mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-30 08:07:28 +00: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>
22 lines
826 B
C#
22 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);
|
|
}
|
|
}
|