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>
This commit is contained in:
M4rchy-S
2025-09-02 03:07:37 +03:00
committed by GitHub
parent c99c9ed200
commit ca29e0a166

View File

@@ -8,6 +8,7 @@ using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems; using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Reagent; using Content.Shared.Chemistry.Reagent;
using Content.Shared.IdentityManagement; using Content.Shared.IdentityManagement;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Systems; using Content.Shared.Movement.Systems;
using Content.Shared.Nutrition.Components; using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems; using Content.Shared.Nutrition.EntitySystems;
@@ -21,15 +22,16 @@ namespace Content.Server.Medical
{ {
[Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly AudioSystem _audio = default!; [Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly BloodstreamSystem _bloodstream = default!;
[Dependency] private readonly BodySystem _body = default!; [Dependency] private readonly BodySystem _body = default!;
[Dependency] private readonly ForensicsSystem _forensics = default!;
[Dependency] private readonly HungerSystem _hunger = 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 PopupSystem _popup = default!;
[Dependency] private readonly PuddleSystem _puddle = default!; [Dependency] private readonly PuddleSystem _puddle = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!; [Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly MovementModStatusSystem _movementMod = default!;
[Dependency] private readonly ThirstSystem _thirst = 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"; private static readonly ProtoId<SoundCollectionPrototype> VomitCollection = "Vomit";
@@ -39,13 +41,18 @@ namespace Content.Server.Medical
/// <summary> /// <summary>
/// Make an entity vomit, if they have a stomach. /// Make an entity vomit, if they have a stomach.
/// </summary> /// </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 // Main requirement: You have a stomach
var stomachList = _body.GetBodyOrganEntityComps<StomachComponent>(uid); var stomachList = _body.GetBodyOrganEntityComps<StomachComponent>(uid);
if (stomachList.Count == 0) if (stomachList.Count == 0)
return; 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 // Vomiting makes you hungrier and thirstier
if (TryComp<HungerComponent>(uid, out var hunger)) if (TryComp<HungerComponent>(uid, out var hunger))
_hunger.ModifyHunger(uid, hungerAdded, hunger); _hunger.ModifyHunger(uid, hungerAdded, hunger);