]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Content fixes for timeoffsets (#15934)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Mon, 1 May 2023 04:49:25 +0000 (14:49 +1000)
committerGitHub <noreply@github.com>
Mon, 1 May 2023 04:49:25 +0000 (14:49 +1000)
18 files changed:
Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Content.IntegrationTests/Tests/PrototypeSaveTest.cs
Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs
Content.Server/Charges/Components/AutoRechargeComponent.cs
Content.Server/Chemistry/EntitySystems/SolutionPurgeSystem.cs
Content.Server/Fluids/EntitySystems/SmokeSystem.cs
Content.Server/NPC/NPCBlackboardSerializer.cs
Content.Server/Pinpointer/ProximityBeeperSystem.cs
Content.Server/PowerCell/PowerCellSystem.cs
Content.Server/Shuttles/Systems/ThrusterSystem.cs
Content.Server/Spreader/SpreaderSystem.cs
Content.Server/Weapons/Ranged/Systems/GunSystem.cs
Content.Shared/Anomaly/Components/AnomalyComponent.cs
Content.Shared/Damage/Systems/StaminaSystem.cs
Content.Shared/Sound/Components/EmitSoundOnCollideComponent.cs
Content.Shared/Sound/SharedEmitSoundSystem.cs
Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs

index d6f068fcb1778705e46b99efd58e7da3848ab7e0..fce3139b62f205546994e94113bbe13f58ca5359 100644 (file)
@@ -158,7 +158,7 @@ public sealed partial class GunSystem : SharedGunSystem
         }
 
         // Define target coordinates relative to gun entity, so that network latency on moving grids doesn't fuck up the target location.
-        var coordinates = EntityCoordinates.FromMap(entity, mousePos, Transform, EntityManager);
+        var coordinates = EntityCoordinates.FromMap(entity, mousePos, TransformSystem, EntityManager);
 
         Sawmill.Debug($"Sending shoot request tick {Timing.CurTick} / {Timing.CurTime}");
 
@@ -175,7 +175,7 @@ public sealed partial class GunSystem : SharedGunSystem
         // Rather than splitting client / server for every ammo provider it's easier
         // to just delete the spawned entities. This is for programmer sanity despite the wasted perf.
         // This also means any ammo specific stuff can be grabbed as necessary.
-        var direction = fromCoordinates.ToMapPos(EntityManager, Transform) - toCoordinates.ToMapPos(EntityManager, Transform);
+        var direction = fromCoordinates.ToMapPos(EntityManager, TransformSystem) - toCoordinates.ToMapPos(EntityManager, TransformSystem);
 
         foreach (var (ent, shootable) in ammo)
         {
index 5d64ca1a4e5276a27d1dd0924019db8ffa6751db..15c3416ae1e4e60fbba0fa16862dd6f34173e8b3 100644 (file)
@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
 using Content.Shared.Coordinates;
+using Content.Shared.Sound.Components;
 using NUnit.Framework;
 using Robust.Shared.GameObjects;
 using Robust.Shared.IoC;
@@ -18,6 +19,7 @@ using Robust.Shared.Serialization.Markdown.Mapping;
 using Robust.Shared.Serialization.Markdown.Validation;
 using Robust.Shared.Serialization.Markdown.Value;
 using Robust.Shared.Serialization.TypeSerializers.Interfaces;
+using Robust.Shared.Timing;
 
 namespace Content.IntegrationTests.Tests;
 
@@ -166,16 +168,19 @@ public sealed class PrototypeSaveTest
                 foreach (var prototype in prototypes)
                 {
                     uid = entityMan.SpawnEntity(prototype.ID, testLocation);
-                    server.RunTicks(1);
 
                     // get default prototype data
                     Dictionary<string, MappingDataNode> protoData = new();
                     try
                     {
+                        context.WritingReadingPrototypes = true;
+
                         foreach (var (compType, comp) in prototype.Components)
                         {
-                            protoData.Add(compType, seriMan.WriteValueAs<MappingDataNode>(comp.Component.GetType(), comp.Component, alwaysWrite:true, context: context));
+                            protoData.Add(compType, seriMan.WriteValueAs<MappingDataNode>(comp.Component.GetType(), comp.Component, alwaysWrite: true, context: context));
                         }
+
+                        context.WritingReadingPrototypes = false;
                     }
                     catch (Exception e)
                     {
@@ -239,6 +244,7 @@ public sealed class PrototypeSaveTest
         ITypeSerializer<EntityUid, ValueDataNode>
     {
         public SerializationManager.SerializerProvider SerializerProvider { get; }
+        public bool WritingReadingPrototypes { get; set; }
 
         public TestEntityUidContext()
         {
index f0cbefa86b2ec241b96536f698a89f892c3c92f1..c3a6aec3e96e304ab9dba2fd3813b773ff01808f 100644 (file)
@@ -175,7 +175,9 @@ public sealed class TileAtmosCollectionSerializer : ITypeSerializer<Dictionary<V
         public readonly Dictionary<int, uint> Data = new();
     }
 
-    public void CopyTo(ISerializationManager serializationManager, Dictionary<Vector2i, TileAtmosphere> source, ref Dictionary<Vector2i, TileAtmosphere> target, SerializationHookContext hookCtx,
+    public void CopyTo(ISerializationManager serializationManager, Dictionary<Vector2i, TileAtmosphere> source, ref Dictionary<Vector2i, TileAtmosphere> target,
+        IDependencyCollection dependencies,
+        SerializationHookContext hookCtx,
         ISerializationContext? context = null)
     {
         target.Clear();
index 6a64c159a8366c8ca588ab02f547fe2a6d5cc62b..911145062bdc31bb4489d35c5aa0a433e597dcc7 100644 (file)
@@ -21,5 +21,5 @@ public sealed class AutoRechargeComponent : Component
     /// The time when the next charge will be added
     /// </summary>
     [DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
-    public TimeSpan NextChargeTime = TimeSpan.MaxValue;
+    public TimeSpan NextChargeTime;
 }
index 41bde848700837fa25f293307c8fec92e5dd24c9..4dde86eadbdf4c34a2d3d991ab3b7db782551e50 100644 (file)
@@ -15,7 +15,6 @@ public sealed class SolutionPurgeSystem : EntitySystem
         base.Initialize();
 
         SubscribeLocalEvent<SolutionPurgeComponent, EntityUnpausedEvent>(OnUnpaused);
-        SubscribeLocalEvent<SolutionPurgeComponent, MapInitEvent>(OnMapInit);
     }
 
     public override void Update(float frameTime)
@@ -39,10 +38,4 @@ public sealed class SolutionPurgeSystem : EntitySystem
     {
         comp.NextPurgeTime += args.PausedTime;
     }
-
-    private void OnMapInit(EntityUid uid, SolutionPurgeComponent comp, MapInitEvent args)
-    {
-        if (comp.NextPurgeTime < _timing.CurTime)
-            comp.NextPurgeTime = _timing.CurTime;
-    }
 }
index b489cbc2a4d674a4b7dd36ee200142b30e5146d1..f9564612ded9e7f4b4196831f43261f5b9c5ad4c 100644 (file)
@@ -45,7 +45,6 @@ public sealed class SmokeSystem : EntitySystem
     {
         base.Initialize();
         SubscribeLocalEvent<SmokeComponent, EntityUnpausedEvent>(OnSmokeUnpaused);
-        SubscribeLocalEvent<SmokeComponent, MapInitEvent>(OnSmokeMapInit);
         SubscribeLocalEvent<SmokeComponent, ReactionAttemptEvent>(OnReactionAttempt);
         SubscribeLocalEvent<SmokeComponent, SpreadNeighborsEvent>(OnSmokeSpread);
         SubscribeLocalEvent<SmokeDissipateSpawnComponent, TimedDespawnEvent>(OnSmokeDissipate);
@@ -166,11 +165,6 @@ public sealed class SmokeSystem : EntitySystem
         }
     }
 
-    private void OnSmokeMapInit(EntityUid uid, SmokeComponent component, MapInitEvent args)
-    {
-        component.NextReact = _timing.CurTime;
-    }
-
     private void OnSmokeUnpaused(EntityUid uid, SmokeComponent component, ref EntityUnpausedEvent args)
     {
         component.NextReact += args.PausedTime;
index 8a02508b9115aab589bb986b748c2c57853a32bb..276e1d072bc7579871fc56bb9bb677ab6b7dec0b 100644 (file)
@@ -85,6 +85,7 @@ public sealed class NPCBlackboardSerializer : ITypeReader<NPCBlackboard, Mapping
         ISerializationManager serializationManager,
         NPCBlackboard source,
         ref NPCBlackboard target,
+        IDependencyCollection dependencies,
         SerializationHookContext hookCtx,
         ISerializationContext? context = null)
     {
index c31c9eb34b964a962de4e6615c95e9abb310fc36..c0cf6cd6055c91975384f7b5b230083dfcef0987 100644 (file)
@@ -22,7 +22,6 @@ public sealed class ProximityBeeperSystem : EntitySystem
     public override void Initialize()
     {
         SubscribeLocalEvent<ProximityBeeperComponent, UseInHandEvent>(OnUseInHand);
-        SubscribeLocalEvent<ProximityBeeperComponent, MapInitEvent>(OnInit);
         SubscribeLocalEvent<ProximityBeeperComponent, EntityUnpausedEvent>(OnUnpaused);
         SubscribeLocalEvent<ProximityBeeperComponent, PowerCellSlotEmptyEvent>(OnPowerCellSlotEmpty);
     }
@@ -34,12 +33,6 @@ public sealed class ProximityBeeperSystem : EntitySystem
         args.Handled = TryToggle(uid, component, args.User);
     }
 
-    private void OnInit(EntityUid uid, ProximityBeeperComponent component, MapInitEvent args)
-    {
-        if (component.NextBeepTime < _timing.CurTime)
-            component.NextBeepTime = _timing.CurTime;
-    }
-
     private void OnUnpaused(EntityUid uid, ProximityBeeperComponent component, ref EntityUnpausedEvent args)
     {
         component.NextBeepTime += args.PausedTime;
index f85da633ca4152f9619d47fb72727393fe2e74c2..b28ea159ecb84ce790b90c2b31aaf6c5d337376f 100644 (file)
@@ -42,7 +42,6 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
 
         SubscribeLocalEvent<PowerCellComponent, ExaminedEvent>(OnCellExamined);
 
-        SubscribeLocalEvent<PowerCellDrawComponent, MapInitEvent>(OnMapInit);
         SubscribeLocalEvent<PowerCellDrawComponent, EntityUnpausedEvent>(OnUnpaused);
 
         // funny
@@ -136,12 +135,6 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
         RaiseLocalEvent(uid, ref ev);
     }
 
-    private void OnMapInit(EntityUid uid, PowerCellDrawComponent component, MapInitEvent args)
-    {
-        if (component.NextUpdateTime < _timing.CurTime)
-            component.NextUpdateTime = _timing.CurTime;
-    }
-
     private void OnUnpaused(EntityUid uid, PowerCellDrawComponent component, ref EntityUnpausedEvent args)
     {
         component.NextUpdateTime += args.PausedTime;
index 6311d0e8c0c2e635f6ae82ab07664e4ca6354f6d..51d6d9217bb4f8a70e06939b20354bb86f7ec279 100644 (file)
@@ -44,7 +44,6 @@ public sealed class ThrusterSystem : EntitySystem
         SubscribeLocalEvent<ThrusterComponent, ActivateInWorldEvent>(OnActivateThruster);
         SubscribeLocalEvent<ThrusterComponent, ComponentInit>(OnThrusterInit);
         SubscribeLocalEvent<ThrusterComponent, ComponentShutdown>(OnThrusterShutdown);
-        SubscribeLocalEvent<ThrusterComponent, MapInitEvent>(OnThrusterMapInit);
         SubscribeLocalEvent<ThrusterComponent, PowerChangedEvent>(OnPowerChange);
         SubscribeLocalEvent<ThrusterComponent, AnchorStateChangedEvent>(OnAnchorChange);
         SubscribeLocalEvent<ThrusterComponent, ReAnchorEvent>(OnThrusterReAnchor);
@@ -201,12 +200,6 @@ public sealed class ThrusterSystem : EntitySystem
             EnableThruster(uid, component);
     }
 
-    private void OnThrusterMapInit(EntityUid uid, ThrusterComponent component, MapInitEvent args)
-    {
-        if (component.NextFire < _timing.CurTime)
-            component.NextFire = _timing.CurTime;
-    }
-
     private void OnThrusterInit(EntityUid uid, ThrusterComponent component, ComponentInit args)
     {
         _ambient.SetAmbience(uid, false);
index b39f83e4a283d33258c47b62c60573156cbc01dd..9bdf71dfd72d9c34a3ccb19294638404a2bc733e 100644 (file)
@@ -36,7 +36,6 @@ public sealed class SpreaderSystem : EntitySystem
     {
         SubscribeLocalEvent<AirtightChanged>(OnAirtightChanged);
         SubscribeLocalEvent<GridInitializeEvent>(OnGridInit);
-        SubscribeLocalEvent<SpreaderGridComponent, MapInitEvent>(OnSpreaderGridMapInit);
 
         SubscribeLocalEvent<SpreaderGridComponent, EntityUnpausedEvent>(OnGridUnpaused);
 
@@ -44,11 +43,6 @@ public sealed class SpreaderSystem : EntitySystem
         _prototype.PrototypesReloaded += OnPrototypeReload;
     }
 
-    private void OnSpreaderGridMapInit(EntityUid uid, SpreaderGridComponent component, MapInitEvent args)
-    {
-        component.NextUpdate = _timing.CurTime;
-    }
-
     public override void Shutdown()
     {
         base.Shutdown();
index 3eaf9d8bf451a19d7976e0101135adbfadfac0a0..8e4a291f333f1dec5fe6603c414b2e53cec1015c 100644 (file)
@@ -93,8 +93,8 @@ public sealed partial class GunSystem : SharedGunSystem
             }
         }
 
-        var fromMap = fromCoordinates.ToMap(EntityManager, Transform);
-        var toMap = toCoordinates.ToMapPos(EntityManager, Transform);
+        var fromMap = fromCoordinates.ToMap(EntityManager, TransformSystem);
+        var toMap = toCoordinates.ToMapPos(EntityManager, TransformSystem);
         var mapDirection = toMap - fromMap.Position;
         var mapAngle = mapDirection.ToAngle();
         var angle = GetRecoilAngle(Timing.CurTime, gun, mapDirection.ToAngle());
@@ -299,7 +299,7 @@ public sealed partial class GunSystem : SharedGunSystem
             Projectiles.SetShooter(projectile, user.Value);
         }
 
-        Transform.SetWorldRotation(uid, direction.ToWorldAngle());
+        TransformSystem.SetWorldRotation(uid, direction.ToWorldAngle());
     }
 
     /// <summary>
@@ -398,10 +398,10 @@ public sealed partial class GunSystem : SharedGunSystem
 
         if (xformQuery.TryGetComponent(gridUid, out var gridXform))
         {
-            var (_, gridRot, gridInvMatrix) = Transform.GetWorldPositionRotationInvMatrix(gridUid.Value, xformQuery);
+            var (_, gridRot, gridInvMatrix) = TransformSystem.GetWorldPositionRotationInvMatrix(gridUid.Value, xformQuery);
 
             fromCoordinates = new EntityCoordinates(gridUid.Value,
-                gridInvMatrix.Transform(fromCoordinates.ToMapPos(EntityManager, Transform)));
+                gridInvMatrix.Transform(fromCoordinates.ToMapPos(EntityManager, TransformSystem)));
 
             // Use the fallback angle I guess?
             angle -= gridRot;
index cf2e12524e289d2dbc949cc24e73d100e31c9ecc..8df708dda8a33435ecfeb04be0ce39d9cdeb60a7 100644 (file)
@@ -85,7 +85,7 @@ public sealed class AnomalyComponent : Component
     /// The time at which the next artifact pulse will occur.
     /// </summary>
     [DataField("nextPulseTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
-    public TimeSpan NextPulseTime = TimeSpan.MaxValue;
+    public TimeSpan NextPulseTime = TimeSpan.Zero;
 
     /// <summary>
     /// The minimum interval between pulses.
index 368f286d4e5777ea08f0ac36885f0e243666ad75..30e974a2f182bdfc9a87df5c971b16835109970b 100644 (file)
@@ -41,6 +41,7 @@ public sealed class StaminaSystem : EntitySystem
     public override void Initialize()
     {
         base.Initialize();
+        SubscribeLocalEvent<StaminaComponent, EntityUnpausedEvent>(OnStamUnpaused);
         SubscribeLocalEvent<StaminaComponent, ComponentStartup>(OnStartup);
         SubscribeLocalEvent<StaminaComponent, ComponentShutdown>(OnShutdown);
         SubscribeLocalEvent<StaminaComponent, ComponentGetState>(OnStamGetState);
@@ -51,6 +52,11 @@ public sealed class StaminaSystem : EntitySystem
         SubscribeLocalEvent<StaminaDamageOnHitComponent, MeleeHitEvent>(OnHit);
     }
 
+    private void OnStamUnpaused(EntityUid uid, StaminaComponent component, ref EntityUnpausedEvent args)
+    {
+        component.NextUpdate += args.PausedTime;
+    }
+
     private void OnStamGetState(EntityUid uid, StaminaComponent component, ref ComponentGetState args)
     {
         args.State = new StaminaComponentState()
@@ -206,7 +212,7 @@ public sealed class StaminaSystem : EntitySystem
     {
         if (!args.OurFixture.ID.Equals(CollideFixture)) return;
 
-        TakeStaminaDamage(args.OtherFixture.Body.Owner, component.Damage, source:args.OurFixture.Body.Owner);
+        TakeStaminaDamage(args.OtherEntity, component.Damage, source:args.OurEntity);
     }
 
     private void SetStaminaAlert(EntityUid uid, StaminaComponent? component = null)
index 671868d02c67a59a498b7bccc2177be591ee5756..95db14427d1200ea4926967b1f9cd21598e0af58 100644 (file)
@@ -17,6 +17,6 @@ public sealed class EmitSoundOnCollideComponent : BaseEmitSoundComponent
     /// <summary>
     /// To avoid sound spam add a cooldown to it.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField("nextSound", customTypeSerializer:typeof(TimeOffsetSerializer))]
-    public TimeSpan NextSound;
+    [ViewVariables(VVAccess.ReadWrite), DataField("nextSound", customTypeSerializer: typeof(TimeOffsetSerializer))]
+    public TimeSpan NextSound = TimeSpan.FromSeconds(0.2);
 }
index 86433d4967311d4960de419c7dd5579fe9b63576..3dc1cb793f33b99cf29b3a0638d0dface81754c8 100644 (file)
@@ -39,6 +39,8 @@ public abstract class SharedEmitSoundSystem : EntitySystem
         SubscribeLocalEvent<EmitSoundOnActivateComponent, ActivateInWorldEvent>(OnEmitSoundOnActivateInWorld);
         SubscribeLocalEvent<EmitSoundOnPickupComponent, GotEquippedHandEvent>(OnEmitSoundOnPickup);
         SubscribeLocalEvent<EmitSoundOnDropComponent, DroppedEvent>(OnEmitSoundOnDrop);
+
+        SubscribeLocalEvent<EmitSoundOnCollideComponent, EntityUnpausedEvent>(OnEmitSoundUnpaused);
         SubscribeLocalEvent<EmitSoundOnCollideComponent, StartCollideEvent>(OnEmitSoundOnCollide);
     }
 
@@ -112,6 +114,11 @@ public abstract class SharedEmitSoundSystem : EntitySystem
         }
     }
 
+    private void OnEmitSoundUnpaused(EntityUid uid, EmitSoundOnCollideComponent component, ref EntityUnpausedEvent args)
+    {
+        component.NextSound += args.PausedTime;
+    }
+
     private void OnEmitSoundOnCollide(EntityUid uid, EmitSoundOnCollideComponent component, ref StartCollideEvent args)
     {
         if (!args.OurFixture.Hard ||
index da8e23584dfd038f051ff4f6aff42f339e24aa0d..ef9be4d9cfa98abd8ce30b2b0b1695f775df0e37 100644 (file)
@@ -59,6 +59,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
         base.Initialize();
         Sawmill = Logger.GetSawmill("melee");
 
+        SubscribeLocalEvent<MeleeWeaponComponent, EntityUnpausedEvent>(OnMeleeUnpaused);
         SubscribeLocalEvent<MeleeWeaponComponent, ComponentGetState>(OnGetState);
         SubscribeLocalEvent<MeleeWeaponComponent, ComponentHandleState>(OnHandleState);
         SubscribeLocalEvent<MeleeWeaponComponent, HandDeselectedEvent>(OnMeleeDropped);
@@ -77,11 +78,16 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
 
     private void OnMapInit(EntityUid uid, MeleeWeaponComponent component, MapInitEvent args)
     {
-        if (component.NextAttack > TimeSpan.Zero)
+        if (component.NextAttack > Timing.CurTime)
             Logger.Warning($"Initializing a map that contains an entity that is on cooldown. Entity: {ToPrettyString(uid)}");
 #endif
     }
 
+    private void OnMeleeUnpaused(EntityUid uid, MeleeWeaponComponent component, ref EntityUnpausedEvent args)
+    {
+        component.NextAttack += args.PausedTime;
+    }
+
     private void OnMeleeSelected(EntityUid uid, MeleeWeaponComponent component, HandSelectedEvent args)
     {
         if (component.AttackRate.Equals(0f))
index 65bb9e6a53d5fa3a2442664badf884f88255efd1..2810019f5b26fe0b8be66636ac80b25fb324d414 100644 (file)
@@ -52,7 +52,7 @@ public abstract partial class SharedGunSystem : EntitySystem
     [Dependency] protected readonly SharedAudioSystem Audio = default!;
     [Dependency] private   readonly SharedGravitySystem _gravity = default!;
     [Dependency] protected readonly SharedProjectileSystem Projectiles = default!;
-    [Dependency] protected readonly SharedTransformSystem Transform = default!;
+    [Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
 
     protected ISawmill Sawmill = default!;
 
@@ -85,7 +85,7 @@ public abstract partial class SharedGunSystem : EntitySystem
         SubscribeLocalEvent<GunComponent, GetVerbsEvent<AlternativeVerb>>(OnAltVerb);
         SubscribeLocalEvent<GunComponent, ExaminedEvent>(OnExamine);
         SubscribeLocalEvent<GunComponent, CycleModeEvent>(OnCycleMode);
-        SubscribeLocalEvent<GunComponent, ComponentInit>(OnGunInit);
+        SubscribeLocalEvent<GunComponent, EntityUnpausedEvent>(OnGunUnpaused);
 
 #if DEBUG
         SubscribeLocalEvent<GunComponent, MapInitEvent>(OnMapInit);
@@ -93,14 +93,16 @@ public abstract partial class SharedGunSystem : EntitySystem
 
     private void OnMapInit(EntityUid uid, GunComponent component, MapInitEvent args)
     {
-        if (component.NextFire > TimeSpan.Zero)
+        if (component.NextFire > Timing.CurTime)
             Logger.Warning($"Initializing a map that contains an entity that is on cooldown. Entity: {ToPrettyString(uid)}");
+
+        DebugTools.Assert((component.AvailableModes & component.SelectedMode) != 0x0);
 #endif
     }
 
-    private void OnGunInit(EntityUid uid, GunComponent component, ComponentInit args)
+    private void OnGunUnpaused(EntityUid uid, GunComponent component, ref EntityUnpausedEvent args)
     {
-        DebugTools.Assert((component.AvailableModes & component.SelectedMode) != 0x0);
+        component.NextFire += args.PausedTime;
     }
 
     private void OnGunMeleeAttempt(EntityUid uid, GunComponent component, ref MeleeAttackAttemptEvent args)
@@ -378,8 +380,8 @@ public abstract partial class SharedGunSystem : EntitySystem
 
     public void CauseImpulse(EntityCoordinates fromCoordinates, EntityCoordinates toCoordinates, EntityUid user, PhysicsComponent userPhysics)
     {
-        var fromMap = fromCoordinates.ToMapPos(EntityManager, Transform);
-        var toMap = toCoordinates.ToMapPos(EntityManager, Transform);
+        var fromMap = fromCoordinates.ToMapPos(EntityManager, TransformSystem);
+        var toMap = toCoordinates.ToMapPos(EntityManager, TransformSystem);
         var shotDirection = (toMap - fromMap).Normalized;
 
         const float impulseStrength = 25.0f;