]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix radiation vomit for dead mobs (#40020)
authorM4rchy-S <89603088+M4rchy-S@users.noreply.github.com>
Tue, 2 Sep 2025 00:07:37 +0000 (03:07 +0300)
committerGitHub <noreply@github.com>
Tue, 2 Sep 2025 00:07:37 +0000 (17:07 -0700)
* Fix Radiation Vomit for dead mobs

* Update Content.Server/Destructible/Thresholds/Behaviors/VomitBehavior.cs

Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>
* Fix Radiation Vomit for dead mobs

* Fix Radiation Vomit system for dead mobs

* refactors

* Adding mobStateSystem for validation

* refactor

* Unrelated cleanup

---------

Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>
Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Content.Server/Medical/VomitSystem.cs

index 9fee1dfc85cab9017cfab8ea49fd068638d70aec..235cc1733184948062f43e039e3408822bcb22f6 100644 (file)
@@ -8,6 +8,7 @@ using Content.Shared.Chemistry.Components;
 using Content.Shared.Chemistry.EntitySystems;
 using Content.Shared.Chemistry.Reagent;
 using Content.Shared.IdentityManagement;
+using Content.Shared.Mobs.Systems;
 using Content.Shared.Movement.Systems;
 using Content.Shared.Nutrition.Components;
 using Content.Shared.Nutrition.EntitySystems;
@@ -21,15 +22,16 @@ namespace Content.Server.Medical
     {
         [Dependency] private readonly IPrototypeManager _proto = default!;
         [Dependency] private readonly AudioSystem _audio = default!;
+        [Dependency] private readonly BloodstreamSystem _bloodstream = default!;
         [Dependency] private readonly BodySystem _body = default!;
+        [Dependency] private readonly ForensicsSystem _forensics = default!;
         [Dependency] private readonly HungerSystem _hunger = default!;
+        [Dependency] private readonly MobStateSystem _mobstate = default!;
+        [Dependency] private readonly MovementModStatusSystem _movementMod = default!;
         [Dependency] private readonly PopupSystem _popup = default!;
         [Dependency] private readonly PuddleSystem _puddle = default!;
         [Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
-        [Dependency] private readonly MovementModStatusSystem _movementMod = default!;
         [Dependency] private readonly ThirstSystem _thirst = default!;
-        [Dependency] private readonly ForensicsSystem _forensics = default!;
-        [Dependency] private readonly BloodstreamSystem _bloodstream = default!;
 
         private static readonly ProtoId<SoundCollectionPrototype> VomitCollection = "Vomit";
 
@@ -39,13 +41,18 @@ namespace Content.Server.Medical
         /// <summary>
         /// Make an entity vomit, if they have a stomach.
         /// </summary>
-        public void Vomit(EntityUid uid, float thirstAdded = -40f, float hungerAdded = -40f)
+        public void Vomit(EntityUid uid, float thirstAdded = -40f, float hungerAdded = -40f, bool force = false)
         {
             // Main requirement: You have a stomach
             var stomachList = _body.GetBodyOrganEntityComps<StomachComponent>(uid);
             if (stomachList.Count == 0)
                 return;
 
+            //  Vomit only if entity is alive
+            //  Ignore condition if force was set to true
+            if (!force && _mobstate.IsDead(uid))
+                return;
+
             // Vomiting makes you hungrier and thirstier
             if (TryComp<HungerComponent>(uid, out var hunger))
                 _hunger.ModifyHunger(uid, hungerAdded, hunger);