Makes construction graphs turing complete (#3516)
* Makes construction graphs turing complete * Improvements
This commit is contained in:
committed by
GitHub
parent
2648ba4e57
commit
13e95ac9a8
28
Content.Server/Construction/Conditions/AllConditions.cs
Normal file
28
Content.Server/Construction/Conditions/AllConditions.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Construction;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Construction.Conditions
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public class AllConditions : IEdgeCondition
|
||||
{
|
||||
[field: DataField("conditions")]
|
||||
public IEdgeCondition[] Conditions { get; } = Array.Empty<IEdgeCondition>();
|
||||
|
||||
public async Task<bool> Condition(IEntity entity)
|
||||
{
|
||||
foreach (var condition in Conditions)
|
||||
{
|
||||
if (!await condition.Condition(entity))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user