fixed pixel to use new callback system
This commit is contained in:
@ -1,24 +1,24 @@
|
||||
|
||||
return function(gate, argv)
|
||||
if argv[1]=="\\:" then argv[1] = ";" end
|
||||
|
||||
local keycode = keyboard_keyToCode[argv[1]] or keyboard_keyToCode["invalid"]
|
||||
local status = keyboard_strToBool[argv[2]]
|
||||
|
||||
local code = keycode+(status and 128 or 0)
|
||||
|
||||
local function queueBit(bit)
|
||||
table.insert(gate.queueBits, 1, bit)
|
||||
end
|
||||
|
||||
queueBit(true)
|
||||
for bitidx = 1, 8 do
|
||||
local val = bit.band(code, 0x80)~=0
|
||||
queueBit(val)
|
||||
|
||||
code = bit.lshift(code, 1)
|
||||
end
|
||||
queueBit(false)
|
||||
|
||||
gate:queue(0)
|
||||
end
|
||||
|
||||
return function(gate, argv)
|
||||
if argv[1]=="\\:" then argv[1] = ";" end
|
||||
|
||||
local keycode = keyboard_keyToCode[argv[1]] or keyboard_keyToCode["invalid"]
|
||||
local status = keyboard_strToBool[argv[2]]
|
||||
|
||||
local code = keycode+(status and 128 or 0)
|
||||
|
||||
local function queueBit(bit)
|
||||
table.insert(gate.queueBits, 1, bit)
|
||||
end
|
||||
|
||||
queueBit(true)
|
||||
for bitidx = 1, 8 do
|
||||
local val = bit.band(code, 0x80)~=0
|
||||
queueBit(val)
|
||||
|
||||
code = bit.lshift(code, 1)
|
||||
end
|
||||
queueBit(false)
|
||||
|
||||
gate:queue(0)
|
||||
end
|
||||
|
@ -1,10 +1,10 @@
|
||||
|
||||
return function(gate)
|
||||
if #gate.queueBits~=0 then
|
||||
local bit = table.remove(gate.queueBits, #gate.queueBits)
|
||||
gate.ports[1]:setstate(bit)
|
||||
gate:queue(1)
|
||||
else
|
||||
gate.ports[1]:setstate(false)
|
||||
end
|
||||
end
|
||||
|
||||
return function(gate)
|
||||
if #gate.queueBits~=0 then
|
||||
local bit = table.remove(gate.queueBits, #gate.queueBits)
|
||||
gate.ports[1]:setstate(bit)
|
||||
gate:queue(1)
|
||||
else
|
||||
gate.ports[1]:setstate(false)
|
||||
end
|
||||
end
|
||||
|
@ -1,44 +1,44 @@
|
||||
|
||||
datablock fxDTSBrickData(LogicGate_Switch_Data)
|
||||
{
|
||||
category = "Logic Bricks";
|
||||
subCategory = "Inputs";
|
||||
uiName = "Switch";
|
||||
iconName = $LuaLogic::Path @ "icons/Switch";
|
||||
brickFile = $LuaLogic::Path @ "bricks/blb/switch.blb";
|
||||
hasPrint = 1;
|
||||
printAspectRatio = "Logic";
|
||||
orientationFix = 3;
|
||||
|
||||
isLogic = 1;
|
||||
isLogicGate = 1;
|
||||
isLogicInput = 1;
|
||||
|
||||
logicInput = lualogic_readfile($LuaLogic::Path @ "bricks/inputs/switch-input.lua");
|
||||
|
||||
numLogicPorts = 2;
|
||||
|
||||
logicPortType[0] = 0;
|
||||
logicPortPos[0] = "0 1 0";
|
||||
logicPortDir[0] = "1";
|
||||
|
||||
logicPortType[1] = 0;
|
||||
logicPortPos[1] = "0 -1 0";
|
||||
logicPortDir[1] = "3";
|
||||
};
|
||||
lualogic_registergatedefinition("LogicGate_Switch_Data");
|
||||
|
||||
function LogicGate_Switch_Data::Logic_onInput(%this, %obj, %pos, %norm)
|
||||
{
|
||||
lualogic_sendinput(%obj, 0);
|
||||
}
|
||||
|
||||
function LogicGate_Switch_Data::Logic_onAdd(%this, %obj)
|
||||
{
|
||||
lualogic_sendinput(%obj, 1, %obj.getColorFXID() == 3);
|
||||
}
|
||||
|
||||
function LogicGate_Switch_Data::LuaLogic_Callback(%this, %obj, %data)
|
||||
{
|
||||
%obj.setColorFX(getField(%data, 0) == 1 ? 3 : 0);
|
||||
}
|
||||
|
||||
datablock fxDTSBrickData(LogicGate_Switch_Data)
|
||||
{
|
||||
category = "Logic Bricks";
|
||||
subCategory = "Inputs";
|
||||
uiName = "Switch";
|
||||
iconName = $LuaLogic::Path @ "icons/Switch";
|
||||
brickFile = $LuaLogic::Path @ "bricks/blb/switch.blb";
|
||||
hasPrint = 1;
|
||||
printAspectRatio = "Logic";
|
||||
orientationFix = 3;
|
||||
|
||||
isLogic = 1;
|
||||
isLogicGate = 1;
|
||||
isLogicInput = 1;
|
||||
|
||||
logicInput = lualogic_readfile($LuaLogic::Path @ "bricks/inputs/switch-input.lua");
|
||||
|
||||
numLogicPorts = 2;
|
||||
|
||||
logicPortType[0] = 0;
|
||||
logicPortPos[0] = "0 1 0";
|
||||
logicPortDir[0] = "1";
|
||||
|
||||
logicPortType[1] = 0;
|
||||
logicPortPos[1] = "0 -1 0";
|
||||
logicPortDir[1] = "3";
|
||||
};
|
||||
lualogic_registergatedefinition("LogicGate_Switch_Data");
|
||||
|
||||
function LogicGate_Switch_Data::Logic_onInput(%this, %obj, %pos, %norm)
|
||||
{
|
||||
lualogic_sendinput(%obj, 0);
|
||||
}
|
||||
|
||||
function LogicGate_Switch_Data::Logic_onAdd(%this, %obj)
|
||||
{
|
||||
lualogic_sendinput(%obj, 1, %obj.getColorFXID() == 3);
|
||||
}
|
||||
|
||||
function LogicGate_Switch_Data::LuaLogic_Callback(%this, %obj, %data)
|
||||
{
|
||||
%obj.setColorFX(getField(%data, 0) == 1 ? 3 : 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user