using Content.Shared.Database;
using Content.Shared.Interaction;
using Content.Shared.Nutrition.Components;
+using Content.Server.Nutrition.EntitySystems;
using Content.Shared.Popups;
using Content.Shared.Storage;
using Content.Shared.Verbs;
{
base.Initialize();
- SubscribeLocalEvent<SharpComponent, AfterInteractEvent>(OnAfterInteract);
+ SubscribeLocalEvent<SharpComponent, AfterInteractEvent>(OnAfterInteract, before: new[] { typeof(UtensilSystem) });
SubscribeLocalEvent<SharpComponent, SharpDoAfterEvent>(OnDoAfter);
SubscribeLocalEvent<ButcherableComponent, GetVerbsEvent<InteractionVerb>>(OnGetInteractionVerbs);
private void OnAfterInteract(EntityUid uid, SharpComponent component, AfterInteractEvent args)
{
+ if (args.Handled)
+ return;
+
if (args.Target is null || !args.CanReach)
return;
- TryStartButcherDoafter(uid, args.Target.Value, args.User);
+ args.Handled = TryStartButcherDoAfter(uid, args.Target.Value, args.User);
}
- private void TryStartButcherDoafter(EntityUid knife, EntityUid target, EntityUid user)
+ private bool TryStartButcherDoAfter(EntityUid knife, EntityUid target, EntityUid user)
{
if (!TryComp<ButcherableComponent>(target, out var butcher))
- return;
+ return false;
if (!TryComp<SharpComponent>(knife, out var sharp))
- return;
+ return false;
+
+ if (TryComp<MobStateComponent>(target, out var mobState) && !_mobStateSystem.IsDead(target, mobState))
+ return false;
if (butcher.Type != ButcheringType.Knife && target != user)
{
_popupSystem.PopupEntity(Loc.GetString("butcherable-different-tool", ("target", target)), knife, user);
- return;
+ return true;
}
- if (TryComp<MobStateComponent>(target, out var mobState) && !_mobStateSystem.IsDead(target, mobState))
- return;
-
if (!sharp.Butchering.Add(target))
- return;
+ return true;
var doAfter =
new DoAfterArgs(EntityManager, user, sharp.ButcherDelayModifier * butcher.ButcherDelay, new SharpDoAfterEvent(), knife, target: target, used: knife)
NeedHand = true
};
_doAfterSystem.TryStartDoAfter(doAfter);
+ return true;
}
private void OnDoAfter(EntityUid uid, SharpComponent component, DoAfterEvent args)
Act = () =>
{
if (!disabled)
- TryStartButcherDoafter(args.Using!.Value, args.Target, args.User);
+ TryStartButcherDoAfter(args.Using!.Value, args.Target, args.User);
},
Message = message,
Disabled = disabled,
+using Content.Shared.Containers.ItemSlots;
using Content.Server.Nutrition.Components;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
{
base.Initialize();
- SubscribeLocalEvent<UtensilComponent, AfterInteractEvent>(OnAfterInteract);
+ SubscribeLocalEvent<UtensilComponent, AfterInteractEvent>(OnAfterInteract, after: new[] { typeof(ItemSlotsSystem) });
}
/// <summary>
/// </summary>
private void OnAfterInteract(EntityUid uid, UtensilComponent component, AfterInteractEvent ev)
{
+ if (ev.Handled)
+ return;
+
if (ev.Target == null || !ev.CanReach)
return;
- type: Clothing
sprite: Clothing/Shoes/Specific/chef.rsi
+# stuff common to all clown & jester shoes
- type: entity
- parent: ClothingShoesBaseButcherable
+ abstract: true
+ parent: [ClothingShoesBaseButcherable, ClothingSlotBase]
+ id: ClothingShoesClownBase
+ components:
+ - type: ItemSlots
+ slots:
+ item:
+ name: clothing-boots-sidearm
+ whitelist:
+ tags:
+ - Knife
+ - ToySidearm
+ blacklist:
+ components:
+ - Sharp
+
+- type: entity
+ parent: ClothingShoesClownBase
id: ClothingShoesClown
name: clown shoes
description: "The prankster's standard-issue clowning shoes. Damn they're huge!"
acceleration: 5
- type: entity
- parent: ClothingShoesBaseButcherable
+ parent: ClothingShoesClownBase
id: ClothingShoesBling
name: bling clown shoes
description: Made of refined bananium and shined with the pulp of a fresh banana peel. These make a flashy statement.