make states numbers instead of booleans

This commit is contained in:
Redo0
2021-05-29 13:14:50 -05:00
parent b08c3cd0c4
commit 16c1a9f75f
309 changed files with 2819 additions and 2819 deletions

View File

@ -1,4 +1,8 @@
local function queueBit(gate, bit)
table.insert(gate.queueBits, 1, bit)
end
return function(gate, argv)
if argv[1]=="\\:" then argv[1] = ";" end
@ -7,18 +11,14 @@ return function(gate, argv)
local code = keycode+(status and 128 or 0)
local function queueBit(bit)
table.insert(gate.queueBits, 1, bit)
end
queueBit(true)
queueBit(gate, 1)
for bitidx = 1, 8 do
local val = bit.band(code, 0x80)~=0
queueBit(val)
local val = bit.band(code, 0x80)
queueBit(gate, val)
code = bit.lshift(code, 1)
end
queueBit(false)
queueBit(gate, 0)
Gate.queue(gate, 0)
end

View File

@ -5,6 +5,6 @@ return function(gate)
Gate.setportstate(gate, 1, bit)
Gate.queue(gate, 1)
else
Gate.setportstate(gate, 1, false)
Gate.setportstate(gate, 1, 0)
end
end

View File

@ -6,7 +6,7 @@ return function(gate, argv)
else
gatedata.switchstate = not gatedata.switchstate
end
Gate.setportstate(gate, 1, gatedata.switchstate)
Gate.setportstate(gate, 2, gatedata.switchstate)
Gate.setportstate(gate, 1, gatedata.switchstate and 1 or 0)
Gate.setportstate(gate, 2, gatedata.switchstate and 1 or 0)
Gate.cb(gate, bool_to_int[gatedata.switchstate])
end