More (IComponent) shenanigans and also some contaminated IoCManager.Resolve<IEntityManager>() very long yes calls
This commit is contained in:
@@ -110,7 +110,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
if (dockingFixture == null)
|
||||
{
|
||||
DebugTools.Assert(false);
|
||||
Logger.ErrorS("docking", $"Found null fixture on {((IComponent) body).Owner}");
|
||||
Logger.ErrorS("docking", $"Found null fixture on {(body).Owner}");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
if (dockB == null || dockA.DockJoint == null)
|
||||
{
|
||||
DebugTools.Assert(false);
|
||||
Logger.Error("docking", $"Tried to cleanup {((IComponent) dockA).Owner} but not docked?");
|
||||
Logger.Error("docking", $"Tried to cleanup {(dockA).Owner} but not docked?");
|
||||
|
||||
dockA.DockedWith = null;
|
||||
if (dockA.DockJoint != null)
|
||||
@@ -200,8 +200,8 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
dockA.DockedWith = null;
|
||||
|
||||
// If these grids are ever invalid then need to look at fixing ordering for unanchored events elsewhere.
|
||||
var gridAUid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(((IComponent) dockA).Owner).GridID).GridEntityId;
|
||||
var gridBUid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(((IComponent) dockB).Owner).GridID).GridEntityId;
|
||||
var gridAUid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>((dockA).Owner).GridID).GridEntityId;
|
||||
var gridBUid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>((dockB).Owner).GridID).GridEntityId;
|
||||
|
||||
var msg = new UndockEvent
|
||||
{
|
||||
@@ -211,8 +211,8 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
GridBUid = gridBUid,
|
||||
};
|
||||
|
||||
EntityManager.EventBus.RaiseLocalEvent(((IComponent) dockA).Owner, msg, false);
|
||||
EntityManager.EventBus.RaiseLocalEvent(((IComponent) dockB).Owner, msg, false);
|
||||
EntityManager.EventBus.RaiseLocalEvent((dockA).Owner, msg, false);
|
||||
EntityManager.EventBus.RaiseLocalEvent((dockB).Owner, msg, false);
|
||||
EntityManager.EventBus.RaiseEvent(EventSource.Local, msg);
|
||||
}
|
||||
|
||||
@@ -308,8 +308,8 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
|
||||
// We could also potentially use a prismatic joint? Depending if we want clamps that can extend or whatever
|
||||
|
||||
var dockAXform = EntityManager.GetComponent<TransformComponent>(((IComponent) dockA).Owner);
|
||||
var dockBXform = EntityManager.GetComponent<TransformComponent>(((IComponent) dockB).Owner);
|
||||
var dockAXform = EntityManager.GetComponent<TransformComponent>((dockA).Owner);
|
||||
var dockBXform = EntityManager.GetComponent<TransformComponent>((dockB).Owner);
|
||||
|
||||
var gridA = _mapManager.GetGrid(dockAXform.GridID).GridEntityId;
|
||||
var gridB = _mapManager.GetGrid(dockBXform.GridID).GridEntityId;
|
||||
@@ -324,7 +324,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
|
||||
// These need playing around with
|
||||
// Could also potentially have collideconnected false and stiffness 0 but it was a bit more suss???
|
||||
var joint = _jointSystem.CreateWeldJoint(gridA, gridB, DockingJoint + ((IComponent) dockA).Owner);
|
||||
var joint = _jointSystem.CreateWeldJoint(gridA, gridB, DockingJoint + (dockA).Owner);
|
||||
|
||||
var gridAXform = EntityManager.GetComponent<TransformComponent>(gridA);
|
||||
var gridBXform = EntityManager.GetComponent<TransformComponent>(gridB);
|
||||
@@ -344,13 +344,13 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
dockA.DockJoint = joint;
|
||||
dockB.DockJoint = joint;
|
||||
|
||||
if (EntityManager.TryGetComponent(((IComponent) dockA).Owner, out ServerDoorComponent? doorA))
|
||||
if (EntityManager.TryGetComponent((dockA).Owner, out ServerDoorComponent? doorA))
|
||||
{
|
||||
doorA.ChangeAirtight = false;
|
||||
doorA.Open();
|
||||
}
|
||||
|
||||
if (EntityManager.TryGetComponent(((IComponent) dockB).Owner, out ServerDoorComponent? doorB))
|
||||
if (EntityManager.TryGetComponent((dockB).Owner, out ServerDoorComponent? doorB))
|
||||
{
|
||||
doorB.ChangeAirtight = false;
|
||||
doorB.Open();
|
||||
@@ -364,8 +364,8 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
GridBUid = gridB,
|
||||
};
|
||||
|
||||
EntityManager.EventBus.RaiseLocalEvent(((IComponent) dockA).Owner, msg, false);
|
||||
EntityManager.EventBus.RaiseLocalEvent(((IComponent) dockB).Owner, msg, false);
|
||||
EntityManager.EventBus.RaiseLocalEvent((dockA).Owner, msg, false);
|
||||
EntityManager.EventBus.RaiseLocalEvent((dockB).Owner, msg, false);
|
||||
EntityManager.EventBus.RaiseEvent(EventSource.Local, msg);
|
||||
}
|
||||
|
||||
@@ -374,8 +374,8 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
/// </summary>
|
||||
private void TryDock(DockingComponent dockA, DockingComponent dockB)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(((IComponent) dockA).Owner, out PhysicsComponent? bodyA) ||
|
||||
!EntityManager.TryGetComponent(((IComponent) dockB).Owner, out PhysicsComponent? bodyB) ||
|
||||
if (!EntityManager.TryGetComponent((dockA).Owner, out PhysicsComponent? bodyA) ||
|
||||
!EntityManager.TryGetComponent((dockB).Owner, out PhysicsComponent? bodyB) ||
|
||||
!dockA.Enabled ||
|
||||
!dockB.Enabled)
|
||||
{
|
||||
@@ -421,17 +421,17 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
if (dock.DockedWith == null)
|
||||
{
|
||||
DebugTools.Assert(false);
|
||||
Logger.ErrorS("docking", $"Tried to undock {((IComponent) dock).Owner} but not docked with anything?");
|
||||
Logger.ErrorS("docking", $"Tried to undock {(dock).Owner} but not docked with anything?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (EntityManager.TryGetComponent(((IComponent) dock).Owner, out ServerDoorComponent? doorA))
|
||||
if (EntityManager.TryGetComponent((dock).Owner, out ServerDoorComponent? doorA))
|
||||
{
|
||||
doorA.ChangeAirtight = true;
|
||||
doorA.Close();
|
||||
}
|
||||
|
||||
if (EntityManager.TryGetComponent(((IComponent) dock.DockedWith).Owner, out ServerDoorComponent? doorB))
|
||||
if (EntityManager.TryGetComponent((dock.DockedWith).Owner, out ServerDoorComponent? doorB))
|
||||
{
|
||||
doorB.ChangeAirtight = true;
|
||||
doorB.Close();
|
||||
|
||||
Reference in New Issue
Block a user