mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* 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>
21 lines
826 B
C#
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);
|
|
}
|
|
}
|