diff --git a/Content.Shared/Alert/AlertsSystem.cs b/Content.Shared/Alert/AlertsSystem.cs index d0e77224f3..1969ed6f01 100644 --- a/Content.Shared/Alert/AlertsSystem.cs +++ b/Content.Shared/Alert/AlertsSystem.cs @@ -108,7 +108,7 @@ public abstract class AlertsSystem : EntitySystem AfterClearAlert(alertsComponent); - alertsComponent.Dirty(); + Dirty(alertsComponent); } /// @@ -128,7 +128,7 @@ public abstract class AlertsSystem : EntitySystem AfterClearAlert(alertsComponent); - alertsComponent.Dirty(); + Dirty(alertsComponent); } else { @@ -210,7 +210,8 @@ public abstract class AlertsSystem : EntitySystem private void HandleClickAlert(ClickAlertEvent msg, EntitySessionEventArgs args) { var player = args.SenderSession.AttachedEntity; - if (player is null || !EntityManager.TryGetComponent(player, out var alertComp)) return; + if (player is null || !EntityManager.HasComponent(player)) + return; if (!IsShowingAlert(player.Value, msg.Type)) { diff --git a/Content.Shared/Electrocution/SharedElectrocutionSystem.cs b/Content.Shared/Electrocution/SharedElectrocutionSystem.cs index f1a17ba9d3..d7848c073b 100644 --- a/Content.Shared/Electrocution/SharedElectrocutionSystem.cs +++ b/Content.Shared/Electrocution/SharedElectrocutionSystem.cs @@ -22,7 +22,7 @@ namespace Content.Shared.Electrocution return; insulated.SiemensCoefficient = siemensCoefficient; - insulated.Dirty(); + Dirty(insulated); } private void OnInsulatedElectrocutionAttempt(EntityUid uid, InsulatedComponent insulated, ElectrocutionAttemptEvent args) diff --git a/Content.Shared/Eye/Blinding/SharedBlindingSystem.cs b/Content.Shared/Eye/Blinding/SharedBlindingSystem.cs index 5d75bc9898..aa5e2b8cc8 100644 --- a/Content.Shared/Eye/Blinding/SharedBlindingSystem.cs +++ b/Content.Shared/Eye/Blinding/SharedBlindingSystem.cs @@ -82,7 +82,7 @@ namespace Content.Shared.Eye.Blinding component.IsActive = true; blur.Magnitude += component.VisionBonus; - blur.Dirty(); + Dirty(blur); } private void OnGlassesUnequipped(EntityUid uid, VisionCorrectionComponent component, GotUnequippedEvent args) @@ -91,7 +91,7 @@ namespace Content.Shared.Eye.Blinding return; component.IsActive = false; blur.Magnitude -= component.VisionBonus; - blur.Dirty(); + Dirty(blur); } private void OnGetState(EntityUid uid, BlurryVisionComponent component, ref ComponentGetState args) @@ -129,7 +129,8 @@ namespace Content.Shared.Eye.Blinding { var ev = new BlindnessChangedEvent(true); RaiseLocalEvent(uid, ev, false); - } else if (blindable.Sources == 0 && oldSources > 0) + } + else if (blindable.Sources == 0 && oldSources > 0) { var ev = new BlindnessChangedEvent(false); RaiseLocalEvent(uid, ev, false); @@ -149,7 +150,7 @@ namespace Content.Shared.Eye.Blinding { var blurry = EnsureComp(uid); blurry.Magnitude = (9 - blindable.EyeDamage); - blurry.Dirty(); + Dirty(blurry); } else { diff --git a/Content.Shared/Follower/FollowerSystem.cs b/Content.Shared/Follower/FollowerSystem.cs index 502bd6c3f7..18072ef899 100644 --- a/Content.Shared/Follower/FollowerSystem.cs +++ b/Content.Shared/Follower/FollowerSystem.cs @@ -9,6 +9,8 @@ namespace Content.Shared.Follower; public sealed class FollowerSystem : EntitySystem { + [Dependency] private readonly SharedTransformSystem _transform = default!; + public override void Initialize() { base.Initialize(); @@ -71,7 +73,7 @@ public sealed class FollowerSystem : EntitySystem followedComp.Following.Add(follower); var xform = Transform(follower); - xform.AttachParent(entity); + _transform.SetParent(xform, entity); xform.LocalPosition = Vector2.Zero; xform.LocalRotation = Angle.Zero; diff --git a/Content.Shared/Jittering/SharedJitteringSystem.cs b/Content.Shared/Jittering/SharedJitteringSystem.cs index a9fe8079d2..e0cb2463f9 100644 --- a/Content.Shared/Jittering/SharedJitteringSystem.cs +++ b/Content.Shared/Jittering/SharedJitteringSystem.cs @@ -89,7 +89,7 @@ namespace Content.Shared.Jittering var jitter = EnsureComp(uid); jitter.Amplitude = amplitude; jitter.Frequency = frequency; - jitter.Dirty(); + Dirty(jitter); } } } diff --git a/Content.Shared/Localizations/ContentLocalizationManager.cs b/Content.Shared/Localizations/ContentLocalizationManager.cs index 4becb5d76b..9f3b739ffe 100644 --- a/Content.Shared/Localizations/ContentLocalizationManager.cs +++ b/Content.Shared/Localizations/ContentLocalizationManager.cs @@ -5,7 +5,6 @@ namespace Content.Shared.Localizations public sealed class ContentLocalizationManager { [Dependency] private readonly ILocalizationManager _loc = default!; - [Dependency] private readonly IEntityManager _ent = default!; // If you want to change your codebase's language, do it here. private const string Culture = "en-US"; diff --git a/Content.Shared/Projectiles/ProjectileComponent.cs b/Content.Shared/Projectiles/ProjectileComponent.cs index 06935bc5a8..bab2298a31 100644 --- a/Content.Shared/Projectiles/ProjectileComponent.cs +++ b/Content.Shared/Projectiles/ProjectileComponent.cs @@ -12,20 +12,9 @@ namespace Content.Shared.Projectiles [ViewVariables(VVAccess.ReadWrite), DataField("impactEffect", customTypeSerializer:typeof(PrototypeIdSerializer))] public string? ImpactEffect; - private bool _ignoreShooter = true; public EntityUid Shooter { get; set; } - public bool IgnoreShooter - { - get => _ignoreShooter; - set - { - if (_ignoreShooter == value) return; - - _ignoreShooter = value; - Dirty(); - } - } + public bool IgnoreShooter = true; [DataField("damage", required: true)] [ViewVariables(VVAccess.ReadWrite)] diff --git a/Content.Shared/Standing/StandingStateSystem.cs b/Content.Shared/Standing/StandingStateSystem.cs index b7c17b1848..9c1116d537 100644 --- a/Content.Shared/Standing/StandingStateSystem.cs +++ b/Content.Shared/Standing/StandingStateSystem.cs @@ -15,7 +15,6 @@ namespace Content.Shared.Standing { public sealed class StandingStateSystem : EntitySystem { - [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; diff --git a/Content.Shared/SubFloor/TrayScannerSystem.cs b/Content.Shared/SubFloor/TrayScannerSystem.cs index 446417e0c8..c9eecb3ea2 100644 --- a/Content.Shared/SubFloor/TrayScannerSystem.cs +++ b/Content.Shared/SubFloor/TrayScannerSystem.cs @@ -11,10 +11,12 @@ namespace Content.Shared.SubFloor; public sealed class TrayScannerSystem : EntitySystem { - [Dependency] private IMapManager _mapManager = default!; - [Dependency] private IGameTiming _gameTiming = default!; - [Dependency] private SharedSubFloorHideSystem _subfloorSystem = default!; - [Dependency] private SharedContainerSystem _containerSystem = default!; + [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedSubFloorHideSystem _subfloorSystem = default!; + [Dependency] private readonly SharedContainerSystem _containerSystem = default!; + [Dependency] private readonly SharedTransformSystem _transform = default!; private HashSet _activeScanners = new(); private RemQueue _invalidScanners = new(); @@ -50,7 +52,7 @@ public sealed class TrayScannerSystem : EntitySystem if (EntityManager.TryGetComponent(uid, out var appearance)) { - appearance.SetData(TrayScannerVisual.Visual, scanner.Enabled == true ? TrayScannerVisual.On : TrayScannerVisual.Off); + _appearance.SetData(uid, TrayScannerVisual.Visual, scanner.Enabled ? TrayScannerVisual.On : TrayScannerVisual.Off, appearance); } } @@ -83,7 +85,8 @@ public sealed class TrayScannerSystem : EntitySystem if (!_gameTiming.IsFirstTimePredicted) return; - if (!_activeScanners.Any()) return; + if (!_activeScanners.Any()) + return; foreach (var scanner in _activeScanners) { @@ -96,7 +99,9 @@ public sealed class TrayScannerSystem : EntitySystem } foreach (var invalidScanner in _invalidScanners) + { _activeScanners.Remove(invalidScanner); + } _invalidScanners.List?.Clear(); } @@ -148,15 +153,16 @@ public sealed class TrayScannerSystem : EntitySystem } var pos = transform.LocalPosition; + var parent = _transform.GetParent(transform); // zero vector implies container // // this means we should get the entity transform's parent if (pos == Vector2.Zero - && transform.Parent != null + && parent != null && _containerSystem.ContainsEntity(transform.ParentUid, uid)) { - pos = transform.Parent.LocalPosition; + pos = parent.LocalPosition; // if this is also zero, we can check one more time // @@ -165,7 +171,7 @@ public sealed class TrayScannerSystem : EntitySystem // that doesn't work, just don't bother any further if (pos == Vector2.Zero) { - var gpTransform = transform.Parent.Parent; + var gpTransform = _transform.GetParent(parent); if (gpTransform != null && _containerSystem.ContainsEntity(gpTransform.Owner, transform.ParentUid)) { diff --git a/Content.Shared/Throwing/ThrowingSystem.cs b/Content.Shared/Throwing/ThrowingSystem.cs index 8a02f0efc8..e84b392507 100644 --- a/Content.Shared/Throwing/ThrowingSystem.cs +++ b/Content.Shared/Throwing/ThrowingSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Movement.Components; using Content.Shared.Tag; using Robust.Shared.Physics; using Robust.Shared.Physics.Components; +using Robust.Shared.Physics.Systems; using Robust.Shared.Timing; namespace Content.Shared.Throwing; @@ -20,6 +21,7 @@ public sealed class ThrowingSystem : EntitySystem [Dependency] private readonly SharedGravitySystem _gravity = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; + [Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly ThrownItemSystem _thrownSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!; @@ -58,7 +60,7 @@ public sealed class ThrowingSystem : EntitySystem comp.Thrower = user; // Give it a l'il spin. if (!_tagSystem.HasTag(uid, "NoSpinOnThrow")) - physics.ApplyAngularImpulse(ThrowAngularImpulse); + _physics.ApplyAngularImpulse(physics, ThrowAngularImpulse); else { if (transform == null) @@ -73,24 +75,26 @@ public sealed class ThrowingSystem : EntitySystem _interactionSystem.ThrownInteraction(user.Value, uid); var impulseVector = direction.Normalized * strength * physics.Mass; - physics.ApplyLinearImpulse(impulseVector); + _physics.ApplyLinearImpulse(physics, impulseVector); // Estimate time to arrival so we can apply OnGround status and slow it much faster. var time = (direction / strength).Length; if (time < FlyTime) { - physics.BodyStatus = BodyStatus.OnGround; + _physics.SetBodyStatus(physics, BodyStatus.OnGround); _thrownSystem.LandComponent(comp); } else { - physics.BodyStatus = BodyStatus.InAir; + _physics.SetBodyStatus(physics, BodyStatus.InAir); Timer.Spawn(TimeSpan.FromSeconds(time - FlyTime), () => { - if (physics.Deleted) return; - physics.BodyStatus = BodyStatus.OnGround; + if (physics.Deleted) + return; + + _physics.SetBodyStatus(physics, BodyStatus.OnGround); _thrownSystem.LandComponent(comp); }); } @@ -105,7 +109,7 @@ public sealed class ThrowingSystem : EntitySystem RaiseLocalEvent(physics.Owner, msg); if (!msg.Cancelled) - userPhysics.ApplyLinearImpulse(-impulseVector * pushbackRatio); + _physics.ApplyLinearImpulse(userPhysics, -impulseVector * pushbackRatio); } } } diff --git a/Content.Shared/Traits/TraitPrototype.cs b/Content.Shared/Traits/TraitPrototype.cs index 1d581c36f0..74f7d5aaaa 100644 --- a/Content.Shared/Traits/TraitPrototype.cs +++ b/Content.Shared/Traits/TraitPrototype.cs @@ -10,9 +10,6 @@ namespace Content.Shared.Traits [Prototype("trait")] public sealed class TraitPrototype : IPrototype { - private string _name = string.Empty; - private string? _description; - [ViewVariables] [IdDataField] public string ID { get; } = default!; diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Magazine.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Magazine.cs index 093f4ce1e7..16095e477f 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Magazine.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Magazine.cs @@ -137,8 +137,8 @@ public abstract partial class SharedGunSystem if (TryComp(magEnt, out var magAppearance)) { - magAppearance.TryGetData(AmmoVisuals.AmmoCount, out var addCount); - magAppearance.TryGetData(AmmoVisuals.AmmoMax, out var addCapacity); + Appearance.TryGetData(magEnt, AmmoVisuals.AmmoCount, out var addCount, magAppearance); + Appearance.TryGetData(magEnt, AmmoVisuals.AmmoMax, out var addCapacity, magAppearance); count += addCount; capacity += addCapacity; }