diff --git a/Content.Server/Fluids/Components/EvaporationComponent.cs b/Content.Server/Fluids/Components/EvaporationComponent.cs index 34de2af104..3b00358ea4 100644 --- a/Content.Server/Fluids/Components/EvaporationComponent.cs +++ b/Content.Server/Fluids/Components/EvaporationComponent.cs @@ -11,6 +11,12 @@ namespace Content.Server.Fluids.Components [Friend(typeof(EvaporationSystem))] public sealed class EvaporationComponent : Component { + /// + /// Is this entity actively evaporating? This toggle lets us pause evaporation under certain conditions. + /// + [DataField("evaporationToggle")] + public bool EvaporationToggle = true; + /// /// The time that it will take this puddle to lose one fixed unit of solution, in seconds. /// @@ -32,10 +38,10 @@ namespace Content.Server.Fluids.Components /// /// Upper limit below which puddle won't evaporate. Useful when wanting to make sure large puddle will - /// remain forever. Defaults to . + /// remain forever. Defaults to 100. /// [DataField("upperLimit")] - public FixedPoint2 UpperLimit = PuddleComponent.DefaultOverflowVolume; + public FixedPoint2 UpperLimit = FixedPoint2.New(100); //TODO: Consider setting this back to PuddleComponent.DefaultOverflowVolume once that behaviour is fixed. /// /// The time accumulated since the start. diff --git a/Content.Server/Fluids/Components/PuddleComponent.cs b/Content.Server/Fluids/Components/PuddleComponent.cs index 03f5789f1c..eec596d154 100644 --- a/Content.Server/Fluids/Components/PuddleComponent.cs +++ b/Content.Server/Fluids/Components/PuddleComponent.cs @@ -32,8 +32,18 @@ namespace Content.Server.Fluids.Components // based on behaviour (e.g. someone being punched vs slashed with a sword would have different blood sprite) // to check for low volumes for evaporation or whatever + /// + /// Puddles with volume above this threshold can slip players. + /// + [DataField("slipThreshold")] + public FixedPoint2 SlipThreshold = DefaultSlipThreshold; - [DataField("slipThreshold")] public FixedPoint2 SlipThreshold = DefaultSlipThreshold; + /// + /// Puddles with volume below this threshold will have their sprite changed to a wet floor effect, + /// provided they can evaporate down to zero. + /// + [DataField("wetFloorEffectThreshold")] + public FixedPoint2 WetFloorEffectThreshold = FixedPoint2.New(5); [DataField("spillSound")] public SoundSpecifier SpillSound = new SoundPathSpecifier("/Audio/Effects/Fluids/splat.ogg"); diff --git a/Content.Server/Fluids/EntitySystems/EvaporationSystem.cs b/Content.Server/Fluids/EntitySystems/EvaporationSystem.cs index 5bac9f8434..88eb6c6d0f 100644 --- a/Content.Server/Fluids/EntitySystems/EvaporationSystem.cs +++ b/Content.Server/Fluids/EntitySystems/EvaporationSystem.cs @@ -25,7 +25,7 @@ namespace Content.Server.Fluids.EntitySystems if (!_solutionContainerSystem.TryGetSolution(uid, evaporationComponent.SolutionName, out var solution)) { // If no solution, delete the entity - queueDelete.Add(evaporationComponent); + EntityManager.QueueDeleteEntity(uid); continue; } @@ -34,19 +34,22 @@ namespace Content.Server.Fluids.EntitySystems evaporationComponent.Accumulator -= evaporationComponent.EvaporateTime; + if (evaporationComponent.EvaporationToggle == true) + { + _solutionContainerSystem.SplitSolution(uid, solution, + FixedPoint2.Min(FixedPoint2.New(1), solution.CurrentVolume)); // removes 1 unit, or solution current volume, whichever is lower. + } - _solutionContainerSystem.SplitSolution(uid, solution, - FixedPoint2.Min(FixedPoint2.New(1), solution.CurrentVolume)); - - if (solution.CurrentVolume == 0) + if (solution.CurrentVolume <= 0) { EntityManager.QueueDeleteEntity(uid); } - else if (solution.CurrentVolume <= evaporationComponent.LowerLimit + else if (solution.CurrentVolume <= evaporationComponent.LowerLimit // if puddle is too big or too small to evaporate. || solution.CurrentVolume >= evaporationComponent.UpperLimit) { - queueDelete.Add(evaporationComponent); + evaporationComponent.EvaporationToggle = false; // pause evaporation } + else evaporationComponent.EvaporationToggle = true; // unpause evaporation, e.g. if a puddle previously above evaporation UpperLimit was brought down below evaporation UpperLimit via mopping. } foreach (var evaporationComponent in queueDelete) diff --git a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs index afdcfb9883..44b8014494 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs @@ -68,10 +68,14 @@ namespace Content.Server.Fluids.EntitySystems var volumeScale = puddleComponent.CurrentVolume.Float() / puddleComponent.OverflowVolume.Float(); var puddleSolution = _solutionContainerSystem.EnsureSolution(uid, puddleComponent.SolutionName); - // Puddles with volume below this threshold will have their sprite changed to a wet floor effect - var wetFloorEffectThreshold = FixedPoint2.New(5); + + bool hasEvaporationComponent = EntityManager.TryGetComponent(uid, out var evaporationComponent); + bool canEvaporate = (hasEvaporationComponent && + (evaporationComponent.LowerLimit == 0 || puddleComponent.CurrentVolume > evaporationComponent.LowerLimit)); + // "Does this puddle's sprite need changing to the wet floor effect sprite?" - bool changeToWetFloor = (puddleComponent.CurrentVolume <= wetFloorEffectThreshold); + bool changeToWetFloor = (puddleComponent.CurrentVolume <= puddleComponent.WetFloorEffectThreshold + && canEvaporate); appearanceComponent.SetData(PuddleVisuals.VolumeScale, volumeScale); appearanceComponent.SetData(PuddleVisuals.SolutionColor, puddleSolution.Color); diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml b/Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml index 6e56c7320a..9d7abc3422 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml @@ -365,7 +365,7 @@ - ReagentId: JuiceTomato Quantity: 10 - type: Evaporation - lowerLimit: 2 + lowerLimit: 0 # todo: reimplement stain behaviour, ideally in a way that doesn't use evaporation lowerLimit - type: Appearance visuals: - type: PuddleVisualizer