diff --git a/Content.Server/Cuffs/Components/CuffableComponent.cs b/Content.Server/Cuffs/Components/CuffableComponent.cs index b230b2120f..340d532f8a 100644 --- a/Content.Server/Cuffs/Components/CuffableComponent.cs +++ b/Content.Server/Cuffs/Components/CuffableComponent.cs @@ -286,7 +286,7 @@ namespace Content.Server.Cuffs.Components sprite.LayerSetState(0, cuff.BrokenState); // TODO: safety check to see if RSI contains the state? } - _entMan.AddComponent(cuffsToRemove); + _entMan.EnsureComponent(cuffsToRemove); } CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.SortedHands.Count() > CuffedHandCount; diff --git a/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs b/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs index 8a144a494a..6e7d27ea32 100644 --- a/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs +++ b/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs @@ -45,6 +45,9 @@ namespace Content.Server.MachineLinking.System private void OnGetInteractionVerbs(EntityUid uid, TwoWayLeverComponent component, GetVerbsEvent args) { + if (!args.CanAccess || !args.CanInteract || (args.Hands == null)) + return; + InteractionVerb verbLeft = new() { Act = () => @@ -57,6 +60,7 @@ namespace Content.Server.MachineLinking.System }; StateChanged(uid, component); }, + Category = VerbCategory.Lever, Message = Loc.GetString("two-way-lever-cant"), Disabled = component.State == TwoWayLeverState.Left, IconTexture = $"/Textures/Interface/VerbIcons/{_leftToggleImage}", @@ -77,6 +81,7 @@ namespace Content.Server.MachineLinking.System }; StateChanged(uid, component); }, + Category = VerbCategory.Lever, Message = Loc.GetString("two-way-lever-cant"), Disabled = component.State == TwoWayLeverState.Right, IconTexture = $"/Textures/Interface/VerbIcons/{_rightToggleImage}", diff --git a/Content.Server/Recycling/Components/RecyclerComponent.cs b/Content.Server/Recycling/Components/RecyclerComponent.cs index e9284680e2..37225b5721 100644 --- a/Content.Server/Recycling/Components/RecyclerComponent.cs +++ b/Content.Server/Recycling/Components/RecyclerComponent.cs @@ -11,7 +11,7 @@ namespace Content.Server.Recycling.Components [Dependency] private readonly IEntityManager _entMan = default!; [DataField("enabled")] - public bool Enabled = true; + public bool Enabled; /// /// Whether or not sentient beings will be recycled @@ -27,14 +27,6 @@ namespace Content.Server.Recycling.Components [DataField("efficiency")] internal float Efficiency = 0.25f; - private void Clean() - { - if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance)) - { - appearance.SetData(RecyclerVisuals.Bloody, false); - } - } - /// /// Default sound to play when recycling /// diff --git a/Content.Server/Recycling/RecyclerSystem.cs b/Content.Server/Recycling/RecyclerSystem.cs index 08a9f61558..9708cc6b09 100644 --- a/Content.Server/Recycling/RecyclerSystem.cs +++ b/Content.Server/Recycling/RecyclerSystem.cs @@ -3,6 +3,7 @@ using Content.Server.Body.Systems; using Content.Server.GameTicking; using Content.Server.Players; using Content.Server.Popups; +using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; using Content.Server.Recycling.Components; using Content.Shared.Audio; @@ -29,6 +30,10 @@ namespace Content.Server.Recycling [Dependency] private readonly GameTicker _ticker = default!; [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly TagSystem _tags = default!; + [Dependency] private readonly AudioSystem _soundSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!; + + private const string RecyclerColliderName = "brrt"; private const float RecyclerSoundCooldown = 0.8f; @@ -38,6 +43,7 @@ namespace Content.Server.Recycling SubscribeLocalEvent(OnCollide); SubscribeLocalEvent(OnEmagged); SubscribeLocalEvent(OnSuicide); + SubscribeLocalEvent(OnPowerChanged); } private void OnExamined(EntityUid uid, RecyclerComponent component, ExaminedEvent args) @@ -77,7 +83,16 @@ namespace Content.Server.Recycling if (component.Enabled) return; component.Enabled = true; - _ambience.SetAmbience(component.Owner, true); + + if (TryComp(component.Owner, out ApcPowerReceiverComponent? apcPower)) + { + _ambience.SetAmbience(component.Owner, apcPower.Powered); + } + else + { + _ambience.SetAmbience(component.Owner, true); + } + } public void DisableRecycler(RecyclerComponent component) @@ -88,9 +103,24 @@ namespace Content.Server.Recycling _ambience.SetAmbience(component.Owner, false); } + private void OnPowerChanged(EntityUid uid, RecyclerComponent component, ref PowerChangedEvent args) + { + if (component.Enabled) + { + _ambience.SetAmbience(uid, args.Powered); + } + } + private void OnCollide(EntityUid uid, RecyclerComponent component, ref StartCollideEvent args) { - if (component.Enabled && args.OurFixture.ID != "brrt") return; + if (component.Enabled && args.OurFixture.ID != RecyclerColliderName) + return; + + if (TryComp(uid, out ApcPowerReceiverComponent? apcPower)) + { + if (!apcPower.Powered) + return; + } Recycle(component, args.OtherFixture.Body.Owner); } @@ -123,7 +153,7 @@ namespace Content.Server.Recycling if (component.Sound != null && (_timing.CurTime - component.LastSound).TotalSeconds > RecyclerSoundCooldown) { - SoundSystem.Play(component.Sound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner, AudioHelpers.WithVariation(0.01f).WithVolume(-3)); + _soundSystem.PlayPvs(component.Sound, component.Owner, AudioHelpers.WithVariation(0.01f).WithVolume(-3)); component.LastSound = _timing.CurTime; } @@ -140,7 +170,7 @@ namespace Content.Server.Recycling { if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance)) { - appearance.SetData(RecyclerVisuals.Bloody, true); + _appearanceSystem.SetData(component.Owner, RecyclerVisuals.Bloody, true, appearance); } } diff --git a/Content.Shared/Verbs/VerbCategory.cs b/Content.Shared/Verbs/VerbCategory.cs index 141dc04aad..51c26c91cf 100644 --- a/Content.Shared/Verbs/VerbCategory.cs +++ b/Content.Shared/Verbs/VerbCategory.cs @@ -77,5 +77,7 @@ namespace Content.Shared.Verbs new("verb-categories-instrument-style", null); public static readonly VerbCategory SetSensor = new("verb-categories-set-sensor", null); + + public static readonly VerbCategory Lever = new("verb-categories-lever", null); } } diff --git a/Resources/Locale/en-US/verbs/verb-system.ftl b/Resources/Locale/en-US/verbs/verb-system.ftl index 55d894d120..bad305dafe 100644 --- a/Resources/Locale/en-US/verbs/verb-system.ftl +++ b/Resources/Locale/en-US/verbs/verb-system.ftl @@ -24,6 +24,7 @@ verb-categories-split = Split verb-categories-instrument-style = Instrument Style verb-categories-set-sensor = Sensor verb-categories-timer = Set Delay +verb-categories-lever = Lever verb-common-toggle-light = Toggle light verb-common-close = Close diff --git a/Resources/Prototypes/Entities/Structures/Machines/recycler.yml b/Resources/Prototypes/Entities/Structures/Machines/recycler.yml index 7168e2f009..6faa94dd3f 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/recycler.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/recycler.yml @@ -65,3 +65,4 @@ state_off: grinder-o0 - type: Recycler - type: Conveyor + - type: Rotatable \ No newline at end of file diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/structures/conveyor.yml b/Resources/Prototypes/Recipes/Construction/Graphs/structures/conveyor.yml index 57da56076e..ff0ecbc4ed 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/structures/conveyor.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/structures/conveyor.yml @@ -28,4 +28,7 @@ - to: item steps: - tool: Prying - doAfter: 3 \ No newline at end of file + doAfter: 3 + completed: + - !type:SetAnchor + value: false \ No newline at end of file