update logic functions to remove metatable OOP

This commit is contained in:
Redo
2020-09-10 12:58:25 -05:00
parent 4095d193ff
commit ab19de7333
206 changed files with 22726 additions and 3544 deletions

View File

@@ -27,20 +27,20 @@ datablock fxDtsBrickData(LogicGate_Demux5_Data){
logicInput = "";
logicUpdate =
"return function(gate) " @
" if gate.ports[38].state then " @
" if Gate.getportstate(gate, 38) then " @
" local idx = 6 + " @
" (gate.ports[1].state and 1 or 0) + " @
" (gate.ports[2].state and 2 or 0) + " @
" (gate.ports[3].state and 4 or 0) + " @
" (gate.ports[4].state and 8 or 0) + " @
" (gate.ports[5].state and 16 or 0) " @
" gate.ports[idx]:setstate(true) " @
" (bool_to_int[Gate.getportstate(gate, 1)] * 1) + " @
" (bool_to_int[Gate.getportstate(gate, 2)] * 2) + " @
" (bool_to_int[Gate.getportstate(gate, 3)] * 4) + " @
" (bool_to_int[Gate.getportstate(gate, 4)] * 8) + " @
" (bool_to_int[Gate.getportstate(gate, 5)] * 16) " @
" Gate.setportstate(gate, idx, true) " @
" if gate.laston~=idx then " @
" gate.ports[gate.laston]:setstate(false) " @
" Gate.setportstate(gate, gate.laston, false) " @
" gate.laston = idx " @
" end " @
" else " @
" gate.ports[gate.laston]:setstate(false) " @
" Gate.setportstate(gate, gate.laston, false) " @
" end " @
"end"
;