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

@ -1,4 +1,4 @@
return function(gate)
gate:cb(gate.ports[1].state and 1 or 0)
Gate.cb(gate, Gate.getportstate(gate, 1) and 1 or 0)
end

View File

@ -42,6 +42,8 @@ datablock fxDtsBrickData(LogicGate_Pixel3Upsidedown_Data : LogicGate_Pixel3_Data
logicUiName = "Pixel Upside Down";
logicUpdate = lualogic_readfile($LuaLogic::Path @ "bricks/outputs/pixel3-update.lua");
logicPortPos[0] = "0 0 1";
};
lualogic_registergatedefinition("LogicGate_Pixel3Upsidedown_Data");
@ -49,3 +51,6 @@ lualogic_registergatedefinition("LogicGate_Pixel3Upsidedown_Data");
function LogicGate_Pixel3Upsidedown_Data::LuaLogic_Callback(%data, %brick, %state){
LogicGate_Pixel3_Data::LuaLogic_Callback(%data, %brick, %state);
}
$ND::ManualSymmetryZ["Logic Pixel" ] = "Logic Pixel Upside Down";
$ND::ManualSymmetryZ["Logic Pixel Upside Down"] = "Logic Pixel" ;

View File

@ -24,7 +24,7 @@ local function getBit(gate, val)
local printid = gate.valReceived
local printname = textbrick2_idxToPrint[printid]
gate:cb(printname)
Gate.cb(gate, printname)
--print("", "set print", string.format("%02x", printid), printname)
end
@ -37,7 +37,7 @@ local function getBit(gate, val)
end
local function changeTo(gate, val)
local tick = gate:gettick()
local tick = Gate.gettick(gate)
local ticks = tick-gate.lastTickChanged
local bits = math.min(ticks, 10)
@ -49,9 +49,9 @@ local function changeTo(gate, val)
end
return function(gate)
if gate.ports[1]:isrising() then
if Gate.getportisrising(gate, 1) then
changeTo(gate, 0)
elseif gate.ports[1]:isfalling() then
elseif Gate.getportisfalling(gate, 2) then
changeTo(gate, 1)
end
end