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:
@@ -1,4 +1,4 @@
|
||||
using Content.Shared.CartridgeLoader.Cartridges;
|
||||
using Content.Shared.CartridgeLoader.Cartridges;
|
||||
using Content.Shared.Paper;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -26,7 +26,7 @@ public sealed partial class LogProbeCartridgeComponent : Component
|
||||
/// The sound to make when we scan something with access
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public SoundSpecifier SoundScan = new SoundPathSpecifier("/Audio/Machines/scan_finish.ogg");
|
||||
public SoundSpecifier SoundScan = new SoundPathSpecifier("/Audio/Machines/scan_finish.ogg", AudioParams.Default.WithVariation(0.25f));
|
||||
|
||||
/// <summary>
|
||||
/// Paper to spawn when printing logs.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.CartridgeLoader;
|
||||
using Content.Shared.CartridgeLoader.Cartridges;
|
||||
using Content.Shared.Database;
|
||||
@@ -8,6 +7,7 @@ using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Labels.EntitySystems;
|
||||
using Content.Shared.Paper;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -52,7 +52,7 @@ public sealed class LogProbeCartridgeSystem : EntitySystem
|
||||
return;
|
||||
|
||||
//Play scanning sound with slightly randomized pitch
|
||||
_audio.PlayEntity(ent.Comp.SoundScan, args.InteractEvent.User, target, AudioHelpers.WithVariation(0.25f, _random));
|
||||
_audio.PlayEntity(ent.Comp.SoundScan, args.InteractEvent.User, target);
|
||||
_popup.PopupCursor(Loc.GetString("log-probe-scan", ("device", target)), args.InteractEvent.User);
|
||||
|
||||
ent.Comp.EntityName = Name(target);
|
||||
|
||||
@@ -33,12 +33,14 @@ namespace Content.Server.Containers
|
||||
|
||||
private void OnDeconstruct(EntityUid uid, EmptyOnMachineDeconstructComponent component, MachineDeconstructedEvent ev)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent<ContainerManagerComponent>(uid, out var mComp))
|
||||
if (!TryComp<ContainerManagerComponent>(uid, out var mComp))
|
||||
return;
|
||||
var baseCoords = EntityManager.GetComponent<TransformComponent>(uid).Coordinates;
|
||||
|
||||
var baseCoords = Transform(uid).Coordinates;
|
||||
|
||||
foreach (var v in component.Containers)
|
||||
{
|
||||
if (mComp.TryGetContainer(v, out var container))
|
||||
if (_container.TryGetContainer(uid, v, out var container, mComp))
|
||||
{
|
||||
_container.EmptyContainer(container, true, baseCoords);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace Content.Server.Decals
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
private readonly Dictionary<NetEntity, HashSet<Vector2i>> _dirtyChunks = new();
|
||||
private readonly Dictionary<ICommonSession, Dictionary<NetEntity, HashSet<Vector2i>>> _previousSentChunks = new();
|
||||
@@ -249,7 +250,7 @@ namespace Content.Server.Decals
|
||||
if (!coordinates.IsValid(EntityManager))
|
||||
return;
|
||||
|
||||
var gridId = coordinates.GetGridUid(EntityManager);
|
||||
var gridId = _transform.GetGrid(coordinates);
|
||||
|
||||
if (gridId == null)
|
||||
return;
|
||||
@@ -296,7 +297,7 @@ namespace Content.Server.Decals
|
||||
if (!PrototypeManager.HasIndex<DecalPrototype>(decal.Id))
|
||||
return false;
|
||||
|
||||
var gridId = coordinates.GetGridUid(EntityManager);
|
||||
var gridId = _transform.GetGrid(coordinates);
|
||||
if (!TryComp(gridId, out MapGridComponent? grid))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
var newPosition = destination * progress;
|
||||
|
||||
// This is some supreme shit code.
|
||||
_xformSystem.SetCoordinates(uid, origin.Offset(newPosition).WithEntityId(currentTube));
|
||||
_xformSystem.SetCoordinates(uid, _xformSystem.WithEntityId(origin.Offset(newPosition), currentTube));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Content.Server.Engineering.EntitySystems
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly StackSystem _stackSystem = default!;
|
||||
[Dependency] private readonly TurfSystem _turfSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -31,7 +32,7 @@ namespace Content.Server.Engineering.EntitySystems
|
||||
return;
|
||||
if (string.IsNullOrEmpty(component.Prototype))
|
||||
return;
|
||||
if (!TryComp<MapGridComponent>(args.ClickLocation.GetGridUid(EntityManager), out var grid))
|
||||
if (!TryComp<MapGridComponent>(_transform.GetGrid(args.ClickLocation), out var grid))
|
||||
return;
|
||||
if (!grid.TryGetTileRef(args.ClickLocation, out var tileRef))
|
||||
return;
|
||||
|
||||
@@ -56,6 +56,7 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
|
||||
[Dependency] private readonly StepTriggerSystem _stepTrigger = default!;
|
||||
[Dependency] private readonly SpeedModifierContactsSystem _speedModContacts = default!;
|
||||
[Dependency] private readonly TileFrictionController _tile = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
[ValidatePrototypeId<ReagentPrototype>]
|
||||
private const string Blood = "Blood";
|
||||
@@ -626,7 +627,8 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
|
||||
return false;
|
||||
}
|
||||
|
||||
var gridUid = coordinates.GetGridUid(EntityManager);
|
||||
var gridUid = _transform.GetGrid(coordinates);
|
||||
|
||||
if (!TryComp<MapGridComponent>(gridUid, out var mapGrid))
|
||||
{
|
||||
puddleUid = EntityUid.Invalid;
|
||||
|
||||
@@ -27,6 +27,7 @@ public sealed class IdentitySystem : SharedIdentitySystem
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly HumanoidAppearanceSystem _humanoid = default!;
|
||||
[Dependency] private readonly CriminalRecordsConsoleSystem _criminalRecordsConsole = default!;
|
||||
[Dependency] private readonly GrammarSystem _grammarSystem = default!;
|
||||
|
||||
private HashSet<EntityUid> _queuedIdentityUpdates = new();
|
||||
|
||||
@@ -102,7 +103,7 @@ public sealed class IdentitySystem : SharedIdentitySystem
|
||||
|
||||
// If presumed name is null and we're using that, we set proper noun to be false ("the old woman")
|
||||
if (name != representation.TrueName && representation.PresumedName == null)
|
||||
identityGrammar.ProperNoun = false;
|
||||
_grammarSystem.SetProperNoun((uid, grammar), false);
|
||||
|
||||
Dirty(ident, identityGrammar);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem
|
||||
|
||||
private EntityCoordinates? SelectRandomTileInRange(TransformComponent userXform, float radius)
|
||||
{
|
||||
var userCoords = userXform.Coordinates.ToMap(EntityManager, _xform);
|
||||
var userCoords = _xform.ToMapCoordinates(userXform.Coordinates);
|
||||
_targetGrids.Clear();
|
||||
_lookupSystem.GetEntitiesInRange(userCoords, radius, _targetGrids);
|
||||
Entity<MapGridComponent>? targetGrid = null;
|
||||
|
||||
@@ -225,7 +225,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
|
||||
{
|
||||
var metadataQuery = EntityManager.GetEntityQuery<MetaDataComponent>();
|
||||
|
||||
if (Deleted(uid, metadataQuery))
|
||||
if (Deleted(uid))
|
||||
return Array.Empty<(NetEntity, string)>();
|
||||
|
||||
var list = new ValueList<(NetEntity, string)>();
|
||||
@@ -380,7 +380,6 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
|
||||
}
|
||||
|
||||
var activeQuery = EntityManager.GetEntityQuery<ActiveInstrumentComponent>();
|
||||
var metadataQuery = EntityManager.GetEntityQuery<MetaDataComponent>();
|
||||
var transformQuery = EntityManager.GetEntityQuery<TransformComponent>();
|
||||
|
||||
var query = AllEntityQuery<ActiveInstrumentComponent, InstrumentComponent>();
|
||||
@@ -388,7 +387,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
|
||||
{
|
||||
if (instrument.Master is {} master)
|
||||
{
|
||||
if (Deleted(master, metadataQuery))
|
||||
if (Deleted(master))
|
||||
{
|
||||
Clean(uid, instrument);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ using Content.Server.Medical.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.DoAfter;
|
||||
@@ -21,6 +20,7 @@ using Content.Shared.Popups;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server.Medical;
|
||||
|
||||
@@ -31,7 +31,6 @@ public sealed class HealingSystem : EntitySystem
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly StackSystem _stacks = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!;
|
||||
@@ -115,7 +114,7 @@ public sealed class HealingSystem : EntitySystem
|
||||
$"{EntityManager.ToPrettyString(args.User):user} healed themselves for {total:damage} damage");
|
||||
}
|
||||
|
||||
_audio.PlayPvs(healing.HealingEndSound, entity.Owner, AudioHelpers.WithVariation(0.125f, _random).WithVolume(1f));
|
||||
_audio.PlayPvs(healing.HealingEndSound, entity.Owner);
|
||||
|
||||
// Logic to determine the whether or not to repeat the healing action
|
||||
args.Repeat = (HasDamage(entity, healing) && !dontRepeat);
|
||||
@@ -198,8 +197,7 @@ public sealed class HealingSystem : EntitySystem
|
||||
return false;
|
||||
}
|
||||
|
||||
_audio.PlayPvs(component.HealingBeginSound, uid,
|
||||
AudioHelpers.WithVariation(0.125f, _random).WithVolume(1f));
|
||||
_audio.PlayPvs(component.HealingBeginSound, uid);
|
||||
|
||||
var isNotSelf = user != target;
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ public sealed class MindSystem : SharedMindSystem
|
||||
// not implicitly via optional arguments.
|
||||
|
||||
var position = Deleted(mind.OwnedEntity)
|
||||
? _gameTicker.GetObserverSpawnPoint().ToMap(EntityManager, _transform)
|
||||
? _transform.ToMapCoordinates(_gameTicker.GetObserverSpawnPoint())
|
||||
: _transform.GetMapCoordinates(mind.OwnedEntity.Value);
|
||||
|
||||
entity = Spawn(GameTicker.ObserverPrototypeName, position);
|
||||
@@ -336,7 +336,7 @@ public sealed class MindSystem : SharedMindSystem
|
||||
if (_players.TryGetSessionById(userId.Value, out var ret))
|
||||
{
|
||||
mind.Session = ret;
|
||||
_pvsOverride.AddSessionOverride(netMind, ret);
|
||||
_pvsOverride.AddSessionOverride(mindId, ret);
|
||||
_players.SetAttachedEntity(ret, mind.CurrentEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
||||
|
||||
private void OnFTLStarted(ref FTLStartedEvent ev)
|
||||
{
|
||||
var targetMap = ev.TargetCoordinates.ToMap(EntityManager, _transform);
|
||||
var targetMap = _transform.ToMapCoordinates(ev.TargetCoordinates);
|
||||
var targetMapUid = _mapManager.GetMapEntityId(targetMap.MapId);
|
||||
|
||||
if (!TryComp<BiomeComponent>(targetMapUid, out var biome))
|
||||
|
||||
@@ -25,7 +25,7 @@ public sealed class PointSystem : SharedPointSystem
|
||||
|
||||
private void OnStartup(EntityUid uid, PointManagerComponent component, ComponentStartup args)
|
||||
{
|
||||
_pvsOverride.AddGlobalOverride(GetNetEntity(uid));
|
||||
_pvsOverride.AddGlobalOverride(uid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -69,7 +69,7 @@ public sealed partial class CableSystem : EntitySystem
|
||||
|
||||
// anchor state can change as a result of deletion (detach to null).
|
||||
// We don't want to spawn an entity when deleted.
|
||||
if (!TryLifeStage(uid, out var life) || life >= EntityLifeStage.Terminating)
|
||||
if (TerminatingOrDeleted(uid))
|
||||
return;
|
||||
|
||||
// This entity should not be un-anchorable. But this can happen if the grid-tile is deleted (RCD, explosion,
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Shared.Singularity.Components;
|
||||
using Content.Shared.Singularity.EntitySystems;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
@@ -477,7 +478,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
|
||||
if (drop_container is null)
|
||||
_containerSystem.TryGetContainingContainer((uid, null, null), out drop_container);
|
||||
|
||||
foreach (var container in comp.GetAllContainers())
|
||||
foreach (var container in _containerSystem.GetAllContainers(uid))
|
||||
{
|
||||
ConsumeEntitiesInContainer(args.EventHorizonUid, container, args.EventHorizon, drop_container);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public sealed class SingularityAttractorSystem : EntitySystem
|
||||
|
||||
attractor.LastPulseTime = _timing.CurTime;
|
||||
|
||||
var mapPos = xform.Coordinates.ToMap(EntityManager, _transform);
|
||||
var mapPos = _transform.ToMapCoordinates(xform.Coordinates);
|
||||
|
||||
if (mapPos == MapCoordinates.Nullspace)
|
||||
return;
|
||||
@@ -72,7 +72,7 @@ public sealed class SingularityAttractorSystem : EntitySystem
|
||||
var query = EntityQuery<SingularityComponent, RandomWalkComponent, TransformComponent>();
|
||||
foreach (var (singulo, walk, singuloXform) in query)
|
||||
{
|
||||
var singuloMapPos = singuloXform.Coordinates.ToMap(EntityManager, _transform);
|
||||
var singuloMapPos = _transform.ToMapCoordinates(singuloXform.Coordinates);
|
||||
|
||||
if (singuloMapPos.MapId != mapPos.MapId)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user