From 6e8c4009b40ac6bd67ec5ad17f8026c8ccaf37b6 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+emogarbage404@users.noreply.github.com> Date: Tue, 2 Jan 2024 03:12:32 +0100 Subject: [PATCH] Fix defibs resetting rot timer + slimes not having perishable (#23340) * Fix defibs resetting rot timer + slimes not having perishable * fix the sound too (cherry picked from commit 8d9a76c95d25e5bc26c897e61ec9702141afed7a) --- Content.Server/Medical/DefibrillatorSystem.cs | 14 +++++++++++--- .../Prototypes/Entities/Mobs/Species/arachnid.yml | 1 - .../Prototypes/Entities/Mobs/Species/base.yml | 1 + .../Prototypes/Entities/Mobs/Species/diona.yml | 1 - .../Prototypes/Entities/Mobs/Species/dwarf.yml | 1 - .../Prototypes/Entities/Mobs/Species/human.yml | 1 - .../Prototypes/Entities/Mobs/Species/moth.yml | 1 - .../Prototypes/Entities/Mobs/Species/reptilian.yml | 1 - Resources/Prototypes/Entities/Mobs/Species/vox.yml | 1 - 9 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Content.Server/Medical/DefibrillatorSystem.cs b/Content.Server/Medical/DefibrillatorSystem.cs index 12391d724f..d3374bd775 100644 --- a/Content.Server/Medical/DefibrillatorSystem.cs +++ b/Content.Server/Medical/DefibrillatorSystem.cs @@ -214,6 +214,7 @@ public sealed class DefibrillatorSystem : EntitySystem ICommonSession? session = null; + var dead = true; if (_rotting.IsRotten(target)) { _chatManager.TrySendInGameICMessage(uid, Loc.GetString("defibrillator-rotten"), @@ -223,9 +224,16 @@ public sealed class DefibrillatorSystem : EntitySystem { if (_mobState.IsDead(target, mob)) _damageable.TryChangeDamage(target, component.ZapHeal, true, origin: uid); - _mobState.ChangeMobState(target, MobState.Critical, mob, uid); - if (_mind.TryGetMind(target, out var mindId, out var mind) && + if (_mobThreshold.TryGetThresholdForState(target, MobState.Dead, out var threshold) && + TryComp(target, out var damageableComponent) && + damageableComponent.TotalDamage < threshold) + { + _mobState.ChangeMobState(target, MobState.Critical, mob, uid); + dead = false; + } + + if (_mind.TryGetMind(target, out _, out var mind) && mind.Session is { } playerSession) { session = playerSession; @@ -242,7 +250,7 @@ public sealed class DefibrillatorSystem : EntitySystem } } - var sound = _mobState.IsDead(target, mob) || session == null + var sound = dead || session == null ? component.FailureSound : component.SuccessSound; _audio.PlayPvs(sound, uid); diff --git a/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml b/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml index 7f2f972015..f2ba6aac51 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml @@ -29,7 +29,6 @@ - FootstepSound - DoorBumpOpener - SpiderCraft - - type: Perishable - type: Butcherable butcheringType: Spike spawned: diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml index 16cd7515dd..b379f62d16 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml @@ -287,6 +287,7 @@ shiveringHeatRegulation: 2000 normalBodyTemperature: 310.15 thermalRegulationTemperatureThreshold: 25 + - type: Perishable - type: Butcherable butcheringType: Spike # TODO human. spawned: diff --git a/Resources/Prototypes/Entities/Mobs/Species/diona.yml b/Resources/Prototypes/Entities/Mobs/Species/diona.yml index c6b464c3d2..9a0e505316 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/diona.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/diona.yml @@ -29,7 +29,6 @@ Brute: sprite: Mobs/Effects/brute_damage.rsi color: "#75b1f0" - - type: Perishable - type: Butcherable butcheringType: Spike spawned: diff --git a/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml b/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml index e9e46e5d20..149769876d 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml @@ -29,7 +29,6 @@ - type: Body prototype: Dwarf requiredLegs: 2 - - type: Perishable - type: Butcherable butcheringType: Spike spawned: diff --git a/Resources/Prototypes/Entities/Mobs/Species/human.yml b/Resources/Prototypes/Entities/Mobs/Species/human.yml index 83fe8a6f13..fb93c210a7 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/human.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/human.yml @@ -15,7 +15,6 @@ state: full - type: Thirst - type: Carriable # Carrying system from nyanotrasen. - - type: Perishable - type: Butcherable butcheringType: Spike spawned: diff --git a/Resources/Prototypes/Entities/Mobs/Species/moth.yml b/Resources/Prototypes/Entities/Mobs/Species/moth.yml index 2bc110bad6..912bffb642 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/moth.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/moth.yml @@ -29,7 +29,6 @@ speechVerb: Moth - type: TypingIndicator proto: moth - - type: Perishable - type: Butcherable butcheringType: Spike spawned: diff --git a/Resources/Prototypes/Entities/Mobs/Species/reptilian.yml b/Resources/Prototypes/Entities/Mobs/Species/reptilian.yml index 59eb7f4fd9..b3d6ea5508 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/reptilian.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/reptilian.yml @@ -22,7 +22,6 @@ - type: Body prototype: Reptilian requiredLegs: 2 - - type: Perishable - type: Butcherable butcheringType: Spike spawned: diff --git a/Resources/Prototypes/Entities/Mobs/Species/vox.yml b/Resources/Prototypes/Entities/Mobs/Species/vox.yml index c1ee7744c8..e17b2f7080 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/vox.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/vox.yml @@ -97,7 +97,6 @@ - type: Inventory speciesId: vox - type: InventorySlots - - type: Perishable - type: Butcherable butcheringType: Spike spawned: