CatStation/Content.Shared/EntityEffects/SharedEntityEffectsSystem.Nested.cs
deltanedas d9d0cd92ae
add nested entity effects+conditions (#42341)
* add nested effect

* add nested condition

* move api to the main systems and improve effect guidebook text gen

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
2026-03-03 15:16:04 +00:00

21 lines
826 B
C#

using Robust.Shared.Prototypes;
namespace Content.Shared.EntityEffects;
/// <summary>
/// Entity effects API counterparts using <see cref="EntityEffectPrototype"/> instead of <see cref="EntityEffect"/>.
// </summary>
public sealed partial class SharedEntityEffectsSystem
{
[Dependency] private readonly IPrototypeManager _proto = default!;
/// <summary>
/// <c>TryApplyEffect</c> overload using a <see cref="EntityEffectPrototype"/> instead of <see cref="EntityEffect"/>.
/// </summary>
public void TryApplyEffect(EntityUid target, [ForbidLiteral] ProtoId<EntityEffectPrototype> id, float scale = 1f, EntityUid? user = null)
{
var proto = _proto.Index(id);
if (_condition.TryConditions(target, proto.Conditions))
ApplyEffects(target, proto.Effects, scale, user);
}
}