Various system spring cleaning (#36206)

* Various systems warnings cleanup

* Last changes before submitting PR

* Add guard for transform component, fix failing test

* Small corrections

* Audio params to specifiers datafields

* Using audio params on components and configs
This commit is contained in:
J
2025-04-16 11:08:22 +00:00
committed by GitHub
parent 2a80540b70
commit b1c08582d5
27 changed files with 101 additions and 46 deletions

View File

@@ -1,13 +1,11 @@
using Content.Shared.Clothing.Components;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Humanoid;
using Content.Shared.Interaction.Events;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Content.Shared.Item;
using Content.Shared.Strip.Components;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
namespace Content.Shared.Clothing.EntitySystems;
@@ -15,10 +13,8 @@ namespace Content.Shared.Clothing.EntitySystems;
public abstract class ClothingSystem : EntitySystem
{
[Dependency] private readonly SharedItemSystem _itemSys = default!;
[Dependency] private readonly SharedContainerSystem _containerSys = default!;
[Dependency] private readonly InventorySystem _invSystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly HideLayerClothingSystem _hideLayer = default!;
public override void Initialize()
{

View File

@@ -71,7 +71,7 @@ public sealed class DashAbilitySystem : EntitySystem
}
var origin = _transform.GetMapCoordinates(user);
var target = args.Target.ToMap(EntityManager, _transform);
var target = _transform.ToMapCoordinates(args.Target);
if (!_examine.InRangeUnOccluded(origin, target, SharedInteractionSystem.MaxRaycastRange, null))
{
// can only dash if the destination is visible on screen

View File

@@ -15,7 +15,6 @@ namespace Content.Shared.Ninja.Systems;
public sealed class EmagProviderSystem : EntitySystem
{
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly EmagSystem _emag = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedNinjaGlovesSystem _gloves = default!;

View File

@@ -45,6 +45,7 @@ public class RCDSystem : EntitySystem
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly TagSystem _tags = default!;
private readonly int _instantConstructionDelay = 0;
@@ -561,12 +562,12 @@ public class RCDSystem : EntitySystem
public bool TryGetMapGridData(EntityCoordinates location, [NotNullWhen(true)] out MapGridData? mapGridData)
{
mapGridData = null;
var gridUid = location.GetGridUid(EntityManager);
var gridUid = _transform.GetGrid(location);
if (!TryComp<MapGridComponent>(gridUid, out var mapGrid))
{
location = location.AlignWithClosestGridTile(1.75f, EntityManager);
gridUid = location.GetGridUid(EntityManager);
gridUid = _transform.GetGrid(location);
// Check if we got a grid ID the second time round
if (!TryComp(gridUid, out mapGrid))

View File

@@ -1,4 +1,4 @@
using System.Numerics;
using System.Numerics;
using Content.Shared.Random.Helpers;
using Robust.Shared.Random;
using Robust.Shared.Utility;
@@ -20,7 +20,7 @@ public sealed class RandomHelperSystem : EntitySystem
var offset = new Vector2(randomX, randomY);
var xform = Transform(entity);
_transform.SetLocalPosition(xform, xform.LocalPosition + offset);
_transform.SetLocalPosition(entity, xform.LocalPosition + offset, xform);
}
public void RandomOffset(EntityUid entity, float min, float max)

View File

@@ -1,4 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using Content.Shared.Physics;
using Robust.Shared.Map;
using Robust.Shared.Physics.Systems;
@@ -16,7 +16,7 @@ namespace Content.Shared.Spawning
SharedPhysicsSystem? physicsManager = null)
{
physicsManager ??= entityManager.System<SharedPhysicsSystem>();
var mapCoordinates = coordinates.ToMap(entityManager, entityManager.System<SharedTransformSystem>());
var mapCoordinates = entityManager.System<SharedTransformSystem>().ToMapCoordinates(coordinates);
return entityManager.SpawnIfUnobstructed(prototypeName, mapCoordinates, collisionLayer, box, physicsManager);
}

View File

@@ -59,14 +59,14 @@ public sealed class FloorTileSystem : EntitySystem
// this looks a bit sussy but it might be because it needs to be able to place off of grids and expand them
var location = args.ClickLocation.AlignWithClosestGridTile();
var locationMap = location.ToMap(EntityManager, _transform);
var locationMap = _transform.ToMapCoordinates(location);
if (locationMap.MapId == MapId.Nullspace)
return;
var physicQuery = GetEntityQuery<PhysicsComponent>();
var transformQuery = GetEntityQuery<TransformComponent>();
var map = location.ToMap(EntityManager, _transform);
var map = _transform.ToMapCoordinates(location);
// Disallow placement close to grids.
// FTLing close is okay but this makes alignment too finnicky.
@@ -92,7 +92,7 @@ public sealed class FloorTileSystem : EntitySystem
return;
}
var userPos = transformQuery.GetComponent(args.User).Coordinates.ToMapPos(EntityManager, _transform);
var userPos = _transform.ToMapCoordinates(transformQuery.GetComponent(args.User).Coordinates).Position;
var dir = userPos - map.Position;
var canAccessCenter = false;
if (dir.LengthSquared() > 0.01)