mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 10:51:14 +03:00
* refactor: rough strokes for initial implementation * refactor: fix ada remarks * refactor: fix XenoArtifactNodeParser not displaying trigger and effect properly in autocompletion * refactor: more changes for IsNotRepeatingCondition * refactor: update triggers declarations * refactor: remove IsNotRepeatingCondition - duplicate * refactor: fixup after merge with master * refactor: properly handle creation of improper trigger set, all selectors gt ToString override! * refactor: fix missing weight for some triggers, XenoArtifactCommand.UnlockAllNodes now accepts multiple entries * refactor: fix trigger hints loc being name explicitly and failing tests * yaml changes * rename * refactor: fix xml-doc copy-paste for XenoArtifactTriggerParser --------- Co-authored-by: iaada <iaada@users.noreply.github.com>
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using Content.Shared.EntityTable.EntitySelectors;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared.EntityTable.Conditions;
|
|
|
|
/// <summary>
|
|
/// Condition for checking that selector is not going to spawn entity that is marked in current context as excluded .
|
|
/// Can be used to keep spawns unique (if no selector rolls more than 1).
|
|
/// </summary>
|
|
public sealed partial class ExcludeEntitiesFromContextCondition : EntityTableCondition
|
|
{
|
|
/// <summary>
|
|
/// Context key used to track which entity prototypes should not be spawned.
|
|
/// Value should be <see cref="HashSet{EntityUid}"/>.
|
|
/// </summary>
|
|
public const string EntitiesToExclude = "EntitiesToExclude";
|
|
|
|
/// <inheritdoc/>>
|
|
protected override bool EvaluateImplementation(
|
|
EntityTableSelector root,
|
|
IEntityManager entMan,
|
|
IPrototypeManager proto,
|
|
EntityTableContext ctx
|
|
)
|
|
{
|
|
if (!ctx.TryGetData<HashSet<EntProtoId>>(EntitiesToExclude, out var used))
|
|
return true;
|
|
|
|
if (root is not EntSelector entSelector)
|
|
return true;
|
|
|
|
return !used.Contains(entSelector.Id);
|
|
}
|
|
}
|