From: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> Date: Tue, 29 Apr 2025 20:10:00 +0000 (-0700) Subject: Puddle code hotfix 2 (#37046) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=84178dd5343399305e875c19bdb2a5393bb59905;p=space-station-14.git Puddle code hotfix 2 (#37046) --- diff --git a/Content.Server/Chemistry/TileReactions/SpillIfPuddlePresentTileReaction.cs b/Content.Server/Chemistry/TileReactions/SpillIfPuddlePresentTileReaction.cs new file mode 100644 index 0000000000..5acef8d1a8 --- /dev/null +++ b/Content.Server/Chemistry/TileReactions/SpillIfPuddlePresentTileReaction.cs @@ -0,0 +1,30 @@ +using Content.Server.Fluids.EntitySystems; +using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reaction; +using Content.Shared.Chemistry.Reagent; +using Content.Shared.FixedPoint; +using JetBrains.Annotations; +using Robust.Shared.Map; + +namespace Content.Server.Chemistry.TileReactions +{ + [UsedImplicitly] + [DataDefinition] + public sealed partial class SpillIfPuddlePresentTileReaction : ITileReaction + { + public FixedPoint2 TileReact(TileRef tile, + ReagentPrototype reagent, + FixedPoint2 reactVolume, + IEntityManager entityManager, + List? data) + { + var spillSystem = entityManager.System(); + if (!spillSystem.TryGetPuddle(tile, out _)) + return FixedPoint2.Zero; + + return spillSystem.TrySpillAt(tile, new Solution(reagent.ID, reactVolume, data), out _, sound: false, tileReact: false) + ? reactVolume + : FixedPoint2.Zero; + } + } +} diff --git a/Content.Server/Chemistry/TileReactions/SpillTileReaction.cs b/Content.Server/Chemistry/TileReactions/SpillTileReaction.cs new file mode 100644 index 0000000000..c371410909 --- /dev/null +++ b/Content.Server/Chemistry/TileReactions/SpillTileReaction.cs @@ -0,0 +1,28 @@ +using Content.Server.Fluids.EntitySystems; +using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reaction; +using Content.Shared.Chemistry.Reagent; +using Content.Shared.FixedPoint; +using JetBrains.Annotations; +using Robust.Shared.Map; + +namespace Content.Server.Chemistry.TileReactions +{ + [UsedImplicitly] + [DataDefinition] + public sealed partial class SpillTileReaction : ITileReaction + { + public FixedPoint2 TileReact(TileRef tile, + ReagentPrototype reagent, + FixedPoint2 reactVolume, + IEntityManager entityManager, + List? data) + { + var spillSystem = entityManager.System(); + + return spillSystem.TrySpillAt(tile, new Solution(reagent.ID, reactVolume, data), out _, sound: false, tileReact: false) + ? reactVolume + : FixedPoint2.Zero; + } + } +} diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/base_drink.yml b/Resources/Prototypes/Reagents/Consumable/Drink/base_drink.yml index dac16dcb1c..c5cbaea8d3 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/base_drink.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/base_drink.yml @@ -19,6 +19,7 @@ amount: 1 tileReactions: - !type:ExtinguishTileReaction { } + - !type:SpillIfPuddlePresentTileReaction { } - type: reagent id: BaseSoda diff --git a/Resources/Prototypes/Reagents/Consumable/Food/condiments.yml b/Resources/Prototypes/Reagents/Consumable/Food/condiments.yml index 1dde464128..addc85096d 100644 --- a/Resources/Prototypes/Reagents/Consumable/Food/condiments.yml +++ b/Resources/Prototypes/Reagents/Consumable/Food/condiments.yml @@ -175,6 +175,8 @@ recognizable: true physicalDesc: reagent-physical-desc-sticky viscosity: 0.55 #Start using syrup to attach your remote recievers to your microwaves! + tileReactions: + - !type:SpillTileReaction metabolisms: Food: # 12 diona blood for 1 unit of syrup, this stuff better be worthwhile. diff --git a/Resources/Prototypes/Reagents/biological.yml b/Resources/Prototypes/Reagents/biological.yml index df5ed51945..7e7c544c12 100644 --- a/Resources/Prototypes/Reagents/biological.yml +++ b/Resources/Prototypes/Reagents/biological.yml @@ -66,6 +66,8 @@ recognizable: true physicalDesc: reagent-physical-desc-viscous viscosity: 0.25 + tileReactions: + - !type:SpillTileReaction metabolisms: Food: # Delicious! @@ -87,6 +89,8 @@ recognizable: true physicalDesc: reagent-physical-desc-sticky viscosity: 0.10 + tileReactions: + - !type:SpillTileReaction metabolisms: Food: # Sweet! diff --git a/Resources/Prototypes/Reagents/cleaning.yml b/Resources/Prototypes/Reagents/cleaning.yml index 1c0f220160..3f289d0486 100644 --- a/Resources/Prototypes/Reagents/cleaning.yml +++ b/Resources/Prototypes/Reagents/cleaning.yml @@ -77,6 +77,8 @@ recognizable: true boilingPoint: 290.0 # Glycerin meltingPoint: 18.2 + tileReactions: + - !type:SpillTileReaction friction: 0.0 - type: reagent @@ -88,6 +90,8 @@ color: "#ffffff" boilingPoint: 250.0 meltingPoint: 380.0 + tileReactions: + - !type:SpillTileReaction viscosity: 0.5 reactiveEffects: Acidic: