From: 0tito <147736056+0tito@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:35:48 +0000 (-0300) Subject: Add Sprite changes to Logic Gates to show the input/output state (#33277) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=de19418126127b91166da6f52832832145003416;p=space-station-14.git Add Sprite changes to Logic Gates to show the input/output state (#33277) --- diff --git a/Content.Server/DeviceLinking/Systems/LogicGateSystem.cs b/Content.Server/DeviceLinking/Systems/LogicGateSystem.cs index 598d5a2725..1280ecd5d1 100644 --- a/Content.Server/DeviceLinking/Systems/LogicGateSystem.cs +++ b/Content.Server/DeviceLinking/Systems/LogicGateSystem.cs @@ -102,10 +102,12 @@ public sealed class LogicGateSystem : EntitySystem if (args.Port == comp.InputPortA) { comp.StateA = state; + _appearance.SetData(uid, LogicGateVisuals.InputA, state == SignalState.High); //If A == High => Sets input A sprite to True } else if (args.Port == comp.InputPortB) { comp.StateB = state; + _appearance.SetData(uid, LogicGateVisuals.InputB, state == SignalState.High); //If B == High => Sets input B sprite to True } UpdateOutput(uid, comp); @@ -143,6 +145,8 @@ public sealed class LogicGateSystem : EntitySystem break; } + _appearance.SetData(uid, LogicGateVisuals.Output, output); + // only send a payload if it actually changed if (output != comp.LastOutput) { diff --git a/Content.Shared/DeviceLinking/SharedLogicGate.cs b/Content.Shared/DeviceLinking/SharedLogicGate.cs index 8d814f461f..75f8cb4951 100644 --- a/Content.Shared/DeviceLinking/SharedLogicGate.cs +++ b/Content.Shared/DeviceLinking/SharedLogicGate.cs @@ -23,7 +23,10 @@ public enum LogicGate : byte [Serializable, NetSerializable] public enum LogicGateVisuals : byte { - Gate + Gate, + InputA, + InputB, + Output } /// @@ -32,5 +35,8 @@ public enum LogicGateVisuals : byte [Serializable, NetSerializable] public enum LogicGateLayers : byte { - Gate + Gate, + InputA, + InputB, + Output } diff --git a/Resources/Prototypes/Entities/Structures/gates.yml b/Resources/Prototypes/Entities/Structures/gates.yml index 8e60962321..3cae4411a6 100644 --- a/Resources/Prototypes/Entities/Structures/gates.yml +++ b/Resources/Prototypes/Entities/Structures/gates.yml @@ -36,6 +36,15 @@ layers: - state: base - state: logic + - state: logic_a + visible: false + map: [ "enum.LogicGateLayers.InputA" ] + - state: logic_b + visible: false + map: [ "enum.LogicGateLayers.InputB" ] + - state: logic_o + visible: false + map: [ "enum.LogicGateLayers.Output" ] - state: or map: [ "enum.LogicGateLayers.Gate" ] - type: LogicGate @@ -63,7 +72,18 @@ Nor: { state: nor } Nand: { state: nand } Xnor: { state: xnor } - + enum.LogicGateVisuals.InputA: + enum.LogicGateLayers.InputA: + True: { visible: true } + False: { visible: false } + enum.LogicGateVisuals.InputB: + enum.LogicGateLayers.InputB: + True: { visible: true } + False: { visible: false } + enum.LogicGateVisuals.Output: + enum.LogicGateLayers.Output: + True: { visible: true } + False: { visible: false } - type: entity parent: LogicGateOr id: LogicGateAnd @@ -72,6 +92,16 @@ - type: Sprite layers: - state: base + - state: logic + - state: logic_a + visible: false + map: [ "enum.LogicGateLayers.InputA" ] + - state: logic_b + visible: false + map: [ "enum.LogicGateLayers.InputB" ] + - state: logic_o + visible: false + map: [ "enum.LogicGateLayers.Output" ] - state: and map: [ "enum.LogicGateLayers.Gate" ] - type: LogicGate @@ -85,6 +115,16 @@ - type: Sprite layers: - state: base + - state: logic + - state: logic_a + visible: false + map: [ "enum.LogicGateLayers.InputA" ] + - state: logic_b + visible: false + map: [ "enum.LogicGateLayers.InputB" ] + - state: logic_o + visible: false + map: [ "enum.LogicGateLayers.Output" ] - state: xor map: [ "enum.LogicGateLayers.Gate" ] - type: LogicGate @@ -98,6 +138,16 @@ - type: Sprite layers: - state: base + - state: logic + - state: logic_a + visible: false + map: [ "enum.LogicGateLayers.InputA" ] + - state: logic_b + visible: false + map: [ "enum.LogicGateLayers.InputB" ] + - state: logic_o + visible: false + map: [ "enum.LogicGateLayers.Output" ] - state: nor map: [ "enum.LogicGateLayers.Gate" ] - type: LogicGate @@ -111,6 +161,16 @@ - type: Sprite layers: - state: base + - state: logic + - state: logic_a + visible: false + map: [ "enum.LogicGateLayers.InputA" ] + - state: logic_b + visible: false + map: [ "enum.LogicGateLayers.InputB" ] + - state: logic_o + visible: false + map: [ "enum.LogicGateLayers.Output" ] - state: nand map: [ "enum.LogicGateLayers.Gate" ] - type: LogicGate @@ -124,6 +184,16 @@ - type: Sprite layers: - state: base + - state: logic + - state: logic_a + visible: false + map: [ "enum.LogicGateLayers.InputA" ] + - state: logic_b + visible: false + map: [ "enum.LogicGateLayers.InputB" ] + - state: logic_o + visible: false + map: [ "enum.LogicGateLayers.Output" ] - state: xnor map: [ "enum.LogicGateLayers.Gate" ] - type: LogicGate diff --git a/Resources/Textures/Objects/Devices/gates.rsi/logic_a.png b/Resources/Textures/Objects/Devices/gates.rsi/logic_a.png new file mode 100644 index 0000000000..4727847a9c Binary files /dev/null and b/Resources/Textures/Objects/Devices/gates.rsi/logic_a.png differ diff --git a/Resources/Textures/Objects/Devices/gates.rsi/logic_b.png b/Resources/Textures/Objects/Devices/gates.rsi/logic_b.png new file mode 100644 index 0000000000..e8a848ab9b Binary files /dev/null and b/Resources/Textures/Objects/Devices/gates.rsi/logic_b.png differ diff --git a/Resources/Textures/Objects/Devices/gates.rsi/logic_o.png b/Resources/Textures/Objects/Devices/gates.rsi/logic_o.png new file mode 100644 index 0000000000..e7af90e951 Binary files /dev/null and b/Resources/Textures/Objects/Devices/gates.rsi/logic_o.png differ diff --git a/Resources/Textures/Objects/Devices/gates.rsi/meta.json b/Resources/Textures/Objects/Devices/gates.rsi/meta.json index 761bdab87a..ba7c7ea232 100644 --- a/Resources/Textures/Objects/Devices/gates.rsi/meta.json +++ b/Resources/Textures/Objects/Devices/gates.rsi/meta.json @@ -1,7 +1,7 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "or.png originally created by Kevin Zheng, 2022. All are modified by deltanedas (github) for SS14, 2024.", + "copyright": "or.png originally created by Kevin Zheng, 2022. All are modified by deltanedas (github) for SS14, 2024. Sprites logic_a logic_b logic_o were made by 0tito (github) for SS14", "size": { "x": 32, "y": 32 @@ -13,6 +13,15 @@ { "name": "logic" }, + { + "name": "logic_o" + }, + { + "name": "logic_b" + }, + { + "name": "logic_a" + }, { "name": "or" },