fix switch to use new oop
This commit is contained in:
parent
ab19de7333
commit
58133caa95
@ -1,11 +1,12 @@
|
||||
|
||||
return function(gate, argv)
|
||||
local gatedata = Gate.getdata(gate)
|
||||
if #argv == 1 then
|
||||
gate.switchstate = toboolean(argv[1])
|
||||
gatedata.switchstate = toboolean(argv[1])
|
||||
else
|
||||
gate.switchstate = not gate.switchstate
|
||||
gatedata.switchstate = not gatedata.switchstate
|
||||
end
|
||||
Gate.setportstate(gate, 1, gate.switchstate)
|
||||
Gate.setportstate(gate, 2, gate.switchstate)
|
||||
Gate.cb(gate, bool_to_int[gate.ports[1].state])
|
||||
Gate.setportstate(gate, 1, gatedata.switchstate)
|
||||
Gate.setportstate(gate, 2, gatedata.switchstate)
|
||||
Gate.cb(gate, bool_to_int[gatedata.switchstate])
|
||||
end
|
||||
|
@ -14,7 +14,7 @@ datablock fxDTSBrickData(LogicGate_Switch_Data)
|
||||
isLogicGate = 1;
|
||||
isLogicInput = 1;
|
||||
|
||||
logicInit = "return function(gate) gate.switchstate = false end";
|
||||
logicInit = "return function(gate) Gate.initdata(gate) local gatedata = Gate.getdata(gate) gatedata.switchstate = false end";
|
||||
logicInput = lualogic_readfile($LuaLogic::Path @ "bricks/inputs/switch-input.lua");
|
||||
|
||||
numLogicPorts = 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user