From 1782eb6ad722846503a36cc4cdfbc99cc789b994 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 17 Oct 2022 02:49:22 +1100 Subject: [PATCH] Fix even more warnings (#11968) Also more instances of someone using TryComp instead of HasComp Co-authored-by: metalgearsloth --- .../AME/Components/AMEControllerComponent.cs | 3 ++- .../Access/Systems/AgentIDCardSystem.cs | 4 ++-- Content.Server/Alert/Click/BreakVow.cs | 6 ++++-- Content.Server/Alert/Click/ResistFire.cs | 6 ++++-- Content.Server/Alert/Click/RetakeVow.cs | 6 ++++-- Content.Server/Alert/Click/StopBeingPulled.cs | 8 +++++--- Content.Server/Alert/Click/StopPiloting.cs | 6 ++++-- Content.Server/Alert/Click/StopPulling.cs | 6 ++++-- .../Access/SharedAgentIDCardSystem.cs | 7 ++++--- Content.Shared/Alert/AlertsSystem.cs | 5 +---- .../Light/SharedHandheldLightSystem.cs | 8 +++++--- .../Systems/SharedMoverController.Pushing.cs | 11 +++++++---- Content.Shared/Paper/StampComponent.cs | 2 +- .../Pulling/Systems/SharedPullingSystem.cs | 4 +++- .../EntitySystems/SharedCorporealSystem.cs | 10 ++++++---- .../Singularity/SharedSingularitySystem.cs | 9 ++++----- Content.Shared/Slippery/SlipperySystem.cs | 6 ++++-- .../Spawning/EntitySystemExtensions.cs | 4 ++-- Content.Shared/Standing/StandingStateSystem.cs | 7 ++++--- .../EntitySystems/SharedItemCounterSystem.cs | 18 +++++++++++------- Content.Shared/Stunnable/SharedStunSystem.cs | 5 ++--- .../Structures/Power/Generation/ame.yml | 3 +++ 22 files changed, 86 insertions(+), 58 deletions(-) diff --git a/Content.Server/AME/Components/AMEControllerComponent.cs b/Content.Server/AME/Components/AMEControllerComponent.cs index 899f7a9713..032486c82e 100644 --- a/Content.Server/AME/Components/AMEControllerComponent.cs +++ b/Content.Server/AME/Components/AMEControllerComponent.cs @@ -54,7 +54,8 @@ namespace Content.Server.AME.Components _injecting = false; InjectionAmount = 2; - JarSlot = ContainerHelpers.EnsureContainer(Owner, $"{Name}-fuelJarContainer"); + // TODO: Fix this bad name. I'd update maps but then people get mad. + JarSlot = ContainerHelpers.EnsureContainer(Owner, $"AMEController-fuelJarContainer"); } internal void OnUpdate(float frameTime) diff --git a/Content.Server/Access/Systems/AgentIDCardSystem.cs b/Content.Server/Access/Systems/AgentIDCardSystem.cs index 678c92f0d0..697bb9db89 100644 --- a/Content.Server/Access/Systems/AgentIDCardSystem.cs +++ b/Content.Server/Access/Systems/AgentIDCardSystem.cs @@ -27,10 +27,10 @@ namespace Content.Server.Access.Systems private void OnAfterInteract(EntityUid uid, AgentIDCardComponent component, AfterInteractEvent args) { - if (!TryComp(args.Target, out var targetAccess) || !TryComp(args.Target, out var targetIDCard) || args.Target == null) + if (!TryComp(args.Target, out var targetAccess) || !HasComp(args.Target) || args.Target == null) return; - if (!TryComp(uid, out var access) || !TryComp(uid, out var idCard)) + if (!TryComp(uid, out var access) || !HasComp(uid)) return; var beforeLength = access.Tags.Count; diff --git a/Content.Server/Alert/Click/BreakVow.cs b/Content.Server/Alert/Click/BreakVow.cs index 67ac15bea8..5956973991 100644 --- a/Content.Server/Alert/Click/BreakVow.cs +++ b/Content.Server/Alert/Click/BreakVow.cs @@ -11,9 +11,11 @@ namespace Content.Server.Alert.Click { public void AlertClicked(EntityUid player) { - if (IoCManager.Resolve().TryGetComponent(player, out var mimePowers)) + var entManager = IoCManager.Resolve(); + + if (entManager.TryGetComponent(player, out var mimePowers)) { - EntitySystem.Get().BreakVow(player, mimePowers); + entManager.System().BreakVow(player, mimePowers); } } } diff --git a/Content.Server/Alert/Click/ResistFire.cs b/Content.Server/Alert/Click/ResistFire.cs index b373e7eff9..9ce89ab48b 100644 --- a/Content.Server/Alert/Click/ResistFire.cs +++ b/Content.Server/Alert/Click/ResistFire.cs @@ -14,9 +14,11 @@ namespace Content.Server.Alert.Click { public void AlertClicked(EntityUid player) { - if (IoCManager.Resolve().TryGetComponent(player, out FlammableComponent? flammable)) + var entManager = IoCManager.Resolve(); + + if (entManager.TryGetComponent(player, out FlammableComponent? flammable)) { - EntitySystem.Get().Resist(player, flammable); + entManager.System().Resist(player, flammable); } } } diff --git a/Content.Server/Alert/Click/RetakeVow.cs b/Content.Server/Alert/Click/RetakeVow.cs index 06c97697fb..1996461c47 100644 --- a/Content.Server/Alert/Click/RetakeVow.cs +++ b/Content.Server/Alert/Click/RetakeVow.cs @@ -11,9 +11,11 @@ namespace Content.Server.Alert.Click { public void AlertClicked(EntityUid player) { - if (IoCManager.Resolve().TryGetComponent(player, out var mimePowers)) + var entManager = IoCManager.Resolve(); + + if (entManager.TryGetComponent(player, out var mimePowers)) { - EntitySystem.Get().RetakeVow(player, mimePowers); + entManager.System().RetakeVow(player, mimePowers); } } } diff --git a/Content.Server/Alert/Click/StopBeingPulled.cs b/Content.Server/Alert/Click/StopBeingPulled.cs index 2b9f16b3a4..de0f39d27a 100644 --- a/Content.Server/Alert/Click/StopBeingPulled.cs +++ b/Content.Server/Alert/Click/StopBeingPulled.cs @@ -15,12 +15,14 @@ namespace Content.Server.Alert.Click { public void AlertClicked(EntityUid player) { - if (!EntitySystem.Get().CanInteract(player, null)) + var entityManager = IoCManager.Resolve(); + + if (!entityManager.System().CanInteract(player, null)) return; - if (IoCManager.Resolve().TryGetComponent(player, out var playerPullable)) + if (entityManager.TryGetComponent(player, out var playerPullable)) { - EntitySystem.Get().TryStopPull(playerPullable); + entityManager.System().TryStopPull(playerPullable); } } } diff --git a/Content.Server/Alert/Click/StopPiloting.cs b/Content.Server/Alert/Click/StopPiloting.cs index e0c3b791d0..446389da25 100644 --- a/Content.Server/Alert/Click/StopPiloting.cs +++ b/Content.Server/Alert/Click/StopPiloting.cs @@ -14,10 +14,12 @@ namespace Content.Server.Alert.Click { public void AlertClicked(EntityUid player) { - if (IoCManager.Resolve().TryGetComponent(player, out PilotComponent? pilotComponent) && + var entManager = IoCManager.Resolve(); + + if (entManager.TryGetComponent(player, out PilotComponent? pilotComponent) && pilotComponent.Console != null) { - EntitySystem.Get().RemovePilot(pilotComponent); + entManager.System().RemovePilot(pilotComponent); } } } diff --git a/Content.Server/Alert/Click/StopPulling.cs b/Content.Server/Alert/Click/StopPulling.cs index 14e64d12d8..45ae14172f 100644 --- a/Content.Server/Alert/Click/StopPulling.cs +++ b/Content.Server/Alert/Click/StopPulling.cs @@ -14,9 +14,11 @@ namespace Content.Server.Alert.Click { public void AlertClicked(EntityUid player) { - var ps = EntitySystem.Get(); + var entManager = IoCManager.Resolve(); + + var ps = entManager.System(); var playerTarget = ps.GetPulled(player); - if (playerTarget != default && IoCManager.Resolve().TryGetComponent(playerTarget, out SharedPullableComponent? playerPullable)) + if (playerTarget != default && entManager.TryGetComponent(playerTarget, out SharedPullableComponent? playerPullable)) { ps.TryStopPull(playerPullable); } diff --git a/Content.Shared/Access/SharedAgentIDCardSystem.cs b/Content.Shared/Access/SharedAgentIDCardSystem.cs index bb4a1fd1d1..c3e75e4436 100644 --- a/Content.Shared/Access/SharedAgentIDCardSystem.cs +++ b/Content.Shared/Access/SharedAgentIDCardSystem.cs @@ -2,16 +2,17 @@ using Robust.Shared.Serialization; namespace Content.Shared.Access.Systems { - public class SharedAgentIdCardSystem : EntitySystem + public abstract class SharedAgentIdCardSystem : EntitySystem { - /// Just for friending for now + // Just for friending for now } + /// /// Key representing which is currently open. /// Useful when there are multiple UI for an object. Here it's future-proofing only. /// [Serializable, NetSerializable] - public enum AgentIDCardUiKey + public enum AgentIDCardUiKey : byte { Key, } diff --git a/Content.Shared/Alert/AlertsSystem.cs b/Content.Shared/Alert/AlertsSystem.cs index c5f920aebf..d0e77224f3 100644 --- a/Content.Shared/Alert/AlertsSystem.cs +++ b/Content.Shared/Alert/AlertsSystem.cs @@ -6,10 +6,7 @@ namespace Content.Shared.Alert; public abstract class AlertsSystem : EntitySystem { - [Dependency] - private readonly IPrototypeManager _prototypeManager = default!; - - [Dependency] private readonly MetaDataSystem _metaSystem = default!; + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; private readonly Dictionary _typeToAlert = new(); diff --git a/Content.Shared/Light/SharedHandheldLightSystem.cs b/Content.Shared/Light/SharedHandheldLightSystem.cs index 13aa6c7532..5101ca4f77 100644 --- a/Content.Shared/Light/SharedHandheldLightSystem.cs +++ b/Content.Shared/Light/SharedHandheldLightSystem.cs @@ -14,6 +14,8 @@ public abstract class SharedHandheldLightSystem : EntitySystem [Dependency] private readonly SharedItemSystem _itemSys = default!; [Dependency] private readonly ClothingSystem _clothingSys = default!; [Dependency] private readonly SharedActionsSystem _actionSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { @@ -52,9 +54,9 @@ public abstract class SharedHandheldLightSystem : EntitySystem if (makeNoise) { var sound = component.Activated ? component.TurnOnSound : component.TurnOffSound; - SoundSystem.Play(sound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner); + _audio.PlayPvs(sound, component.Owner); } - + Dirty(component); UpdateVisuals(uid, component); } @@ -74,6 +76,6 @@ public abstract class SharedHandheldLightSystem : EntitySystem if (component.ToggleAction != null) _actionSystem.SetToggled(component.ToggleAction, component.Activated); - appearance.SetData(ToggleableLightVisuals.Enabled, component.Activated); + _appearance.SetData(uid, ToggleableLightVisuals.Enabled, component.Activated, appearance); } } diff --git a/Content.Shared/Movement/Systems/SharedMoverController.Pushing.cs b/Content.Shared/Movement/Systems/SharedMoverController.Pushing.cs index b29ee8c5b4..da49bf7862 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.Pushing.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.Pushing.cs @@ -43,14 +43,17 @@ public abstract partial class SharedMoverController /// private void OnMobCollision(Fixture ourFixture, Fixture otherFixture, float frameTime, Vector2 worldNormal) { - if (!_pushingEnabled) return; + if (!_pushingEnabled) + return; var otherBody = otherFixture.Body; - if (otherBody.BodyType != BodyType.Dynamic || !otherFixture.Hard) return; + if (otherBody.BodyType != BodyType.Dynamic || !otherFixture.Hard) + return; - if (!EntityManager.TryGetComponent(ourFixture.Body.Owner, out MobMoverComponent? mobMover) || worldNormal == Vector2.Zero) return; + if (!EntityManager.TryGetComponent(ourFixture.Body.Owner, out MobMoverComponent? mobMover) || worldNormal == Vector2.Zero) + return; - otherBody.ApplyLinearImpulse(-worldNormal * mobMover.PushStrengthVV * frameTime); + PhysicsSystem.ApplyLinearImpulse(otherBody, -worldNormal * mobMover.PushStrengthVV * frameTime); } } diff --git a/Content.Shared/Paper/StampComponent.cs b/Content.Shared/Paper/StampComponent.cs index 6318a52e7a..08198259f4 100644 --- a/Content.Shared/Paper/StampComponent.cs +++ b/Content.Shared/Paper/StampComponent.cs @@ -1,7 +1,7 @@ namespace Content.Shared.Paper { [RegisterComponent] - public class StampComponent : Component + public sealed class StampComponent : Component { /// /// The loc string name that will be stamped to the piece of paper on examine. diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs index b33e55bc3f..9835525b78 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using Content.Shared.Alert; using Content.Shared.GameTicking; +using Content.Shared.Gravity; using Content.Shared.Input; using Content.Shared.Movement.Components; using Content.Shared.Physics.Pull; @@ -19,6 +20,7 @@ namespace Content.Shared.Pulling public abstract partial class SharedPullingSystem : EntitySystem { [Dependency] private readonly SharedPullingStateManagementSystem _pullSm = default!; + [Dependency] private readonly SharedGravitySystem _gravity = default!; [Dependency] private readonly AlertsSystem _alertsSystem = default!; /// @@ -197,7 +199,7 @@ namespace Content.Shared.Pulling } if (_containerSystem.IsEntityInContainer(player) || - player.IsWeightless(entityManager: EntityManager)) + _gravity.IsWeightless(player)) return false; TryMoveTo(pullable, coords); diff --git a/Content.Shared/Revenant/EntitySystems/SharedCorporealSystem.cs b/Content.Shared/Revenant/EntitySystems/SharedCorporealSystem.cs index 7d277a5198..293504523a 100644 --- a/Content.Shared/Revenant/EntitySystems/SharedCorporealSystem.cs +++ b/Content.Shared/Revenant/EntitySystems/SharedCorporealSystem.cs @@ -3,6 +3,7 @@ using Robust.Shared.Physics; using System.Linq; using Content.Shared.Movement.Systems; using Content.Shared.Revenant.Components; +using Robust.Shared.Physics.Systems; namespace Content.Shared.Revenant.EntitySystems; @@ -15,6 +16,7 @@ public abstract class SharedCorporealSystem : EntitySystem { [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly MovementSpeedModifierSystem _movement = default!; + [Dependency] private readonly SharedPhysicsSystem _physics = default!; public override void Initialize() { @@ -38,8 +40,8 @@ public abstract class SharedCorporealSystem : EntitySystem { var fixture = fixtures.Fixtures.Values.First(); - fixture.CollisionMask = (int) (CollisionGroup.SmallMobMask | CollisionGroup.GhostImpassable); - fixture.CollisionLayer = (int) CollisionGroup.SmallMobLayer; + _physics.SetCollisionMask(fixture, (int) (CollisionGroup.SmallMobMask | CollisionGroup.GhostImpassable)); + _physics.SetCollisionLayer(fixture, (int) CollisionGroup.SmallMobLayer); } _movement.RefreshMovementSpeedModifiers(uid); } @@ -52,8 +54,8 @@ public abstract class SharedCorporealSystem : EntitySystem { var fixture = fixtures.Fixtures.Values.First(); - fixture.CollisionMask = (int) CollisionGroup.GhostImpassable; - fixture.CollisionLayer = 0; + _physics.SetCollisionMask(fixture, (int) CollisionGroup.GhostImpassable); + _physics.SetCollisionLayer(fixture, 0); } component.MovementSpeedDebuff = 1; //just so we can avoid annoying code elsewhere _movement.RefreshMovementSpeedModifiers(uid); diff --git a/Content.Shared/Singularity/SharedSingularitySystem.cs b/Content.Shared/Singularity/SharedSingularitySystem.cs index e3088f4458..bf3d5868ce 100644 --- a/Content.Shared/Singularity/SharedSingularitySystem.cs +++ b/Content.Shared/Singularity/SharedSingularitySystem.cs @@ -14,6 +14,8 @@ namespace Content.Shared.Singularity public abstract class SharedSingularitySystem : EntitySystem { [Dependency] private readonly FixtureSystem _fixtures = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedPhysicsSystem _physics = default!; public const string DeleteFixture = "DeleteCircle"; @@ -102,7 +104,7 @@ namespace Content.Shared.Singularity // Prevents it getting stuck (see SingularityController.MoveSingulo) if (physics != null) { - physics.LinearVelocity = Vector2.Zero; + _physics.SetLinearVelocity(physics, Vector2.Zero); } } @@ -113,10 +115,7 @@ namespace Content.Shared.Singularity source.Intensity = singularity.RadsPerLevel * value; } - if (EntityManager.TryGetComponent(singularity.Owner, out AppearanceComponent? appearance)) - { - appearance.SetData(SingularityVisuals.Level, value); - } + _appearance.SetData(singularity.Owner, SingularityVisuals.Level, value); if (physics != null) { diff --git a/Content.Shared/Slippery/SlipperySystem.cs b/Content.Shared/Slippery/SlipperySystem.cs index aa1c6caa62..aeac09f72c 100644 --- a/Content.Shared/Slippery/SlipperySystem.cs +++ b/Content.Shared/Slippery/SlipperySystem.cs @@ -9,6 +9,7 @@ using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Physics.Components; +using Robust.Shared.Physics.Systems; namespace Content.Shared.Slippery { @@ -20,6 +21,7 @@ namespace Content.Shared.Slippery [Dependency] private readonly SharedStunSystem _stunSystem = default!; [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; [Dependency] private readonly SharedContainerSystem _container = default!; + [Dependency] private readonly SharedPhysicsSystem _physics = default!; public override void Initialize() { @@ -43,7 +45,7 @@ namespace Content.Shared.Slippery private void OnSlipperyGetState(EntityUid uid, SlipperyComponent component, ref ComponentGetState args) { - args.State = new SlipperyComponentState(component.ParalyzeTime, component.LaunchForwardsMultiplier, component.SlipSound.GetSound()); + args.State = new SlipperyComponentState(component.ParalyzeTime, component.LaunchForwardsMultiplier, _audio.GetSound(component.SlipSound)); } private void HandleStepTrigger(EntityUid uid, SlipperyComponent component, ref StepTriggeredEvent args) @@ -81,7 +83,7 @@ namespace Content.Shared.Slippery return; if (TryComp(other, out PhysicsComponent? physics)) - physics.LinearVelocity *= component.LaunchForwardsMultiplier; + _physics.SetLinearVelocity(physics, physics.LinearVelocity * component.LaunchForwardsMultiplier); var playSound = !_statusEffectsSystem.HasStatusEffect(other, "KnockedDown"); diff --git a/Content.Shared/Spawning/EntitySystemExtensions.cs b/Content.Shared/Spawning/EntitySystemExtensions.cs index 78d56c5b29..14b171baeb 100644 --- a/Content.Shared/Spawning/EntitySystemExtensions.cs +++ b/Content.Shared/Spawning/EntitySystemExtensions.cs @@ -15,7 +15,7 @@ namespace Content.Shared.Spawning in Box2? box = null, SharedPhysicsSystem? physicsManager = null) { - physicsManager ??= EntitySystem.Get(); + physicsManager ??= entityManager.System(); var mapCoordinates = coordinates.ToMap(entityManager); return entityManager.SpawnIfUnobstructed(prototypeName, mapCoordinates, collisionLayer, box, physicsManager); @@ -30,7 +30,7 @@ namespace Content.Shared.Spawning SharedPhysicsSystem? collision = null) { var boxOrDefault = box.GetValueOrDefault(Box2.UnitCentered).Translated(coordinates.Position); - collision ??= EntitySystem.Get(); + collision ??= entityManager.System(); foreach (var body in collision.GetCollidingEntities(coordinates.MapId, in boxOrDefault)) { diff --git a/Content.Shared/Standing/StandingStateSystem.cs b/Content.Shared/Standing/StandingStateSystem.cs index f7db16d91f..5660caa5b6 100644 --- a/Content.Shared/Standing/StandingStateSystem.cs +++ b/Content.Shared/Standing/StandingStateSystem.cs @@ -9,15 +9,16 @@ using Content.Shared.Physics; using Robust.Shared.GameStates; using Robust.Shared.Serialization; using Robust.Shared.Network; +using Robust.Shared.Physics.Systems; namespace Content.Shared.Standing { public sealed class StandingStateSystem : EntitySystem { [Dependency] private readonly IGameTiming _gameTiming = default!; - [Dependency] private readonly INetManager _netMan = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly SharedPhysicsSystem _physics = default!; // If StandingCollisionLayer value is ever changed to more than one layer, the logic needs to be edited. private const int StandingCollisionLayer = (int) CollisionGroup.MidImpassable; @@ -96,7 +97,7 @@ namespace Content.Shared.Standing continue; standingState.ChangedFixtures.Add(key); - fixture.CollisionMask &= ~StandingCollisionLayer; + _physics.SetCollisionMask(fixture, fixture.CollisionMask & ~StandingCollisionLayer); } } @@ -142,7 +143,7 @@ namespace Content.Shared.Standing foreach (var key in standingState.ChangedFixtures) { if (fixtureComponent.Fixtures.TryGetValue(key, out var fixture)) - fixture.CollisionMask |= StandingCollisionLayer; + _physics.SetCollisionMask(fixture, fixture.CollisionMask | StandingCollisionLayer); } } standingState.ChangedFixtures.Clear(); diff --git a/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs b/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs index 4082528da9..b2912db2a5 100644 --- a/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs @@ -8,6 +8,8 @@ namespace Content.Shared.Storage.EntitySystems [UsedImplicitly] public abstract class SharedItemCounterSystem : EntitySystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + /// public override void Initialize() { @@ -19,30 +21,32 @@ namespace Content.Shared.Storage.EntitySystems private void CounterEntityInserted(EntityUid uid, ItemCounterComponent itemCounter, EntInsertedIntoContainerMessage args) { - if (!EntityManager.TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent)) return; + if (!EntityManager.TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent)) + return; var count = GetCount(args, itemCounter); if (count == null) return; - appearanceComponent.SetData(StackVisuals.Actual, count); - if (itemCounter.MaxAmount != null) - appearanceComponent.SetData(StackVisuals.MaxCount, itemCounter.MaxAmount); + _appearance.SetData(itemCounter.Owner, StackVisuals.Actual, count, appearanceComponent); + if (itemCounter.MaxAmount != null) + _appearance.SetData(itemCounter.Owner, StackVisuals.MaxCount, itemCounter.MaxAmount, appearanceComponent); } private void CounterEntityRemoved(EntityUid uid, ItemCounterComponent itemCounter, EntRemovedFromContainerMessage args) { - if (!EntityManager.TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent)) return; + if (!EntityManager.TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent)) + return; var count = GetCount(args, itemCounter); if (count == null) return; - appearanceComponent.SetData(StackVisuals.Actual, count); + _appearance.SetData(itemCounter.Owner, StackVisuals.Actual, count, appearanceComponent); if (itemCounter.MaxAmount != null) - appearanceComponent.SetData(StackVisuals.MaxCount, itemCounter.MaxAmount); + _appearance.SetData(itemCounter.Owner, StackVisuals.MaxCount, itemCounter.MaxAmount, appearanceComponent); } protected abstract int? GetCount(ContainerModifiedMessage msg, ItemCounterComponent itemCounter); diff --git a/Content.Shared/Stunnable/SharedStunSystem.cs b/Content.Shared/Stunnable/SharedStunSystem.cs index cc3c58683d..75db954007 100644 --- a/Content.Shared/Stunnable/SharedStunSystem.cs +++ b/Content.Shared/Stunnable/SharedStunSystem.cs @@ -25,6 +25,7 @@ namespace Content.Shared.Stunnable [Dependency] private readonly StandingStateSystem _standingStateSystem = default!; [Dependency] private readonly StatusEffectsSystem _statusEffectSystem = default!; [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; /// /// Friction modifier for knocked down players. @@ -221,9 +222,7 @@ namespace Content.Shared.Stunnable knocked.HelpTimer = knocked.HelpInterval/2f; _statusEffectSystem.TryRemoveTime(uid, "KnockedDown", TimeSpan.FromSeconds(knocked.HelpInterval)); - - SoundSystem.Play(knocked.StunAttemptSound.GetSound(), Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.05f)); - + _audio.PlayPredicted(knocked.StunAttemptSound, uid, args.User); Dirty(knocked); args.Handled = true; diff --git a/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml b/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml index 9fada7cdc0..9522565ee1 100644 --- a/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml +++ b/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml @@ -70,6 +70,9 @@ # - type: ExtensionCableReceiver - type: PowerSupplier supplyRate: 0 + - type: ContainerContainer + containers: + AMEController-fuelJarContainer: !type:ContainerSlot {} - type: entity noSpawn: true