]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add water droplet hat for arachnids (#23822)
authorSlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>
Tue, 30 Jan 2024 00:21:25 +0000 (01:21 +0100)
committerGitHub <noreply@github.com>
Tue, 30 Jan 2024 00:21:25 +0000 (16:21 -0800)
Co-authored-by: Kevin Zheng <kevinz5000@gmail.com>
Content.Server/Chemistry/ReagentEffects/WearableReaction.cs [new file with mode: 0644]
Resources/Prototypes/Entities/Clothing/Head/misc.yml
Resources/Prototypes/Entities/Mobs/Species/arachnid.yml
Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/equipped-HELMET.png [new file with mode: 0644]
Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/icon.png [new file with mode: 0644]
Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/inhand-left.png [new file with mode: 0644]
Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/inhand-right.png [new file with mode: 0644]
Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/meta.json [new file with mode: 0644]

diff --git a/Content.Server/Chemistry/ReagentEffects/WearableReaction.cs b/Content.Server/Chemistry/ReagentEffects/WearableReaction.cs
new file mode 100644 (file)
index 0000000..d9f8414
--- /dev/null
@@ -0,0 +1,42 @@
+using Content.Shared.Inventory;
+using Content.Shared.Chemistry.Reagent;
+using Robust.Shared.Prototypes;
+
+namespace Content.Server.Chemistry.ReagentEffects;
+
+/// <summary>
+/// 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.
+/// </summary>
+public sealed partial class WearableReaction : ReagentEffect
+{
+    /// <summary>
+    /// Minimum quantity of reagent required to trigger this effect.
+    /// </summary>
+    [DataField]
+    public float AmountThreshold = 1f;
+
+    /// <summary>
+    /// Slot to spawn the item into.
+    /// </summary>
+    [DataField(required: true)]
+    public string Slot;
+
+    /// <summary>
+    /// Prototype ID of item to spawn.
+    /// </summary>
+    [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<InventorySystem>().SpawnItemInSlot(args.SolutionEntity, Slot, PrototypeID))
+            args.Source?.RemoveReagent(args.Reagent.ID, AmountThreshold);
+    }
+}
index 7b93e83cd9e3df76b48f1fc7a8b5cfac149c0c46..9826da57b780163f0adeef574bfb664aaa990dd6 100644 (file)
     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
index b49029f7915176c5f5c270484fa747ae138371ce..703345dae20b67a45d48474b3cb442fc961d8266 100644 (file)
         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 (file)
index 0000000..9759d20
Binary files /dev/null and b/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/equipped-HELMET.png differ
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 (file)
index 0000000..964a74e
Binary files /dev/null and b/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/icon.png differ
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 (file)
index 0000000..eb7f81e
Binary files /dev/null and b/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/inhand-left.png differ
diff --git a/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/inhand-right.png b/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/inhand-right.png
new file mode 100644 (file)
index 0000000..bab564c
Binary files /dev/null and b/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/inhand-right.png differ
diff --git a/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/meta.json b/Resources/Textures/Clothing/Head/Misc/waterdroplet.rsi/meta.json
new file mode 100644 (file)
index 0000000..77d5e14
--- /dev/null
@@ -0,0 +1,26 @@
+{
+  "version": 1,
+  "license": "CC-BY-SA-3.0",
+  "copyright": "Created by SlamBamActionman",
+  "size": {
+    "x": 32,
+    "y": 32
+  },
+  "states": [
+    {
+      "name": "icon"
+    },
+    {
+      "name": "equipped-HELMET",
+      "directions": 4
+    },
+    {
+      "name": "inhand-left",
+      "directions": 4
+    },
+    {
+      "name": "inhand-right",
+      "directions": 4
+    }
+  ]
+}