From 7fde051b1ae70b7766e5dc922c10731220131ab9 Mon Sep 17 00:00:00 2001 From: Saphire Date: Tue, 24 Sep 2024 12:37:26 +0600 Subject: [PATCH] Make minibomb explosion resistant and trigger timer on damage --- .../Thresholds/Behaviors/TimerStartBehavior.cs | 10 ++++++++++ .../Objects/Weapons/Throwable/grenades.yml | 15 +++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Content.Server/Destructible/Thresholds/Behaviors/TimerStartBehavior.cs diff --git a/Content.Server/Destructible/Thresholds/Behaviors/TimerStartBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/TimerStartBehavior.cs new file mode 100644 index 00000000000000..97a5f8b7ef5e86 --- /dev/null +++ b/Content.Server/Destructible/Thresholds/Behaviors/TimerStartBehavior.cs @@ -0,0 +1,10 @@ +namespace Content.Server.Destructible.Thresholds.Behaviors; + +[DataDefinition] +public sealed partial class TimerStartBehavior : IThresholdBehavior +{ + public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null) + { + system.TriggerSystem.StartTimer(owner, cause); + } +} diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml index a279c56378f28b..3a04acf15efc50 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml @@ -106,6 +106,21 @@ components: - type: Sprite sprite: Objects/Weapons/Grenades/syndgrenade.rsi + - type: ExplosionResistance + damageCoefficient: 0.1 + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 10 + behaviors: + - !type:TimerStartBehavior + - trigger: + !type:DamageTrigger + damage: 20 + behaviors: + - !type:DoActsBehavior + acts: ["Destruction"] - type: OnUseTimerTrigger delay: 5 - type: ExplodeOnTrigger