New status effect system (#37238)

* spectra

* documentation

* added into liquid anomaly

* Update TemporaryStealthComponent.cs

* Update TemporaryStealthComponent.cs

* integrated

* new system

* mark old status effect system as obsolete

* ForcedSleeping new status effect

* work with reagents

* networking???

* Revert "integrated"

This reverts commit bca02b82bae18ae131af593d7eb86e6de2745157.

* Revert "Update TemporaryStealthComponent.cs"

This reverts commit 4a5be8c4b704a0d1ff9544b2e245d8b2701ec580.

* Revert "Update TemporaryStealthComponent.cs"

This reverts commit a4875bcb41347638854bd723d96a51c3e6d38034.

* Revert "added into liquid anomaly"

This reverts commit df5086b14bb35f1467158a36807c0f2163a16d99.

* Revert "documentation"

This reverts commit 3629b9466758cbdfa4dd5e67ece122fa2f181138.

* Revert "spectra"

This reverts commit 2d03d88c16d16ad6831c19a7921b84600daeb284.

* drowsiness status effect remove

* reagents work

* polish, remove test changes

* first Fildrance review part

* Update misc.yml

* more fildrance review

* final part

* fix trailing spaces

* sleeping status effect

* drowsiness status effect

* Create ModifyStatusEffect.cs

* some tweak

* Yay!!! Manual networking

* minor nitpick

* oopsie

* refactor: xml-docs, notnullwhen attributes, whitespaces

* fildrance and emo review

* refactor: simplify check in SharedStatusEffectsSystem by using pattern matching, TryEffectsWithComp now returns set of Entity<T, StatusEffectComponent>

---------

Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
This commit is contained in:
Red
2025-06-25 14:41:35 +03:00
committed by GitHub
parent 8be0b7a614
commit 78a94730be
35 changed files with 913 additions and 170 deletions

View File

@@ -1,5 +1,6 @@
using Content.Shared.Bed.Sleep;
using Content.Shared.CCVar;
using Content.Shared.StatusEffectNew;
using Robust.Shared.Configuration;
using Robust.Shared.Player;
using Robust.Shared.Timing;
@@ -13,6 +14,7 @@ public sealed class SSDIndicatorSystem : EntitySystem
{
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedStatusEffectsSystem _statusEffects = default!;
private bool _icSsdSleep;
private float _icSsdSleepTime;
@@ -37,10 +39,11 @@ public sealed class SSDIndicatorSystem : EntitySystem
component.FallAsleepTime = TimeSpan.Zero;
if (component.ForcedSleepAdded) // Remove component only if it has been added by this system
{
EntityManager.RemoveComponent<ForcedSleepingComponent>(uid);
_statusEffects.TryRemoveStatusEffect(uid, SleepingSystem.StatusEffectForcedSleeping);
component.ForcedSleepAdded = false;
}
}
Dirty(uid, component);
}
@@ -53,6 +56,7 @@ public sealed class SSDIndicatorSystem : EntitySystem
{
component.FallAsleepTime = _timing.CurTime + TimeSpan.FromSeconds(_icSsdSleepTime);
}
Dirty(uid, component);
}
@@ -79,12 +83,11 @@ public sealed class SSDIndicatorSystem : EntitySystem
while (query.MoveNext(out var uid, out var ssd))
{
// Forces the entity to sleep when the time has come
if(ssd.IsSSD &&
if (ssd.IsSSD &&
ssd.FallAsleepTime <= _timing.CurTime &&
!TerminatingOrDeleted(uid) &&
!HasComp<ForcedSleepingComponent>(uid)) // Don't add the component if the entity has it from another sources
!TerminatingOrDeleted(uid))
{
EnsureComp<ForcedSleepingComponent>(uid);
_statusEffects.TryAddStatusEffect(uid, SleepingSystem.StatusEffectForcedSleeping);
ssd.ForcedSleepAdded = true;
}
}