Use construction graphs for hacking protections (#20265)

This commit is contained in:
chromiumboy
2023-10-05 22:15:03 -05:00
committed by GitHub
parent 8eeedb2427
commit acc9c8940b
20 changed files with 363 additions and 581 deletions

View File

@@ -1,4 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using Content.Shared.Construction.NodeEntities;
using Content.Shared.Construction.Serialization;
using Robust.Shared.Prototypes;
@@ -31,6 +31,20 @@ namespace Content.Shared.Construction
[DataField("entity", customTypeSerializer: typeof(GraphNodeEntitySerializer), serverOnly:true)]
public IGraphNodeEntity Entity { get; private set; } = new NullNodeEntity();
/// <summary>
/// Ignore requests to change the entity if the entity's current prototype inherits from specified replacement
/// </summary>
/// <remarks>
/// When this bool is true and a construction node specifies that the current entity should be replaced with a new entity, if the
/// current entity has an entity prototype which inherits from the replacement entity prototype, entity replacement will not occur.
/// E.g., if an entity with the 'AirlockCommand' prototype was to be replaced with a new entity that had the 'Airlock' prototype,
/// and 'DoNotReplaceInheritingEntities' was true, the entity would not be replaced because 'AirlockCommand' is derived from 'Airlock'
/// This will largely be used for construction graphs which have removeable upgrades, such as hacking protections for airlocks,
/// so that the upgrades can be removed and you can return to the last primary construction step without replacing the entity
/// </remarks>
[DataField("doNotReplaceInheritingEntities")]
public bool DoNotReplaceInheritingEntities = false;
public ConstructionGraphEdge? GetEdge(string target)
{
foreach (var edge in _edges)