Moved scripts into separate folder
This commit is contained in:
48
bricks/outputs/HorizontalPixel.cs
Normal file
48
bricks/outputs/HorizontalPixel.cs
Normal file
@ -0,0 +1,48 @@
|
||||
datablock fxDTSBrickData(LogicGate_HorizontalPixel_Data)
|
||||
{
|
||||
brickFile = $LuaLogic::Path @ "bricks/blb/pixels/HPixel.blb";
|
||||
category = "Logic Bricks";
|
||||
subCategory = "Outputs";
|
||||
uiName = "Horizontal Pixel";
|
||||
iconName = $LuaLogic::Path @ "icons/Horizontal Pixel";
|
||||
hasPrint = 1;
|
||||
printAspectRatio = "Logic";
|
||||
orientationFix = 3;
|
||||
|
||||
isLogic = true;
|
||||
isLogicGate = true;
|
||||
isLogicInput = false;
|
||||
|
||||
logicUIName = "Horizontal Pixel";
|
||||
logicUIDesc = "";
|
||||
|
||||
logicUpdate = "return function(gate) gate:cb(\"3\t\" .. bool_to_int[gate.ports[1].state] .. \"\t\" .. bool_to_int[gate.ports[2].state] .. \"\t\" .. bool_to_int[gate.ports[3].state]) end";
|
||||
|
||||
numLogicPorts = 3;
|
||||
|
||||
logicPortType[0] = 1;
|
||||
logicPortPos[0] = "-1 1 0";
|
||||
logicPortDir[0] = 5;
|
||||
logicPortCauseUpdate[0] = true;
|
||||
logicPortUIName[0] = "R";
|
||||
|
||||
logicPortType[1] = 1;
|
||||
logicPortPos[1] = "-1 -1 0";
|
||||
logicPortDir[1] = 5;
|
||||
logicPortCauseUpdate[1] = true;
|
||||
logicPortUIName[1] = "G";
|
||||
|
||||
logicPortType[2] = 1;
|
||||
logicPortPos[2] = "1 -1 0";
|
||||
logicPortDir[2] = 5;
|
||||
logicPortCauseUpdate[2] = true;
|
||||
logicPortUIName[2] = "B";
|
||||
};
|
||||
lualogic_registergatedefinition("LogicGate_HorizontalPixel_Data");
|
||||
|
||||
function LogicGate_HorizontalPixel_Data::LuaLogic_Callback(%this, %obj, %data)
|
||||
{
|
||||
%color = getField(%data, 0) @ getField(%data, 1) @ getField(%data, 2);
|
||||
if(lualogic_isprint("COLOR" @ %color))
|
||||
%obj.setPrint(lualogic_getprint("COLOR" @ %color));
|
||||
}
|
36
bricks/outputs/TextBrick.cs
Normal file
36
bricks/outputs/TextBrick.cs
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
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));
|
||||
}
|
48
bricks/outputs/pixel.cs
Normal file
48
bricks/outputs/pixel.cs
Normal file
@ -0,0 +1,48 @@
|
||||
datablock fxDTSBrickData(LogicGate_Pixel_Data)
|
||||
{
|
||||
brickFile = $LuaLogic::Path @ "bricks/blb/pixels/pixel.blb";
|
||||
category = "Logic Bricks";
|
||||
subCategory = "Outputs";
|
||||
uiName = "Pixel";
|
||||
iconName = $LuaLogic::Path @ "icons/Pixel";
|
||||
hasPrint = 1;
|
||||
printAspectRatio = "Logic";
|
||||
orientationFix = 3;
|
||||
|
||||
isLogic = true;
|
||||
isLogicGate = true;
|
||||
isLogicInput = false;
|
||||
|
||||
logicUIName = "Pixel";
|
||||
logicUIDesc = "";
|
||||
|
||||
logicUpdate = "return function(gate) gate:cb(\"3\t\" .. bool_to_int[gate.ports[1].state] .. \"\t\" .. bool_to_int[gate.ports[2].state] .. \"\t\" .. bool_to_int[gate.ports[3].state]) end";
|
||||
|
||||
numLogicPorts = 3;
|
||||
|
||||
logicPortType[0] = 1;
|
||||
logicPortPos[0] = "-1 0 -4";
|
||||
logicPortDir[0] = 3;
|
||||
logicPortCauseUpdate[0] = true;
|
||||
logicPortUIName[0] = "R";
|
||||
|
||||
logicPortType[1] = 1;
|
||||
logicPortPos[1] = "-1 0 0";
|
||||
logicPortDir[1] = 3;
|
||||
logicPortCauseUpdate[1] = true;
|
||||
logicPortUIName[1] = "G";
|
||||
|
||||
logicPortType[2] = 1;
|
||||
logicPortPos[2] = "-1 0 4";
|
||||
logicPortDir[2] = 3;
|
||||
logicPortCauseUpdate[2] = true;
|
||||
logicPortUIName[2] = "B";
|
||||
};
|
||||
lualogic_registergatedefinition("LogicGate_Pixel_Data");
|
||||
|
||||
function LogicGate_Pixel_Data::LuaLogic_Callback(%this, %obj, %data)
|
||||
{
|
||||
%color = getField(%data, 0) @ getField(%data, 1) @ getField(%data, 2);
|
||||
if(lualogic_isprint("COLOR" @ %color))
|
||||
%obj.setPrint(lualogic_getprint("COLOR" @ %color));
|
||||
}
|
83
bricks/outputs/text-init.lua
Normal file
83
bricks/outputs/text-init.lua
Normal file
@ -0,0 +1,83 @@
|
||||
|
||||
textbrick_idxToPrint = textbrick_idxToPrint or {
|
||||
[0x00] = "space",
|
||||
|
||||
[0x01] = "A",
|
||||
[0x02] = "B",
|
||||
[0x03] = "C",
|
||||
[0x04] = "D",
|
||||
[0x05] = "E",
|
||||
[0x06] = "F",
|
||||
[0x07] = "G",
|
||||
[0x08] = "H",
|
||||
[0x09] = "I",
|
||||
[0x0A] = "J",
|
||||
[0x0B] = "K",
|
||||
[0x0C] = "L",
|
||||
[0x0D] = "M",
|
||||
[0x0E] = "N",
|
||||
[0x0F] = "O",
|
||||
[0x10] = "P",
|
||||
[0x11] = "Q",
|
||||
[0x12] = "R",
|
||||
[0x13] = "S",
|
||||
[0x14] = "T",
|
||||
[0x15] = "U",
|
||||
[0x16] = "V",
|
||||
[0x17] = "W",
|
||||
[0x18] = "X",
|
||||
[0x19] = "Y",
|
||||
[0x1A] = "Z",
|
||||
|
||||
[0x1B] = "0",
|
||||
[0x1C] = "1",
|
||||
[0x1D] = "2",
|
||||
[0x1E] = "3",
|
||||
[0x1F] = "4",
|
||||
[0x20] = "5",
|
||||
[0x21] = "6",
|
||||
[0x22] = "7",
|
||||
[0x23] = "8",
|
||||
[0x24] = "9",
|
||||
|
||||
[0x25] = "bang",
|
||||
[0x26] = "at",
|
||||
[0x27] = "pound",
|
||||
[0x28] = "dollar",
|
||||
[0x29] = "percent",
|
||||
[0x2A] = "caret",
|
||||
[0x2B] = "and",
|
||||
[0x2C] = "asterisk",
|
||||
[0x2D] = "minus",
|
||||
[0x2E] = "equals",
|
||||
[0x2F] = "plus",
|
||||
[0x30] = "apostrophe",
|
||||
[0x31] = "less_than",
|
||||
[0x32] = "greater_than",
|
||||
[0x33] = "period",
|
||||
[0x34] = "qmark",
|
||||
|
||||
[0x35] = "apostrophe2",
|
||||
[0x36] = "colon",
|
||||
[0x37] = "comma",
|
||||
[0x38] = "curlybracketleft",
|
||||
[0x39] = "curlybracketright",
|
||||
[0x3A] = "currencysign",
|
||||
[0x3B] = "euro",
|
||||
[0x3C] = "onehalf",
|
||||
[0x3D] = "poundsymbol",
|
||||
[0x3E] = "roundbracketleft",
|
||||
[0x3F] = "roundbracketright",
|
||||
[0x40] = "slashleft",
|
||||
[0x41] = "slashright",
|
||||
[0x42] = "squarebracketleft",
|
||||
[0x43] = "squarebracketright",
|
||||
[0x44] = "tilde",
|
||||
[0x45] = "umlaut",
|
||||
[0x46] = "underscore",
|
||||
[0x47] = "verticalbar",
|
||||
}
|
||||
|
||||
return function(gate)
|
||||
gate.tickStarted = 0
|
||||
end
|
13
bricks/outputs/text-update.lua
Normal file
13
bricks/outputs/text-update.lua
Normal file
@ -0,0 +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
|
Reference in New Issue
Block a user