From: Krunklehorn <42424291+Krunklehorn@users.noreply.github.com> Date: Wed, 13 Mar 2024 10:03:14 +0000 (-0400) Subject: Fix Butcherable handling, ItemSlots for clown shoes (#25661) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=674b42b3a0ab9fa607887c1401f38ca1f8bb3911;p=space-station-14.git Fix Butcherable handling, ItemSlots for clown shoes (#25661) * Fix butcherable handling * ItemSlots for clown shoes * Return if handled * Handle if popup * Whitespace, spoons are metal * Zero damage plastic utensils, blacklist by metal+melee * Hmmm truthy * Plastic knives are knives too, just use that * Delete unused tag * Always true if doAfter * Raw rat meat should be sliceable too --- diff --git a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs index 60178ed0ed..2c5f88baec 100644 --- a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Body.Components; 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; @@ -34,7 +35,7 @@ public sealed class SharpSystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(OnAfterInteract); + SubscribeLocalEvent(OnAfterInteract, before: new[] { typeof(UtensilSystem) }); SubscribeLocalEvent(OnDoAfter); SubscribeLocalEvent>(OnGetInteractionVerbs); @@ -42,31 +43,34 @@ public sealed class SharpSystem : EntitySystem 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(target, out var butcher)) - return; + return false; if (!TryComp(knife, out var sharp)) - return; + return false; + + if (TryComp(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(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) @@ -77,6 +81,7 @@ public sealed class SharpSystem : EntitySystem NeedHand = true }; _doAfterSystem.TryStartDoAfter(doAfter); + return true; } private void OnDoAfter(EntityUid uid, SharpComponent component, DoAfterEvent args) @@ -161,7 +166,7 @@ public sealed class SharpSystem : EntitySystem Act = () => { if (!disabled) - TryStartButcherDoafter(args.Using!.Value, args.Target, args.User); + TryStartButcherDoAfter(args.Using!.Value, args.Target, args.User); }, Message = message, Disabled = disabled, diff --git a/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs b/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs index f9feed955f..0edd0711b6 100644 --- a/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared.Containers.ItemSlots; using Content.Server.Nutrition.Components; using Content.Shared.Nutrition.Components; using Content.Shared.Nutrition.EntitySystems; @@ -25,7 +26,7 @@ namespace Content.Server.Nutrition.EntitySystems { base.Initialize(); - SubscribeLocalEvent(OnAfterInteract); + SubscribeLocalEvent(OnAfterInteract, after: new[] { typeof(ItemSlotsSystem) }); } /// @@ -33,6 +34,9 @@ namespace Content.Server.Nutrition.EntitySystems /// private void OnAfterInteract(EntityUid uid, UtensilComponent component, AfterInteractEvent ev) { + if (ev.Handled) + return; + if (ev.Target == null || !ev.CanReach) return; diff --git a/Resources/Locale/en-US/clothing/boots.ftl b/Resources/Locale/en-US/clothing/boots.ftl index 05322d612a..c86bec8455 100644 --- a/Resources/Locale/en-US/clothing/boots.ftl +++ b/Resources/Locale/en-US/clothing/boots.ftl @@ -1 +1 @@ -clothing-military-boots-sidearm = Sidearm +clothing-boots-sidearm = Sidearm diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml b/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml index 8d7dde5928..1119d5cda7 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml @@ -45,7 +45,7 @@ - type: ItemSlots slots: item: - name: clothing-military-boots-sidearm + name: clothing-boots-sidearm whitelist: tags: - Knife diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml index 4a49c804cd..4b9cbeef42 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml @@ -9,8 +9,26 @@ - 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!" @@ -49,7 +67,7 @@ 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. diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Food/meat.yml b/Resources/Prototypes/Entities/Objects/Consumable/Food/meat.yml index e49889e940..bc6895fe5b 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Food/meat.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Food/meat.yml @@ -400,6 +400,9 @@ Quantity: 3 - ReagentId: Fat Quantity: 3 + - type: SliceableFood + count: 3 + slice: FoodMeatCutlet - type: entity name: raw lizard meat diff --git a/Resources/Prototypes/Entities/Objects/Fun/toys.yml b/Resources/Prototypes/Entities/Objects/Fun/toys.yml index a5e022fd20..902735bb30 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/toys.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/toys.yml @@ -893,6 +893,7 @@ - type: Tag tags: - Sidearm + - ToySidearm - type: Gun selectedMode: SemiAuto availableModes: @@ -925,14 +926,14 @@ suffix: Fake description: Looks almost like the real thing! Ages 8 and up. components: - - type: RevolverAmmoProvider - whitelist: - tags: - - CartridgeCap - - SpeedLoaderCap - - CartridgeMagnum - - SpeedLoaderMagnum - proto: CartridgeMagnumAP + - type: RevolverAmmoProvider + whitelist: + tags: + - CartridgeCap + - SpeedLoaderCap + - CartridgeMagnum + - SpeedLoaderMagnum + proto: CartridgeMagnumAP - type: entity parent: BaseItem diff --git a/Resources/Prototypes/Entities/Objects/Misc/utensils.yml b/Resources/Prototypes/Entities/Objects/Misc/utensils.yml index 4ac05e1e4b..4250669581 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/utensils.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/utensils.yml @@ -7,9 +7,6 @@ sprite: Objects/Misc/utensils.rsi - type: Item # TODO add inhand sprites for all utensils sprite: Objects/Misc/utensils.rsi - - type: Tag - tags: - - Metal - type: SpaceGarbage - type: entity @@ -23,8 +20,14 @@ price: 0 - type: Tag tags: - - Plastic - - Trash + - Plastic + - Trash + - type: MeleeWeapon + wideAnimationRotation: 180 + attackRate: 1.5 + damage: + types: + Blunt: 0 - type: entity parent: UtensilBase @@ -66,6 +69,9 @@ name: spoon description: There is no spoon. components: + - type: Tag + tags: + - Metal - type: Sprite state: spoon - type: Item @@ -99,7 +105,7 @@ speedModifier: 0.1 # you can try - type: entity - parent: UtensilBase + parent: UtensilBasePlastic id: KnifePlastic name: plastic knife description: That's not a knife. This is a knife. @@ -109,3 +115,8 @@ - type: Utensil types: - Knife + - type: Tag + tags: + - Plastic + - Trash + - Knife diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index 2b11b7991b..fc4d16f5d5 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -1181,6 +1181,9 @@ - type: Tag id: Torch +- type: Tag + id: ToySidearm + - type: Tag id: Trash