Pepper makes you cough (#36358)

This commit is contained in:
āda
2025-05-19 13:23:38 -05:00
committed by GitHub
parent 69354f59c8
commit 41a129e749
9 changed files with 143 additions and 9 deletions

View File

@@ -0,0 +1,33 @@
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Shared.EntityEffects;
using Robust.Shared.Prototypes;
namespace Content.Server.EntityEffects.EffectConditions;
/// <summary>
/// Condition for if the entity is successfully breathing.
/// </summary>
public sealed partial class Breathing : EntityEffectCondition
{
/// <summary>
/// If true, the entity must not have trouble breathing to pass.
/// </summary>
[DataField]
public bool IsBreathing = true;
public override bool Condition(EntityEffectBaseArgs args)
{
if (!args.EntityManager.TryGetComponent(args.TargetEntity, out RespiratorComponent? respiratorComp))
return !IsBreathing; // They do not breathe.
var breathingState = args.EntityManager.System<RespiratorSystem>().IsBreathing((args.TargetEntity, respiratorComp));
return IsBreathing == breathingState;
}
public override string GuidebookExplanation(IPrototypeManager prototype)
{
return Loc.GetString("reagent-effect-condition-guidebook-breathing",
("isBreathing", IsBreathing));
}
}

View File

@@ -0,0 +1,31 @@
using Content.Shared.Body.Components;
using Content.Shared.EntityEffects;
using Robust.Shared.Prototypes;
namespace Content.Server.EntityEffects.EffectConditions;
/// <summary>
/// Condition for if the entity is or isn't wearing internals.
/// </summary>
public sealed partial class Internals : EntityEffectCondition
{
/// <summary>
/// To pass, the entity's internals must have this same state.
/// </summary>
[DataField]
public bool UsingInternals = true;
public override bool Condition(EntityEffectBaseArgs args)
{
if (!args.EntityManager.TryGetComponent(args.TargetEntity, out InternalsComponent? internalsComp))
return !UsingInternals; // They have no internals to wear.
var internalsState = internalsComp.GasTankEntity == null;
return UsingInternals == internalsState;
}
public override string GuidebookExplanation(IPrototypeManager prototype)
{
return Loc.GetString("reagent-effect-condition-guidebook-internals", ("usingInternals", UsingInternals));
}
}