Files
wwdpublic/Content.Server/Wires/WireLayout.cs
SimpleStation14 5c2cff0022 Mirror: Fix wire layout inheritance. (#284)
## Mirror of PR #26289: [Fix wire layout
inheritance.](https://github.com/space-wizards/space-station-14/pull/26289)
from <img src="https://avatars.githubusercontent.com/u/10567778?v=4"
alt="space-wizards" width="22"/>
[space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14)

###### `a4692004de978cda6761d4090e13ed4d8bc1fa11`

PR opened by <img
src="https://avatars.githubusercontent.com/u/8107459?v=4" width="16"/><a
href="https://github.com/PJB3005"> PJB3005</a> at 2024-03-20 14:42:55
UTC

---

PR changed 2 files with 105 additions and 0 deletions.

The PR had the following labels:


---

<details open="true"><summary><h1>Original Body</h1></summary>

> Wire layouts manually navigate the inheritance hierarchy, but the data
fields on the prototypes were also automatically inherited already. This
meant that inheriting a wire layout prototype and changing nothing would
cause the wires to be duplicated unless they were manually modified on
top.
> 
> Fix is easy: just disable inheritance on the data fields.
> 
> Also, integration test for it.
> 


</details>

Co-authored-by: SimpleStation14 <Unknown>
Co-authored-by: Danger Revolution! <142105406+DangerRevolution@users.noreply.github.com>
2024-05-29 00:19:32 -04:00

41 lines
1.3 KiB
C#

using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
namespace Content.Server.Wires;
/// <summary>
/// WireLayout prototype.
///
/// This is meant for ease of organizing wire sets on entities that use
/// wires. Once one of these is initialized, it should be stored in the
/// WiresSystem as a functional wire set.
/// </summary>
[Prototype("wireLayout")]
public sealed partial class WireLayoutPrototype : IPrototype, IInheritingPrototype
{
[IdDataField]
public string ID { get; private set; } = default!;
[ParentDataField(typeof(AbstractPrototypeIdArraySerializer<WireLayoutPrototype>))]
public string[]? Parents { get; private set; }
[AbstractDataField]
public bool Abstract { get; }
/// <summary>
/// How many wires in this layout will do
/// nothing (these are added upon layout
/// initialization)
/// </summary>
[DataField("dummyWires")]
[NeverPushInheritance]
public int DummyWires { get; private set; } = default!;
/// <summary>
/// All the valid IWireActions currently in this layout.
/// </summary>
[DataField("wires")]
[NeverPushInheritance]
public List<IWireAction>? Wires { get; private set; }
}