Add Sprite changes to Logic Gates to show the input/output state (#33277)

This commit is contained in:
0tito
2024-12-06 12:35:48 -03:00
committed by GitHub
parent 6add781c4a
commit de19418126
7 changed files with 93 additions and 4 deletions

View 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)
{