add cdata size and cfunc
This commit is contained in:
parent
949aeaa2c8
commit
57087d728f
@ -13,6 +13,7 @@ datablock fxDTSBrickData(LogicGate_NOT_Data : LogicGate_Diode_Data)
|
|||||||
logicForcePrint = "ARROW";
|
logicForcePrint = "ARROW";
|
||||||
|
|
||||||
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, 1-Gate.getportstate(gate, 1)) end";
|
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, 1-Gate.getportstate(gate, 1)) end";
|
||||||
|
logicCFunction = 2;
|
||||||
|
|
||||||
numLogicPorts = 2;
|
numLogicPorts = 2;
|
||||||
};
|
};
|
||||||
|
@ -17,6 +17,7 @@ datablock fxDTSBrickData(LogicGate_Diode_Data)
|
|||||||
logicForcePrint = "ARROW";
|
logicForcePrint = "ARROW";
|
||||||
|
|
||||||
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, Gate.getportstate(gate, 1)) end";
|
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, Gate.getportstate(gate, 1)) end";
|
||||||
|
logicCFunction = 1;
|
||||||
|
|
||||||
numLogicPorts = 2;
|
numLogicPorts = 2;
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ datablock fxDTSBrickData(LogicGate_DiodeUp_Data)
|
|||||||
logicForcePrint = "UPARROW";
|
logicForcePrint = "UPARROW";
|
||||||
|
|
||||||
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, Gate.getportstate(gate, 1)) end";
|
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, Gate.getportstate(gate, 1)) end";
|
||||||
|
logicCFunction = 1;
|
||||||
|
|
||||||
numLogicPorts = 2;
|
numLogicPorts = 2;
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ datablock fxDTSBrickData(LogicGate_DiodeDown_Data : LogicGate_DiodeUp_Data)
|
|||||||
logicForcePrint = "DOWNARROW";
|
logicForcePrint = "DOWNARROW";
|
||||||
|
|
||||||
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, Gate.getportstate(gate, 1)) end";
|
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, Gate.getportstate(gate, 1)) end";
|
||||||
|
logicCFunction = 1;
|
||||||
|
|
||||||
logicPortDir[0] = 4;
|
logicPortDir[0] = 4;
|
||||||
logicPortDir[1] = 5;
|
logicPortDir[1] = 5;
|
||||||
|
@ -13,6 +13,7 @@ datablock fxDTSBrickData(LogicGate_NotUp_Data : LogicGate_DiodeUp_Data)
|
|||||||
logicForcePrint = "UPARROW";
|
logicForcePrint = "UPARROW";
|
||||||
|
|
||||||
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, 1-Gate.getportstate(gate, 1)) end";
|
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, 1-Gate.getportstate(gate, 1)) end";
|
||||||
|
logicCFunction = 2;
|
||||||
};
|
};
|
||||||
lualogic_registergatedefinition("LogicGate_NotUp_Data");
|
lualogic_registergatedefinition("LogicGate_NotUp_Data");
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ datablock fxDTSBrickData(LogicGate_NotDown_Data : LogicGate_DiodeDown_Data)
|
|||||||
logicForcePrint = "DOWNARROW";
|
logicForcePrint = "DOWNARROW";
|
||||||
|
|
||||||
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, 1-Gate.getportstate(gate, 1)) end";
|
logicUpdate = "return function(gate) Gate.setportstate(gate, 2, 1-Gate.getportstate(gate, 1)) end";
|
||||||
|
logicCFunction = 2;
|
||||||
};
|
};
|
||||||
lualogic_registergatedefinition("LogicGate_NotDown_Data");
|
lualogic_registergatedefinition("LogicGate_NotDown_Data");
|
||||||
|
|
||||||
|
@ -98,9 +98,9 @@ textbrick2_idxToPrint = {
|
|||||||
[0x58] = "X",
|
[0x58] = "X",
|
||||||
[0x59] = "Y",
|
[0x59] = "Y",
|
||||||
[0x5A] = "Z",
|
[0x5A] = "Z",
|
||||||
[0x5B] = "squarebracketright",
|
[0x5B] = "squarebracketleft",
|
||||||
[0x5C] = "slashleft",
|
[0x5C] = "slashleft",
|
||||||
[0x5D] = "squarebracketleft",
|
[0x5D] = "squarebracketright",
|
||||||
[0x5E] = "caret",
|
[0x5E] = "caret",
|
||||||
[0x5F] = "underscore",
|
[0x5F] = "underscore",
|
||||||
|
|
||||||
|
@ -180,6 +180,7 @@ function LogicGate_RobotController_Data::LuaLogic_Callback(%this, %brick, %data)
|
|||||||
} else if(%first $= "P") { // plant brick
|
} else if(%first $= "P") { // plant brick
|
||||||
LogicRobot_CreateBrickGroup();
|
LogicRobot_CreateBrickGroup();
|
||||||
|
|
||||||
|
if(!isObject(%tbrick)) {
|
||||||
%nbrick = new fxDTSBrick() {
|
%nbrick = new fxDTSBrick() {
|
||||||
datablock = brick1x1fData;
|
datablock = brick1x1fData;
|
||||||
position = %pos;
|
position = %pos;
|
||||||
@ -201,6 +202,7 @@ function LogicGate_RobotController_Data::LuaLogic_Callback(%this, %brick, %data)
|
|||||||
BrickGroup_12345678.add(%nbrick);
|
BrickGroup_12345678.add(%nbrick);
|
||||||
%nbrick.setTrusted(1);
|
%nbrick.setTrusted(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if(%first $= "M") { // move
|
} else if(%first $= "M") { // move
|
||||||
%pos = getWords(%field, 1, 3);
|
%pos = getWords(%field, 1, 3);
|
||||||
%rot = getWord(%field, 4);
|
%rot = getWord(%field, 4);
|
||||||
|
@ -27,6 +27,12 @@ package lualogic_rom_update {
|
|||||||
parent::setRaycasting(%brick, %val);
|
parent::setRaycasting(%brick, %val);
|
||||||
lualogic_rom_updatebrick(%brick);
|
lualogic_rom_updatebrick(%brick);
|
||||||
}
|
}
|
||||||
|
function fxDtsBrickData::Logic_onAdd(%data, %brick) {
|
||||||
|
parent::onAdd(%data, %brick);
|
||||||
|
if(%data.isLogicRom) {
|
||||||
|
schedule(5000, 0, lualogic_rom_updatedata, %brick);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
schedule(0, 0, activatePackage, lualogic_rom_update);
|
schedule(0, 0, activatePackage, lualogic_rom_update);
|
||||||
|
|
||||||
|
@ -27,11 +27,13 @@ function lualogic_registergatedefinition_auto(%data){
|
|||||||
%def = %id @ ";" @
|
%def = %id @ ";" @
|
||||||
lualogic_expandescape(%data.logicUIName) @ ";" @
|
lualogic_expandescape(%data.logicUIName) @ ";" @
|
||||||
lualogic_expandescape(%data.logicUIDesc) @ ";" @
|
lualogic_expandescape(%data.logicUIDesc) @ ";" @
|
||||||
lualogic_expandescape(%data.logicInit) @ ";" @
|
lualogic_expandescape(%data.logicInit ) @ ";" @
|
||||||
lualogic_expandescape(%data.logicUpdate) @ ";" @
|
lualogic_expandescape(%data.logicUpdate) @ ";" @
|
||||||
lualogic_expandescape(%data.logicInput) @ ";" @
|
lualogic_expandescape(%data.logicInput ) @ ";" @
|
||||||
lualogic_expandescape(%data.logicGlobal) @ ";" @
|
lualogic_expandescape(%data.logicGlobal) @ ";" @
|
||||||
%numports
|
%numports @ ";" @
|
||||||
|
(%data.logicCFunction || 0) @ ";" @
|
||||||
|
(%data.logicCDataSize || 0)
|
||||||
;
|
;
|
||||||
|
|
||||||
for(%i = 0; %i < %numports; %i++)
|
for(%i = 0; %i < %numports; %i++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user