Various sharedsystem spring cleaning (#36200)

* Various shared system warnings cleanup

* More shared system warnings cleanup

* Rearranging changes

* Using correct transform for unbuckle

* Small changes

* Revert buckle change

* Update Content.Shared/Ghost/SharedGhostSystem.cs

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
J
2025-04-21 18:40:31 +00:00
committed by GitHub
parent dd308c6d2d
commit ded94ebc3d
8 changed files with 14 additions and 17 deletions

View File

@@ -517,13 +517,12 @@ public abstract class SharedActionsSystem : EntitySystem
// even if we don't check for obstructions, we may still need to check the range. // even if we don't check for obstructions, we may still need to check the range.
var xform = Transform(user); var xform = Transform(user);
if (xform.MapID != coords.GetMapId(EntityManager)) if (xform.MapID != _transformSystem.GetMapId(coords))
return false; return false;
if (range <= 0) if (range <= 0)
return true; return true;
return _transformSystem.InRange(coords, xform.Coordinates, range);
return coords.InRange(EntityManager, _transformSystem, Transform(user).Coordinates, range);
} }
return _interactionSystem.InRangeUnobstructed(user, coords, range: range); return _interactionSystem.InRangeUnobstructed(user, coords, range: range);

View File

@@ -1,7 +1,4 @@
using System.Linq;
using Content.Shared.Alert; using Content.Shared.Alert;
using Content.Shared.Body.Part;
using Content.Shared.Body.Systems;
using Content.Shared.CombatMode.Pacification; using Content.Shared.CombatMode.Pacification;
using Content.Shared.Damage.Components; using Content.Shared.Damage.Components;
using Content.Shared.Damage.Systems; using Content.Shared.Damage.Systems;
@@ -31,7 +28,6 @@ public abstract class SharedEnsnareableSystem : EntitySystem
[Dependency] private readonly MovementSpeedModifierSystem _speedModifier = default!; [Dependency] private readonly MovementSpeedModifierSystem _speedModifier = default!;
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!; [Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedBodySystem _body = default!;
[Dependency] protected readonly SharedContainerSystem Container = default!; [Dependency] protected readonly SharedContainerSystem Container = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!; [Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!; [Dependency] private readonly SharedHandsSystem _hands = default!;

View File

@@ -38,6 +38,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly ISerializationManager _serManager = default!; [Dependency] private readonly ISerializationManager _serManager = default!;
[Dependency] private readonly MarkingManager _markingManager = default!; [Dependency] private readonly MarkingManager _markingManager = default!;
[Dependency] private readonly GrammarSystem _grammarSystem = default!;
[ValidatePrototypeId<SpeciesPrototype>] [ValidatePrototypeId<SpeciesPrototype>]
public const string DefaultSpecies = "Human"; public const string DefaultSpecies = "Human";
@@ -156,8 +157,9 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
targetHumanoid.MarkingSet = new(sourceHumanoid.MarkingSet); targetHumanoid.MarkingSet = new(sourceHumanoid.MarkingSet);
targetHumanoid.Gender = sourceHumanoid.Gender; targetHumanoid.Gender = sourceHumanoid.Gender;
if (TryComp<GrammarComponent>(target, out var grammar)) if (TryComp<GrammarComponent>(target, out var grammar))
grammar.Gender = sourceHumanoid.Gender; _grammarSystem.SetGender((target, grammar), sourceHumanoid.Gender);
Dirty(target, targetHumanoid); Dirty(target, targetHumanoid);
} }
@@ -438,7 +440,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
humanoid.Gender = profile.Gender; humanoid.Gender = profile.Gender;
if (TryComp<GrammarComponent>(uid, out var grammar)) if (TryComp<GrammarComponent>(uid, out var grammar))
{ {
grammar.Gender = profile.Gender; _grammarSystem.SetGender((uid, grammar), profile.Gender);
} }
humanoid.Age = profile.Age; humanoid.Age = profile.Age;

View File

@@ -1319,7 +1319,7 @@ namespace Content.Shared.Interaction
if (Deleted(target)) if (Deleted(target))
return false; return false;
if (!_containerSystem.TryGetContainingContainer((target, null, null), out var container)) if (!_containerSystem.TryGetContainingContainer(target, out var container))
return false; return false;
var wearer = container.Owner; var wearer = container.Owner;

View File

@@ -279,14 +279,14 @@ public abstract class SharedMagicSystem : EntitySystem
var userVelocity = _physics.GetMapLinearVelocity(ev.Performer); var userVelocity = _physics.GetMapLinearVelocity(ev.Performer);
// If applicable, this ensures the projectile is parented to grid on spawn, instead of the map. // If applicable, this ensures the projectile is parented to grid on spawn, instead of the map.
var fromMap = fromCoords.ToMap(EntityManager, _transform); var fromMap = _transform.ToMapCoordinates(fromCoords);
var spawnCoords = _mapManager.TryFindGridAt(fromMap, out var gridUid, out _) var spawnCoords = _mapManager.TryFindGridAt(fromMap, out var gridUid, out _)
? fromCoords.WithEntityId(gridUid, EntityManager) ? _transform.WithEntityId(fromCoords, gridUid)
: new(_mapManager.GetMapEntityId(fromMap.MapId), fromMap.Position); : new(_mapManager.GetMapEntityId(fromMap.MapId), fromMap.Position);
var ent = Spawn(ev.Prototype, spawnCoords); var ent = Spawn(ev.Prototype, spawnCoords);
var direction = toCoords.ToMapPos(EntityManager, _transform) - var direction = _transform.ToMapCoordinates(toCoords).Position -
spawnCoords.ToMapPos(EntityManager, _transform); _transform.ToMapCoordinates(spawnCoords).Position;
_gunSystem.ShootProjectile(ent, direction, userVelocity, ev.Performer, ev.Performer); _gunSystem.ShootProjectile(ent, direction, userVelocity, ev.Performer, ev.Performer);
} }
// End Projectile Spells // End Projectile Spells

View File

@@ -181,7 +181,7 @@ public abstract partial class SharedShuttleSystem : EntitySystem
// Just checks if any grids inside of a buffer range at the target position. // Just checks if any grids inside of a buffer range at the target position.
_grids.Clear(); _grids.Clear();
var mapCoordinates = coordinates.ToMap(EntityManager, XformSystem); var mapCoordinates = XformSystem.ToMapCoordinates(coordinates);
var ourPos = Maps.GetGridPosition((shuttleUid, shuttlePhysics, shuttleXform)); var ourPos = Maps.GetGridPosition((shuttleUid, shuttlePhysics, shuttleXform));

View File

@@ -42,7 +42,7 @@ namespace Content.Shared.Tabletop
// Move the entity and dirty it (we use the map ID from the entity so noone can try to be funny and move the item to another map) // Move the entity and dirty it (we use the map ID from the entity so noone can try to be funny and move the item to another map)
var transform = EntityManager.GetComponent<TransformComponent>(moved); var transform = EntityManager.GetComponent<TransformComponent>(moved);
Transforms.SetParent(moved, transform, _mapMan.GetMapEntityId(transform.MapID)); Transforms.SetParent(moved, transform, _mapMan.GetMapEntityId(transform.MapID));
Transforms.SetLocalPositionNoLerp(transform, msg.Coordinates.Position); Transforms.SetLocalPositionNoLerp(moved, msg.Coordinates.Position, transform);
} }
private void OnDraggingPlayerChanged(TabletopDraggingPlayerChangedEvent msg, EntitySessionEventArgs args) private void OnDraggingPlayerChanged(TabletopDraggingPlayerChangedEvent msg, EntitySessionEventArgs args)

View File

@@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using Content.Shared.Ghost; using Content.Shared.Ghost;
using Content.Shared.Movement.Pulling.Components; using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Pulling.Systems; using Content.Shared.Movement.Pulling.Systems;