]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add Sprite changes to Logic Gates to show the input/output state (#33277)
author0tito <147736056+0tito@users.noreply.github.com>
Fri, 6 Dec 2024 15:35:48 +0000 (12:35 -0300)
committerGitHub <noreply@github.com>
Fri, 6 Dec 2024 15:35:48 +0000 (16:35 +0100)
Content.Server/DeviceLinking/Systems/LogicGateSystem.cs
Content.Shared/DeviceLinking/SharedLogicGate.cs
Resources/Prototypes/Entities/Structures/gates.yml
Resources/Textures/Objects/Devices/gates.rsi/logic_a.png [new file with mode: 0644]
Resources/Textures/Objects/Devices/gates.rsi/logic_b.png [new file with mode: 0644]
Resources/Textures/Objects/Devices/gates.rsi/logic_o.png [new file with mode: 0644]
Resources/Textures/Objects/Devices/gates.rsi/meta.json

index 598d5a2725ef70691620709d3125082cb6d2e365..1280ecd5d1197fd3a2b795fc250fa6e9051b5678 100644 (file)
@@ -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)
         {
index 8d814f461fe9a45701cba6254f051a1bdee906d5..75f8cb4951c0fad01ec6f68c4e49d56096bd8253 100644 (file)
@@ -23,7 +23,10 @@ public enum LogicGate : byte
 [Serializable, NetSerializable]
 public enum LogicGateVisuals : byte
 {
-    Gate
+    Gate,
+    InputA,
+    InputB,
+    Output
 }
 
 /// <summary>
@@ -32,5 +35,8 @@ public enum LogicGateVisuals : byte
 [Serializable, NetSerializable]
 public enum LogicGateLayers : byte
 {
-    Gate
+    Gate,
+    InputA,
+    InputB,
+    Output
 }
index 8e6096232142e9e896b853c3507d0a72896f5e52..3cae4411a6b3acd750326c3e20d93d44bf916b38 100644 (file)
     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
           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
   - 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
   - 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
   - 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
   - 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
   - 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 (file)
index 0000000..4727847
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 (file)
index 0000000..e8a848a
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 (file)
index 0000000..e7af90e
Binary files /dev/null and b/Resources/Textures/Objects/Devices/gates.rsi/logic_o.png differ
index 761bdab87a6bb1c9f7e8ad799a529904c33c8450..ba7c7ea232df7a69b8217d92245f42e44fec54e1 100644 (file)
@@ -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
     {
       "name": "logic"
     },
+    {
+       "name":  "logic_o"
+    },
+    {
+       "name":  "logic_b"
+    },
+    {
+      "name":  "logic_a"
+    },
     {
       "name": "or"
     },