Make SharpComponent work with Hands (#37543)

* init

* review
This commit is contained in:
ScarKy0
2025-05-17 17:27:20 +02:00
committed by GitHub
parent 9acead4236
commit 28e3c3d8a7

View File

@@ -12,6 +12,7 @@ using Content.Shared.Verbs;
using Content.Shared.Destructible; using Content.Shared.Destructible;
using Content.Shared.DoAfter; using Content.Shared.DoAfter;
using Content.Shared.Hands.Components; using Content.Shared.Hands.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Kitchen; using Content.Shared.Kitchen;
using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems; using Content.Shared.Mobs.Systems;
@@ -124,7 +125,7 @@ public sealed class SharpSystem : EntitySystem
if (hasBody) if (hasBody)
popupType = PopupType.LargeCaution; popupType = PopupType.LargeCaution;
_popupSystem.PopupEntity(Loc.GetString("butcherable-knife-butchered-success", ("target", args.Args.Target.Value), ("knife", uid)), _popupSystem.PopupEntity(Loc.GetString("butcherable-knife-butchered-success", ("target", args.Args.Target.Value), ("knife", Identity.Entity(uid, EntityManager))),
popupEnt, args.Args.User, popupType); popupEnt, args.Args.User, popupType);
if (hasBody) if (hasBody)
@@ -152,10 +153,10 @@ public sealed class SharpSystem : EntitySystem
var disabled = false; var disabled = false;
string? message = null; string? message = null;
// if the user has hands // if the held item doesn't have SharpComponent
// and the item they're holding doesn't have the SharpComponent // and the user doesn't have SharpComponent
// disable the verb // disable the verb
if (!TryComp<SharpComponent>(args.Using, out var usingSharpComp) && args.Hands != null) if (!TryComp<SharpComponent>(args.Using, out var usingSharpComp) && userSharpComp == null)
{ {
disabled = true; disabled = true;
message = Loc.GetString("butcherable-need-knife", message = Loc.GetString("butcherable-need-knife",