feat: add a component for rejuvenateable status effects (#39025)

* feat: add a component for rejuvenateable effects

* feat: let god mode'd entities get buffs

* fix: handle old status effect system

Didn't realize BeforeStatusEffectAddedEvent was called by both systems,
oops.

* refactor: rename to RejuvenateRemovedStatusEffect

* fix: make forced sleeping a debuff again

Missed in rebase.

* refactor: make BeforeStatusEffectAdded two events
This commit is contained in:
Perry Fraser
2025-07-24 11:13:29 -04:00
committed by GitHub
parent 82c0f63d50
commit b0e1ce7c0c
7 changed files with 63 additions and 9 deletions

View File

@@ -1,14 +1,19 @@
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Events;
using Content.Shared.Destructible;
using Content.Shared.Prototypes;
using Content.Shared.Rejuvenate;
using Content.Shared.Slippery;
using Content.Shared.StatusEffect;
using Content.Shared.StatusEffectNew;
using Content.Shared.StatusEffectNew.Components;
using Robust.Shared.Prototypes;
namespace Content.Shared.Damage.Systems;
public abstract class SharedGodmodeSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _protoMan = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
public override void Initialize()
@@ -17,6 +22,7 @@ public abstract class SharedGodmodeSystem : EntitySystem
SubscribeLocalEvent<GodmodeComponent, BeforeDamageChangedEvent>(OnBeforeDamageChanged);
SubscribeLocalEvent<GodmodeComponent, BeforeStatusEffectAddedEvent>(OnBeforeStatusEffect);
SubscribeLocalEvent<GodmodeComponent, BeforeOldStatusEffectAddedEvent>(OnBeforeOldStatusEffect);
SubscribeLocalEvent<GodmodeComponent, BeforeStaminaDamageEvent>(OnBeforeStaminaDamage);
SubscribeLocalEvent<GodmodeComponent, SlipAttemptEvent>(OnSlipAttempt);
SubscribeLocalEvent<GodmodeComponent, DestructionAttemptEvent>(OnDestruction);
@@ -34,6 +40,13 @@ public abstract class SharedGodmodeSystem : EntitySystem
private void OnBeforeStatusEffect(EntityUid uid, GodmodeComponent component, ref BeforeStatusEffectAddedEvent args)
{
if (_protoMan.Index(args.Effect).HasComponent<RejuvenateRemovedStatusEffectComponent>(Factory))
args.Cancelled = true;
}
private void OnBeforeOldStatusEffect(Entity<GodmodeComponent> ent, ref BeforeOldStatusEffectAddedEvent args)
{
// Old status effect system doesn't distinguish between good and bad status effects
args.Cancelled = true;
}