Cleanup warnings in GunSystem (#36629)

* Cleanup warnings in GunSystem

* Remove _transform and use shared's TransformSystem instead

* Missed one
This commit is contained in:
Tayrtahn
2025-04-16 15:01:54 -04:00
committed by GitHub
parent c0aa3189c7
commit a0d5d85019
2 changed files with 10 additions and 10 deletions

View File

@@ -31,7 +31,7 @@ public sealed partial class GunSystem
}
else if (gun.BurstActivated)
{
var parent = _transform.GetParentUid(uid);
var parent = TransformSystem.GetParentUid(uid);
if (HasComp<DamageableComponent>(parent))
AttemptShoot(parent, uid, gun, gun.ShootCoordinates ?? new EntityCoordinates(uid, gun.DefaultDirection));
else

View File

@@ -32,9 +32,9 @@ public sealed partial class GunSystem : SharedGunSystem
[Dependency] private readonly DamageExamineSystem _damageExamine = default!;
[Dependency] private readonly PricingSystem _pricing = default!;
[Dependency] private readonly SharedColorFlashEffectSystem _color = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly StaminaSystem _stamina = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SharedMapSystem _map = default!;
private const float DamagePitchVariation = 0.05f;
@@ -76,16 +76,16 @@ public sealed partial class GunSystem : SharedGunSystem
}
}
var fromMap = fromCoordinates.ToMap(EntityManager, TransformSystem);
var toMap = toCoordinates.ToMapPos(EntityManager, TransformSystem);
var fromMap = TransformSystem.ToMapCoordinates(fromCoordinates);
var toMap = TransformSystem.ToMapCoordinates(toCoordinates).Position;
var mapDirection = toMap - fromMap.Position;
var mapAngle = mapDirection.ToAngle();
var angle = GetRecoilAngle(Timing.CurTime, gun, mapDirection.ToAngle());
// If applicable, this ensures the projectile is parented to grid on spawn, instead of the map.
var fromEnt = MapManager.TryFindGridAt(fromMap, out var gridUid, out var grid)
? fromCoordinates.WithEntityId(gridUid, EntityManager)
: new EntityCoordinates(MapManager.GetMapEntityId(fromMap.MapId), fromMap.Position);
var fromEnt = MapManager.TryFindGridAt(fromMap, out var gridUid, out _)
? TransformSystem.WithEntityId(fromCoordinates, gridUid)
: new EntityCoordinates(_map.GetMapOrInvalid(fromMap.MapId), fromMap.Position);
// Update shot based on the recoil
toMap = fromMap.Position + angle.ToVec() * mapDirection.Length();
@@ -196,7 +196,7 @@ public sealed partial class GunSystem : SharedGunSystem
break;
fromEffect = Transform(hit).Coordinates;
from = fromEffect.ToMap(EntityManager, _transform);
from = TransformSystem.ToMapCoordinates(fromEffect);
dir = ev.Direction;
lastUser = hit;
}
@@ -405,13 +405,13 @@ public sealed partial class GunSystem : SharedGunSystem
if (gridUid != fromCoordinates.EntityId && TryComp(gridUid, out TransformComponent? gridXform))
{
var (_, gridRot, gridInvMatrix) = TransformSystem.GetWorldPositionRotationInvMatrix(gridXform);
var map = _transform.ToMapCoordinates(fromCoordinates);
var map = TransformSystem.ToMapCoordinates(fromCoordinates);
fromCoordinates = new EntityCoordinates(gridUid.Value, Vector2.Transform(map.Position, gridInvMatrix));
angle -= gridRot;
}
else
{
angle -= _transform.GetWorldRotation(fromXform);
angle -= TransformSystem.GetWorldRotation(fromXform);
}
if (distance >= 1f)