mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 02:41:18 +03:00
* documentation pass on content.server -> E! * APi pass on content.server for the E folder. * documentation pass on content.shared for e. * Apply suggestions from code review Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> * fixing documentation according to review part 1. * typo * Very minor fixes * And a short explanation about EUI --------- Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
31 lines
1 KiB
C#
31 lines
1 KiB
C#
using Content.Shared.EntityTable.EntitySelectors;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared.EntityTable.Conditions;
|
|
|
|
/// <summary>
|
|
/// Used for implementing conditional logic for <see cref="EntityTableSelector"/>.
|
|
/// </summary>
|
|
[ImplicitDataDefinitionForInheritors, UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)]
|
|
public abstract partial class EntityTableCondition
|
|
{
|
|
/// <summary>
|
|
/// If true, inverts the result of the condition.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool Invert;
|
|
|
|
/// <summary>
|
|
/// Evaluates a condition for a given context.
|
|
/// </summary>
|
|
public bool Evaluate(EntityTableSelector root, IEntityManager entMan, IPrototypeManager proto, EntityTableContext ctx)
|
|
{
|
|
var res = EvaluateImplementation(root, entMan, proto, ctx);
|
|
|
|
// XOR eval to invert the result.
|
|
return res ^ Invert;
|
|
}
|
|
|
|
protected abstract bool EvaluateImplementation(EntityTableSelector root, IEntityManager entMan, IPrototypeManager proto, EntityTableContext ctx);
|
|
}
|