]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix defibs resetting rot timer + slimes not having perishable (#23340)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Tue, 2 Jan 2024 02:12:32 +0000 (21:12 -0500)
committerGitHub <noreply@github.com>
Tue, 2 Jan 2024 02:12:32 +0000 (13:12 +1100)
* Fix defibs resetting rot timer + slimes not having perishable

* fix the sound too

Content.Server/Medical/DefibrillatorSystem.cs
Resources/Prototypes/Entities/Mobs/Species/arachnid.yml
Resources/Prototypes/Entities/Mobs/Species/base.yml
Resources/Prototypes/Entities/Mobs/Species/diona.yml
Resources/Prototypes/Entities/Mobs/Species/dwarf.yml
Resources/Prototypes/Entities/Mobs/Species/human.yml
Resources/Prototypes/Entities/Mobs/Species/moth.yml
Resources/Prototypes/Entities/Mobs/Species/reptilian.yml
Resources/Prototypes/Entities/Mobs/Species/vox.yml

index 12391d724f3f3e5bffb574ec479d2fbc259758d7..d3374bd775508b795c7fae9590336858f61d175a 100644 (file)
@@ -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<DamageableComponent>(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);
index 244631509c72398c594a4183b77a6331724f8391..d22ba665704451ec9f93d0d79dcd8a41de3fdac7 100644 (file)
@@ -27,7 +27,6 @@
     - FootstepSound
     - DoorBumpOpener
     - SpiderCraft
-  - type: Perishable
   - type: Butcherable
     butcheringType: Spike
     spawned:
index 71a60e9aa4fb46cdcb955716884dbfc310155a66..1ce48ce140351075af8790ac1505192c4e7f6d21 100644 (file)
     shiveringHeatRegulation: 2000
     normalBodyTemperature: 310.15
     thermalRegulationTemperatureThreshold: 25
+  - type: Perishable
   - type: Butcherable
     butcheringType: Spike # TODO human.
     spawned:
index 6ca493aedd4b7b6cf7ddfffc022b7abcfd41b692..2951f5b6204ec8d220f7d2c7778e0bf911e95b84 100644 (file)
@@ -28,7 +28,6 @@
       Brute:
         sprite: Mobs/Effects/brute_damage.rsi
         color: "#75b1f0"
-  - type: Perishable
   - type: Butcherable
     butcheringType: Spike
     spawned:
index 70e75e54835978aefca7a74d88d2463319284095..ff94c70fe0570148e2ec8a2feaeb28fb8566e67c 100644 (file)
@@ -28,7 +28,6 @@
   - type: Body
     prototype: Dwarf
     requiredLegs: 2
-  - type: Perishable
   - type: Butcherable
     butcheringType: Spike
     spawned:
index 990097c396a5ff0aa2e14cb39a4c764d3da05364..51450cf3fff5fb32f15524a518f8b8e84a0bd856 100644 (file)
@@ -14,7 +14,6 @@
     sprite: Mobs/Species/Human/parts.rsi
     state: full
   - type: Thirst
-  - type: Perishable
   - type: Butcherable
     butcheringType: Spike
     spawned:
index 5dc1fba97980565fa2a406a74b03c9e6e8f685e6..32105112f6068c330fc2ed8d8897bb6c22eafbb6 100644 (file)
@@ -28,7 +28,6 @@
     speechVerb: Moth
   - type: TypingIndicator
     proto: moth
-  - type: Perishable
   - type: Butcherable
     butcheringType: Spike
     spawned:
index b01f838119920e2ab10184fdf87daa1e108f8ce7..fea25132566bb8e6f01aa8d2d94937ada54f66b2 100644 (file)
@@ -21,7 +21,6 @@
   - type: Body
     prototype: Reptilian
     requiredLegs: 2
-  - type: Perishable
   - type: Butcherable
     butcheringType: Spike
     spawned:
index c1ee7744c8ea3bbbf480dfc0b637639d7a667fb5..e17b2f70805c133ad995a5b97958ca64020668f0 100644 (file)
@@ -97,7 +97,6 @@
   - type: Inventory
     speciesId: vox
   - type: InventorySlots
-  - type: Perishable
   - type: Butcherable
     butcheringType: Spike
     spawned: