using System;
using System.Collections.Concurrent;
namespace ACE.Server.Physics.Managers
{
public static class ServerObjectManager
{
///
/// Custom lookup table of PhysicsObjs for the server
///
public static ConcurrentDictionary ServerObjects { get; } = new ConcurrentDictionary();
///
/// Adds a PhysicsObj to the static list of server-wide objects
///
public static void AddServerObject(PhysicsObj obj)
{
if (obj != null)
ServerObjects[obj.ID] = obj;
}
///
/// Removes a PhysicsObj from the static list of server-wide objects
///
public static void RemoveServerObject(PhysicsObj obj)
{
if (obj != null)
ServerObjects.TryRemove(obj.ID, out _);
}
///
/// Returns a PhysicsObj for an object ID
///
public static PhysicsObj GetObjectA(uint objectID)
{
ServerObjects.TryGetValue(objectID, out var obj);
return obj;
}
}
}