diff --git a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs index 65441796b2..c0036369c6 100644 --- a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs @@ -1,5 +1,6 @@ using Content.Server.DoAfter; using Content.Server.Kitchen.Components; +using Content.Server.MobState; using Content.Shared.Body.Components; using Content.Shared.Interaction; using Content.Shared.MobState.Components; @@ -7,6 +8,7 @@ using Content.Shared.Nutrition.Components; using Content.Shared.Popups; using Content.Shared.Storage; using Content.Shared.Verbs; +using Robust.Server.Containers; using Robust.Shared.Player; using Robust.Shared.Random; @@ -16,6 +18,8 @@ public sealed class SharpSystem : EntitySystem { [Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; + [Dependency] private readonly ContainerSystem _containerSystem = default!; + [Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; public override void Initialize() @@ -48,7 +52,7 @@ public sealed class SharpSystem : EntitySystem if (butcher.Type != ButcheringType.Knife) return; - if (TryComp(target, out var mobState) && !mobState.IsDead()) + if (TryComp(target, out var mobState) && !_mobStateSystem.IsDead(target, mobState)) return; if (!sharp.Butchering.Add(target)) @@ -77,6 +81,9 @@ public sealed class SharpSystem : EntitySystem if (!TryComp(ev.Sharp, out var sharp)) return; + if (_containerSystem.IsEntityInContainer(ev.Entity)) + return; + sharp.Butchering.Remove(ev.Entity); var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom); @@ -124,18 +131,23 @@ public sealed class SharpSystem : EntitySystem bool disabled = false; string? message = null; - if (TryComp(uid, out var state) && !state.IsDead()) - { - disabled = true; - message = Loc.GetString("butcherable-mob-isnt-dead"); - } - if (args.Using is null || !HasComp(args.Using)) { disabled = true; message = Loc.GetString("butcherable-need-knife", ("target", uid)); } + else if (_containerSystem.IsEntityInContainer(uid)) + { + message = Loc.GetString("butcherable-not-in-container", + ("target", uid)); + disabled = true; + } + else if (TryComp(uid, out var state) && !_mobStateSystem.IsDead(uid, state)) + { + disabled = true; + message = Loc.GetString("butcherable-mob-isnt-dead"); + } InteractionVerb verb = new() { diff --git a/Resources/Locale/en-US/kitchen/components/butcherable-component.ftl b/Resources/Locale/en-US/kitchen/components/butcherable-component.ftl index 7b07b42a14..e27b083023 100644 --- a/Resources/Locale/en-US/kitchen/components/butcherable-component.ftl +++ b/Resources/Locale/en-US/kitchen/components/butcherable-component.ftl @@ -1,4 +1,5 @@ butcherable-knife-butchered-success = You butcher { THE($target) } with { THE($knife) }. butcherable-need-knife = Use a sharp object to butcher { THE($target) }. +butcherable-not-in-container = { CAPITALIZE(THE($target)) } can't be in a container. butcherable-mob-isnt-dead = Needs to be dead. butcherable-verb-name = Butcher