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

@@ -15,10 +15,14 @@ datablock fxDTSBrickData(LogicGate_HalfAdder_Data)
logicUIName = "Half Adder";
logicUIDesc = "Adds A and B";
logicUpdate = "return function(gate) gate.ports[3]:setstate(bit.bxor(bool_to_int[gate.ports[1].state], bool_to_int[gate.ports[2].state]) == 1) " @
"gate.ports[4]:setstate(gate.ports[1].state and gate.ports[2].state) end";
logicUpdate =
"return function(gate) " @
" Gate.setportstate(gate, 3, bit.bxor(bool_to_int[Gate.getportstate(gate, 1)], bool_to_int[Gate.getportstate(gate, 2)]) == 1) " @
" Gate.setportstate(gate, 4, Gate.getportstate(gate, 1) and Gate.getportstate(gate, 2)) " @
"end"
;
numLogicPorts = 4;
logicPortType[0] = 1;