altered callback functionality
This commit is contained in:
@ -1,36 +1,34 @@
|
||||
|
||||
datablock fxDTSBrickData(LogicGate_TextBrick_Data){
|
||||
brickFile = $LuaLogic::Path @ "bricks/blb/TextBrick.blb";
|
||||
category = "Logic Bricks";
|
||||
subCategory = "Outputs";
|
||||
uiName = "Text Brick";
|
||||
iconName = $LuaLogic::Path @ "icons/Text Brick";
|
||||
hasPrint = 1;
|
||||
printAspectRatio = "Logic";
|
||||
orientationFix = 3;
|
||||
|
||||
isLogic = true;
|
||||
isLogicGate = true;
|
||||
isLogicInput = false;
|
||||
|
||||
logicUIName = "Text Brick";
|
||||
logicUIDesc = "Resets on rise, increments based on pulse length";
|
||||
|
||||
logicInit = lualogic_readfile($LuaLogic::Path @ "bricks/outputs/text-init.lua" );
|
||||
logicUpdate = lualogic_readfile($LuaLogic::Path @ "bricks/outputs/text-update.lua");
|
||||
|
||||
numLogicPorts = 1;
|
||||
|
||||
logicPortType[0] = 1;
|
||||
logicPortPos[0] = "0 0 -1";
|
||||
logicPortDir[0] = 3;
|
||||
logicPortCauseUpdate[0] = true;
|
||||
logicPortUIName[0] = "Inc";
|
||||
};
|
||||
lualogic_registergatedefinition("LogicGate_TextBrick_Data");
|
||||
|
||||
function LogicGate_TextBrick_Data::LuaLogic_Callback(%data, %brick, %args){
|
||||
%printname = getField(%args, 0);
|
||||
|
||||
%brick.setPrint(lualogic_getprint(%printname));
|
||||
}
|
||||
|
||||
datablock fxDTSBrickData(LogicGate_TextBrick_Data){
|
||||
brickFile = $LuaLogic::Path @ "bricks/blb/TextBrick.blb";
|
||||
category = "Logic Bricks";
|
||||
subCategory = "Outputs";
|
||||
uiName = "Text Brick";
|
||||
iconName = $LuaLogic::Path @ "icons/Text Brick";
|
||||
hasPrint = 1;
|
||||
printAspectRatio = "Logic";
|
||||
orientationFix = 3;
|
||||
|
||||
isLogic = true;
|
||||
isLogicGate = true;
|
||||
isLogicInput = false;
|
||||
|
||||
logicUIName = "Text Brick";
|
||||
logicUIDesc = "Resets on rise, increments based on pulse length";
|
||||
|
||||
logicInit = lualogic_readfile($LuaLogic::Path @ "bricks/outputs/text-init.lua" );
|
||||
logicUpdate = lualogic_readfile($LuaLogic::Path @ "bricks/outputs/text-update.lua");
|
||||
|
||||
numLogicPorts = 1;
|
||||
|
||||
logicPortType[0] = 1;
|
||||
logicPortPos[0] = "0 0 -1";
|
||||
logicPortDir[0] = 3;
|
||||
logicPortCauseUpdate[0] = true;
|
||||
logicPortUIName[0] = "Inc";
|
||||
};
|
||||
lualogic_registergatedefinition("LogicGate_TextBrick_Data");
|
||||
|
||||
function LogicGate_TextBrick_Data::LuaLogic_Callback(%data, %brick, %printname){
|
||||
%brick.setPrint(lualogic_getprint(%printname));
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
|
||||
return function(gate)
|
||||
if gate.ports[1]:isrising() then
|
||||
gate.tickStarted = gate:gettick()
|
||||
elseif gate.ports[1]:isfalling() then
|
||||
local ticksOn = gate:gettick() - gate.tickStarted
|
||||
|
||||
local printid = ((ticksOn-1) % #textbrick_idxToPrint)
|
||||
local printname = textbrick_idxToPrint[printid]
|
||||
|
||||
gate:cb("1\t" .. printname)
|
||||
end
|
||||
end
|
||||
|
||||
return function(gate)
|
||||
if gate.ports[1]:isrising() then
|
||||
gate.tickStarted = gate:gettick()
|
||||
elseif gate.ports[1]:isfalling() then
|
||||
local ticksOn = gate:gettick() - gate.tickStarted
|
||||
|
||||
local printid = ((ticksOn-1) % #textbrick_idxToPrint)
|
||||
local printname = textbrick_idxToPrint[printid]
|
||||
|
||||
gate:cb(printname)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user