From 903dabf0dbd15b50395202076f5fe67dc6416bac Mon Sep 17 00:00:00 2001 From: mirrorcult Date: Mon, 28 Feb 2022 20:38:39 -0700 Subject: [PATCH] Jumpsuit butchering and gauze crafting (#6787) Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> --- .../Kitchen/EntitySystems/SharpSystem.cs | 63 +++++++++++++++--- .../Nutrition/EntitySystems/FoodSystem.cs | 1 + .../components/butcherable-component.ftl | 3 + .../Clothing/Neck/base_clothingneck.yml | 4 ++ .../Clothing/Shoes/base_clothingshoes.yml | 9 ++- .../Uniforms/base_clothinguniforms.yml | 18 +++-- .../Entities/Objects/Materials/materials.yml | 5 ++ .../Objects/Specific/Medical/healing.yml | 10 +++ .../Crafting/Graphs/improvised/gauze.yml | 13 ++++ .../Recipes/Crafting/improvised.yml | 13 ++++ .../Prototypes/Recipes/Lathes/medical.yml | 8 --- .../Textures/Interface/VerbIcons/cutlery.svg | 41 ++++++++++++ .../VerbIcons/cutlery.svg.192dpi.png | Bin 0 -> 855 bytes .../VerbIcons/cutley.svg.192dpi.png.yml | 2 + 14 files changed, 159 insertions(+), 31 deletions(-) create mode 100644 Resources/Prototypes/Recipes/Crafting/Graphs/improvised/gauze.yml create mode 100644 Resources/Textures/Interface/VerbIcons/cutlery.svg create mode 100644 Resources/Textures/Interface/VerbIcons/cutlery.svg.192dpi.png create mode 100644 Resources/Textures/Interface/VerbIcons/cutley.svg.192dpi.png.yml diff --git a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs index 83a55d9a8e..b8dac64971 100644 --- a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Interaction; using Content.Shared.MobState.Components; using Content.Shared.Nutrition.Components; using Content.Shared.Popups; +using Content.Shared.Verbs; using Robust.Shared.Player; namespace Content.Server.Kitchen.EntitySystems; @@ -22,35 +23,45 @@ public sealed class SharpSystem : EntitySystem SubscribeLocalEvent(OnAfterInteract); SubscribeLocalEvent(OnDoafterComplete); SubscribeLocalEvent(OnDoafterCancelled); + + SubscribeLocalEvent>(OnGetInteractionVerbs); } private void OnAfterInteract(EntityUid uid, SharpComponent component, AfterInteractEvent args) { - if (!args.CanReach) + if (args.Target is null || !args.CanReach) return; - - if (args.Target is null || !TryComp(args.Target, out var butcher)) + + TryStartButcherDoafter(uid, args.Target.Value, args.User); + } + + private void TryStartButcherDoafter(EntityUid knife, EntityUid target, EntityUid user) + { + if (!TryComp(target, out var butcher)) + return; + + if (!TryComp(knife, out var sharp)) return; if (butcher.Type != ButcheringType.Knife) return; - if (TryComp(args.Target, out var mobState) && !mobState.IsDead()) + if (TryComp(target, out var mobState) && !mobState.IsDead()) return; - if (!component.Butchering.Add(args.Target.Value)) + if (!sharp.Butchering.Add(target)) return; var doAfter = - new DoAfterEventArgs(args.User, component.ButcherDelayModifier * butcher.ButcherDelay, default, args.Target) + new DoAfterEventArgs(user, sharp.ButcherDelayModifier * butcher.ButcherDelay, default, target) { BreakOnTargetMove = true, BreakOnUserMove = true, BreakOnDamage = true, BreakOnStun = true, NeedHand = true, - BroadcastFinishedEvent = new SharpButcherDoafterComplete { User = args.User, Entity = args.Target.Value, Sharp = uid }, - BroadcastCancelledEvent = new SharpButcherDoafterCancelled { Entity = args.Target.Value, Sharp = uid } + BroadcastFinishedEvent = new SharpButcherDoafterComplete { User = user, Entity = target, Sharp = knife }, + BroadcastCancelledEvent = new SharpButcherDoafterCancelled { Entity = target, Sharp = knife } }; _doAfterSystem.DoAfter(doAfter); @@ -92,6 +103,42 @@ public sealed class SharpSystem : EntitySystem sharp.Butchering.Remove(ev.Entity); } + + private void OnGetInteractionVerbs(EntityUid uid, SharedButcherableComponent component, GetVerbsEvent args) + { + if (component.Type != ButcheringType.Knife) + return; + + 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 || !TryComp(args.Using, out var sharp)) + { + disabled = true; + message = Loc.GetString("butcherable-need-knife"); + } + + InteractionVerb verb = new() + { + Act = () => + { + if (!disabled) + TryStartButcherDoafter(args.Using!.Value, args.Target, args.User); + }, + Message = message, + Disabled = disabled, + IconTexture = "/Textures/Interface/VerbIcons/cutlery.svg.192dpi.png", + Text = Loc.GetString("butcherable-verb-name"), + }; + + args.Verbs.Add(verb); + } } public sealed class SharpButcherDoafterComplete : EntityEventArgs diff --git a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs index ed63c333b4..07f0128060 100644 --- a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs @@ -259,6 +259,7 @@ namespace Content.Server.Nutrition.EntitySystems { TryFeed(uid, ev.User, component); }, + IconTexture = "/Textures/Interface/VerbIcons/cutlery.svg.192dpi.png", Text = Loc.GetString("food-system-verb-eat"), Priority = -1 }; diff --git a/Resources/Locale/en-US/kitchen/components/butcherable-component.ftl b/Resources/Locale/en-US/kitchen/components/butcherable-component.ftl index 1a5578d209..8e0aab1a6a 100644 --- a/Resources/Locale/en-US/kitchen/components/butcherable-component.ftl +++ b/Resources/Locale/en-US/kitchen/components/butcherable-component.ftl @@ -1 +1,4 @@ butcherable-knife-butchered-success = You butcher { THE($target) } with { THE($knife) }. +butcherable-need-knife = Need something sharp. +butcherable-mob-isnt-dead = Needs to be dead. +butcherable-verb-name = Butcher diff --git a/Resources/Prototypes/Entities/Clothing/Neck/base_clothingneck.yml b/Resources/Prototypes/Entities/Clothing/Neck/base_clothingneck.yml index b904780dfd..d2b57c0d32 100644 --- a/Resources/Prototypes/Entities/Clothing/Neck/base_clothingneck.yml +++ b/Resources/Prototypes/Entities/Clothing/Neck/base_clothingneck.yml @@ -10,3 +10,7 @@ - neck - type: Sprite state: icon + - type: Butcherable + butcheringType: Knife + spawned: MaterialCloth1 + pieces: 2 diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml b/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml index 5e7bc13f50..5e2aab9f77 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml @@ -8,8 +8,7 @@ - FEET - type: Sprite state: icon - - type: Extractable - juiceSolution: - reagents: - - ReagentId: Fiber - Quantity: 5 + - type: Butcherable + butcheringType: Knife + spawned: MaterialCloth1 + pieces: 1 diff --git a/Resources/Prototypes/Entities/Clothing/Uniforms/base_clothinguniforms.yml b/Resources/Prototypes/Entities/Clothing/Uniforms/base_clothinguniforms.yml index 54482b7164..9a2716d448 100644 --- a/Resources/Prototypes/Entities/Clothing/Uniforms/base_clothinguniforms.yml +++ b/Resources/Prototypes/Entities/Clothing/Uniforms/base_clothinguniforms.yml @@ -20,11 +20,10 @@ Slots: [innerclothing] EquipSound: path: /Audio/Items/jumpsuit_equip.ogg - - type: Extractable - juiceSolution: - reagents: - - ReagentId: Fiber - Quantity: 10 + - type: Butcherable + butcheringType: Knife + spawned: MaterialCloth1 + pieces: 3 - type: entity abstract: true @@ -38,8 +37,7 @@ femaleMask: UniformTop EquipSound: path: /Audio/Items/jumpsuit_equip.ogg - - type: Extractable - juiceSolution: - reagents: - - ReagentId: Fiber - Quantity: 5 + - type: Butcherable + butcheringType: Knife + spawned: MaterialCloth1 + pieces: 3 diff --git a/Resources/Prototypes/Entities/Objects/Materials/materials.yml b/Resources/Prototypes/Entities/Objects/Materials/materials.yml index 4ebd393648..b8b914a8da 100644 --- a/Resources/Prototypes/Entities/Objects/Materials/materials.yml +++ b/Resources/Prototypes/Entities/Objects/Materials/materials.yml @@ -57,6 +57,11 @@ state: cloth - type: Stack count: 1 + - type: Extractable + juiceSolution: + reagents: + - ReagentId: Fiber + Quantity: 3 - type: entity parent: MaterialBase diff --git a/Resources/Prototypes/Entities/Objects/Specific/Medical/healing.yml b/Resources/Prototypes/Entities/Objects/Specific/Medical/healing.yml index ca6e1c804d..d28f2bf805 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Medical/healing.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Medical/healing.yml @@ -71,6 +71,9 @@ - Gauze - type: Sprite state: gauze + - type: Construction + graph: Gauze + node: gauze - type: Healing damageContainer: Biological damage: @@ -85,6 +88,13 @@ - type: Stack stackType: Gauze +- type: entity + id: Gauze1 + parent: Gauze + components: + - type: Stack + count: 1 + - type: entity name: aloe cream description: A topical cream for burns. diff --git a/Resources/Prototypes/Recipes/Crafting/Graphs/improvised/gauze.yml b/Resources/Prototypes/Recipes/Crafting/Graphs/improvised/gauze.yml new file mode 100644 index 0000000000..ea21a56448 --- /dev/null +++ b/Resources/Prototypes/Recipes/Crafting/Graphs/improvised/gauze.yml @@ -0,0 +1,13 @@ +- type: constructionGraph + id: Gauze + start: start + graph: + - node: start + edges: + - to: gauze + steps: + - material: Cloth + amount: 2 + doAfter: 10 + - node: gauze + entity: Gauze1 diff --git a/Resources/Prototypes/Recipes/Crafting/improvised.yml b/Resources/Prototypes/Recipes/Crafting/improvised.yml index b9f146d576..4116442fa6 100644 --- a/Resources/Prototypes/Recipes/Crafting/improvised.yml +++ b/Resources/Prototypes/Recipes/Crafting/improvised.yml @@ -34,3 +34,16 @@ icon: sprite: Objects/Weapons/Guns/Cannons/pneumatic_cannon.rsi state: pneumaticCannon + +- type: construction + name: gauze + id: gauze + graph: Gauze + startNode: start + targetNode: gauze + category: Tools + objectType: Item + description: When you've really got nothing left. + icon: + sprite: Objects/Specific/Medical/medical.rsi + state: gauze diff --git a/Resources/Prototypes/Recipes/Lathes/medical.yml b/Resources/Prototypes/Recipes/Lathes/medical.yml index 4869ca37b5..4857ec9684 100644 --- a/Resources/Prototypes/Recipes/Lathes/medical.yml +++ b/Resources/Prototypes/Recipes/Lathes/medical.yml @@ -1,11 +1,3 @@ -- type: latheRecipe - id: Gauze - icon: Objects/Specific/Medical/medical.rsi/gauze.png - result: Gauze - completetime: 500 - materials: - Plastic: 100 - - type: latheRecipe id: Scalpel icon: Objects/Specific/Medical/Surgery/scalpel.rsi/scalpel.png diff --git a/Resources/Textures/Interface/VerbIcons/cutlery.svg b/Resources/Textures/Interface/VerbIcons/cutlery.svg new file mode 100644 index 0000000000..1c89aa049e --- /dev/null +++ b/Resources/Textures/Interface/VerbIcons/cutlery.svg @@ -0,0 +1,41 @@ + + + + + + + diff --git a/Resources/Textures/Interface/VerbIcons/cutlery.svg.192dpi.png b/Resources/Textures/Interface/VerbIcons/cutlery.svg.192dpi.png new file mode 100644 index 0000000000000000000000000000000000000000..c3c597a928fd29030b2abfbcd500a17be118de56 GIT binary patch literal 855 zcmV-d1E~CoP)cAw^!ci)eh-@Y^VvA2>Zz*Ari_y8Dd z8wD1Cf52_WchcIv0%MN-oz3ycx2_XA1Y7}TfG@x|U=Fwk90<)94Dgo?PFUMz$M(tb zee2k-TiapBwiH-<9C$@%mVs+!=Cv)r*Eq-PS9R2}4Lip}&hbbaU-x`hfSr|S#tAY`wkOCdF4 z1@P&B7>-IB4~#hz;+%2`^n!!Ej_F4Sw6ptm%Wm%xZLlZAxgVQg3}tc##iZeW$7=kPS@-l#Gj=6p``CsQo55 zTl62Y_vl5XbDM9Z7#+Wy1-Klw@);jjt%#id`(lbf>j4^YegUlA- zmd9uF`w{uG`Yx~~i4`E5kF;fJIv_H>>3~6}_8n06H^F`}FX`bX+XYGcQx(Ws0AtLo zq*>Pn98p36nmwTE0aQ)xH^HU@BI9e{0ks#vhpa_v_JGKEpR2p2JD~Og3_MK-^r6O< z79i`%`OqwZ$oSd|F!00*u$p8P6%s3e&wc)1ku^3`^cTCJ8?Uhfyiep4!pF$-X#u`> zxly?Sct0lVS#P4?=4jA^lPLytmev#D?U?FO&AT1yJ;6TN-dF5Z`3$UDF&27#C4h5w h!moknz|}I7{|`mcn;D68i2ncp002ovPDHLkV1kcRi}(Nl literal 0 HcmV?d00001 diff --git a/Resources/Textures/Interface/VerbIcons/cutley.svg.192dpi.png.yml b/Resources/Textures/Interface/VerbIcons/cutley.svg.192dpi.png.yml new file mode 100644 index 0000000000..5c43e23305 --- /dev/null +++ b/Resources/Textures/Interface/VerbIcons/cutley.svg.192dpi.png.yml @@ -0,0 +1,2 @@ +sample: + filter: true