diff --git a/Content.Server/Physics/TestbedCommand.cs b/Content.Server/Physics/TestbedCommand.cs index c281fed423..881a977078 100644 --- a/Content.Server/Physics/TestbedCommand.cs +++ b/Content.Server/Physics/TestbedCommand.cs @@ -113,9 +113,10 @@ namespace Content.Server.Physics private void SetupPlayer(MapId mapId, IConsoleShell shell, IPlayerSession? player, IMapManager mapManager) { + if (mapId == MapId.Nullspace) return; var pauseManager = IoCManager.Resolve(); pauseManager.SetMapPaused(mapId, false); - var map = EntitySystem.Get().Maps[mapId].Gravity = new Vector2(0, -4.9f); + IoCManager.Resolve().GetMapEntity(mapId).GetComponent().Gravity = new Vector2(0, -4.9f); return; } @@ -353,9 +354,7 @@ namespace Content.Server.Physics // Box2D has this as 800 which is jesus christo. // Wouldn't recommend higher than 100 in debug and higher than 300 on release unless // you really want a profile. - var count = 50; - - EntitySystem.Get().Maps[mapId].Gravity = new Vector2(0f, -9.8f); + var count = 200; var mapManager = IoCManager.Resolve(); for (var i = 0; i < count; i++) diff --git a/Content.Shared/Friction/SharedTileFrictionController.cs b/Content.Shared/Friction/SharedTileFrictionController.cs index 4c78f655dc..9b8d163937 100644 --- a/Content.Shared/Friction/SharedTileFrictionController.cs +++ b/Content.Shared/Friction/SharedTileFrictionController.cs @@ -46,11 +46,11 @@ namespace Content.Shared.Friction configManager.UnsubValueChanged(CCVars.StopSpeed, SetStopSpeed); } - public override void UpdateBeforeMapSolve(bool prediction, PhysicsMap map, float frameTime) + public override void UpdateBeforeMapSolve(bool prediction, SharedPhysicsMapComponent mapComponent, float frameTime) { - base.UpdateBeforeMapSolve(prediction, map, frameTime); + base.UpdateBeforeMapSolve(prediction, mapComponent, frameTime); - foreach (var body in map.AwakeBodies) + foreach (var body in mapComponent.AwakeBodies) { // Only apply friction when it's not a mob (or the mob doesn't have control) if (body.Deleted || diff --git a/Content.Shared/Throwing/ThrownItemSystem.cs b/Content.Shared/Throwing/ThrownItemSystem.cs index 7174709102..5cae3976a0 100644 --- a/Content.Shared/Throwing/ThrownItemSystem.cs +++ b/Content.Shared/Throwing/ThrownItemSystem.cs @@ -3,6 +3,7 @@ using System.Linq; using Content.Shared.Physics; using Content.Shared.Physics.Pull; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Physics; using Robust.Shared.Physics.Dynamics; @@ -14,6 +15,8 @@ namespace Content.Shared.Throwing /// public class ThrownItemSystem : EntitySystem { + [Dependency] private readonly SharedBroadphaseSystem _broadphaseSystem = default!; + private const string ThrowingFixture = "throw-fixture"; public override void Initialize() @@ -37,7 +40,7 @@ namespace Content.Shared.Throwing return; } - Get().DestroyFixture(physicsComponent, fixture); + _broadphaseSystem.DestroyFixture(physicsComponent, fixture); } private void ThrowItem(EntityUid uid, ThrownItemComponent component, ThrownEvent args) @@ -52,7 +55,7 @@ namespace Content.Shared.Throwing } var shape = physicsComponent.Fixtures[0].Shape; - Get().CreateFixture(physicsComponent, new Fixture(physicsComponent, shape) {CollisionLayer = (int) CollisionGroup.ThrownItem, Hard = false, ID = ThrowingFixture}); + _broadphaseSystem.CreateFixture(physicsComponent, new Fixture(physicsComponent, shape) {CollisionLayer = (int) CollisionGroup.ThrownItem, Hard = false, ID = ThrowingFixture}); } private void HandleCollision(EntityUid uid, ThrownItemComponent component, StartCollideEvent args)