From ca29e0a16690a5f827095718afb60cfb44e702a8 Mon Sep 17 00:00:00 2001 From: M4rchy-S <89603088+M4rchy-S@users.noreply.github.com> Date: Tue, 2 Sep 2025 03:07:37 +0300 Subject: [PATCH] Fix radiation vomit for dead mobs (#40020) * 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 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Content.Server/Medical/VomitSystem.cs b/Content.Server/Medical/VomitSystem.cs index 9fee1dfc85..235cc17331 100644 --- a/Content.Server/Medical/VomitSystem.cs +++ b/Content.Server/Medical/VomitSystem.cs @@ -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 VomitCollection = "Vomit"; @@ -39,13 +41,18 @@ namespace Content.Server.Medical /// /// Make an entity vomit, if they have a stomach. /// - 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(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(uid, out var hunger)) _hunger.ModifyHunger(uid, hungerAdded, hunger); -- 2.51.2