]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix Butcherable handling, ItemSlots for clown shoes (#25661)
authorKrunklehorn <42424291+Krunklehorn@users.noreply.github.com>
Wed, 13 Mar 2024 10:03:14 +0000 (06:03 -0400)
committerGitHub <noreply@github.com>
Wed, 13 Mar 2024 10:03:14 +0000 (21:03 +1100)
* 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

Content.Server/Kitchen/EntitySystems/SharpSystem.cs
Content.Server/Nutrition/EntitySystems/UtensilSystem.cs
Resources/Locale/en-US/clothing/boots.ftl
Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml
Resources/Prototypes/Entities/Clothing/Shoes/specific.yml
Resources/Prototypes/Entities/Objects/Consumable/Food/meat.yml
Resources/Prototypes/Entities/Objects/Fun/toys.yml
Resources/Prototypes/Entities/Objects/Misc/utensils.yml
Resources/Prototypes/tags.yml

index 60178ed0ede2823424feb982771ceb04b93ac1e0..2c5f88baec7002cdc51cc3ebd579a63bd4e2e1f1 100644 (file)
@@ -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<SharpComponent, AfterInteractEvent>(OnAfterInteract);
+        SubscribeLocalEvent<SharpComponent, AfterInteractEvent>(OnAfterInteract, before: new[] { typeof(UtensilSystem) });
         SubscribeLocalEvent<SharpComponent, SharpDoAfterEvent>(OnDoAfter);
 
         SubscribeLocalEvent<ButcherableComponent, GetVerbsEvent<InteractionVerb>>(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<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)
@@ -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,
index f9feed955fc5ffcdca5f8e8310f3aaf9b5d857a9..0edd0711b670d6e0ceb76cc21c66a139cdb607ba 100644 (file)
@@ -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<UtensilComponent, AfterInteractEvent>(OnAfterInteract);
+            SubscribeLocalEvent<UtensilComponent, AfterInteractEvent>(OnAfterInteract, after: new[] { typeof(ItemSlotsSystem) });
         }
 
         /// <summary>
@@ -33,6 +34,9 @@ namespace Content.Server.Nutrition.EntitySystems
         /// </summary>
         private void OnAfterInteract(EntityUid uid, UtensilComponent component, AfterInteractEvent ev)
         {
+            if (ev.Handled)
+                return;
+
             if (ev.Target == null || !ev.CanReach)
                 return;
 
index 05322d612a517c38365a90b93e2e8bffaa1a2415..c86bec845599347d3efdec2f8ad488123cc06936 100644 (file)
@@ -1 +1 @@
-clothing-military-boots-sidearm = Sidearm
+clothing-boots-sidearm = Sidearm
index 8d7dde5928e474497ff851eefa1278bcc2e96901..1119d5cda74b292078359ef17103dc5f8532e242 100644 (file)
@@ -45,7 +45,7 @@
   - type: ItemSlots
     slots:
       item:
-        name: clothing-military-boots-sidearm
+        name: clothing-boots-sidearm
         whitelist:
           tags:
           - Knife
index 4a49c804cdb1e56ee0066bfed01a12433794ff92..4b9cbeef424ccfeb21b9d39e226d61433360555d 100644 (file)
@@ -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.
index e49889e940d46656a8233b5914ba8c3afbde2eb0..bc6895fe5b2174dcc56d2a2bc25aca08265a7dee 100644 (file)
           Quantity: 3
         - ReagentId: Fat
           Quantity: 3
+  - type: SliceableFood
+    count: 3
+    slice: FoodMeatCutlet
 
 - type: entity
   name: raw lizard meat
index a5e022fd20043d744a7b1ca5f320307ea76313e5..902735bb303ad5e24e6921b01ce8a79e14cbcd55 100644 (file)
   - type: Tag
     tags:
     - Sidearm
+    - ToySidearm
   - type: Gun
     selectedMode: SemiAuto
     availableModes:
   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
index 4ac05e1e4b11ee4eda600cf4ab4a97accc6217a0..4250669581f8687aeae8bd102cb448f242d01ec2 100644 (file)
@@ -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
     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
     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.
   - type: Utensil
     types:
     - Knife
+  - type: Tag
+    tags:
+    - Plastic
+    - Trash
+    - Knife
index 2b11b7991b065f2003dc155bcdd6bba41ee2c914..fc4d16f5d56818a97ae6d5b8aad0c11b224add05 100644 (file)
 - type: Tag
   id: Torch
 
+- type: Tag
+  id: ToySidearm
+
 - type: Tag
   id: Trash