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();
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
{
|
||||
if (comp.Console == null) continue;
|
||||
|
||||
if (!_blocker.CanInteract(((IComponent) comp).Owner))
|
||||
if (!_blocker.CanInteract((comp).Owner))
|
||||
{
|
||||
toRemove.Add(comp);
|
||||
}
|
||||
|
||||
@@ -397,14 +397,14 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
if (args.OurFixture.ID != BurnFixture) return;
|
||||
|
||||
_activeThrusters.Add(component);
|
||||
component.Colliding.Add(((IComponent) args.OtherFixture.Body).Owner);
|
||||
component.Colliding.Add((args.OtherFixture.Body).Owner);
|
||||
}
|
||||
|
||||
private void OnEndCollide(EntityUid uid, ThrusterComponent component, EndCollideEvent args)
|
||||
{
|
||||
if (args.OurFixture.ID != BurnFixture) return;
|
||||
|
||||
component.Colliding.Remove(((IComponent) args.OtherFixture.Body).Owner);
|
||||
component.Colliding.Remove((args.OtherFixture.Body).Owner);
|
||||
|
||||
if (component.Colliding.Count == 0)
|
||||
{
|
||||
@@ -425,7 +425,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
|
||||
foreach (var comp in component.LinearThrusters[index])
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(((IComponent) comp).Owner, out AppearanceComponent? appearanceComponent))
|
||||
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
|
||||
continue;
|
||||
|
||||
comp.Firing = true;
|
||||
@@ -446,7 +446,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
|
||||
foreach (var comp in component.LinearThrusters[index])
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(((IComponent) comp).Owner, out AppearanceComponent? appearanceComponent))
|
||||
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
|
||||
continue;
|
||||
|
||||
comp.Firing = false;
|
||||
@@ -470,7 +470,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
{
|
||||
foreach (var comp in component.AngularThrusters)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(((IComponent) comp).Owner, out AppearanceComponent? appearanceComponent))
|
||||
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
|
||||
continue;
|
||||
|
||||
comp.Firing = true;
|
||||
@@ -481,7 +481,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
{
|
||||
foreach (var comp in component.AngularThrusters)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(((IComponent) comp).Owner, out AppearanceComponent? appearanceComponent))
|
||||
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
|
||||
continue;
|
||||
|
||||
comp.Firing = false;
|
||||
|
||||
Reference in New Issue
Block a user