add io brick, misc fixes
This commit is contained in:
parent
38351b8a3e
commit
a25f184c94
631
bricks/blb/2x2pixelbrick.blb
Normal file
631
bricks/blb/2x2pixelbrick.blb
Normal file
@ -0,0 +1,631 @@
|
||||
1 2 4
|
||||
SPECIAL
|
||||
|
||||
u
|
||||
x
|
||||
x
|
||||
d
|
||||
|
||||
u
|
||||
x
|
||||
x
|
||||
d
|
||||
|
||||
1
|
||||
|
||||
0 0 0
|
||||
1 2 4
|
||||
COVERAGE:
|
||||
0 : 99999
|
||||
0 : 99999
|
||||
0 : 99999
|
||||
0 : 99999
|
||||
0 : 99999
|
||||
0 : 99999
|
||||
---------------- TOP QUADS ----------------
|
||||
1
|
||||
|
||||
TEX:TOP
|
||||
POSITION:
|
||||
-0.5 -1 2
|
||||
-0.5 1 2
|
||||
0.5 1 2
|
||||
0.5 -1 2
|
||||
UV COORDS:
|
||||
0 0
|
||||
2 0
|
||||
2 1
|
||||
0 1
|
||||
NORMALS:
|
||||
0 0 1
|
||||
0 0 1
|
||||
0 0 1
|
||||
0 0 1
|
||||
---------------- BOTTOM QUADS ----------------
|
||||
4
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
-0.5 -1 -2
|
||||
0.5 -1 -2
|
||||
0 -0.5 -2
|
||||
0 -0.5 -2
|
||||
UV COORDS:
|
||||
0 0
|
||||
1 0
|
||||
0.5 0.5
|
||||
0.5 0.5
|
||||
NORMALS:
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 -1 -2
|
||||
0.5 1 -2
|
||||
0 0.5 -2
|
||||
0 -0.5 -2
|
||||
UV COORDS:
|
||||
-0.5 0
|
||||
1.5 0
|
||||
1 0.5
|
||||
0 0.5
|
||||
NORMALS:
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
-0.5 1 -2
|
||||
-0.5 -1 -2
|
||||
0 -0.5 -2
|
||||
0 0.5 -2
|
||||
UV COORDS:
|
||||
-0.5 0
|
||||
1.5 0
|
||||
1 0.5
|
||||
0 0.5
|
||||
NORMALS:
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 1 -2
|
||||
-0.5 1 -2
|
||||
0 0.5 -2
|
||||
0 0.5 -2
|
||||
UV COORDS:
|
||||
0 0
|
||||
1 0
|
||||
0.5 0.5
|
||||
0.5 0.5
|
||||
NORMALS:
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
---------------- NORTH QUADS ----------------
|
||||
1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 1 -2
|
||||
0.5 1 2
|
||||
-0.5 1 2
|
||||
-0.5 1 -2
|
||||
UV COORDS:
|
||||
0 0
|
||||
1 0
|
||||
1 1
|
||||
0 1
|
||||
NORMALS:
|
||||
0 1 0
|
||||
0 1 0
|
||||
0 1 0
|
||||
0 1 0
|
||||
---------------- EAST QUADS ----------------
|
||||
21
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 -0.1 -1.8
|
||||
0.5 -0.9 -1.8
|
||||
0.64 -0.9 -1.8
|
||||
0.64 -0.1 -1.8
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.64 -0.9 -1.8
|
||||
0.64 -0.9 -1.2
|
||||
0.64 -0.1 -1.2
|
||||
0.64 -0.1 -1.8
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
1 0 0
|
||||
1 0 0
|
||||
1 0 0
|
||||
1 0 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.64 -0.1 -1.8
|
||||
0.64 -0.1 -1.2
|
||||
0.5 -0.1 -1.2
|
||||
0.5 -0.1 -1.8
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 1 0
|
||||
0 1 0
|
||||
0 1 0
|
||||
0 1 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 0.9 -1.8
|
||||
0.5 0.1 -1.8
|
||||
0.64 0.1 -1.8
|
||||
0.64 0.9 -1.8
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 -0.9 -1.2
|
||||
0.5 -0.1 -1.2
|
||||
0.64 -0.1 -1.2
|
||||
0.64 -0.9 -1.2
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 0 1
|
||||
0 0 1
|
||||
0 0 1
|
||||
0 0 1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 -0.9 -1.8
|
||||
0.5 -0.9 -1.2
|
||||
0.64 -0.9 -1.2
|
||||
0.64 -0.9 -1.8
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.64 0.1 -1.8
|
||||
0.64 0.1 -1.2
|
||||
0.64 0.9 -1.2
|
||||
0.64 0.9 -1.8
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
1 0 0
|
||||
1 0 0
|
||||
1 0 0
|
||||
1 0 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.64 0.9 -1.8
|
||||
0.64 0.9 -1.2
|
||||
0.5 0.9 -1.2
|
||||
0.5 0.9 -1.8
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 1 0
|
||||
0 1 0
|
||||
0 1 0
|
||||
0 1 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 0.1 -1.2
|
||||
0.5 0.9 -1.2
|
||||
0.64 0.9 -1.2
|
||||
0.64 0.1 -1.2
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 0 1
|
||||
0 0 1
|
||||
0 0 1
|
||||
0 0 1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 0.1 -1.8
|
||||
0.5 0.1 -1.2
|
||||
0.64 0.1 -1.2
|
||||
0.64 0.1 -1.8
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 0.9 0.2
|
||||
0.5 0.1 0.2
|
||||
0.64 0.1 0.2
|
||||
0.64 0.9 0.2
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.64 0.1 0.2
|
||||
0.64 0.1 0.8
|
||||
0.64 0.9 0.8
|
||||
0.64 0.9 0.2
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
1 0 0
|
||||
1 0 0
|
||||
1 0 0
|
||||
1 0 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.64 0.9 0.2
|
||||
0.64 0.9 0.8
|
||||
0.5 0.9 0.8
|
||||
0.5 0.9 0.2
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 1 0
|
||||
0 1 0
|
||||
0 1 0
|
||||
0 1 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 0.1 0.8
|
||||
0.5 0.9 0.8
|
||||
0.64 0.9 0.8
|
||||
0.64 0.1 0.8
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 0 1
|
||||
0 0 1
|
||||
0 0 1
|
||||
0 0 1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 0.1 0.2
|
||||
0.5 0.1 0.8
|
||||
0.64 0.1 0.8
|
||||
0.64 0.1 0.2
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 -0.1 0.2
|
||||
0.5 -0.9 0.2
|
||||
0.64 -0.9 0.2
|
||||
0.64 -0.1 0.2
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
0 0 -1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.64 -0.9 0.2
|
||||
0.64 -0.9 0.8
|
||||
0.64 -0.1 0.8
|
||||
0.64 -0.1 0.2
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
1 0 0
|
||||
1 0 0
|
||||
1 0 0
|
||||
1 0 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.64 -0.1 0.2
|
||||
0.64 -0.1 0.8
|
||||
0.5 -0.1 0.8
|
||||
0.5 -0.1 0.2
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 1 0
|
||||
0 1 0
|
||||
0 1 0
|
||||
0 1 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 -0.9 0.8
|
||||
0.5 -0.1 0.8
|
||||
0.64 -0.1 0.8
|
||||
0.64 -0.9 0.8
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 0 1
|
||||
0 0 1
|
||||
0 0 1
|
||||
0 0 1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 -0.9 0.2
|
||||
0.5 -0.9 0.8
|
||||
0.64 -0.9 0.8
|
||||
0.64 -0.9 0.2
|
||||
UV COORDS:
|
||||
0.375 0.375
|
||||
0.625 0.375
|
||||
0.625 0.625
|
||||
0.375 0.625
|
||||
COLORS:
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
0.8 0.8 0.8 1
|
||||
NORMALS:
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
0.5 1 2
|
||||
0.5 1 -2
|
||||
0.5 -1 -2
|
||||
0.5 -1 2
|
||||
UV COORDS:
|
||||
0 0
|
||||
1 0
|
||||
1 1
|
||||
0 1
|
||||
NORMALS:
|
||||
1 0 0
|
||||
1 0 0
|
||||
1 0 0
|
||||
1 0 0
|
||||
---------------- SOUTH QUADS ----------------
|
||||
1
|
||||
|
||||
TEX:SIDE
|
||||
POSITION:
|
||||
-0.5 -1 -2
|
||||
-0.5 -1 2
|
||||
0.5 -1 2
|
||||
0.5 -1 -2
|
||||
UV COORDS:
|
||||
0 0
|
||||
1 0
|
||||
1 1
|
||||
0 1
|
||||
NORMALS:
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
0 -1 0
|
||||
---------------- WEST QUADS ----------------
|
||||
1
|
||||
|
||||
TEX:PRINT
|
||||
POSITION:
|
||||
-0.5 1 -2
|
||||
-0.5 1 2
|
||||
-0.5 -1 2
|
||||
-0.5 -1 -2
|
||||
UV COORDS:
|
||||
0.1 0.9
|
||||
0.1 0.1
|
||||
0.9 0.1
|
||||
0.9 0.9
|
||||
NORMALS:
|
||||
-1 0 0
|
||||
-1 0 0
|
||||
-1 0 0
|
||||
-1 0 0
|
||||
---------------- OMNI QUADS ----------------
|
||||
0
|
2053
bricks/blb/D FlipFlop 8 Bit.blb
Normal file
2053
bricks/blb/D FlipFlop 8 Bit.blb
Normal file
File diff suppressed because it is too large
Load Diff
9366
bricks/blb/serialport.blb
Normal file
9366
bricks/blb/serialport.blb
Normal file
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,7 @@ exec("./gates/srlatch.cs");
|
||||
exec("./inputs/switch.cs");
|
||||
exec("./inputs/button.cs");
|
||||
exec("./inputs/keyboard.cs");
|
||||
exec("./inputs/iobrick.cs");
|
||||
|
||||
exec("./math/8bitAdder.cs");
|
||||
exec("./math/8bitSubtractor.cs");
|
||||
@ -22,6 +23,7 @@ exec("./math/HalfAdder.cs");
|
||||
|
||||
exec("./outputs/Pixel3.cs");
|
||||
exec("./outputs/TextBrick2.cs");
|
||||
exec("./outputs/Pixel2x2.cs");
|
||||
|
||||
exec("./special/EventGate.cs");
|
||||
exec("./special/rom.cs");
|
||||
|
5
bricks/inputs/iobrick-init.lua
Normal file
5
bricks/inputs/iobrick-init.lua
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
return function(gate)
|
||||
gate.queueIn = {}
|
||||
gate.outputToggle = true
|
||||
end
|
12
bricks/inputs/iobrick-input.lua
Normal file
12
bricks/inputs/iobrick-input.lua
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
return function(gate, argv)
|
||||
local arg = argv[1]
|
||||
for i = 1, #arg, 2 do
|
||||
local d = arg:sub(i, i+1)
|
||||
local v = tonumber(d, 16) or 0
|
||||
if #gate.queueIn < 2048 then
|
||||
table.insert(gate.queueIn, 1, v)
|
||||
end
|
||||
end
|
||||
Gate.queue(gate, 0)
|
||||
end
|
49
bricks/inputs/iobrick-update.lua
Normal file
49
bricks/inputs/iobrick-update.lua
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
local function outputByte(gate, v)
|
||||
local p = 256
|
||||
for i = 1, 8 do
|
||||
p = p/2
|
||||
local port = 17 - i
|
||||
if v>=p then
|
||||
v = v - p
|
||||
Gate.setportstate(gate, port, 1)
|
||||
else
|
||||
Gate.setportstate(gate, port, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
local function inputByte(gate)
|
||||
local v = 0
|
||||
local p = 256
|
||||
for i = 1, 8 do
|
||||
p = p/2
|
||||
local port = 9 - i
|
||||
v = v + p*Gate.getportstate(gate, port)
|
||||
end
|
||||
return v
|
||||
end
|
||||
|
||||
return function(gate)
|
||||
-- input
|
||||
if #gate.queueIn > 0 and gate.outputToggle then
|
||||
--if #gate.queueIn > 0 then
|
||||
local v = table.remove(gate.queueIn, #gate.queueIn)
|
||||
outputByte(gate, v)
|
||||
Gate.setportstate(gate, 18, 1)
|
||||
gate.outputToggle = false
|
||||
Gate.queue(gate, 1)
|
||||
else
|
||||
outputByte(gate, 0)
|
||||
Gate.setportstate(gate, 18, 0)
|
||||
gate.outputToggle = true
|
||||
if #gate.queueIn > 0 then
|
||||
Gate.queue(gate, 1)
|
||||
end
|
||||
end
|
||||
|
||||
-- output
|
||||
if Gate.getportisrising(gate, 17) then
|
||||
local v = inputByte(gate)
|
||||
Gate.cbQueue(gate, string.format("%02X", v), 1024)
|
||||
end
|
||||
end
|
290
bricks/inputs/iobrick.cs
Normal file
290
bricks/inputs/iobrick.cs
Normal file
@ -0,0 +1,290 @@
|
||||
//bls 3
|
||||
|
||||
datablock fxDtsBrickData(LogicGate_ClientIOBrick_Data){
|
||||
brickFile = $LuaLogic::Path @ "bricks/blb/serialport.blb";
|
||||
iconName = $LuaLogic::Path @ "icons/serialport";
|
||||
|
||||
category = "Logic Bricks";
|
||||
subCategory = "Special I/O";
|
||||
uiName = "Client I/O Brick";
|
||||
logicUIName = "Client I/O Brick";
|
||||
logicUIDesc = "Allows clients to connect and share data with logic bricks.";
|
||||
orientationFix = 2;
|
||||
hasPrint = 0;
|
||||
|
||||
isLogic = true;
|
||||
isLogicGate = true;
|
||||
isLogicInput = true;
|
||||
|
||||
logicInit = lualogic_readfile($LuaLogic::Path @ "bricks/inputs/iobrick-init.lua" );
|
||||
logicInput = lualogic_readfile($LuaLogic::Path @ "bricks/inputs/iobrick-input.lua" );
|
||||
logicUpdate = lualogic_readfile($LuaLogic::Path @ "bricks/inputs/iobrick-update.lua");
|
||||
//logicGlobal = lualogic_readfile($LuaLogic::Path @ "bricks/inputs/iobrick-global.lua");
|
||||
|
||||
numLogicPorts = 18;
|
||||
|
||||
logicPortPos[ 0] = "-8 1 -3";
|
||||
logicPortPos[ 1] = "-6 1 -3";
|
||||
logicPortPos[ 2] = "-4 1 -3";
|
||||
logicPortPos[ 3] = "-2 1 -3";
|
||||
logicPortPos[ 4] = "0 1 -3";
|
||||
logicPortPos[ 5] = "2 1 -3";
|
||||
logicPortPos[ 6] = "4 1 -3";
|
||||
logicPortPos[ 7] = "6 1 -3";
|
||||
|
||||
logicPortPos[16] = "-8 1 -3";
|
||||
|
||||
logicPortPos[ 8] = "-8 -1 -3";
|
||||
logicPortPos[ 9] = "-6 -1 -3";
|
||||
logicPortPos[10] = "-4 -1 -3";
|
||||
logicPortPos[11] = "-2 -1 -3";
|
||||
logicPortPos[12] = "0 -1 -3";
|
||||
logicPortPos[13] = "2 -1 -3";
|
||||
logicPortPos[14] = "4 -1 -3";
|
||||
logicPortPos[15] = "6 -1 -3";
|
||||
|
||||
logicPortPos[17] = "-8 -1 -3";
|
||||
|
||||
logicPortType[0] = 1;
|
||||
logicPortDir[0] = 1;
|
||||
logicPortUIName[0] = "In0";
|
||||
|
||||
logicPortType[1] = 1;
|
||||
logicPortDir[1] = 1;
|
||||
logicPortUIName[1] = "In1";
|
||||
|
||||
logicPortType[2] = 1;
|
||||
logicPortDir[2] = 1;
|
||||
logicPortUIName[2] = "In2";
|
||||
|
||||
logicPortType[3] = 1;
|
||||
logicPortDir[3] = 1;
|
||||
logicPortUIName[3] = "In3";
|
||||
|
||||
logicPortType[4] = 1;
|
||||
logicPortDir[4] = 1;
|
||||
logicPortUIName[4] = "In4";
|
||||
|
||||
logicPortType[5] = 1;
|
||||
logicPortDir[5] = 1;
|
||||
logicPortUIName[5] = "In5";
|
||||
|
||||
logicPortType[6] = 1;
|
||||
logicPortDir[6] = 1;
|
||||
logicPortUIName[6] = "In6";
|
||||
|
||||
logicPortType[7] = 1;
|
||||
logicPortDir[7] = 1;
|
||||
logicPortUIName[7] = "In7";
|
||||
|
||||
logicPortType[8] = 0;
|
||||
logicPortDir[8] = 3;
|
||||
logicPortUIName[8] = "Out0";
|
||||
|
||||
logicPortType[9] = 0;
|
||||
logicPortDir[9] = 3;
|
||||
logicPortUIName[9] = "Out1";
|
||||
|
||||
logicPortType[10] = 0;
|
||||
logicPortDir[10] = 3;
|
||||
logicPortUIName[10] = "Out2";
|
||||
|
||||
logicPortType[11] = 0;
|
||||
logicPortDir[11] = 3;
|
||||
logicPortUIName[11] = "Out3";
|
||||
|
||||
logicPortType[12] = 0;
|
||||
logicPortDir[12] = 3;
|
||||
logicPortUIName[12] = "Out4";
|
||||
|
||||
logicPortType[13] = 0;
|
||||
logicPortDir[13] = 3;
|
||||
logicPortUIName[13] = "Out5";
|
||||
|
||||
logicPortType[14] = 0;
|
||||
logicPortDir[14] = 3;
|
||||
logicPortUIName[14] = "Out6";
|
||||
|
||||
logicPortType[15] = 0;
|
||||
logicPortDir[15] = 3;
|
||||
logicPortUIName[15] = "Out7";
|
||||
|
||||
logicPortType[16] = 1;
|
||||
logicPortDir[16] = 0;
|
||||
logicPortUIName[16] = "InClk";
|
||||
logicPortCauseUpdate[16] = true;
|
||||
|
||||
logicPortType[17] = 0;
|
||||
logicPortDir[17] = 0;
|
||||
logicPortUIName[17] = "OutClk";
|
||||
logicPortCauseUpdate[17] = true;
|
||||
};
|
||||
|
||||
// Input
|
||||
function serverCmdLogicIO(%client, %data) {
|
||||
if(isObject(%brick = %client.LogicIO_Brick)) {
|
||||
%brick.LogicIO_input(%data);
|
||||
}
|
||||
}
|
||||
function fxDtsBrick::LogicIO_input(%brick, %data) {
|
||||
lualogic_sendInput(%brick, 1, %data);
|
||||
}
|
||||
|
||||
// Output
|
||||
function fxDtsBrick::LogicIO_output(%brick, %data) {
|
||||
if(isObject(%client = %brick.LogicIO_Client)) {
|
||||
%maxLen = 250;
|
||||
%len = strLen(%data);
|
||||
|
||||
commandToClient(%client, 'LogicIO', getSubStr(%data, 0, %maxLen));
|
||||
|
||||
//if(%len > %maxLen) {
|
||||
// %brick.LogicIO_output(getSubStr(%data, 0, %maxLen));
|
||||
// %brick.LogicIO_output(getSubStr(%data, %maxLen, %len - %maxLen));
|
||||
//} else {
|
||||
// commandToClient(%client, 'LogicIO', %data);
|
||||
//}
|
||||
}
|
||||
}
|
||||
function LogicGate_ClientIOBrick_Data::LuaLogic_Callback(%db, %brick, %data) {
|
||||
%brick.LogicIO_output(%data);
|
||||
}
|
||||
|
||||
// Binding
|
||||
function LogicGate_ClientIOBrick_Data::Logic_OnInput(%db, %brick, %pos, %norm, %client){
|
||||
if(isObject(%client)) {
|
||||
if(%client.LogicIO_Brick == %brick) {
|
||||
%client.LogicIO_unbind();
|
||||
} else {
|
||||
%brick.LogicIO_bindClient(%client);
|
||||
}
|
||||
}
|
||||
}
|
||||
function GameConnection::LogicIO_unbind(%client) {
|
||||
if(isObject(%brick = %client.LogicIO_Brick)) %brick.LogicIO_unbindClient(%brick);
|
||||
}
|
||||
function fxDtsBrick::LogicIO_unbindClient(%brick) {
|
||||
if(isObject(%client = %brick.LogicIO_Client)) {
|
||||
%client.LogicIO_Brick = "";
|
||||
messageClient(%client, 0, "\c6Logic I/O: Unbound from \c3" @ %brick);
|
||||
if(isObject(%player = %client.player)) serverPlay3D(LogicIO_PlugOutSound, %player.getHackPosition());
|
||||
}
|
||||
%brick.LogicIO_Client = "";
|
||||
serverPlay3D(LogicIO_PlugOutSound, %brick.getPosition());
|
||||
|
||||
//SerialLink_delete(%brick.LogicIO_bindLink);
|
||||
//%brick.LogicIO_bindLink = "";
|
||||
}
|
||||
function fxDtsBrick::LogicIO_bindClient(%brick, %client) {
|
||||
%brick.LogicIO_unbindClient();
|
||||
%client.LogicIO_unbind();
|
||||
|
||||
%client.LogicIO_Brick = %brick;
|
||||
%brick.LogicIO_Client = %client;
|
||||
messageClient(%client, 0, "\c6Logic I/O: Bound to \c3" @ %brick);
|
||||
|
||||
serverPlay3D(LogicIO_PlugInSound, %player.getHackPosition());
|
||||
serverPlay3D(LogicIO_PlugInSound, %brick.getPosition());
|
||||
|
||||
//%linkPos = vectorAdd(%brick.getPosition(), LogicIO_rotateVector("0 2 0", %brick.angleId));
|
||||
//%linkRot = "0 0 1" SPC ($math.pi/2*%brick.angleId);
|
||||
//%brick.LogicIO_bindLink = SerialLink_create(%linkPos, %linkRot, %client.player);
|
||||
}
|
||||
|
||||
// Util
|
||||
function LogicIO_rotateVector(%vector, %steps) {
|
||||
switch(%steps % 4) {
|
||||
case 0: return %vector;
|
||||
case 1: return getWord(%vector, 1) SPC -getWord(%vector, 0) SPC getWord(%vector, 2);
|
||||
case 2: return -getWord(%vector, 0) SPC -getWord(%vector, 1) SPC getWord(%vector, 2);
|
||||
case 3: return -getWord(%vector, 1) SPC getWord(%vector, 0) SPC getWord(%vector, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Serial link visuals
|
||||
|
||||
datablock AudioProfile(LogicIO_PlugInSound) {
|
||||
filename = "./plugIn.wav";
|
||||
description = MediumClose3D;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(LogicIO_PlugOutSound) {
|
||||
filename = "./plugOut.wav";
|
||||
description = MediumClose3D;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
function SerialLink_delete(%link) {
|
||||
if(!isObject(%link)) return;
|
||||
cancel(%link.updateSched);
|
||||
%link.end0.delete();
|
||||
%link.end1.delete();
|
||||
%link.wire.delete();
|
||||
}
|
||||
function SerialLink_createEnd() {
|
||||
%shape = new StaticShape() {
|
||||
// todo
|
||||
};
|
||||
return %shape;
|
||||
}
|
||||
function SerialLink_createPlayerEnd() {
|
||||
%shape = new StaticShape() {
|
||||
// todo
|
||||
};
|
||||
return %shape;
|
||||
}
|
||||
function SerialLink_createWire() {
|
||||
%shape = new StaticShape() {
|
||||
// todo
|
||||
};
|
||||
return %shape;
|
||||
}
|
||||
function SerialLink_create(%pos1, %rot1, %player) {
|
||||
%link = new ScriptObject();
|
||||
%link.end0 = SerialLink_createEnd();
|
||||
%link.end1 = SerialLink_createPlayerEnd();
|
||||
%link.wire = SerialLink_createWire();
|
||||
%link.endPlayer0 = %player;
|
||||
SerialLink_update(%link);
|
||||
}
|
||||
function SerialLink_moveEndToPlayer(%shape, %player) {
|
||||
%shape.setTransform(%player.getSlotTransform(2)); // todo
|
||||
}
|
||||
function SerialLink_moveWire(%shape, %pos1, %pos2) {
|
||||
// todo
|
||||
%midPos = vectorScale(vectorAdd(%pos1, %pos2), 0.5);
|
||||
%shape.setTransform(%midPos SPC "0 0 1 0");
|
||||
}
|
||||
function SerialLink_update(%link) {
|
||||
cancel(%link.updateSched);
|
||||
for(%i=0; %i<=1; %i++) {
|
||||
%player = %link.endPlayer[%i];
|
||||
if(%player) {
|
||||
//if(!isObject(%player) || %player.getState() $= "Dead") {
|
||||
if(!isObject(%player)) {
|
||||
if(isObject(%client = %player.client)) %client.LogicIO_Unbind();
|
||||
SerialLink_delete(%link);
|
||||
return;
|
||||
} else {
|
||||
SerialLink_moveEndToPlayer(%link.end[%i], %player);
|
||||
%moved = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(%moved) {
|
||||
%dist = vectorLen(vectorSub(%pos1, %pos2));
|
||||
if(%dist > $SerialLink_maxDistance) { // If link is stretched too long, break it
|
||||
for(%i=0; %i<=1; %i++) { // Unbind client(s)
|
||||
if(isObject(%player = %link.endPlayer[%i]) && isObject(%client = %player.client)) {
|
||||
%client.LogicIO_Unbind();
|
||||
}
|
||||
}
|
||||
SerialLink_delete(%link); // Delete link
|
||||
return;
|
||||
} else { // Link moved, not too stretched -> update position
|
||||
SerialLink_moveWire(%link.wire, %link.end[0].getPosition(), %link.end[1].getPosition());
|
||||
}
|
||||
}
|
||||
%link.updateSched = schedule(32, 0, SerialLink_update, %link);
|
||||
}
|
BIN
bricks/inputs/plugIn.wav
Normal file
BIN
bricks/inputs/plugIn.wav
Normal file
Binary file not shown.
BIN
bricks/inputs/plugOut.wav
Normal file
BIN
bricks/inputs/plugOut.wav
Normal file
Binary file not shown.
@ -14,7 +14,7 @@ datablock fxDTSBrickData(LogicGate_TextBrick2_Data){
|
||||
isLogicInput = false;
|
||||
|
||||
logicUIName = "Text Brick";
|
||||
logicUIDesc = "Takes 9-bit serial input of format 1cxxxxxxxx10. If c==0, x = 8-bit ascii code. If c==1, lower 6 bits of x = color ID, top bit = invert character. MSB first.";
|
||||
logicUIDesc = "Takes 9-bit serial input of format 1cxxxxxxxx10. If c==0, x = 8-bit ascii code. If c==1, lower 6 bits of x = color ID, bit 6 = fx glow, top bit = invert character. MSB first.";
|
||||
|
||||
logicInit = lualogic_readfile($LuaLogic::Path @ "bricks/outputs/text2-init.lua" );
|
||||
logicUpdate = lualogic_readfile($LuaLogic::Path @ "bricks/outputs/text2-update.lua");
|
||||
|
9
bricks/outputs/pixel2x2-update.lua
Normal file
9
bricks/outputs/pixel2x2-update.lua
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
return function(gate)
|
||||
Gate.cb(gate,
|
||||
Gate.getportstate(gate, 1) +
|
||||
Gate.getportstate(gate, 2)*2 +
|
||||
Gate.getportstate(gate, 3)*4 +
|
||||
Gate.getportstate(gate, 4)*8
|
||||
)
|
||||
end
|
69
bricks/outputs/pixel2x2.cs
Normal file
69
bricks/outputs/pixel2x2.cs
Normal file
@ -0,0 +1,69 @@
|
||||
//bls 3
|
||||
|
||||
datablock fxDTSBrickData(LogicGate_Pixel2x2_Data){
|
||||
brickFile = $LuaLogic::Path @ "bricks/blb/2x2pixelbrick.blb";
|
||||
category = "Logic Bricks";
|
||||
subCategory = "Outputs";
|
||||
uiName = "Pixel 2x2";
|
||||
iconName = $LuaLogic::Path @ "icons/Pixel 2x2";
|
||||
hasPrint = 1;
|
||||
printAspectRatio = "Logic";
|
||||
orientationFix = 0;
|
||||
|
||||
isLogic = true;
|
||||
isLogicGate = true;
|
||||
isLogicInput = false;
|
||||
|
||||
logicUIName = "Pixel 2x2";
|
||||
logicUIDesc = "4 Pixels glued together with one print, for better ghosting performance and brickcount.";
|
||||
|
||||
logicUpdate = lualogic_readfile($LuaLogic::Path @ "bricks/outputs/pixel2x2-update.lua");
|
||||
|
||||
numLogicPorts = 4;
|
||||
|
||||
logicPortType [0] = 1;
|
||||
logicPortPos [0] = "0 -1 -3";
|
||||
logicPortDir [0] = 2;
|
||||
logicPortCauseUpdate[0] = true;
|
||||
logicPortUIName [0] = "BR";
|
||||
|
||||
logicPortType [1] = 1;
|
||||
logicPortPos [1] = "0 1 -3";
|
||||
logicPortDir [1] = 2;
|
||||
logicPortCauseUpdate[1] = true;
|
||||
logicPortUIName [1] = "BL";
|
||||
|
||||
logicPortType [2] = 1;
|
||||
logicPortPos [2] = "0 -1 1";
|
||||
logicPortDir [2] = 2;
|
||||
logicPortCauseUpdate[2] = true;
|
||||
logicPortUIName [2] = "TR";
|
||||
|
||||
logicPortType [3] = 1;
|
||||
logicPortPos [3] = "0 1 1";
|
||||
logicPortDir [3] = 2;
|
||||
logicPortCauseUpdate[3] = true;
|
||||
logicPortUIName [3] = "TL";
|
||||
};
|
||||
lualogic_registergatedefinition("LogicGate_Pixel3_Data");
|
||||
|
||||
function LogicGate_Pixel2x2_Data::LuaLogic_Callback(%data, %brick, %state) {
|
||||
switch(%state) {
|
||||
case 0x0: %brick.setPrint(lualogic_getprint("color000"));
|
||||
case 0x1: %brick.setPrint(lualogic_getprint("pixel2x2_1"));
|
||||
case 0x2: %brick.setPrint(lualogic_getprint("pixel2x2_2"));
|
||||
case 0x3: %brick.setPrint(lualogic_getprint("pixel2x2_3"));
|
||||
case 0x4: %brick.setPrint(lualogic_getprint("pixel2x2_4"));
|
||||
case 0x5: %brick.setPrint(lualogic_getprint("pixel2x2_5"));
|
||||
case 0x6: %brick.setPrint(lualogic_getprint("pixel2x2_6"));
|
||||
case 0x7: %brick.setPrint(lualogic_getprint("pixel2x2_7"));
|
||||
case 0x8: %brick.setPrint(lualogic_getprint("pixel2x2_8"));
|
||||
case 0x9: %brick.setPrint(lualogic_getprint("pixel2x2_9"));
|
||||
case 0xA: %brick.setPrint(lualogic_getprint("pixel2x2_A"));
|
||||
case 0xB: %brick.setPrint(lualogic_getprint("pixel2x2_B"));
|
||||
case 0xC: %brick.setPrint(lualogic_getprint("pixel2x2_C"));
|
||||
case 0xD: %brick.setPrint(lualogic_getprint("pixel2x2_D"));
|
||||
case 0xE: %brick.setPrint(lualogic_getprint("pixel2x2_E"));
|
||||
case 0xF: %brick.setPrint(lualogic_getprint("space"));
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
//bls 3
|
||||
|
||||
datablock fxDTSBrickData(LogicGate_Pixel3_Data){
|
||||
brickFile = $LuaLogic::Path @ "bricks/blb/TextBrick.blb";
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
--bls 3
|
||||
textbrick2_bitsNeeded = 9
|
||||
|
||||
textbrick2_idxToPrint = {
|
||||
@ -44,8 +44,8 @@ textbrick2_idxToPrint = {
|
||||
[0x25] = "percent",
|
||||
[0x26] = "and",
|
||||
[0x27] = "apostrophe",
|
||||
[0x28] = "roundbracketright",
|
||||
[0x29] = "roundbracketleft",
|
||||
[0x28] = "roundbracketleft",
|
||||
[0x29] = "roundbracketright",
|
||||
[0x2A] = "asterisk",
|
||||
[0x2B] = "plus",
|
||||
[0x2C] = "comma",
|
||||
@ -138,22 +138,22 @@ textbrick2_idxToPrint = {
|
||||
[0x7E] = "tilde",
|
||||
[0x7F] = "space",
|
||||
|
||||
[0x80] = "space",
|
||||
[0x81] = "space",
|
||||
[0x82] = "space",
|
||||
[0x83] = "space",
|
||||
[0x84] = "space",
|
||||
[0x85] = "space",
|
||||
[0x86] = "space",
|
||||
[0x87] = "space",
|
||||
[0x88] = "space",
|
||||
[0x89] = "space",
|
||||
[0x8A] = "space",
|
||||
[0x8B] = "space",
|
||||
[0x8C] = "space",
|
||||
[0x8D] = "space",
|
||||
[0x8E] = "space",
|
||||
[0x8F] = "space",
|
||||
[0x80] = "color000",
|
||||
[0x81] = "pixel2x2_1",
|
||||
[0x82] = "pixel2x2_2",
|
||||
[0x83] = "pixel2x2_3",
|
||||
[0x84] = "pixel2x2_4",
|
||||
[0x85] = "pixel2x2_5",
|
||||
[0x86] = "pixel2x2_6",
|
||||
[0x87] = "pixel2x2_7",
|
||||
[0x88] = "pixel2x2_8",
|
||||
[0x89] = "pixel2x2_9",
|
||||
[0x8A] = "pixel2x2_A",
|
||||
[0x8B] = "pixel2x2_B",
|
||||
[0x8C] = "pixel2x2_C",
|
||||
[0x8D] = "pixel2x2_D",
|
||||
[0x8E] = "pixel2x2_E",
|
||||
[0x8F] = "color111",
|
||||
|
||||
[0x90] = "space",
|
||||
[0x91] = "space",
|
||||
|
@ -178,9 +178,10 @@ function LogicGate_RobotController_Data::LuaLogic_Callback(%this, %brick, %data)
|
||||
%tbrick.schedule(0, delete);
|
||||
}
|
||||
} else if(%first $= "P") { // plant brick
|
||||
LogicRobot_CreateBrickGroup();
|
||||
%brickGroup = LogicRobot_CreateBrickGroup();
|
||||
|
||||
if(!isObject(%tbrick)) {
|
||||
%robot.setTransform(vectorAdd(%pos, "0 0 0.2") SPC %robot.lr_rotation);
|
||||
%nbrick = new fxDTSBrick() {
|
||||
datablock = brick1x1fData;
|
||||
position = %pos;
|
||||
@ -189,24 +190,34 @@ function LogicGate_RobotController_Data::LuaLogic_Callback(%this, %brick, %data)
|
||||
shapeFxId = getWord(%field, 3);
|
||||
isPlanted = 1;
|
||||
};
|
||||
%brickGroup.add(%nbrick);
|
||||
%nbrick.setTransform(%pos SPC "0 0 1 0");
|
||||
%nbrick.trustCheckFinished();
|
||||
|
||||
%err = %nbrick.plant();
|
||||
if(%err != 0 && %err != 2 && %err != 3) {
|
||||
if(%err == 1 || %err == 5 || %err == 3) {
|
||||
%nbrick.delete();
|
||||
} else {
|
||||
%nbrick.setRaycasting(getWord(%field, 4));
|
||||
%nbrick.setColliding (getWord(%field, 5));
|
||||
%nbrick.setRendering (getWord(%field, 6));
|
||||
|
||||
BrickGroup_12345678.add(%nbrick);
|
||||
%nbrick.setTrusted(1);
|
||||
}
|
||||
%robot.setTransform(%pos SPC %robot.lr_rotation);
|
||||
} else {
|
||||
%tbrick.setColor(getWord(%field, 1));
|
||||
%tbrick.setColorFx(getWord(%field, 2));
|
||||
%tbrick.setShapeFx(getWord(%field, 3));
|
||||
%tbrick.setRaycasting(getWord(%field, 4));
|
||||
%tbrick.setColliding (getWord(%field, 5));
|
||||
%tbrick.setRendering (getWord(%field, 6));
|
||||
}
|
||||
} else if(%first $= "M") { // move
|
||||
%pos = getWords(%field, 1, 3);
|
||||
%rot = getWord(%field, 4);
|
||||
%robot.setTransform(%pos SPC "0 0 1" SPC (%rot*$pi/2));
|
||||
%robot.lr_rotation = "0 0 1" SPC (%rot*$pi/2);
|
||||
%robot.setTransform(%pos SPC %robot.lr_rotation);
|
||||
} else {
|
||||
talk("invalid robot callback " @ %field);
|
||||
}
|
||||
@ -228,14 +239,15 @@ function LogicGate_RobotController_Data::getRelativeVector(%this, %obj, %vec) {
|
||||
}
|
||||
|
||||
function LogicRobot_CreateBrickGroup() {
|
||||
if(!isObject(BrickGroup_12345678)) {
|
||||
new SimGroup(BrickGroup_12345678) {
|
||||
bl_id = 12345678;
|
||||
name = "\c1Robot";
|
||||
QuotaObject = GlobalQuota;
|
||||
};
|
||||
mainBrickGroup.add(BrickGroup_12345678);
|
||||
}
|
||||
//if(!isObject(BrickGroup_12345678)) {
|
||||
// new SimGroup(BrickGroup_12345678) {
|
||||
// bl_id = 12345678;
|
||||
// name = "\c1Robot";
|
||||
// QuotaObject = GlobalQuota;
|
||||
// };
|
||||
// mainBrickGroup.add(BrickGroup_12345678);
|
||||
//}
|
||||
return BrickGroup_888888;
|
||||
}
|
||||
|
||||
function LogicGate_RobotController_Data::createRobot(%this, %obj) {
|
||||
|
BIN
icons/Pixel 2x2.png
Normal file
BIN
icons/Pixel 2x2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
icons/serialport-original.png
Normal file
BIN
icons/serialport-original.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 MiB |
BIN
icons/serialport.png
Normal file
BIN
icons/serialport.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -1,3 +1,4 @@
|
||||
//bls 2
|
||||
|
||||
if($Pref::Server::LuaLogic::OPT_TICK_ENABLED $= "") $Pref::Server::LuaLogic::OPT_TICK_ENABLED = true;
|
||||
if($Pref::Server::LuaLogic::OPT_TICK_TIME $= "") $Pref::Server::LuaLogic::OPT_TICK_TIME = 0.032;
|
||||
@ -38,4 +39,8 @@ function llr(){
|
||||
//schedule(1000, 0, llc);
|
||||
}
|
||||
|
||||
function AddOn_Brick_LuaLogic_Reload() {
|
||||
llr();
|
||||
}
|
||||
|
||||
schedule(10000, 0, llc);
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
//bls 2
|
||||
function mClampFloat(%x, %min, %max){
|
||||
return %x<%min ? %min : (%x>%max ? %max : %x);
|
||||
}
|
||||
@ -203,21 +203,35 @@ function lualogic_setPrintDomain(%domain) {
|
||||
}
|
||||
|
||||
function lualogic_defineprint(%name, %file) {
|
||||
%count = getNumPrintTextures();
|
||||
%domain = $LuaLogic::Print_Domain;
|
||||
%print = $LuaLogic::PrintsByFile[%file];
|
||||
if(%print $= "") { warn("LuaLogic_definePrint: No print named " @ %file @ " (" @ $LuaLogic::Print_Domain @ "." @ %name @ ")"); return; }
|
||||
$LuaLogic::Print[$LuaLogic::Print_Domain, %name] = %print;
|
||||
if(%print $= "") {
|
||||
%printd = $LuaLogic::Print["default", %name];
|
||||
if(%printd $= "") {
|
||||
warn("LuaLogic_definePrint: No print named " @ %file @ " (" @ $LuaLogic::Print_Domain @ "." @ %name @ ")");
|
||||
} else {
|
||||
$LuaLogic::Print[%domain, %name] = %printd;
|
||||
}
|
||||
} else {
|
||||
$LuaLogic::Print[%domain, %name] = %print;
|
||||
}
|
||||
}
|
||||
|
||||
function lualogic_isprint(%print, %domain) {
|
||||
return $LuaLogic::Print[%domain, %print] !$= "";
|
||||
}
|
||||
|
||||
function lualogic_getprint(%print, %domain) {
|
||||
function lualogic_getprint(%name, %domain) {
|
||||
if(%domain $= "") %domain = "default";
|
||||
%print = $LuaLogic::Print[%domain, %print];
|
||||
if(%print !$= "") return %print;
|
||||
else return 0;
|
||||
%print = $LuaLogic::Print[%domain, %name];
|
||||
if(%print !$= "") {
|
||||
return %print;
|
||||
} else if (%domain !$= "default") {
|
||||
return lualogic_getprint(%name, "default");
|
||||
} else {
|
||||
echo("lualogic_getprint: not found: " @ %domain @ "." @ %name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function lualogic_readfile(%filename){
|
||||
@ -318,6 +332,12 @@ function lualogic_loadprintsandcolors() {
|
||||
lualogic_defineprint("COLOR" @ %a @ %b @ %c, "Add-Ons/Print_Logic_Default/prints/color_" @ %a @ %b @ %c @ ".png");
|
||||
}
|
||||
|
||||
%hex = "0123456789ABCDEF";
|
||||
for(%i=1; %i<=0xE; %i++) {
|
||||
%h = getSubStr(%hex, %i, 1);
|
||||
lualogic_defineprint("pixel2x2_" @ %h, "Add-Ons/Print_Logic_Default/prints/pixel2x2_" @ %h @ ".png");
|
||||
}
|
||||
|
||||
lualogic_loadPrints_default ("default" );
|
||||
lualogic_loadPrints_terminal("terminal" , "" );
|
||||
lualogic_loadPrints_terminal("terminalInv", "-inv");
|
||||
@ -416,14 +436,14 @@ function lualogic_loadPrints_default(%domain) {
|
||||
lualogic_defineprint("apostrophe2" , "Add-Ons/Print_Letters_Extra/prints/-apostrophe2.png" );
|
||||
lualogic_defineprint("colon" , "Add-Ons/Print_Letters_Extra/prints/-colon.png" );
|
||||
lualogic_defineprint("comma" , "Add-Ons/Print_Letters_Extra/prints/-comma.png" );
|
||||
lualogic_defineprint("curlybracketleft" , "Add-Ons/Print_Letters_Extra/prints/-curlybracketleft.png" );
|
||||
lualogic_defineprint("curlybracketright" , "Add-Ons/Print_Letters_Extra/prints/-curlybracketright.png" );
|
||||
lualogic_defineprint("roundbracketleft" , "Add-Ons/Print_Letters_Extra/prints/-roundbracketleft.png" );
|
||||
lualogic_defineprint("roundbracketright" , "Add-Ons/Print_Letters_Extra/prints/-roundbracketright.png" );
|
||||
lualogic_defineprint("curlybracketright" , "Add-Ons/Print_Letters_Extra/prints/-curlybracketleft.png" );
|
||||
lualogic_defineprint("curlybracketleft" , "Add-Ons/Print_Letters_Extra/prints/-curlybracketright.png" );
|
||||
lualogic_defineprint("roundbracketright" , "Add-Ons/Print_Letters_Extra/prints/-roundbracketleft.png" );
|
||||
lualogic_defineprint("roundbracketleft" , "Add-Ons/Print_Letters_Extra/prints/-roundbracketright.png" );
|
||||
lualogic_defineprint("slashleft" , "Add-Ons/Print_Letters_Extra/prints/-slashleft.png" );
|
||||
lualogic_defineprint("slashright" , "Add-Ons/Print_Letters_Extra/prints/-slashright.png" );
|
||||
lualogic_defineprint("squarebracketleft" , "Add-Ons/Print_Letters_Extra/prints/-squarebracketleft.png" );
|
||||
lualogic_defineprint("squarebracketright", "Add-Ons/Print_Letters_Extra/prints/-squarebracketright.png");
|
||||
lualogic_defineprint("squarebracketright" , "Add-Ons/Print_Letters_Extra/prints/-squarebracketleft.png" );
|
||||
lualogic_defineprint("squarebracketleft", "Add-Ons/Print_Letters_Extra/prints/-squarebracketright.png");
|
||||
lualogic_defineprint("tilde" , "Add-Ons/Print_Letters_Extra/prints/-tilde.png" );
|
||||
lualogic_defineprint("underscore" , "Add-Ons/Print_Letters_Extra/prints/-underscore.png" );
|
||||
lualogic_defineprint("verticalbar" , "Add-Ons/Print_Letters_Extra/prints/-verticalbar.png" );
|
||||
|
Loading…
x
Reference in New Issue
Block a user