]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
[#20285 fix] Carp Plush and Rehydratables can now be put into mop bucket (#33079)
authorSlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>
Thu, 31 Oct 2024 18:46:19 +0000 (19:46 +0100)
committerGitHub <noreply@github.com>
Thu, 31 Oct 2024 18:46:19 +0000 (19:46 +0100)
* Make shark plush janitor-bucketable

* fix bucketed grey shark texture

* Make sprites less shiny and adapt copyright notice

* Made shark way way less shiny

* Allow carp plush and rehydratables in mop bucket.

* Remove old mop bucket shark sprites

* Fix post-merge bugs

* Fix errors

* Move ReactiveContainer stuff to shared

That should mean it is now predicted.

* Custom eject verb for the mop bucket

* Fixes OnSolutionChange, removes pop-up as there already is one.

* .ftl is not necessary as the custom pop-up was removed

* Review fixes

* Update Content.Shared/Chemistry/Components/ReactiveContainerComponent.cs

* Update Content.Shared/Chemistry/EntitySystems/ReactiveContainerSystem.cs

---------

Co-authored-by: Psychpsyo <psychpsyo@gmail.com>
Co-authored-by: Psychpsyo <60073468+Psychpsyo@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
12 files changed:
Content.Shared/Chemistry/Components/ReactiveContainerComponent.cs [new file with mode: 0644]
Content.Shared/Chemistry/EntitySystems/ReactiveContainerSystem.cs [new file with mode: 0644]
Resources/Locale/en-US/janitorial/janitorial-slot-component.ftl
Resources/Prototypes/Entities/Objects/Fun/toys.yml
Resources/Prototypes/Entities/Structures/Specific/Janitor/janicart.yml
Resources/Prototypes/tags.yml
Resources/Textures/Objects/Fun/sharkplush.rsi/meta.json
Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/meta.json
Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/mopbucket_carpplush.png [new file with mode: 0644]
Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/mopbucket_shark_blue.png [moved from Resources/Textures/Objects/Fun/sharkplush.rsi/mopbucket_shark_blue.png with 100% similarity]
Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/mopbucket_shark_grey.png [moved from Resources/Textures/Objects/Fun/sharkplush.rsi/mopbucket_shark_grey.png with 100% similarity]
Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/mopbucket_shark_pink.png [moved from Resources/Textures/Objects/Fun/sharkplush.rsi/mopbucket_shark_pink.png with 100% similarity]

diff --git a/Content.Shared/Chemistry/Components/ReactiveContainerComponent.cs b/Content.Shared/Chemistry/Components/ReactiveContainerComponent.cs
new file mode 100644 (file)
index 0000000..6aefd8f
--- /dev/null
@@ -0,0 +1,21 @@
+namespace Content.Shared.Chemistry.Components;
+
+/// <summary>
+///     Represents a container that also contains a solution.
+///     This means that reactive entities react when inserted into the container.
+/// </summary>
+[RegisterComponent]
+public sealed partial class ReactiveContainerComponent : Component
+{
+    /// <summary>
+    ///     The container that holds the solution.
+    /// </summary>
+    [DataField(required: true)]
+    public string Container = default!;
+
+    /// <summary>
+    ///     The solution in the container.
+    /// </summary>
+    [DataField(required: true)]
+    public string Solution = default!;
+}
diff --git a/Content.Shared/Chemistry/EntitySystems/ReactiveContainerSystem.cs b/Content.Shared/Chemistry/EntitySystems/ReactiveContainerSystem.cs
new file mode 100644 (file)
index 0000000..aa217c6
--- /dev/null
@@ -0,0 +1,53 @@
+using Content.Shared.Chemistry.Components;
+using Content.Shared.Chemistry.Reaction;
+using Robust.Shared.Containers;
+
+namespace Content.Shared.Chemistry.EntitySystems;
+
+public sealed class ReactiveContainerSystem : EntitySystem
+{
+    [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
+    [Dependency] private readonly ReactiveSystem _reactiveSystem = default!;
+    [Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
+
+    public override void Initialize()
+    {
+        base.Initialize();
+
+        SubscribeLocalEvent<ReactiveContainerComponent, EntInsertedIntoContainerMessage>(OnInserted);
+        SubscribeLocalEvent<ReactiveContainerComponent, SolutionContainerChangedEvent>(OnSolutionChange);
+    }
+
+    private void OnInserted(EntityUid uid, ReactiveContainerComponent comp, EntInsertedIntoContainerMessage args)
+    {
+        // Only reactive entities can react with the solution
+        if (!HasComp<ReactiveComponent>(args.Entity))
+            return;
+
+        if (!_solutionContainerSystem.TryGetSolution(uid, comp.Solution, out _, out var solution))
+            return;
+        if (solution.Volume == 0)
+            return;
+
+        _reactiveSystem.DoEntityReaction(args.Entity, solution, ReactionMethod.Touch);
+    }
+
+    private void OnSolutionChange(EntityUid uid, ReactiveContainerComponent comp, SolutionContainerChangedEvent args)
+    {
+        if (!_solutionContainerSystem.TryGetSolution(uid, comp.Solution, out _, out var solution))
+            return;
+        if (solution.Volume == 0)
+            return;
+        if (!TryComp<ContainerManagerComponent>(uid, out var manager))
+            return;
+        if (!_containerSystem.TryGetContainer(uid, comp.Container, out var container))
+            return;
+
+        foreach (var entity in container.ContainedEntities)
+        {
+            if (!HasComp<ReactiveComponent>(entity))
+                continue;
+            _reactiveSystem.DoEntityReaction(entity, solution, ReactionMethod.Touch);
+        }
+    }
+}
index b722116587180efd4545390974ed7c3974c20af7..bc03943a016ef24554cb5def0e410ea25a8e0cf1 100644 (file)
@@ -1,5 +1,6 @@
 # mop bucket
-mop-bucket-slot-component-slot-name-shark = Shark
+mop-bucket-slot-component-slot-name-item = Item
+mop-bucket-slot-component-eject-verb = Take out
 # janitorial trolley
 janitorial-trolley-slot-component-slot-name-plunger = Plunger
 janitorial-trolley-slot-component-slot-name-sign = Sign
index c3ef0d0329268fe3d59c4a356020c93721043ab7..d774c4469c9e408c5069fb58ac39b2f163840289 100644 (file)
       path: /Audio/Effects/bite.ogg
     angle: 0
     animation: WeaponArcBite # Rrrr!
+  - type: Tag
+    tags:
+      - Payload
+      - ClothMade
+      - PlushieCarp
 
 - type: entity
   parent: PlushieCarp
index 6ed06addcd4aacbded189f29873f644467c42e91..d74fe8b0f1ba2e658144018467652fa547e279e4 100644 (file)
         whitelist:
           tags:
             - PlushieSharkGrey
-    sprite: Objects/Fun/sharkplush.rsi
+      mopbucket_carpplush:
+        whitelist:
+          tags:
+            - PlushieCarp
+    sprite: Objects/Specific/Janitorial/janitorial.rsi
   - type: Transform
     noRot: true
   - type: ItemSlots
     slots:
-      shark_slot:
-        name: mop-bucket-slot-component-slot-name-shark
+      item_slot:
+        name: mop-bucket-slot-component-slot-name-item
+        ejectVerbText: mop-bucket-slot-component-eject-verb
         whitelist:
           tags:
             - PlushieSharkBlue
             - PlushieSharkPink
             - PlushieSharkGrey
+            - PlushieCarp
+          components:
+            - Rehydratable
         priority: 3 # Higher than drinking priority
+  - type: ReactiveContainer
+    solution: bucket
+    container: item_slot
   - type: Drink
     solution: bucket
   - type: Appearance
@@ -70,7 +81,7 @@
     containers:
       storagebase: !type:Container
         ents: []
-      shark_slot: !type:ContainerSlot {}
+      item_slot: !type:ContainerSlot {}
   - type: GuideHelp
     guides:
     - Janitorial
index 8962da5790ceb70a5a4f9845a0ec41a66f174d35..48bce7ddab7f344e571f167cf7f4294615f3a86b 100644 (file)
 - type: Tag
   id: Plunger
 
+- type: Tag
+  id: PlushieCarp
+
 - type: Tag
   id: PlushieGhost
 
index eca1964c4dd576bf96d441e7009a7ce266cf7857..12144d35596bc163742ffff92f6d8a96e7b2e6c8 100644 (file)
     {
       "name": "grey-inhand-right",
       "directions": 4
-    },
-    {
-      "name": "mopbucket_shark_blue"
-    },
-    {
-      "name": "mopbucket_shark_pink"
-    },
-    {
-      "name": "mopbucket_shark_grey"
     }
   ]
 }
\ No newline at end of file
index ae3103e2be2adc016f0e99e69c4c7a9b3b2361ed..4f7a1e7772225607bb88d43ac567320ea357eea2 100644 (file)
@@ -1,7 +1,7 @@
 {
   "version": 1,
   "license": "CC-BY-SA-3.0",
-  "copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/f8f4aeda930fcd0805ca4cc76d9bc9412a5b3428",
+  "copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/f8f4aeda930fcd0805ca4cc76d9bc9412a5b3428, mopbucket_shark_* by Psychpsyo, mopbucket_carpplush adapted by Psychpsyo from tgstation carpplush at commit https://github.com/tgstation/tgstation/commit/e1142f20f5e4661cb6845cfcf2dd69f864d67432",
   "size": {
     "x": 32,
     "y": 32
     {
       "name": "mopbucket_water-3"
     },
+    {
+      "name": "mopbucket_shark_blue"
+    },
+    {
+      "name": "mopbucket_shark_pink"
+    },
+    {
+      "name": "mopbucket_shark_grey"
+    },
+    {
+      "name": "mopbucket_carpplush"
+    },
     {
       "name": "inhand-left",
       "directions": 4
diff --git a/Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/mopbucket_carpplush.png b/Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/mopbucket_carpplush.png
new file mode 100644 (file)
index 0000000..07ef0a7
Binary files /dev/null and b/Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/mopbucket_carpplush.png differ