12 [Serialize(
"", IsPropertySaveable.Yes, description:
"Tag of the item to check.")]
15 [Serialize(
"", IsPropertySaveable.Yes, description:
"The name of the connection to check on the target item.")]
18 [Serialize(
"", IsPropertySaveable.Yes, description:
"Tag of the item the connection must be wired to. If omitted, it doesn't matter what the connection is wired to.")]
21 [Serialize(
"", IsPropertySaveable.Yes, description:
"The name of the other connection the connection must be wired to. If omitted, it doesn't matter what the connection is wired to.")]
24 [Serialize(1, IsPropertySaveable.Yes, description:
"Minimum number of matching connections for the check to succeed.")]
27 public CheckConnectionAction(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element) { }
33 foreach (var target
in ParentEvent.GetTargets(
ItemTag))
35 if (target is not Item targetItem) {
continue; }
37 if (panel.Connections ==
null || panel.Connections.None()) {
continue; }
38 foreach (var connection
in panel.Connections)
40 if (!IsCorrectConnection(connection,
ConnectionName)) {
continue; }
43 amount += connection.Wires.Count;
47 foreach (var wire
in connection.Wires)
49 if (wire.OtherConnection(connection) is not
Connection otherConnection) {
continue; }
54 bool IsCorrectItem() => connectTargets.Contains(otherConnection.Item);
57 bool IsCorrectConnection(
Connection connection, Identifier
id) => connection.
Name.ToIdentifier() == id;
Check whether a specific connection of an item is wired to a specific kind of connection.
CheckConnectionAction(ScriptedEvent parentEvent, ContentXElement element)
Identifier ConnectionName
override? bool DetermineSuccess()
Identifier ConnectedItemTag
Identifier OtherConnectionName