diff --git a/Content.Server/GameObjects/Components/Destructible/Thresholds/Behavior/SpillBehavior.cs b/Content.Server/GameObjects/Components/Destructible/Thresholds/Behavior/SpillBehavior.cs new file mode 100644 index 0000000000..53ac16d632 --- /dev/null +++ b/Content.Server/GameObjects/Components/Destructible/Thresholds/Behavior/SpillBehavior.cs @@ -0,0 +1,24 @@ +#nullable enable +using Content.Server.GameObjects.Components.Chemistry; +using Content.Server.GameObjects.Components.Fluids; +using Content.Server.GameObjects.EntitySystems; +using JetBrains.Annotations; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Serialization; + +namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior +{ + [UsedImplicitly] + public class SpillBehavior : IThresholdBehavior + { + public void ExposeData(ObjectSerializer serializer) { } + + public void Trigger(IEntity owner, DestructibleSystem system) + { + if (!owner.TryGetComponent(out SolutionContainerComponent? solutionContainer)) + return; + + solutionContainer.Solution.SpillAt(owner.Transform.Coordinates, "PuddleSmear", false); + } + } +} diff --git a/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml b/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml index 6f3b454fcf..c01489c8d5 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml @@ -30,6 +30,7 @@ behaviors: - !type:PlaySoundCollectionBehavior soundCollection: GlassBreak + - !type:SpillBehavior { } - !type:SpawnEntitiesBehavior spawn: ShardGlass: diff --git a/Resources/Prototypes/Entities/Objects/Consumable/drinks_bottles.yml b/Resources/Prototypes/Entities/Objects/Consumable/drinks_bottles.yml index 51fe476ff3..82da85a1da 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/drinks_bottles.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/drinks_bottles.yml @@ -10,8 +10,26 @@ transferAmount: 5 - type: Sprite state: icon - + - type: DamageOnLand + amount: 5 + - type: DamageOtherOnHit + amount: 10 - type: Spillable + - type: Damageable + - type: Destructible + thresholds: + 5: + behaviors: + - !type:PlaySoundCollectionBehavior + soundCollection: GlassBreak + - !type:SpillBehavior { } + - !type:SpawnEntitiesBehavior + spawn: + ShardGlass: + min: 1 + max: 2 + - !type:DoActsBehavior + acts: [ "Destruction" ] - type: entity parent: DrinkBottleBaseFull