2020-08-28 10:08:40 +00:00
|
|
|
|
using QSB.TransformSync;
|
|
|
|
|
using System.Collections.Generic;
|
2020-08-13 17:25:12 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace QSB.WorldSync
|
|
|
|
|
{
|
|
|
|
|
public static class WorldRegistry
|
|
|
|
|
{
|
2020-08-16 15:15:36 +00:00
|
|
|
|
private static readonly List<WorldObject> _worldObjects = new List<WorldObject>();
|
2020-08-28 10:08:40 +00:00
|
|
|
|
public static uint OrbStartNetId { get; set; }
|
|
|
|
|
public static List<NomaiOrbTransformSync> OrbList = new List<NomaiOrbTransformSync>();
|
|
|
|
|
public static List<NomaiInterfaceOrb> OldOrbList = new List<NomaiInterfaceOrb>();
|
|
|
|
|
public static Dictionary<NomaiInterfaceOrb, uint> OrbUserList = new Dictionary<NomaiInterfaceOrb, uint>();
|
2020-08-16 15:15:36 +00:00
|
|
|
|
|
|
|
|
|
public static void AddObject(WorldObject worldObject)
|
|
|
|
|
{
|
2020-08-23 19:52:22 +00:00
|
|
|
|
if (_worldObjects.Contains(worldObject))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-08-16 15:15:36 +00:00
|
|
|
|
_worldObjects.Add(worldObject);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-16 20:39:21 +00:00
|
|
|
|
public static IEnumerable<T> GetObjects<T>()
|
2020-08-16 15:15:36 +00:00
|
|
|
|
{
|
2020-08-16 20:39:21 +00:00
|
|
|
|
return _worldObjects.OfType<T>();
|
2020-08-16 15:15:36 +00:00
|
|
|
|
}
|
2020-08-13 17:25:12 +00:00
|
|
|
|
|
2020-08-13 18:43:47 +00:00
|
|
|
|
public static T GetObject<T>(int id) where T : WorldObject
|
2020-08-13 17:25:12 +00:00
|
|
|
|
{
|
2020-08-16 15:15:36 +00:00
|
|
|
|
return GetObjects<T>().FirstOrDefault(x => x.ObjectId == id);
|
2020-08-13 17:25:12 +00:00
|
|
|
|
}
|
2020-08-16 15:15:36 +00:00
|
|
|
|
|
2020-08-28 10:08:40 +00:00
|
|
|
|
public static bool IsOrbControlledLocally(NomaiInterfaceOrb orb)
|
|
|
|
|
{
|
|
|
|
|
return OrbUserList[orb] == PlayerRegistry.LocalPlayerId;
|
|
|
|
|
}
|
2020-08-13 17:25:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|