From a86d0e51ec74cfdde2969d73bcb1ea1c683911bb Mon Sep 17 00:00:00 2001 From: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> Date: Tue, 30 Jan 2024 01:21:25 +0100 Subject: [PATCH] Add water droplet hat for arachnids (#23822) Co-authored-by: Kevin Zheng --- .../ReagentEffects/WearableReaction.cs | 42 +++++++++++++ .../Entities/Clothing/Head/misc.yml | 58 ++++++++++++++++++ .../Entities/Mobs/Species/arachnid.yml | 8 +++ .../Misc/waterdroplet.rsi/equipped-HELMET.png | Bin 0 -> 215 bytes .../Head/Misc/waterdroplet.rsi/icon.png | Bin 0 -> 554 bytes .../Misc/waterdroplet.rsi/inhand-left.png | Bin 0 -> 197 bytes .../Misc/waterdroplet.rsi/inhand-right.png | Bin 0 -> 204 bytes .../Head/Misc/waterdroplet.rsi/meta.json | 26 ++++++++ 8 files changed, 134 insertions(+) create mode 100644 Content.Server/Chemistry/ReagentEffects/WearableReaction.cs create mode 100644 Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/equipped-HELMET.png create mode 100644 Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/icon.png create mode 100644 Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/inhand-left.png create mode 100644 Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/inhand-right.png create mode 100644 Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/meta.json diff --git a/Content.Server/Chemistry/ReagentEffects/WearableReaction.cs b/Content.Server/Chemistry/ReagentEffects/WearableReaction.cs new file mode 100644 index 0000000000..d9f8414995 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/WearableReaction.cs @@ -0,0 +1,42 @@ +using Content.Shared.Inventory; +using Content.Shared.Chemistry.Reagent; +using Robust.Shared.Prototypes; + +namespace Content.Server.Chemistry.ReagentEffects; + +/// +/// A reaction effect that consumes the required amount of reagent and spawns PrototypeID in the +/// entity's Slot. Used to implement the water droplet effect for arachnids. +/// +public sealed partial class WearableReaction : ReagentEffect +{ + /// + /// Minimum quantity of reagent required to trigger this effect. + /// + [DataField] + public float AmountThreshold = 1f; + + /// + /// Slot to spawn the item into. + /// + [DataField(required: true)] + public string Slot; + + /// + /// Prototype ID of item to spawn. + /// + [DataField(required: true)] + public string PrototypeID; + + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => null; + + public override void Effect(ReagentEffectArgs args) + { + if (args.Reagent == null || args.Quantity < AmountThreshold) + return; + + // SpawnItemInSlot returns false if slot is already occupied + if (args.EntityManager.System().SpawnItemInSlot(args.SolutionEntity, Slot, PrototypeID)) + args.Source?.RemoveReagent(args.Reagent.ID, AmountThreshold); + } +} diff --git a/Resources/Prototypes/Entities/Clothing/Head/misc.yml b/Resources/Prototypes/Entities/Clothing/Head/misc.yml index 7b93e83cd9..9826da57b7 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/misc.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/misc.yml @@ -224,3 +224,61 @@ sprite: Clothing/Head/Misc/red_racoon.rsi - type: Clothing sprite: Clothing/Head/Misc/red_racoon.rsi + +- type: entity + parent: Clothing + id: WaterDropletHat + name: water droplet + description: Makes 8-eyed friends 8 times more adorable! + components: + - type: Sprite + sprite: Clothing/Head/Misc/waterdroplet.rsi + state: icon + - type: Item + sprite: Clothing/Head/Misc/waterdroplet.rsi + size: Tiny + storedRotation: -90 + - type: Clothing + slots: + - HEAD + - type: Food + solution: drink + useSound: /Audio/Items/drink.ogg + eatMessage: drink-component-try-use-drink-success-slurp + delay: 0.5 + forceFeedDelay: 1.5 + - type: FlavorProfile + flavors: + - water + - type: SolutionContainerManager + solutions: + drink: + maxVol: 2 + reagents: + - ReagentId: Water + Quantity: 2 + - type: DamageOnHighSpeedImpact + minimumSpeed: 0.1 + damage: + types: + Blunt: 1 + - type: Damageable + damageContainer: Biological + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 1 + behaviors: + - !type:PlaySoundBehavior + sound: + collection: desecration + - !type:SpillBehavior + solution: drink + - !type:DoActsBehavior + acts: [ "Destruction" ] + - type: Tag + tags: + - WhitelistChameleon + - type: StaticPrice + price: 1 diff --git a/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml b/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml index b49029f791..703345dae2 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml @@ -34,6 +34,14 @@ amount: 5 - type: Inventory templateId: arachnid + - type: Reactive + reactions: + - reagents: [Water] + methods: [Touch] + effects: + - !type:WearableReaction + slot: head + prototypeID: WaterDropletHat # Damage (Self) - type: Bloodstream bloodReagent: CopperBlood diff --git a/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/equipped-HELMET.png b/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/equipped-HELMET.png new file mode 100644 index 0000000000000000000000000000000000000000..9759d202a26dd3d2b7bc7c84993101dc86237b7f GIT binary patch literal 215 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|CVIL!hE&XX zduyZMAp;)P3l0xcC0d(QU(8StHei(XUUEVs?pW{22P-sc6#MkvhwACPo_{AxqU_y; zC=0)x`_6wqz4GVW34f1kUJp8@e&DO&_4x1G@BF_JH6tkM@Adx|_y3&uex-f>^Q-L_ zciRJP0|Ei>8-E+tNmjjQ*O{sKrtUzHS4X8aU4HEEl^>bP0 Hl+XkK@x)ht literal 0 HcmV?d00001 diff --git a/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/icon.png b/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..964a74ec9e6fcc65e96d85802b3c8fa5dcd82b47 GIT binary patch literal 554 zcmV+_0@eMAP)d$&fyc%KO*Nb-g^_v5^GE_cp=J&@6|X8Rmua|I*h_qkRgt1ibI zoj4g{nC_@%>hr;1fR^j~0h_A#Ue&Ahy{4--o-j4AbqUXCx=|38X$WiEgIYQo z7d{sD7&4&njnZRPepQ^R@~2`W99jUo>gh@~aIAr~w2>8_5O!xXMXffE`jWmxZh1-S zi0n~JLiq9FB1Vx7G8FJi%}Hj>eUpE_Me^d&Ym z|9P6p>8Wb>J|A?vSk}iFIQF1Ywyd8M%c`70+cR9{>i)dsH2Wobxvsg7U|<_AuIpNC zA1-%b_(_i%(Lbq8wmq4I_jBlvfb$M|)~Z?6&N+L8@Rt0dTR1p`ak)RR{tMwOXZyAr z4>te+0C!15K~z|UV_+BsqhJ(_f>AKi0VBB@D>q*Kk1p2kuT8dj6kCo@93NmJ*Ac&d z{rdmw*DsPSq!_?_iOT_`h5`$@4q;WP8&m8;*ieFbYP&C>T}%0H;JQf=<@M0000007*qoM6N<$f-0NzL;wH) literal 0 HcmV?d00001 diff --git a/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/inhand-left.png b/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/inhand-left.png new file mode 100644 index 0000000000000000000000000000000000000000..eb7f81e9bc8ff7e3cf22d09808fb25760190bd2b GIT binary patch literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|>OEZ?Ln`LH zy|t0|umKN?gIcTFS0Sk*%{xA5M7i}|TIL~ov8ih}qZ~`bKX;&Vh67Wowg#>@D?3{q zviH`Dz5N{>kM}I^KX>l;)48${UX^d>eBbeSkNdOjn?8e713}Q5H=nlOje*{NzJOf-T!aO{r^=-X&^le3<-&ww=