From 4626904fa8e5915a4faddd74a4d917d8442bfb99 Mon Sep 17 00:00:00 2001 From: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> Date: Thu, 31 Oct 2024 19:46:19 +0100 Subject: [PATCH] [#20285 fix] Carp Plush and Rehydratables can now be put into mop bucket (#33079) * 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 Co-authored-by: Psychpsyo <60073468+Psychpsyo@users.noreply.github.com> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> --- .../Components/ReactiveContainerComponent.cs | 21 +++++++ .../EntitySystems/ReactiveContainerSystem.cs | 53 ++++++++++++++++++ .../janitorial/janitorial-slot-component.ftl | 3 +- .../Prototypes/Entities/Objects/Fun/toys.yml | 5 ++ .../Structures/Specific/Janitor/janicart.yml | 19 +++++-- Resources/Prototypes/tags.yml | 3 + .../Objects/Fun/sharkplush.rsi/meta.json | 9 --- .../Janitorial/janitorial.rsi/meta.json | 14 ++++- .../janitorial.rsi/mopbucket_carpplush.png | Bin 0 -> 587 bytes .../janitorial.rsi}/mopbucket_shark_blue.png | Bin .../janitorial.rsi}/mopbucket_shark_grey.png | Bin .../janitorial.rsi}/mopbucket_shark_pink.png | Bin 12 files changed, 112 insertions(+), 15 deletions(-) create mode 100644 Content.Shared/Chemistry/Components/ReactiveContainerComponent.cs create mode 100644 Content.Shared/Chemistry/EntitySystems/ReactiveContainerSystem.cs create mode 100644 Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/mopbucket_carpplush.png rename Resources/Textures/Objects/{Fun/sharkplush.rsi => Specific/Janitorial/janitorial.rsi}/mopbucket_shark_blue.png (100%) rename Resources/Textures/Objects/{Fun/sharkplush.rsi => Specific/Janitorial/janitorial.rsi}/mopbucket_shark_grey.png (100%) rename Resources/Textures/Objects/{Fun/sharkplush.rsi => Specific/Janitorial/janitorial.rsi}/mopbucket_shark_pink.png (100%) diff --git a/Content.Shared/Chemistry/Components/ReactiveContainerComponent.cs b/Content.Shared/Chemistry/Components/ReactiveContainerComponent.cs new file mode 100644 index 0000000000..6aefd8f462 --- /dev/null +++ b/Content.Shared/Chemistry/Components/ReactiveContainerComponent.cs @@ -0,0 +1,21 @@ +namespace Content.Shared.Chemistry.Components; + +/// +/// Represents a container that also contains a solution. +/// This means that reactive entities react when inserted into the container. +/// +[RegisterComponent] +public sealed partial class ReactiveContainerComponent : Component +{ + /// + /// The container that holds the solution. + /// + [DataField(required: true)] + public string Container = default!; + + /// + /// The solution in the container. + /// + [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 index 0000000000..aa217c60ba --- /dev/null +++ b/Content.Shared/Chemistry/EntitySystems/ReactiveContainerSystem.cs @@ -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(OnInserted); + SubscribeLocalEvent(OnSolutionChange); + } + + private void OnInserted(EntityUid uid, ReactiveContainerComponent comp, EntInsertedIntoContainerMessage args) + { + // Only reactive entities can react with the solution + if (!HasComp(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(uid, out var manager)) + return; + if (!_containerSystem.TryGetContainer(uid, comp.Container, out var container)) + return; + + foreach (var entity in container.ContainedEntities) + { + if (!HasComp(entity)) + continue; + _reactiveSystem.DoEntityReaction(entity, solution, ReactionMethod.Touch); + } + } +} diff --git a/Resources/Locale/en-US/janitorial/janitorial-slot-component.ftl b/Resources/Locale/en-US/janitorial/janitorial-slot-component.ftl index b722116587..bc03943a01 100644 --- a/Resources/Locale/en-US/janitorial/janitorial-slot-component.ftl +++ b/Resources/Locale/en-US/janitorial/janitorial-slot-component.ftl @@ -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 diff --git a/Resources/Prototypes/Entities/Objects/Fun/toys.yml b/Resources/Prototypes/Entities/Objects/Fun/toys.yml index c3ef0d0329..d774c4469c 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/toys.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/toys.yml @@ -599,6 +599,11 @@ path: /Audio/Effects/bite.ogg angle: 0 animation: WeaponArcBite # Rrrr! + - type: Tag + tags: + - Payload + - ClothMade + - PlushieCarp - type: entity parent: PlushieCarp diff --git a/Resources/Prototypes/Entities/Structures/Specific/Janitor/janicart.yml b/Resources/Prototypes/Entities/Structures/Specific/Janitor/janicart.yml index 6ed06addcd..d74fe8b0f1 100644 --- a/Resources/Prototypes/Entities/Structures/Specific/Janitor/janicart.yml +++ b/Resources/Prototypes/Entities/Structures/Specific/Janitor/janicart.yml @@ -47,19 +47,30 @@ 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 diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index 8962da5790..48bce7ddab 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -1071,6 +1071,9 @@ - type: Tag id: Plunger +- type: Tag + id: PlushieCarp + - type: Tag id: PlushieGhost diff --git a/Resources/Textures/Objects/Fun/sharkplush.rsi/meta.json b/Resources/Textures/Objects/Fun/sharkplush.rsi/meta.json index eca1964c4d..12144d3559 100644 --- a/Resources/Textures/Objects/Fun/sharkplush.rsi/meta.json +++ b/Resources/Textures/Objects/Fun/sharkplush.rsi/meta.json @@ -39,15 +39,6 @@ { "name": "grey-inhand-right", "directions": 4 - }, - { - "name": "mopbucket_shark_blue" - }, - { - "name": "mopbucket_shark_pink" - }, - { - "name": "mopbucket_shark_grey" } ] } \ No newline at end of file diff --git a/Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/meta.json b/Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/meta.json index ae3103e2be..4f7a1e7772 100644 --- a/Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/meta.json +++ b/Resources/Textures/Objects/Specific/Janitorial/janitorial.rsi/meta.json @@ -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 @@ -25,6 +25,18 @@ { "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 index 0000000000000000000000000000000000000000..07ef0a77d006ba591efd80af039c800a90660f37 GIT binary patch literal 587 zcmV-R0<`^!P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0pLkQK~z{r?UhYS z+)xyT-+}v>9_k56`q@<+ezenU(WA;D%RXe+Vgs8x`QZ!_O z>T`*wo1Rh3dmCU@aiV6hfSMSjE*xvo9iT#Hf|nM&d8?3_e=@*)#F<)>Rn(~hQ$pb) zC2=xQmnod4fHNoHw=MndZHDe`fQ6^20k8c&Wvwt&*>fk47_LY}+ljt^)0@SY$|+{v z*?K)`#Mr>sEmv*4KfqhJiH4n^mkRtzq^>|p`&~%PFDpcQ3L#ZtEY4i26t6l!5Cqq{ zS#1h37JngI=#nUB%>g)1E&v-?m>%JGEO9(^XoYKW=B7AfWPrtOOyPT?a7Mj88n{|q z_n+DjlPM-r0>5Z~=hDY{V$oa(?DajY1rg#n&YP7{xCK1%`K>m=xODIwwC#~zGhP+w z&06?&n3?f(Z8AFep|9(BVm