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:
@@ -1,6 +1,7 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Rejuvenate;
|
||||
using Content.Shared.StatusEffectNew;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -8,6 +9,7 @@ using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.StatusEffect
|
||||
{
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public sealed class StatusEffectsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
@@ -104,6 +106,7 @@ namespace Content.Shared.StatusEffect
|
||||
/// <param name="status">The status effects component to change, if you already have it.</param>
|
||||
/// <returns>False if the effect could not be added or the component already exists, true otherwise.</returns>
|
||||
/// <typeparam name="T">The component type to add and remove from the entity.</typeparam>
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public bool TryAddStatusEffect<T>(EntityUid uid, string key, TimeSpan time, bool refresh,
|
||||
StatusEffectsComponent? status = null)
|
||||
where T : IComponent, new()
|
||||
@@ -123,6 +126,7 @@ namespace Content.Shared.StatusEffect
|
||||
|
||||
}
|
||||
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public bool TryAddStatusEffect(EntityUid uid, string key, TimeSpan time, bool refresh, string component,
|
||||
StatusEffectsComponent? status = null)
|
||||
{
|
||||
@@ -162,6 +166,7 @@ namespace Content.Shared.StatusEffect
|
||||
/// If the effect already exists, it will simply replace the cooldown with the new one given.
|
||||
/// If you want special 'effect merging' behavior, do it your own damn self!
|
||||
/// </remarks>
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public bool TryAddStatusEffect(EntityUid uid,
|
||||
string key,
|
||||
TimeSpan time,
|
||||
@@ -255,6 +260,7 @@ namespace Content.Shared.StatusEffect
|
||||
/// Obviously this doesn't automatically clear any effects a status effect might have.
|
||||
/// That's up to the removed component to handle itself when it's removed.
|
||||
/// </remarks>
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public bool TryRemoveStatusEffect(EntityUid uid, string key,
|
||||
StatusEffectsComponent? status = null, bool remComp = true)
|
||||
{
|
||||
@@ -298,6 +304,7 @@ namespace Content.Shared.StatusEffect
|
||||
/// <param name="uid">The entity to remove effects from.</param>
|
||||
/// <param name="status">The status effects component to change, if you already have it.</param>
|
||||
/// <returns>False if any status effects failed to be removed, true if they all did.</returns>
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public bool TryRemoveAllStatusEffects(EntityUid uid,
|
||||
StatusEffectsComponent? status = null)
|
||||
{
|
||||
@@ -321,6 +328,7 @@ namespace Content.Shared.StatusEffect
|
||||
/// <param name="uid">The entity to check on.</param>
|
||||
/// <param name="key">The status effect ID to check for</param>
|
||||
/// <param name="status">The status effect component, should you already have it.</param>
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public bool HasStatusEffect(EntityUid uid, string key,
|
||||
StatusEffectsComponent? status = null)
|
||||
{
|
||||
@@ -338,6 +346,7 @@ namespace Content.Shared.StatusEffect
|
||||
/// <param name="uid">The entity to check on.</param>
|
||||
/// <param name="key">The status effect ID to check for</param>
|
||||
/// <param name="status">The status effect component, should you already have it.</param>
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public bool CanApplyEffect(EntityUid uid, string key, StatusEffectsComponent? status = null)
|
||||
{
|
||||
// don't log since stuff calling this prolly doesn't care if we don't actually have it
|
||||
@@ -364,6 +373,7 @@ namespace Content.Shared.StatusEffect
|
||||
/// <param name="key">The status effect to add time to.</param>
|
||||
/// <param name="time">The amount of time to add.</param>
|
||||
/// <param name="status">The status effect component, should you already have it.</param>
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public bool TryAddTime(EntityUid uid, string key, TimeSpan time,
|
||||
StatusEffectsComponent? status = null)
|
||||
{
|
||||
@@ -395,6 +405,7 @@ namespace Content.Shared.StatusEffect
|
||||
/// <param name="key">The status effect to remove time from.</param>
|
||||
/// <param name="time">The amount of time to add.</param>
|
||||
/// <param name="status">The status effect component, should you already have it.</param>
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public bool TryRemoveTime(EntityUid uid, string key, TimeSpan time,
|
||||
StatusEffectsComponent? status = null)
|
||||
{
|
||||
@@ -430,6 +441,7 @@ namespace Content.Shared.StatusEffect
|
||||
/// <remarks>
|
||||
/// Not used internally; just sets it itself.
|
||||
/// </remarks>
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public bool TrySetTime(EntityUid uid, string key, TimeSpan time,
|
||||
StatusEffectsComponent? status = null)
|
||||
{
|
||||
@@ -453,6 +465,7 @@ namespace Content.Shared.StatusEffect
|
||||
/// <param name="time">Out var for the time, if it exists.</param>
|
||||
/// <param name="status">The status effects component to use, if any.</param>
|
||||
/// <returns>False if the status effect was not active, true otherwise.</returns>
|
||||
[Obsolete("Migration to Content.Shared.StatusEffectNew.SharedStatusEffectsSystem is required")]
|
||||
public bool TryGetTime(EntityUid uid, string key,
|
||||
[NotNullWhen(true)] out (TimeSpan, TimeSpan)? time,
|
||||
StatusEffectsComponent? status = null)
|
||||
@@ -468,12 +481,6 @@ namespace Content.Shared.StatusEffect
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised on an entity before a status effect is added to determine if adding it should be cancelled.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public record struct BeforeStatusEffectAddedEvent(string Key, bool Cancelled=false);
|
||||
|
||||
public readonly struct StatusEffectAddedEvent
|
||||
{
|
||||
public readonly EntityUid Uid;
|
||||
|
||||
Reference in New Issue
Block a user