Commit code from local copy
parent
cdf36009ab
commit
64cf2b23c0
|
@ -0,0 +1,8 @@
|
|||
for name, val in pairs(buildtest.pipes.types) do
|
||||
minetest.register_craft({
|
||||
output = (val.outname or ("buildtest:pipe_" .. name .. "_000000_0")),
|
||||
recipe = {
|
||||
{val.base, "default:glass", val.base},
|
||||
}
|
||||
})
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
mesecons
|
||||
str_helpers
|
|
@ -0,0 +1,10 @@
|
|||
buildtest={}
|
||||
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/pipes_defs.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/misc/init.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/pipes_init.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pumps/pump_init.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/support/entity.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/support/liquid.lua")
|
||||
|
||||
dofile(minetest.get_modpath("buildtest").."/crafts.lua")
|
|
@ -0,0 +1,119 @@
|
|||
buildtest.autocraft = {
|
||||
allow_metadata_inventory_put = function(exc, isnumber)
|
||||
return function(pos, listname, index, stack, player)
|
||||
if listname==exc then
|
||||
return stack:get_count()
|
||||
end
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
if inv:get_stack(listname, index):is_empty() then
|
||||
local newStack = {name = stack:get_name()}
|
||||
if isnumber==true then
|
||||
newStack.count = stack:get_count()
|
||||
end
|
||||
inv:set_stack(listname, index, newStack)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_take = function(exc)
|
||||
return function(pos, listname, index, stack, player)
|
||||
if listname==exc then
|
||||
return stack:get_count()
|
||||
end
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
inv:set_stack(listname, index, nil)
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_move = function(exc, ok)
|
||||
return function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
if from_list==to_list or ok==true then
|
||||
return count
|
||||
end
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
--------------------------------------------------------------------------------
|
||||
do_craft = function(inventory)
|
||||
local recipe=inventory:get_list("craft")
|
||||
local result
|
||||
local new
|
||||
for i=1,9 do
|
||||
recipe[i]=ItemStack({name=recipe[i]:get_name(),count=1})
|
||||
end
|
||||
result,new=minetest.get_craft_result({method="normal",width=3,items=recipe})
|
||||
local input=inventory:get_list("in")
|
||||
if result.item:is_empty() then return end
|
||||
result=result.item
|
||||
if not inventory:room_for_item("in", result) then return end
|
||||
local to_use={}
|
||||
for _,item in ipairs(recipe) do
|
||||
if item~=nil and not item:is_empty() then
|
||||
if to_use[item:get_name()]==nil then
|
||||
to_use[item:get_name()]=1
|
||||
else
|
||||
to_use[item:get_name()]=to_use[item:get_name()]+1
|
||||
end
|
||||
end
|
||||
end
|
||||
local stack
|
||||
for itemname,number in pairs(to_use) do
|
||||
stack=ItemStack({name=itemname, count=number})
|
||||
if not inventory:contains_item("in",stack) then return end
|
||||
end
|
||||
for itemname,number in pairs(to_use) do
|
||||
stack=ItemStack({name=itemname, count=number})
|
||||
inventory:remove_item("in",stack)
|
||||
end
|
||||
inventory:add_item("in",result)
|
||||
for i=1,9 do
|
||||
inventory:add_item("in",new.items[i])
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
minetest.register_node("buildtest:autocraft", {
|
||||
--tiles = {"buildtest_pump_mesecon.png"},
|
||||
description = "Buildtest Automatic Crafting Table",
|
||||
groups = {choppy=1, oddly_breakable_by_hand=3},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("craft", 9)
|
||||
inv:set_size("in", 8*3)
|
||||
|
||||
meta:set_string("formspec", "size[8,11]"
|
||||
.."list[context;craft;2.5,0;3,3]"
|
||||
.."list[context;in;0,3.5;8,3]"
|
||||
.."list[current_player;main;0,7;8,4]")
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("in")
|
||||
end,
|
||||
--------------------------------------------------------------------------------
|
||||
allow_metadata_inventory_put = buildtest.autocraft.allow_metadata_inventory_put("in"),
|
||||
allow_metadata_inventory_take = buildtest.autocraft.allow_metadata_inventory_take("in"),
|
||||
allow_metadata_inventory_move = buildtest.autocraft.allow_metadata_inventory_move("in"),
|
||||
---------------------------------------------------------------------------------
|
||||
on_place = buildtest.pipes.onp_funct,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames={"buildtest:autocraft"},
|
||||
interval=5,
|
||||
chance=1,
|
||||
action=function(pos,node)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
buildtest.autocraft.do_craft(inv)
|
||||
end,
|
||||
})
|
|
@ -0,0 +1 @@
|
|||
dofile(minetest.get_modpath("buildtest").."/misc/autocraft.lua")
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,591 @@
|
|||
xof 0303txt 0032
|
||||
|
||||
Frame Root {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 1.000000, 0.000000,
|
||||
0.000000, 1.000000,-0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Frame Cube {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000,-0.000000, 0.093750, 0.000000,
|
||||
0.000000,-1.000000,-0.000001, 0.000000,
|
||||
0.000000, 0.000000, 0.344000, 1.000000;;
|
||||
}
|
||||
Mesh { //Mesh Mesh
|
||||
24;
|
||||
-1.000000;-1.000000;-1.000000;,
|
||||
-1.000000; 1.000000;-1.000000;,
|
||||
-1.000000; 1.000000; 1.000000;,
|
||||
-1.000000;-1.000000; 1.000000;,
|
||||
-1.000000; 1.000000;-1.000000;,
|
||||
1.000000; 1.000000;-1.000000;,
|
||||
1.000000; 1.000000; 1.000000;,
|
||||
-1.000000; 1.000000; 1.000000;,
|
||||
1.000000; 1.000000;-1.000000;,
|
||||
1.000000;-1.000000;-1.000000;,
|
||||
1.000000;-1.000000; 1.000000;,
|
||||
1.000000; 1.000000; 1.000000;,
|
||||
1.000000;-1.000000;-1.000000;,
|
||||
-1.000000;-1.000000;-1.000000;,
|
||||
-1.000000;-1.000000; 1.000000;,
|
||||
1.000000;-1.000000; 1.000000;,
|
||||
1.000000;-1.000000;-1.000000;,
|
||||
1.000000; 1.000000;-1.000000;,
|
||||
-1.000000; 1.000000;-1.000000;,
|
||||
-1.000000;-1.000000;-1.000000;,
|
||||
-1.000000;-1.000000; 1.000000;,
|
||||
-1.000000; 1.000000; 1.000000;,
|
||||
1.000000; 1.000000; 1.000000;,
|
||||
1.000000;-1.000000; 1.000000;;
|
||||
6;
|
||||
4;0;1;2;3;,
|
||||
4;4;5;6;7;,
|
||||
4;8;9;10;11;,
|
||||
4;12;13;14;15;,
|
||||
4;16;17;18;19;,
|
||||
4;20;21;22;23;;
|
||||
MeshNormals { //Mesh Normals
|
||||
24;
|
||||
-1.000000; 0.000000; 0.000000;,
|
||||
-1.000000; 0.000000; 0.000000;,
|
||||
-1.000000; 0.000000; 0.000000;,
|
||||
-1.000000; 0.000000; 0.000000;,
|
||||
0.000000; 1.000000;-0.000000;,
|
||||
0.000000; 1.000000;-0.000000;,
|
||||
0.000000; 1.000000;-0.000000;,
|
||||
0.000000; 1.000000;-0.000000;,
|
||||
1.000000; 0.000000;-0.000000;,
|
||||
1.000000; 0.000000;-0.000000;,
|
||||
1.000000; 0.000000;-0.000000;,
|
||||
1.000000; 0.000000;-0.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
-0.000000; 0.000000;-1.000000;,
|
||||
-0.000000; 0.000000;-1.000000;,
|
||||
-0.000000; 0.000000;-1.000000;,
|
||||
-0.000000; 0.000000;-1.000000;,
|
||||
-0.000000; 0.000000; 1.000000;,
|
||||
-0.000000; 0.000000; 1.000000;,
|
||||
-0.000000; 0.000000; 1.000000;,
|
||||
-0.000000; 0.000000; 1.000000;;
|
||||
6;
|
||||
4;0;1;2;3;,
|
||||
4;4;5;6;7;,
|
||||
4;8;9;10;11;,
|
||||
4;12;13;14;15;,
|
||||
4;16;17;18;19;,
|
||||
4;20;21;22;23;;
|
||||
} //End of Mesh Normals
|
||||
MeshMaterialList { //Mesh Material List
|
||||
1;
|
||||
1;
|
||||
0;;
|
||||
Material Default_Material {
|
||||
0.800000; 0.800000; 0.800000; 0.800000;;
|
||||
96.078431;
|
||||
0.500000; 0.500000; 0.500000;;
|
||||
0.000000; 0.000000; 0.000000;;
|
||||
}
|
||||
} //End of Mesh Material List
|
||||
MeshTextureCoords { //Mesh UV Coordinates
|
||||
24;
|
||||
0.000000; 0.000000;,
|
||||
1.000000; 0.000000;,
|
||||
1.000000; 0.125000;,
|
||||
0.000000; 0.125000;,
|
||||
0.000000; 0.000000;,
|
||||
1.000000; 0.000000;,
|
||||
1.000000; 1.000000;,
|
||||
0.000000; 1.000000;,
|
||||
1.000000; 0.125000;,
|
||||
0.000000; 0.125000;,
|
||||
0.000000; 0.000000;,
|
||||
1.000000; 0.000000;,
|
||||
1.000000; 1.000000;,
|
||||
0.000000; 1.000000;,
|
||||
0.000000; 0.000000;,
|
||||
1.000000; 0.000000;,
|
||||
0.992583; 0.000000;,
|
||||
0.992583; 0.123827;,
|
||||
0.000000; 0.123827;,
|
||||
0.000000; 0.000000;,
|
||||
0.000000; 0.125000;,
|
||||
0.000000; 0.000000;,
|
||||
1.000000; 0.000000;,
|
||||
1.000000; 0.125000;;
|
||||
} //End of Mesh UV Coordinates
|
||||
} //End of Mesh Mesh
|
||||
} //End of Cube
|
||||
} //End of Root Frame
|
||||
AnimationSet {
|
||||
Animation {
|
||||
{Cube}
|
||||
AnimationKey { //Position
|
||||
2;
|
||||
150;
|
||||
0;3; 0.000000, 0.000000, 0.344000;;,
|
||||
1;3; 0.000000, 0.000000, 0.355352;;,
|
||||
2;3; 0.000000, 0.000000, 0.388924;;,
|
||||
3;3; 0.000000, 0.000000, 0.440051;;,
|
||||
4;3; 0.000000, 0.000000, 0.498021;;,
|
||||
5;3; 0.000000, 0.000000, 0.549121;;,
|
||||
6;3; 0.000000, 0.000000, 0.582661;;,
|
||||
7;3; 0.000000, 0.000000, 0.594000;;,
|
||||
8;3; 0.000000, 0.000000, 0.582659;;,
|
||||
9;3; 0.000000, 0.000000, 0.549110;;,
|
||||
10;3; 0.000000, 0.000000, 0.497993;;,
|
||||
11;3; 0.000000, 0.000000, 0.440012;;,
|
||||
12;3; 0.000000, 0.000000, 0.388894;;,
|
||||
13;3; 0.000000, 0.000000, 0.355342;;,
|
||||
14;3; 0.000000, 0.000000, 0.344000;;,
|
||||
15;3; 0.000000, 0.000000, 0.346455;;,
|
||||
16;3; 0.000000, 0.000000, 0.353876;;,
|
||||
17;3; 0.000000, 0.000000, 0.366224;;,
|
||||
18;3; 0.000000, 0.000000, 0.383241;;,
|
||||
19;3; 0.000000, 0.000000, 0.404391;;,
|
||||
20;3; 0.000000, 0.000000, 0.428818;;,
|
||||
21;3; 0.000000, 0.000000, 0.455363;;,
|
||||
22;3; 0.000000, 0.000000, 0.482642;;,
|
||||
23;3; 0.000000, 0.000000, 0.509187;;,
|
||||
24;3; 0.000000, 0.000000, 0.533613;;,
|
||||
25;3; 0.000000, 0.000000, 0.554762;;,
|
||||
26;3; 0.000000, 0.000000, 0.571778;;,
|
||||
27;3; 0.000000, 0.000000, 0.584125;;,
|
||||
28;3; 0.000000, 0.000000, 0.591545;;,
|
||||
29;3; 0.000000, 0.000000, 0.594000;;,
|
||||
30;3; 0.000000, 0.000000, 0.591545;;,
|
||||
31;3; 0.000000, 0.000000, 0.584125;;,
|
||||
32;3; 0.000000, 0.000000, 0.571778;;,
|
||||
33;3; 0.000000, 0.000000, 0.554761;;,
|
||||
34;3; 0.000000, 0.000000, 0.533612;;,
|
||||
35;3; 0.000000, 0.000000, 0.509185;;,
|
||||
36;3; 0.000000, 0.000000, 0.482640;;,
|
||||
37;3; 0.000000, 0.000000, 0.455361;;,
|
||||
38;3; 0.000000, 0.000000, 0.428816;;,
|
||||
39;3; 0.000000, 0.000000, 0.404389;;,
|
||||
40;3; 0.000000, 0.000000, 0.383239;;,
|
||||
41;3; 0.000000, 0.000000, 0.366222;;,
|
||||
42;3; 0.000000, 0.000000, 0.353875;;,
|
||||
43;3; 0.000000, 0.000000, 0.346455;;,
|
||||
44;3; 0.000000, 0.000000, 0.344000;;,
|
||||
45;3; 0.000000, 0.000000, 0.345041;;,
|
||||
46;3; 0.000000, 0.000000, 0.348186;;,
|
||||
47;3; 0.000000, 0.000000, 0.353449;;,
|
||||
48;3; 0.000000, 0.000000, 0.360815;;,
|
||||
49;3; 0.000000, 0.000000, 0.370228;;,
|
||||
50;3; 0.000000, 0.000000, 0.381586;;,
|
||||
51;3; 0.000000, 0.000000, 0.394733;;,
|
||||
52;3; 0.000000, 0.000000, 0.409456;;,
|
||||
53;3; 0.000000, 0.000000, 0.425482;;,
|
||||
54;3; 0.000000, 0.000000, 0.442485;;,
|
||||
55;3; 0.000000, 0.000000, 0.460093;;,
|
||||
56;3; 0.000000, 0.000000, 0.477907;;,
|
||||
57;3; 0.000000, 0.000000, 0.495516;;,
|
||||
58;3; 0.000000, 0.000000, 0.512519;;,
|
||||
59;3; 0.000000, 0.000000, 0.528545;;,
|
||||
60;3; 0.000000, 0.000000, 0.543268;;,
|
||||
61;3; 0.000000, 0.000000, 0.556415;;,
|
||||
62;3; 0.000000, 0.000000, 0.567772;;,
|
||||
63;3; 0.000000, 0.000000, 0.577185;;,
|
||||
64;3; 0.000000, 0.000000, 0.584551;;,
|
||||
65;3; 0.000000, 0.000000, 0.589814;;,
|
||||
66;3; 0.000000, 0.000000, 0.592959;;,
|
||||
67;3; 0.000000, 0.000000, 0.594000;;,
|
||||
68;3; 0.000000, 0.000000, 0.592862;;,
|
||||
69;3; 0.000000, 0.000000, 0.589423;;,
|
||||
70;3; 0.000000, 0.000000, 0.583669;;,
|
||||
71;3; 0.000000, 0.000000, 0.575624;;,
|
||||
72;3; 0.000000, 0.000000, 0.565357;;,
|
||||
73;3; 0.000000, 0.000000, 0.552999;;,
|
||||
74;3; 0.000000, 0.000000, 0.538742;;,
|
||||
75;3; 0.000000, 0.000000, 0.522852;;,
|
||||
76;3; 0.000000, 0.000000, 0.505660;;,
|
||||
77;3; 0.000000, 0.000000, 0.487563;;,
|
||||
78;3; 0.000000, 0.000000, 0.469000;;,
|
||||
79;3; 0.000000, 0.000000, 0.450437;;,
|
||||
80;3; 0.000000, 0.000000, 0.432340;;,
|
||||
81;3; 0.000000, 0.000000, 0.415148;;,
|
||||
82;3; 0.000000, 0.000000, 0.399258;;,
|
||||
83;3; 0.000000, 0.000000, 0.385001;;,
|
||||
84;3; 0.000000, 0.000000, 0.372643;;,
|
||||
85;3; 0.000000, 0.000000, 0.362376;;,
|
||||
86;3; 0.000000, 0.000000, 0.354331;;,
|
||||
87;3; 0.000000, 0.000000, 0.348577;;,
|
||||
88;3; 0.000000, 0.000000, 0.345138;;,
|
||||
89;3; 0.000000, 0.000000, 0.344000;;,
|
||||
90;3; 0.000000, 0.000000, 0.344611;;,
|
||||
91;3; 0.000000, 0.000000, 0.346455;;,
|
||||
92;3; 0.000000, 0.000000, 0.349542;;,
|
||||
93;3; 0.000000, 0.000000, 0.353875;;,
|
||||
94;3; 0.000000, 0.000000, 0.359443;;,
|
||||
95;3; 0.000000, 0.000000, 0.366222;;,
|
||||
96;3; 0.000000, 0.000000, 0.374173;;,
|
||||
97;3; 0.000000, 0.000000, 0.383239;;,
|
||||
98;3; 0.000000, 0.000000, 0.393343;;,
|
||||
99;3; 0.000000, 0.000000, 0.404388;;,
|
||||
100;3; 0.000000, 0.000000, 0.416258;;,
|
||||
101;3; 0.000000, 0.000000, 0.428815;;,
|
||||
102;3; 0.000000, 0.000000, 0.441906;;,
|
||||
103;3; 0.000000, 0.000000, 0.455361;;,
|
||||
104;3; 0.000000, 0.000000, 0.469000;;,
|
||||
105;3; 0.000000, 0.000000, 0.482639;;,
|
||||
106;3; 0.000000, 0.000000, 0.496094;;,
|
||||
107;3; 0.000000, 0.000000, 0.509185;;,
|
||||
108;3; 0.000000, 0.000000, 0.521742;;,
|
||||
109;3; 0.000000, 0.000000, 0.533612;;,
|
||||
110;3; 0.000000, 0.000000, 0.544657;;,
|
||||
111;3; 0.000000, 0.000000, 0.554761;;,
|
||||
112;3; 0.000000, 0.000000, 0.563827;;,
|
||||
113;3; 0.000000, 0.000000, 0.571778;;,
|
||||
114;3; 0.000000, 0.000000, 0.578557;;,
|
||||
115;3; 0.000000, 0.000000, 0.584125;;,
|
||||
116;3; 0.000000, 0.000000, 0.588458;;,
|
||||
117;3; 0.000000, 0.000000, 0.591545;;,
|
||||
118;3; 0.000000, 0.000000, 0.593389;;,
|
||||
119;3; 0.000000, 0.000000, 0.594000;;,
|
||||
120;3; 0.000000, 0.000000, 0.593389;;,
|
||||
121;3; 0.000000, 0.000000, 0.591545;;,
|
||||
122;3; 0.000000, 0.000000, 0.588458;;,
|
||||
123;3; 0.000000, 0.000000, 0.584125;;,
|
||||
124;3; 0.000000, 0.000000, 0.578557;;,
|
||||
125;3; 0.000000, 0.000000, 0.571778;;,
|
||||
126;3; 0.000000, 0.000000, 0.563827;;,
|
||||
127;3; 0.000000, 0.000000, 0.554762;;,
|
||||
128;3; 0.000000, 0.000000, 0.544658;;,
|
||||
129;3; 0.000000, 0.000000, 0.533613;;,
|
||||
130;3; 0.000000, 0.000000, 0.521743;;,
|
||||
131;3; 0.000000, 0.000000, 0.509186;;,
|
||||
132;3; 0.000000, 0.000000, 0.496096;;,
|
||||
133;3; 0.000000, 0.000000, 0.482641;;,
|
||||
134;3; 0.000000, 0.000000, 0.469002;;,
|
||||
135;3; 0.000000, 0.000000, 0.455363;;,
|
||||
136;3; 0.000000, 0.000000, 0.441908;;,
|
||||
137;3; 0.000000, 0.000000, 0.428818;;,
|
||||
138;3; 0.000000, 0.000000, 0.416260;;,
|
||||
139;3; 0.000000, 0.000000, 0.404390;;,
|
||||
140;3; 0.000000, 0.000000, 0.393345;;,
|
||||
141;3; 0.000000, 0.000000, 0.383241;;,
|
||||
142;3; 0.000000, 0.000000, 0.374175;;,
|
||||
143;3; 0.000000, 0.000000, 0.366223;;,
|
||||
144;3; 0.000000, 0.000000, 0.359444;;,
|
||||
145;3; 0.000000, 0.000000, 0.353876;;,
|
||||
146;3; 0.000000, 0.000000, 0.349543;;,
|
||||
147;3; 0.000000, 0.000000, 0.346455;;,
|
||||
148;3; 0.000000, 0.000000, 0.344611;;,
|
||||
149;3; 0.000000, 0.000000, 0.344000;;;
|
||||
}
|
||||
AnimationKey { //Rotation
|
||||
0;
|
||||
150;
|
||||
0;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
1;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
2;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
3;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
4;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
5;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
6;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
7;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
8;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
9;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
10;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
11;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
12;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
13;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
14;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
15;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
16;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
17;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
18;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
19;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
20;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
21;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
22;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
23;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
24;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
25;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
26;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
27;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
28;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
29;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
30;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
31;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
32;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
33;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
34;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
35;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
36;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
37;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
38;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
39;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
40;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
41;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
42;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
43;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
44;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
45;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
46;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
47;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
48;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
49;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
50;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
51;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
52;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
53;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
54;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
55;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
56;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
57;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
58;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
59;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
60;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
61;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
62;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
63;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
64;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
65;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
66;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
67;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
68;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
69;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
70;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
71;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
72;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
73;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
74;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
75;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
76;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
77;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
78;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
79;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
80;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
81;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
82;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
83;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
84;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
85;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
86;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
87;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
88;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
89;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
90;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
91;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
92;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
93;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
94;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
95;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
96;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
97;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
98;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
99;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
100;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
101;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
102;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
103;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
104;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
105;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
106;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
107;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
108;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
109;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
110;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
111;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
112;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
113;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
114;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
115;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
116;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
117;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
118;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
119;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
120;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
121;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
122;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
123;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
124;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
125;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
126;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
127;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
128;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
129;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
130;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
131;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
132;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
133;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
134;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
135;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
136;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
137;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
138;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
139;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
140;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
141;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
142;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
143;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
144;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
145;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
146;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
147;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
148;4; -0.707107, 0.707107, 0.000000, 0.000000;;,
|
||||
149;4; -0.707107, 0.707107, 0.000000, 0.000000;;;
|
||||
}
|
||||
AnimationKey { //Scale
|
||||
1;
|
||||
150;
|
||||
0;3; 1.000000, 0.093750, 1.000000;;,
|
||||
1;3; 1.000000, 0.093750, 1.000000;;,
|
||||
2;3; 1.000000, 0.093750, 1.000000;;,
|
||||
3;3; 1.000000, 0.093750, 1.000000;;,
|
||||
4;3; 1.000000, 0.093750, 1.000000;;,
|
||||
5;3; 1.000000, 0.093750, 1.000000;;,
|
||||
6;3; 1.000000, 0.093750, 1.000000;;,
|
||||
7;3; 1.000000, 0.093750, 1.000000;;,
|
||||
8;3; 1.000000, 0.093750, 1.000000;;,
|
||||
9;3; 1.000000, 0.093750, 1.000000;;,
|
||||
10;3; 1.000000, 0.093750, 1.000000;;,
|
||||
11;3; 1.000000, 0.093750, 1.000000;;,
|
||||
12;3; 1.000000, 0.093750, 1.000000;;,
|
||||
13;3; 1.000000, 0.093750, 1.000000;;,
|
||||
14;3; 1.000000, 0.093750, 1.000000;;,
|
||||
15;3; 1.000000, 0.093750, 1.000000;;,
|
||||
16;3; 1.000000, 0.093750, 1.000000;;,
|
||||
17;3; 1.000000, 0.093750, 1.000000;;,
|
||||
18;3; 1.000000, 0.093750, 1.000000;;,
|
||||
19;3; 1.000000, 0.093750, 1.000000;;,
|
||||
20;3; 1.000000, 0.093750, 1.000000;;,
|
||||
21;3; 1.000000, 0.093750, 1.000000;;,
|
||||
22;3; 1.000000, 0.093750, 1.000000;;,
|
||||
23;3; 1.000000, 0.093750, 1.000000;;,
|
||||
24;3; 1.000000, 0.093750, 1.000000;;,
|
||||
25;3; 1.000000, 0.093750, 1.000000;;,
|
||||
26;3; 1.000000, 0.093750, 1.000000;;,
|
||||
27;3; 1.000000, 0.093750, 1.000000;;,
|
||||
28;3; 1.000000, 0.093750, 1.000000;;,
|
||||
29;3; 1.000000, 0.093750, 1.000000;;,
|
||||
30;3; 1.000000, 0.093750, 1.000000;;,
|
||||
31;3; 1.000000, 0.093750, 1.000000;;,
|
||||
32;3; 1.000000, 0.093750, 1.000000;;,
|
||||
33;3; 1.000000, 0.093750, 1.000000;;,
|
||||
34;3; 1.000000, 0.093750, 1.000000;;,
|
||||
35;3; 1.000000, 0.093750, 1.000000;;,
|
||||
36;3; 1.000000, 0.093750, 1.000000;;,
|
||||
37;3; 1.000000, 0.093750, 1.000000;;,
|
||||
38;3; 1.000000, 0.093750, 1.000000;;,
|
||||
39;3; 1.000000, 0.093750, 1.000000;;,
|
||||
40;3; 1.000000, 0.093750, 1.000000;;,
|
||||
41;3; 1.000000, 0.093750, 1.000000;;,
|
||||
42;3; 1.000000, 0.093750, 1.000000;;,
|
||||
43;3; 1.000000, 0.093750, 1.000000;;,
|
||||
44;3; 1.000000, 0.093750, 1.000000;;,
|
||||
45;3; 1.000000, 0.093750, 1.000000;;,
|
||||
46;3; 1.000000, 0.093750, 1.000000;;,
|
||||
47;3; 1.000000, 0.093750, 1.000000;;,
|
||||
48;3; 1.000000, 0.093750, 1.000000;;,
|
||||
49;3; 1.000000, 0.093750, 1.000000;;,
|
||||
50;3; 1.000000, 0.093750, 1.000000;;,
|
||||
51;3; 1.000000, 0.093750, 1.000000;;,
|
||||
52;3; 1.000000, 0.093750, 1.000000;;,
|
||||
53;3; 1.000000, 0.093750, 1.000000;;,
|
||||
54;3; 1.000000, 0.093750, 1.000000;;,
|
||||
55;3; 1.000000, 0.093750, 1.000000;;,
|
||||
56;3; 1.000000, 0.093750, 1.000000;;,
|
||||
57;3; 1.000000, 0.093750, 1.000000;;,
|
||||
58;3; 1.000000, 0.093750, 1.000000;;,
|
||||
59;3; 1.000000, 0.093750, 1.000000;;,
|
||||
60;3; 1.000000, 0.093750, 1.000000;;,
|
||||
61;3; 1.000000, 0.093750, 1.000000;;,
|
||||
62;3; 1.000000, 0.093750, 1.000000;;,
|
||||
63;3; 1.000000, 0.093750, 1.000000;;,
|
||||
64;3; 1.000000, 0.093750, 1.000000;;,
|
||||
65;3; 1.000000, 0.093750, 1.000000;;,
|
||||
66;3; 1.000000, 0.093750, 1.000000;;,
|
||||
67;3; 1.000000, 0.093750, 1.000000;;,
|
||||
68;3; 1.000000, 0.093750, 1.000000;;,
|
||||
69;3; 1.000000, 0.093750, 1.000000;;,
|
||||
70;3; 1.000000, 0.093750, 1.000000;;,
|
||||
71;3; 1.000000, 0.093750, 1.000000;;,
|
||||
72;3; 1.000000, 0.093750, 1.000000;;,
|
||||
73;3; 1.000000, 0.093750, 1.000000;;,
|
||||
74;3; 1.000000, 0.093750, 1.000000;;,
|
||||
75;3; 1.000000, 0.093750, 1.000000;;,
|
||||
76;3; 1.000000, 0.093750, 1.000000;;,
|
||||
77;3; 1.000000, 0.093750, 1.000000;;,
|
||||
78;3; 1.000000, 0.093750, 1.000000;;,
|
||||
79;3; 1.000000, 0.093750, 1.000000;;,
|
||||
80;3; 1.000000, 0.093750, 1.000000;;,
|
||||
81;3; 1.000000, 0.093750, 1.000000;;,
|
||||
82;3; 1.000000, 0.093750, 1.000000;;,
|
||||
83;3; 1.000000, 0.093750, 1.000000;;,
|
||||
84;3; 1.000000, 0.093750, 1.000000;;,
|
||||
85;3; 1.000000, 0.093750, 1.000000;;,
|
||||
86;3; 1.000000, 0.093750, 1.000000;;,
|
||||
87;3; 1.000000, 0.093750, 1.000000;;,
|
||||
88;3; 1.000000, 0.093750, 1.000000;;,
|
||||
89;3; 1.000000, 0.093750, 1.000000;;,
|
||||
90;3; 1.000000, 0.093750, 1.000000;;,
|
||||
91;3; 1.000000, 0.093750, 1.000000;;,
|
||||
92;3; 1.000000, 0.093750, 1.000000;;,
|
||||
93;3; 1.000000, 0.093750, 1.000000;;,
|
||||
94;3; 1.000000, 0.093750, 1.000000;;,
|
||||
95;3; 1.000000, 0.093750, 1.000000;;,
|
||||
96;3; 1.000000, 0.093750, 1.000000;;,
|
||||
97;3; 1.000000, 0.093750, 1.000000;;,
|
||||
98;3; 1.000000, 0.093750, 1.000000;;,
|
||||
99;3; 1.000000, 0.093750, 1.000000;;,
|
||||
100;3; 1.000000, 0.093750, 1.000000;;,
|
||||
101;3; 1.000000, 0.093750, 1.000000;;,
|
||||
102;3; 1.000000, 0.093750, 1.000000;;,
|
||||
103;3; 1.000000, 0.093750, 1.000000;;,
|
||||
104;3; 1.000000, 0.093750, 1.000000;;,
|
||||
105;3; 1.000000, 0.093750, 1.000000;;,
|
||||
106;3; 1.000000, 0.093750, 1.000000;;,
|
||||
107;3; 1.000000, 0.093750, 1.000000;;,
|
||||
108;3; 1.000000, 0.093750, 1.000000;;,
|
||||
109;3; 1.000000, 0.093750, 1.000000;;,
|
||||
110;3; 1.000000, 0.093750, 1.000000;;,
|
||||
111;3; 1.000000, 0.093750, 1.000000;;,
|
||||
112;3; 1.000000, 0.093750, 1.000000;;,
|
||||
113;3; 1.000000, 0.093750, 1.000000;;,
|
||||
114;3; 1.000000, 0.093750, 1.000000;;,
|
||||
115;3; 1.000000, 0.093750, 1.000000;;,
|
||||
116;3; 1.000000, 0.093750, 1.000000;;,
|
||||
117;3; 1.000000, 0.093750, 1.000000;;,
|
||||
118;3; 1.000000, 0.093750, 1.000000;;,
|
||||
119;3; 1.000000, 0.093750, 1.000000;;,
|
||||
120;3; 1.000000, 0.093750, 1.000000;;,
|
||||
121;3; 1.000000, 0.093750, 1.000000;;,
|
||||
122;3; 1.000000, 0.093750, 1.000000;;,
|
||||
123;3; 1.000000, 0.093750, 1.000000;;,
|
||||
124;3; 1.000000, 0.093750, 1.000000;;,
|
||||
125;3; 1.000000, 0.093750, 1.000000;;,
|
||||
126;3; 1.000000, 0.093750, 1.000000;;,
|
||||
127;3; 1.000000, 0.093750, 1.000000;;,
|
||||
128;3; 1.000000, 0.093750, 1.000000;;,
|
||||
129;3; 1.000000, 0.093750, 1.000000;;,
|
||||
130;3; 1.000000, 0.093750, 1.000000;;,
|
||||
131;3; 1.000000, 0.093750, 1.000000;;,
|
||||
132;3; 1.000000, 0.093750, 1.000000;;,
|
||||
133;3; 1.000000, 0.093750, 1.000000;;,
|
||||
134;3; 1.000000, 0.093750, 1.000000;;,
|
||||
135;3; 1.000000, 0.093750, 1.000000;;,
|
||||
136;3; 1.000000, 0.093750, 1.000000;;,
|
||||
137;3; 1.000000, 0.093750, 1.000000;;,
|
||||
138;3; 1.000000, 0.093750, 1.000000;;,
|
||||
139;3; 1.000000, 0.093750, 1.000000;;,
|
||||
140;3; 1.000000, 0.093750, 1.000000;;,
|
||||
141;3; 1.000000, 0.093750, 1.000000;;,
|
||||
142;3; 1.000000, 0.093750, 1.000000;;,
|
||||
143;3; 1.000000, 0.093750, 1.000000;;,
|
||||
144;3; 1.000000, 0.093750, 1.000000;;,
|
||||
145;3; 1.000000, 0.093750, 1.000000;;,
|
||||
146;3; 1.000000, 0.093750, 1.000000;;,
|
||||
147;3; 1.000000, 0.093750, 1.000000;;,
|
||||
148;3; 1.000000, 0.093750, 1.000000;;,
|
||||
149;3; 1.000000, 0.093750, 1.000000;;;
|
||||
}
|
||||
}
|
||||
} //End of AnimationSet
|
Binary file not shown.
After Width: | Height: | Size: 217 B |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 198 B |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 196 B |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 199 B |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 201 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,44 @@
|
|||
buildtest.pipes.types.cobble = {
|
||||
base = "default:cobble",
|
||||
}
|
||||
|
||||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Cobblestone Pipe",
|
||||
tiles = {"buildtest_pipe_cobble.png"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
buildtest = {
|
||||
slowdown=0.1,
|
||||
pipe=1,
|
||||
connects={
|
||||
buildtest.pipes.defaultPipes
|
||||
},
|
||||
disconnects = {{
|
||||
"buildtest:pipe_stone",
|
||||
}},
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_cobble_000000_'..id} }
|
||||
}
|
||||
},
|
||||
on_place = buildtest.pipes.onp_funct,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
}
|
||||
if count~=1 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
minetest.register_node("buildtest:pipe_cobble_"..name, def)
|
||||
end)
|
|
@ -0,0 +1,95 @@
|
|||
buildtest.pipes.types.diamond = {
|
||||
base = "default:diamond",
|
||||
colours = {
|
||||
"green",
|
||||
"black",
|
||||
"red",
|
||||
"white",
|
||||
"blue",
|
||||
"yellow",
|
||||
},
|
||||
}
|
||||
-- x+ : red
|
||||
-- x- : green
|
||||
-- y+ : blue
|
||||
-- y- : yellow
|
||||
-- z+ : black
|
||||
-- z- : white
|
||||
|
||||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local top = "buildtest_pipe_diamond_top.png"
|
||||
local bttm = "buildtest_pipe_diamond_bottem.png"
|
||||
local side = "buildtest_pipe_diamond.png"
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Diamond Pipe",
|
||||
tiles = {top,bttm,side,side,side,side},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
buildtest = {
|
||||
slowdown=0.1,
|
||||
pipe=1,
|
||||
connects={
|
||||
buildtest.pipes.defaultPipes
|
||||
},
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_diamond_000000_'..id} }
|
||||
}
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
buildtest.pipes.onp_funct(itemstack, placer, pointed_thing)
|
||||
local meta = minetest.get_meta(pointed_thing.above)
|
||||
--meta:set_string("formspec", buildtest.pipes.diamond.formspec)
|
||||
meta:set_string("infotext", "Diamond Pipe")
|
||||
local inv = meta:get_inventory()
|
||||
--inv:set_size("main", 10*6)
|
||||
for i=1,#buildtest.pipes.types.diamond.colours do
|
||||
local name = buildtest.pipes.types.diamond.colours[i]
|
||||
inv:set_size(name, 10)
|
||||
end
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
local posname = "nodemeta:"..pos.x..","..pos.y..","..pos.z
|
||||
local formspec = "invsize[11,11;]"
|
||||
--.."list["..posname..";main;1,0;10,6;]"
|
||||
.."list[current_player;main;0,7;8,4;]"
|
||||
for i=1,#buildtest.pipes.types.diamond.colours do
|
||||
local name = buildtest.pipes.types.diamond.colours[i]
|
||||
formspec = formspec.."list["..posname..";"..name..";1,"..(i-1)..";10,1;]label[0,"..(i-1)..";"..name.."]"
|
||||
end
|
||||
minetest.show_formspec(clicker:get_player_name(), "buildtest:pipe_diamond_"..name, formspec)
|
||||
end,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
--------------------------------------------------------------------------------
|
||||
allow_metadata_inventory_put = buildtest.autocraft.allow_metadata_inventory_put(nil), -- {["green"]=1, ["black"]=1, ["red"]=1, ["white"]=1, ["blue"]=1, ["yellow"]=1,}
|
||||
allow_metadata_inventory_take = buildtest.autocraft.allow_metadata_inventory_take(nil),
|
||||
allow_metadata_inventory_move = buildtest.autocraft.allow_metadata_inventory_move(nil, true),
|
||||
}
|
||||
if count~=1 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
minetest.register_node("buildtest:pipe_diamond_"..name, def)
|
||||
end)
|
||||
|
||||
buildtest.pipes.types.diamond.getDir = function(pos,cargo)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
for i=1,#buildtest.pipes.types.diamond.colours do
|
||||
local name = buildtest.pipes.types.diamond.colours[i]
|
||||
if inv:contains_item(name, {name=cargo.name}) then
|
||||
return buildtest.toXY(i)
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
|
@ -0,0 +1,57 @@
|
|||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Emeriald Pipe",
|
||||
tiles = {"buildtest_pipe_emr.png"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
buildtest = {
|
||||
slowdown=0.1,
|
||||
pipe=1,
|
||||
connects={
|
||||
buildtest.pipes.defaultPipes,
|
||||
{"default:chest"}
|
||||
},
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_emr_000000_'..id} }
|
||||
}
|
||||
},
|
||||
--on_place = buildtest.pipes.onp_funct,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
buildtest.pipes.onp_funct(itemstack, placer, pointed_thing)
|
||||
local meta = minetest.get_meta(pointed_thing.above)
|
||||
|
||||
meta:set_string("infotext", "Emeriald Pipe")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*2)
|
||||
end,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
local posname = "nodemeta:"..pos.x..","..pos.y..","..pos.z
|
||||
local formspec = "invsize[8,7;]"
|
||||
.."list["..posname..";main;0,0;8,2;]"
|
||||
.."list[current_player;main;0,2;8,4;]"
|
||||
minetest.show_formspec(clicker:get_player_name(), "buildtest:pipe_emr_"..name, formspec)
|
||||
end,
|
||||
--------------------------------------------------------------------------------
|
||||
allow_metadata_inventory_put = buildtest.autocraft.allow_metadata_inventory_put(nil),
|
||||
allow_metadata_inventory_take = buildtest.autocraft.allow_metadata_inventory_take(nil),
|
||||
allow_metadata_inventory_move = buildtest.autocraft.allow_metadata_inventory_move(nil),
|
||||
}
|
||||
if count~=1 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
minetest.register_node("buildtest:pipe_emr_"..name, def)
|
||||
end)
|
|
@ -0,0 +1,366 @@
|
|||
buildtest.pipes.types.gate = {
|
||||
base = "mesecons_luacontroller:luacontroller0000",
|
||||
outname = "buildtest:pipe_gate1_000000_0",
|
||||
types = {
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
buildtest.pipes.types.gate.setFS = function(meta)
|
||||
--local meta = minetest.get_meta(pos)
|
||||
|
||||
local trigger = meta:get_int("sel") or 1
|
||||
if trigger == 0 then trigger = 1 end
|
||||
|
||||
local act = meta:get_int("act") or 1
|
||||
if act == 0 then act = 1 end
|
||||
-- print("trigger: "..trigger)
|
||||
local triggers = buildtest.pipes.types.gate.triggers
|
||||
local nextTrigger = triggers[trigger + 1] or triggers[1]
|
||||
|
||||
local acts = buildtest.pipes.types.gate.acts
|
||||
local nextAct = acts[act + 1] or acts[1]
|
||||
|
||||
local fs =
|
||||
"invsize[8,7;]"
|
||||
.."image_button[2,1;1,1;"..triggers[trigger][3] -- texture
|
||||
..";trigset_"..nextTrigger[1]--triggers[trigger][1] -- name
|
||||
..";"--..triggers[trigger][2] -- label
|
||||
.."]"
|
||||
|
||||
.."label[2,0.5;"..triggers[trigger][2].."]"
|
||||
|
||||
|
||||
.."image_button[4,1;1,1;"..acts[act][3] -- texture
|
||||
..";setact_"..nextAct[1]--triggers[trigger][1] -- name
|
||||
..";"--..triggers[trigger][2] -- label
|
||||
.."]"
|
||||
|
||||
.."label[4,0.5;"..acts[act][2].."]"
|
||||
|
||||
.."list[current_player;main;0,3;8,4;]"
|
||||
|
||||
if buildtest.pipes.types.gate.triggers[meta:get_int("sel")].cont
|
||||
== buildtest.pipes.types.gate.acts[meta:get_int("act")].cont then
|
||||
fs = fs .. "image[3,1;2,1;buildtest_pipe_gate_joinok.png]"
|
||||
else
|
||||
fs = fs .. "image[3,1;2,1;buildtest_pipe_gate_joinnogo.png]"
|
||||
end
|
||||
|
||||
if triggers[trigger][4]~=nil then
|
||||
fs = fs .. triggers[trigger][4]
|
||||
--print(triggers[trigger][4])
|
||||
end
|
||||
|
||||
meta:set_string("formspec", fs)
|
||||
end
|
||||
|
||||
buildtest.pipes.types.gate.triggers = {
|
||||
{"eng_blue", "Engine blue", "buildtest_pump_mask_blue_side.png", cont=true},
|
||||
{"eng_green", "Engine green", "buildtest_pump_mask_green_side.png", cont=true},
|
||||
{"eng_yellow", "Engine yellow", "buildtest_pump_mask_yellow_side.png", cont=true},
|
||||
{"eng_red", "Engine red", "buildtest_pump_mask_red_side.png", cont=true},
|
||||
|
||||
{"chest_cont", "Chest contains", "default_chest_front.png", "list[context;main;2,2;1,1;]", cont=true},
|
||||
{"chest_room", "Chest has room", "default_chest_front.png", "list[context;main;2,2;1,1;]", cont=true},
|
||||
|
||||
{"item_pass", "Item traversing", "default_book.png", "list[context;main;2,2;1,1;]", cont=false},
|
||||
}
|
||||
|
||||
buildtest.pipes.types.gate.acts = {
|
||||
{"mesecon_on", "Mesecon On", "jeija_torches_on.png", cont=true},
|
||||
{"mesecon_off", "Mesecon Off", "jeija_torches_off.png", cont=true},
|
||||
{"mesecon_tog", "Mesecon Toggle", "jeija_wall_lever_off.png", cont=false},
|
||||
}
|
||||
|
||||
if minetest.get_modpath("digilines") ~= nil then
|
||||
buildtest.pipes.types.gate.acts[#buildtest.pipes.types.gate.acts + 1] =
|
||||
{"digiline_send", "Digiline Send", "jeija_wall_lever_off.png", cont=false}
|
||||
end
|
||||
|
||||
for m_on = 1, 2 do
|
||||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local state = {"off", "on"}
|
||||
local mesecon_state = mesecon.state[state[m_on]]
|
||||
--print(m_on .. " = " .. mesecon_state)
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Gate",
|
||||
tiles = {"buildtest_pipe_gate_"..m_on..".png"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
buildtest = {
|
||||
pipe=1,
|
||||
slowdown=0.1,
|
||||
connects={
|
||||
--"default:chest",
|
||||
buildtest.pipes.defaultPipes
|
||||
},
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_gate1_000000_'..id} }
|
||||
}
|
||||
},
|
||||
mesecons = {
|
||||
receptor = {
|
||||
state = mesecon_state,
|
||||
--rules = mesecon.rules.buttonlike_get
|
||||
}
|
||||
},
|
||||
digiline = {
|
||||
receptor = {},
|
||||
effector = {},
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
buildtest.pipes.onp_funct(itemstack, placer, pointed_thing)
|
||||
-- meta:set_string("formspec", )
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 1)
|
||||
|
||||
meta:set_string("infotext", "Gate Pipe")
|
||||
meta:set_int("sel", 1)
|
||||
meta:set_int("act", 1)
|
||||
|
||||
buildtest.pipes.types.gate.setFS(meta)
|
||||
end,
|
||||
-- on_rightclick = function(pos, node, clicker, itemstack)
|
||||
-- local meta = minetest.get_meta(pos)
|
||||
--
|
||||
-- local trigger = meta:get_int("sel") or 1
|
||||
-- if trigger == 0 then trigger = 1 end
|
||||
-- --print("trigger: "..trigger)
|
||||
-- local triggers = buildtest.pipes.types.gate.triggers
|
||||
-- local nextTrigger = triggers[trigger + 1] or triggers[1]
|
||||
--
|
||||
-- local posname = "nodemeta:"..pos.x..","..pos.y..","..pos.z
|
||||
-- local formspec = "invsize[8,7;]"
|
||||
---- .."list["..posname..";main;0,0;8,2;]"
|
||||
--
|
||||
-- .."image_button[2,1;1,1"
|
||||
--
|
||||
-- ..";"..triggers[trigger][3] -- texture
|
||||
--
|
||||
-- ..";trigset_"..triggers[trigger][1] -- name
|
||||
--
|
||||
-- ..";"..triggers[trigger][2] -- label
|
||||
--
|
||||
-- .."]"
|
||||
--
|
||||
-- .."list[current_player;main;0,3;8,4;]"
|
||||
-- minetest.show_formspec(clicker:get_player_name(), "buildtest:pipe_gate_"..name, formspec)
|
||||
-- end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
-- print("ok")
|
||||
-- for name, val in pairs(fields) do
|
||||
-- print(name .. "=" .. val)
|
||||
-- end
|
||||
|
||||
local triggers = buildtest.pipes.types.gate.triggers
|
||||
for i=1, #triggers do
|
||||
if fields["trigset_"..triggers[i][1]]~=nil then
|
||||
--print(i)
|
||||
minetest.env:get_meta(pos):set_int("sel", i)
|
||||
end
|
||||
end
|
||||
|
||||
local acts = buildtest.pipes.types.gate.acts
|
||||
for i=1, #acts do
|
||||
if fields["setact_"..acts[i][1]]~=nil then
|
||||
--print(i)
|
||||
minetest.env:get_meta(pos):set_int("act", i)
|
||||
end
|
||||
end
|
||||
|
||||
buildtest.pipes.types.gate.setFS(minetest.get_meta(pos))
|
||||
end,
|
||||
on_place = buildtest.pipes.onp_funct,
|
||||
on_dig = function(pos, node, digger)
|
||||
buildtest.pipes.ond_funct(pos, node, digger)
|
||||
mesecon.on_dignode(pos, node)
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = buildtest.autocraft.allow_metadata_inventory_put(nil, true),
|
||||
allow_metadata_inventory_take = buildtest.autocraft.allow_metadata_inventory_take(nil),
|
||||
allow_metadata_inventory_move = buildtest.autocraft.allow_metadata_inventory_move(nil),
|
||||
}
|
||||
if count~=1 or m_on==2 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
minetest.register_node("buildtest:pipe_gate"..m_on.."_"..name, def)
|
||||
|
||||
|
||||
local getRunAction = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local trig = buildtest.pipes.types.gate.triggers[meta:get_int("sel")][1]
|
||||
local action = buildtest.pipes.types.gate.acts[meta:get_int("act")][1]
|
||||
local runAction = nil
|
||||
|
||||
if action == "mesecon_on" or action == "mesecon_off" then
|
||||
runAction = function(is_on)
|
||||
--print(is_on)
|
||||
local new_name = "buildtest:pipe_gate"
|
||||
if is_on==(action == "mesecon_on") then
|
||||
new_name = new_name .. "2"
|
||||
else
|
||||
new_name = new_name .. "1"
|
||||
end
|
||||
new_name = new_name .. "_" .. name
|
||||
|
||||
if new_name~=minetest.get_node(pos).name then
|
||||
--print(new_name)
|
||||
buildtest.pumps.hacky_swap_node(pos, new_name)
|
||||
if is_on~=(action == "mesecon_on") then
|
||||
mesecon:receptor_off(pos)
|
||||
else
|
||||
mesecon:receptor_on(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if action == "mesecon_tog" then
|
||||
runAction = function(is_on)
|
||||
if is_on==false then
|
||||
return
|
||||
end
|
||||
--print(is_on)
|
||||
local def = minetest.registered_items[minetest.get_node(pos).name]
|
||||
local is_now_on = def.mesecons.receptor.state
|
||||
if is_now_on=="off" then
|
||||
is_now_on = 2
|
||||
else
|
||||
is_now_on = 1
|
||||
end
|
||||
local new_name = "buildtest:pipe_gate" .. is_now_on .. "_" .. name
|
||||
|
||||
buildtest.pumps.hacky_swap_node(pos, new_name)
|
||||
if is_now_on==1 then
|
||||
mesecon:receptor_off(pos)
|
||||
else
|
||||
mesecon:receptor_on(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if action == "digiline_send" then
|
||||
runAction = function(is_on)
|
||||
if is_on==false then
|
||||
return
|
||||
end
|
||||
local setchan = "pipe_gate"
|
||||
digiline:receptor_send(pos, digiline.rules.default, channel, "event")
|
||||
end
|
||||
end
|
||||
|
||||
local entProcess = nil
|
||||
|
||||
if trig=="item_pass" then
|
||||
entProcess = function(stack)
|
||||
if inv:get_stack("main", 1):is_empty() then
|
||||
runAction(true)
|
||||
return
|
||||
end
|
||||
if inv:get_stack("main", 1):get_name() == stack.name then
|
||||
runAction(true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return {act = runAction, entProcess = entProcess,}
|
||||
end
|
||||
|
||||
local abm = function(pos)
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
if buildtest.pipes.types.gate.triggers[meta:get_int("sel")].cont
|
||||
~= buildtest.pipes.types.gate.acts[meta:get_int("act")].cont then
|
||||
return
|
||||
end
|
||||
|
||||
local trig = buildtest.pipes.types.gate.triggers[meta:get_int("sel")][1]
|
||||
local action = buildtest.pipes.types.gate.acts[meta:get_int("act")][1]
|
||||
local runAction = getRunAction(pos).act
|
||||
|
||||
for i=1, 6 do
|
||||
local newPos = buildtest.posADD(buildtest.toXY(i), pos)
|
||||
local posname = minetest.get_node(newPos).name
|
||||
local def = minetest.registered_items[posname]
|
||||
if strs:starts(trig, "eng_") then
|
||||
if def~=nil then
|
||||
local colour = strs:rem_from_start(trig, "eng_")
|
||||
if def.buildtest~=nil then
|
||||
if def.buildtest.pump~=nil then
|
||||
if colour==def.buildtest.pump.colour then
|
||||
if runAction~=nil then
|
||||
runAction(true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if (trig=="chest_cont" or trig=="chest_room") and buildtest.canPumpInto[posname]~=nil then
|
||||
local listname = buildtest.get_listname_for_dir_in(buildtest.toXY(i), posname)
|
||||
--buildtest.canPumpInto[minetest.get_node(newPos).name][1]
|
||||
local newInv = minetest.get_meta(newPos):get_inventory()
|
||||
|
||||
if trig=="chest_cont" then
|
||||
-- if minetest.get_node(newPos).name=="default:chest" then
|
||||
if newInv:contains_item(listname, inv:get_stack("main", 1)) then
|
||||
if runAction~=nil then
|
||||
runAction(true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if trig=="chest_room" then
|
||||
--if minetest.get_node(newPos).name=="default:chest" then
|
||||
if newInv:room_for_item(listname, inv:get_stack("main", 1)) then
|
||||
if runAction~=nil then
|
||||
runAction(true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if runAction~=nil then
|
||||
runAction(false)
|
||||
end
|
||||
end
|
||||
|
||||
buildtest.pipes.types.gate.types["buildtest:pipe_gate"..m_on.."_"..name] = {
|
||||
abm = abm,
|
||||
getRunAction = getRunAction,
|
||||
}
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"buildtest:pipe_gate"..m_on.."_"..name},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = abm,
|
||||
})
|
||||
end)
|
||||
end
|
|
@ -0,0 +1,57 @@
|
|||
buildtest.pipes.types.gold = {
|
||||
base = "default:gold_ingot",
|
||||
}
|
||||
|
||||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Gold Pipe",
|
||||
tiles = {"buildtest_pipe_gold.png"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
buildtest = {
|
||||
slowdown=0.1,
|
||||
pipe=1,
|
||||
connects={
|
||||
buildtest.pipes.defaultPipes
|
||||
},
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_gold_000000_'..id} }
|
||||
}
|
||||
},
|
||||
mesecons = {
|
||||
effector = {
|
||||
action_off = function (pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("on", 1)
|
||||
end,
|
||||
action_on = function (pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("on", 0)
|
||||
end,
|
||||
},
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
buildtest.pipes.onp_funct(itemstack, placer, pointed_thing)
|
||||
local meta = minetest.get_meta(pointed_thing.above)
|
||||
meta:set_int("on", 1)
|
||||
end,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
}
|
||||
if count~=1 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
minetest.register_node("buildtest:pipe_gold_"..name, def)
|
||||
end)
|
|
@ -0,0 +1,121 @@
|
|||
buildtest.pipes.types.iron = {
|
||||
base = "default:steel_ingot",
|
||||
}
|
||||
|
||||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local top = "buildtest_pipe_iron_top.png"
|
||||
local side = "buildtest_pipe_iron.png"
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
paramtype2= "facedir",
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Iron Pipe",
|
||||
tiles = {top,side,side,side,side,side},
|
||||
groups = {cracky=1},
|
||||
buildtest = {
|
||||
slowdown=0.1,
|
||||
pipe=1,
|
||||
connects={
|
||||
buildtest.pipes.defaultPipes
|
||||
},
|
||||
},
|
||||
mesecons = {
|
||||
effector = {
|
||||
action_off = function (pos, node)
|
||||
end,
|
||||
action_on = function (pos, node)
|
||||
--minetest.after(0.5, function() -- mesecons seems to call "action_on" BEFORE it sets all the wires to new nodes. -- WRONG!
|
||||
for i=0, 5 do
|
||||
local newPos = buildtest.posADD(pos, buildtest.pipes.types.iron.getRawDir(i*4))
|
||||
--if mesecon:is_power_on(newPos) then
|
||||
-- local rule = {x=newPos.x, y=newPos.y, z=newPos.z, name = "in"..i}
|
||||
-- local invRule = {x=rule.x, y=rule.y, z=rule.z, name = rule.name}
|
||||
-- if mesecon:is_power_on(mesecon:addPosRule(pos, rule), invRule)
|
||||
-- and mesecon:rules_link(mesecon:addPosRule(pos, rule), pos) then
|
||||
-- local def = minetest.registered_items[minetest.get_node(newPos).name]
|
||||
-- if def~=nil and
|
||||
-- def.mesecons~=nil and
|
||||
-- def.mesecons.receptor~=nil and
|
||||
-- def.mesecons.receptor.state=="on" then
|
||||
if strs:starts(minetest.get_node(newPos).name, "buildtest:pipe_meseconon_") then
|
||||
|
||||
node.param2 = i * 4
|
||||
minetest.set_node(pos, node)
|
||||
-- print("setting facedir to: "..node.param2)
|
||||
end
|
||||
end
|
||||
--end)
|
||||
end,
|
||||
},
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_iron_000000_'..id} }
|
||||
}
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
buildtest.pipes.onp_funct(itemstack, placer, pointed_thing)
|
||||
--local meta = minetest.get_meta(pointed_thing.above)
|
||||
--meta:set_int("facedir", 1)
|
||||
end,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
on_punch = function(pos, node, puncher)
|
||||
--node.param2 = node.param2 + 1
|
||||
--print("rotation: "..node.param2)
|
||||
-- local meta = minetest.get_meta(pos)
|
||||
--local rot = meta:get_int("rot")
|
||||
local rot = node.param2
|
||||
rot = rot + 4
|
||||
if rot >= 24 then rot = 0 end
|
||||
--meta:set_int("rot", rot)
|
||||
node.param2 = rot
|
||||
minetest.set_node(pos, node)
|
||||
--print("rotation: "..rot)
|
||||
--buildtest.pipes.processNode(pos)
|
||||
end,
|
||||
}
|
||||
if count~=1 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
minetest.register_node("buildtest:pipe_iron_"..name, def)
|
||||
end)
|
||||
|
||||
buildtest.pipes.types.iron.getRawDir = function(rot)
|
||||
if rot>=0 and rot<=3 then
|
||||
return {x= 0,y= 1,z= 0}
|
||||
end
|
||||
if rot>=4 and rot<=7 then
|
||||
return {x= 0,y= 0,z= 1}
|
||||
end
|
||||
if rot>=8 and rot<=11 then
|
||||
return {x= 0,y= 0,z=-1}
|
||||
end
|
||||
if rot>=12 and rot<=15 then
|
||||
return {x= 1,y= 0,z= 0}
|
||||
end
|
||||
if rot>=16 and rot<=19 then
|
||||
return {x=-1,y= 0,z= 0}
|
||||
end
|
||||
if rot>=20 and rot<=23 then
|
||||
return {x= 0,y=-1,z= 0}
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
buildtest.pipes.types.iron.getDir = function(pos)
|
||||
--print("ok")
|
||||
local node=minetest.get_node(pos)
|
||||
if node==nil then return nil end
|
||||
local rot = node.param2
|
||||
return buildtest.pipes.types.iron.getRawDir(rot)
|
||||
end
|
|
@ -0,0 +1,66 @@
|
|||
buildtest.pipes.types.mesecon = {
|
||||
base = "mesecons:wire_00000000_off",
|
||||
outname = "buildtest:pipe_meseconoff_000000_0",
|
||||
}
|
||||
|
||||
local mesecons_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0}}
|
||||
|
||||
for state, invState in pairs({off="on", on="off"}) do
|
||||
local top = "buildtest_pipe_mesecon.png^wires_"..state..".png"
|
||||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local side = "buildtest_pipe_mesecon.png"
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Mesecon Pipe",
|
||||
tiles = {top,side,side,side,side,side},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
buildtest = {
|
||||
pipe=1,
|
||||
slowdown=0.1,
|
||||
connects={
|
||||
--"default:chest",
|
||||
buildtest.pipes.defaultPipes
|
||||
},
|
||||
},
|
||||
mesecons={
|
||||
conductor={
|
||||
state=state,
|
||||
rules=mesecons_rules,
|
||||
[invState.."state"]="buildtest:pipe_mesecon"..invState.."_"..name
|
||||
}
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_meseconoff_000000_'..id} }
|
||||
}
|
||||
},
|
||||
on_place = buildtest.pipes.onp_funct,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
}
|
||||
if count~=1 or state~="off" then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
-- def.node_box.fixed[#def.node_box.fixed+1] = {1/16, 0.25, -1/16, 8/16, 0.25+1/16, 1/16}
|
||||
-- local size = #def.node_box.fixed
|
||||
-- for i=2, size do -- skip the middle bit
|
||||
-- local newID = #def.node_box.fixed + 1
|
||||
-- def.node_box.fixed[newID] = def.node_box.fixed[i]
|
||||
--
|
||||
-- def.node_box.fixed[newID][2] = 0.25
|
||||
-- def.node_box.fixed[newID][2] = 0.25 + 1/16
|
||||
-- end
|
||||
|
||||
minetest.register_node("buildtest:pipe_mesecon"..state.."_"..name, def)
|
||||
end)
|
||||
end
|
|
@ -0,0 +1,41 @@
|
|||
buildtest.pipes.types.obsidian = {
|
||||
base = "default:obsidian",
|
||||
}
|
||||
|
||||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Obsidian Pipe",
|
||||
tiles = {"buildtest_pipe_obsidian.png"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
buildtest = {
|
||||
slowdown=0.1,
|
||||
pipe=1,
|
||||
connects={
|
||||
buildtest.pipes.defaultPipes
|
||||
},
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_obsidian_000000_'..id} }
|
||||
}
|
||||
},
|
||||
on_place = buildtest.pipes.onp_funct,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
}
|
||||
if count~=1 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
minetest.register_node("buildtest:pipe_obsidian_"..name, def)
|
||||
end)
|
|
@ -0,0 +1,250 @@
|
|||
buildtest.pipes={}
|
||||
buildtest.pipes.shapes={}
|
||||
buildtest.pipes.types = {}
|
||||
buildtest.pipes.makepipe = function(go)
|
||||
local count=0
|
||||
for wp=0, 0 do -- was for wp=0, 1 do
|
||||
for f=0,1 do
|
||||
for e=0,1 do
|
||||
for d=0,1 do
|
||||
for c=0,1 do
|
||||
for b=0,1 do
|
||||
for a=0,1 do
|
||||
count=count+1
|
||||
local set={a,b,c,d,e,f}
|
||||
buildtest.pipes.shapes[count]=set
|
||||
local nodeboxCENTERE={-0.25,-0.25,-0.25, 0.25,0.25,0.25}
|
||||
------------------------------------
|
||||
local left={-0.5,-0.25,-0.25, -0.25,0.25,0.25}
|
||||
local right={0.25,-0.25,-0.25, 0.5,0.25,0.25}
|
||||
local top={-0.25,-0.25,0.25, 0.25,0.25,0.5}
|
||||
local bttm={-0.25,-0.25,-0.25, 0.25,0.25,-0.5}
|
||||
local high={-0.25,0.25,-0.25, 0.25,0.5,0.25}
|
||||
local low={-0.25,-0.5,-0.25, 0.25,-0.25,0.25}
|
||||
local nodes={nodeboxCENTERE}
|
||||
if(set[1]==1) then
|
||||
nodes[#nodes+1]=left
|
||||
end
|
||||
if(set[2]==1) then
|
||||
nodes[#nodes+1]=top
|
||||
end
|
||||
if(set[3]==1) then
|
||||
nodes[#nodes+1]=right
|
||||
end
|
||||
if(set[4]==1) then
|
||||
nodes[#nodes+1]=bttm
|
||||
end
|
||||
if(set[5]==1) then
|
||||
nodes[#nodes+1]=high
|
||||
end
|
||||
if(set[6]==1) then
|
||||
nodes[#nodes+1]=low
|
||||
end
|
||||
-----------------------------------------
|
||||
local clas=""
|
||||
if wp==1 then
|
||||
clas="Waterproof "..clas
|
||||
end
|
||||
-----------------------------------------
|
||||
go(set, nodes, count, a..b..c..d..e..f.."_"..wp, wp, clas)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
count=0 -- it relly is a diffrent type of pipe
|
||||
end
|
||||
end
|
||||
|
||||
buildtest.pipes.onp_funct = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local itemstk=minetest.item_place(itemstack, placer, pointed_thing)
|
||||
buildtest.pipes.processNode(pointed_thing.above)
|
||||
for i=1,6 do
|
||||
buildtest.pipes.processNode(buildtest.posADD(pointed_thing.above,buildtest.toXY(i)))
|
||||
end
|
||||
return itemstk
|
||||
end
|
||||
|
||||
buildtest.pipes.getConns = function(pos)
|
||||
local oks={}
|
||||
for i=1,6 do
|
||||
local tmpPos=buildtest.posADD(pos,buildtest.toXY(i))
|
||||
if buildtest.pipeAt(tmpPos)==true then
|
||||
oks[#oks+1] = tmpPos
|
||||
end
|
||||
end
|
||||
return oks
|
||||
end
|
||||
|
||||
buildtest.pipes.ond_funct = function(pos, node, digger)
|
||||
minetest.node_dig(pos, node, digger)
|
||||
|
||||
for i=1,6 do
|
||||
buildtest.pipes.processNode(buildtest.posADD(pos,buildtest.toXY(i)))
|
||||
end
|
||||
end
|
||||
|
||||
buildtest.pipes.processNode=function(pos)
|
||||
--print(minetest.get_node(pos).name)
|
||||
if buildtest.pipeAt(pos)==false then
|
||||
return
|
||||
end
|
||||
|
||||
local j={}
|
||||
for i=1,6 do
|
||||
j[i]=buildtest.pipeConn(buildtest.posADD(pos,buildtest.toXY(i)), pos)
|
||||
end
|
||||
|
||||
local node = minetest.get_node(pos)
|
||||
if strs:starts(node.name, "buildtest:pipe_")==true then
|
||||
local param2 = node.param2
|
||||
local type=strs:rem_from_start(minetest.get_node(pos).name,"buildtest:pipe_")
|
||||
local id=type:split("_")[3]
|
||||
type=type:split("_")[1]
|
||||
node.name = "buildtest:pipe_"..type.."_"..buildtest.arrToStr(j,"").."_"..id
|
||||
print(node.name)
|
||||
--minetest.set_node(pos, node)
|
||||
hacky_swap_node(pos, node.name)
|
||||
end
|
||||
return j
|
||||
end
|
||||
|
||||
function hacky_swap_node(pos,name)
|
||||
local node = minetest.get_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta0 = meta:to_table()
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
node.name = name
|
||||
local meta0 = meta:to_table()
|
||||
minetest.set_node(pos,node)
|
||||
meta = minetest.get_meta(pos)
|
||||
meta:from_table(meta0)
|
||||
end
|
||||
|
||||
buildtest.toXY = function(i)
|
||||
local pos={x=0,y=0,z=0}
|
||||
if i==1 then pos.x=-1
|
||||
elseif i==2 then pos.z=1
|
||||
elseif i==3 then pos.x=1
|
||||
elseif i==4 then pos.z=-1
|
||||
elseif i==5 then pos.y=1
|
||||
elseif i==6 then pos.y=-1
|
||||
end
|
||||
return pos
|
||||
end
|
||||
|
||||
buildtest.posADD = function(a,b)
|
||||
local pos={x=0,y=0,z=0}
|
||||
pos.x=a.x+b.x
|
||||
pos.y=a.y+b.y
|
||||
pos.z=a.z+b.z
|
||||
return pos
|
||||
end
|
||||
|
||||
buildtest.posMult = function(a,b)
|
||||
local pos={x=0,y=0,z=0}
|
||||
pos.x=a.x*b
|
||||
pos.y=a.y*b
|
||||
pos.z=a.z*b
|
||||
return pos
|
||||
end
|
||||
|
||||
buildtest.pipeAt = function(pos)
|
||||
return buildtest.pipeConn(pos, nil)
|
||||
end
|
||||
|
||||
buildtest.pipeConn = function(pos, refpos)
|
||||
if refpos~=nil then
|
||||
local def=minetest.registered_items[minetest.get_node(refpos).name]
|
||||
if def==nil then return false end
|
||||
if def.buildtest==nil then return false end
|
||||
if def.buildtest.pipe~=1 then return false end
|
||||
if def.buildtest.connects==nil then return false end
|
||||
--if strs:inarray(minetest.get_node(pos).name,def.buildtest.connects)==false then return false end
|
||||
if def.buildtest.disconnects~=nil then
|
||||
for i=1,#def.buildtest.disconnects do
|
||||
if buildtest.pipes.pipeInArray(minetest.get_node(pos).name, def.buildtest.disconnects[i])==true then return false end
|
||||
end
|
||||
end
|
||||
|
||||
for i=1,#def.buildtest.connects do
|
||||
if buildtest.pipes.pipeInArray(minetest.get_node(pos).name, def.buildtest.connects[i])==true then break end
|
||||
if i==#def.buildtest.connects then return false end
|
||||
end
|
||||
else
|
||||
-- if strs:starts(minetest.get_node(pos).name,"buildtest:pipe_")==false then
|
||||
-- --print("hv eletro : ok")
|
||||
-- return false
|
||||
-- end
|
||||
local def = minetest.registered_items[minetest.get_node(pos).name]
|
||||
if def==nil then return false end
|
||||
if def.buildtest==nil then return false end
|
||||
if def.buildtest.pipe~=1 then return false end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
buildtest.pipes.pipeInArray = function(node, set)
|
||||
for i=1, #set do
|
||||
local name = set[i]
|
||||
if strs:starts(node, name) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
buildtest.arrToStr=function(t,tok)
|
||||
if t==nil then
|
||||
return ""
|
||||
end
|
||||
local str=""
|
||||
local i=0
|
||||
for i=1,#t do
|
||||
local tmpStr=t[i]
|
||||
if tmpStr==true then tmpStr="1" end
|
||||
if tmpStr==false then tmpStr="0" end
|
||||
if str~=nil and str~="" then
|
||||
str=str..tok
|
||||
end
|
||||
str=str..tmpStr
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
buildtest.pipes.defaultPipes = {
|
||||
----------- ITEST -------------
|
||||
"itest:macerator",
|
||||
"itest:macerator_active",
|
||||
"itest:iron_furnace_active",
|
||||
"itest:iron_furnace",
|
||||
"itest:electric_furnace_active",
|
||||
"itest:electric_furnace",
|
||||
"itest:extractor_active",
|
||||
"itest:extractor",
|
||||
"itest:generator_active",
|
||||
"itest:generator",
|
||||
----------- ITEST -------------
|
||||
--"buildtest:pump_stirling",
|
||||
"default:furnace_active",
|
||||
"buildtest:autocraft",
|
||||
"default:furnace",
|
||||
"default:chest",
|
||||
-----------
|
||||
"buildtest:pipe_meseconoff",
|
||||
"buildtest:pipe_meseconon",
|
||||
"buildtest:pipe_sandstone",
|
||||
"buildtest:pipe_obsidian",
|
||||
"buildtest:pipe_diamond",
|
||||
"buildtest:pipe_stripe",
|
||||
"buildtest:pipe_cobble",
|
||||
"buildtest:pipe_stone",
|
||||
"buildtest:pipe_iron",
|
||||
"buildtest:pipe_gold",
|
||||
"buildtest:pipe_gate",
|
||||
--"buildtest:pipe_emr",
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
dofile(minetest.get_modpath("buildtest").."/pipes/wood.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/cobble.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/stone.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/iron.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/gold.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/diamond.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/obsidian.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/sandstone.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/emriald.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/gate.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/stripe.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pipes/mesecon.lua")
|
|
@ -0,0 +1,44 @@
|
|||
buildtest.pipes.types.sandstone = {
|
||||
base = "default:sandstone",
|
||||
}
|
||||
|
||||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Sandstone Pipe",
|
||||
tiles = {"buildtest_pipe_sandstone.png"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
buildtest = {
|
||||
slowdown=1.1,
|
||||
pipe=1,
|
||||
connects={
|
||||
buildtest.pipes.defaultPipes,
|
||||
{
|
||||
"buildtest:pipe_stone",
|
||||
},
|
||||
},
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_sandstone_000000_'..id} }
|
||||
}
|
||||
},
|
||||
on_place = buildtest.pipes.onp_funct,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
}
|
||||
if count~=1 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
minetest.register_node("buildtest:pipe_sandstone_"..name, def)
|
||||
end)
|
|
@ -0,0 +1,44 @@
|
|||
buildtest.pipes.types.stone = {
|
||||
base = "default:stone",
|
||||
}
|
||||
|
||||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Stone Pipe",
|
||||
tiles = {"buildtest_pipe_stone.png"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
buildtest = {
|
||||
slowdown=0.025,
|
||||
pipe=1,
|
||||
connects={
|
||||
buildtest.pipes.defaultPipes
|
||||
},
|
||||
disconnects = {{
|
||||
"buildtest:pipe_cobble",
|
||||
}},
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_stone_000000_'..id} }
|
||||
}
|
||||
},
|
||||
on_place = buildtest.pipes.onp_funct,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
}
|
||||
if count~=1 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
minetest.register_node("buildtest:pipe_stone_"..name, def)
|
||||
end)
|
|
@ -0,0 +1,48 @@
|
|||
minetest.register_craft({
|
||||
output = "buildtest:pipe_stripe_000000_0",
|
||||
recipe = {
|
||||
{"dye:black", "default:glass", "dye:yellow"},
|
||||
}
|
||||
})
|
||||
|
||||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Stripe Pipe",
|
||||
tiles = {"buildtest_pipe_stripe.png"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
buildtest = {
|
||||
slowdown=0.025,
|
||||
pipe=1,
|
||||
connects={
|
||||
buildtest.pipes.defaultPipes
|
||||
},
|
||||
disconnects = {{
|
||||
"default:chest",
|
||||
"default:chest_locked",
|
||||
}},
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_stripe_000000_'..id} }
|
||||
}
|
||||
},
|
||||
on_place = buildtest.pipes.onp_funct,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
}
|
||||
if count~=1 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
minetest.register_node("buildtest:pipe_stripe_"..name, def)
|
||||
end)
|
|
@ -0,0 +1,45 @@
|
|||
buildtest.pipes.types.wood = {
|
||||
base = "default:wood",
|
||||
}
|
||||
|
||||
buildtest.pipes.makepipe(function(set, nodes, count, name, id, clas)
|
||||
local def = {
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
climbable = false,
|
||||
diggable = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodes
|
||||
},
|
||||
--------------------------
|
||||
description = clas.."Buildtest Wood Pipe",
|
||||
tiles = {"buildtest_pipe_wood.png"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
buildtest = {
|
||||
pipe=1,
|
||||
slowdown=0.1,
|
||||
connects={
|
||||
--"default:chest",
|
||||
buildtest.pipes.defaultPipes
|
||||
},
|
||||
disconnects = {{
|
||||
"default:chest",
|
||||
}},
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'buildtest:pipe_wood_000000_'..id} }
|
||||
}
|
||||
},
|
||||
on_place = buildtest.pipes.onp_funct,
|
||||
on_dig = buildtest.pipes.ond_funct,
|
||||
}
|
||||
if count~=1 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
minetest.register_node("buildtest:pipe_wood_"..name, def)
|
||||
end)
|
|
@ -0,0 +1,174 @@
|
|||
buildtest.pumps.types.combustion = {
|
||||
get_pump_active_formspec = function(heat, fuel)
|
||||
local formspec =
|
||||
"size[8,9]"..
|
||||
--"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..percent..":default_furnace_fire_fg.png]"..
|
||||
"list[context;fuel;2.5,2;1,1;]"..
|
||||
|
||||
"image[6.5,0;1,5;default_lava.png^[lowpart:"..(heat)..":default_water.png]]"..
|
||||
--"image[6.5,0;1,5;default_water.png]"..
|
||||
--"image[6.5,"..(5 - heat * 5 / 4)..";1,1;buildtest_maker.png]"..
|
||||
|
||||
"image[5.5,0;1,5;oil_oil.png^[lowpart:"..(fuel)..":oil_fuel.png]]"..
|
||||
--"image[5.5,0;1,5;oil_fuel.png]"..
|
||||
--"image[5.5,"..(5 - fuel * 5 / 100)..";1,1;buildtest_maker.png]"..
|
||||
|
||||
"list[context;heat;2.5,3;1,1;]"..
|
||||
"list[context;out;3.5,3;2,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
return formspec
|
||||
end,
|
||||
set_pump_active_formspec = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local fuel_level = meta:get_int("fuel")
|
||||
--local max_fuel = meta:get_int("maxfuel")
|
||||
local max_fuel = 1000
|
||||
local fuel = (fuel_level / max_fuel) * 100
|
||||
local def = minetest.registered_items[minetest.get_node(pos).name]
|
||||
--local water = def.buildtest.pump.typeId * 100 / 4
|
||||
local water = meta:get_int("water")
|
||||
local formspec = buildtest.pumps.types.combustion.get_pump_active_formspec(water, (fuel or 0))
|
||||
meta:set_string("formspec", formspec)
|
||||
end,
|
||||
handleCooling = function(pos, inv)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local def = minetest.registered_items[minetest.get_node(pos).name]
|
||||
----------------------------------------------------
|
||||
if minetest.get_node(pos).name=="buildtest:pump_combustion_yellow" then
|
||||
--print(meta:get_int("water"))
|
||||
if meta:get_int("water") > 1 then
|
||||
meta:set_int("water", meta:get_int("water") - 2)
|
||||
buildtest.pumps.types.combustion.set_pump_active_formspec(pos)
|
||||
return false
|
||||
end
|
||||
end
|
||||
if minetest.get_node(pos).name=="buildtest:pump_combustion_red" then
|
||||
if meta:get_int("water") > 20 then
|
||||
meta:set_int("water", meta:get_int("water") - 20)
|
||||
buildtest.pumps.hacky_swap_node(pos, def.buildtest.pump.prev)
|
||||
buildtest.pumps.types.combustion.set_pump_active_formspec(pos)
|
||||
return true
|
||||
end
|
||||
end
|
||||
------------------------------------------------------
|
||||
if inv:get_stack("heat", 1):is_empty() then
|
||||
return false
|
||||
end
|
||||
local name = inv:get_stack("heat", 1):get_name()
|
||||
if name=="bucket:bucket_lava" then
|
||||
if def.buildtest.pump.next~=nil then
|
||||
buildtest.pumps.hacky_swap_node(pos, def.buildtest.pump.next)
|
||||
inv:set_stack("heat", 1, ItemStack(nil))
|
||||
inv:add_item("out", ItemStack("bucket:bucket_empty"))
|
||||
return true
|
||||
end
|
||||
end
|
||||
if name=="bucket:bucket_water" then
|
||||
--if def.buildtest.pump.prev~=nil then
|
||||
if meta:get_int("water") < 80 then
|
||||
--buildtest.pumps.hacky_swap_node(pos, def.buildtest.pump.prev)
|
||||
meta:set_int("water", meta:get_int("water") + 20)
|
||||
inv:set_stack("heat", 1, ItemStack(nil))
|
||||
inv:add_item("out", ItemStack("bucket:bucket_empty"))
|
||||
buildtest.pumps.types.combustion.set_pump_active_formspec(pos)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end,
|
||||
}
|
||||
|
||||
buildtest.pumps.register_pump("buildtest:pump_combustion", "default_steel_block.png", {
|
||||
description = "Buildtest Combustion Engine",
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
---------------------------
|
||||
local formspec = buildtest.pumps.types.combustion.get_pump_active_formspec(0, 1)
|
||||
---------------------------
|
||||
meta:set_string("formspec", formspec)
|
||||
meta:set_int("water", 0)
|
||||
---------------------------
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("fuel", 1)
|
||||
inv:set_size("heat", 1)
|
||||
inv:set_size("out", 2*2)
|
||||
buildtest.pumps.on_construct(pos)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("fuel") then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
},
|
||||
{
|
||||
abm = function(pos)
|
||||
buildtest.pumps.send(pos)
|
||||
end,
|
||||
runConf = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local isBurning = function()
|
||||
local fuel_level = (meta:get_int("fuel") or 0)
|
||||
if fuel_level > 20 then
|
||||
fuel_level = fuel_level - 20
|
||||
meta:set_int("fuel", fuel_level)
|
||||
buildtest.pumps.types.combustion.set_pump_active_formspec(pos)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
if buildtest.pumps.types.combustion.handleCooling(pos, inv)==true then
|
||||
return false
|
||||
end
|
||||
|
||||
if inv:get_stack("fuel", 1):is_empty() then
|
||||
return isBurning()
|
||||
end
|
||||
|
||||
local items = inv:get_list("fuel")
|
||||
|
||||
local itemName = items[1]:get_name()
|
||||
if itemName ~= "bucket:bucket_lava" and itemName ~= "oil:fuel_bucket" and itemName ~= "oil:bucket_oil" then
|
||||
return isBurning()
|
||||
end
|
||||
-- print("item: "..inv:get_stack("fuel", 1):get_name())
|
||||
local fuel
|
||||
local sub
|
||||
fuel, sub = minetest.get_craft_result({
|
||||
method="fuel",
|
||||
width=1,
|
||||
items = items,
|
||||
})
|
||||
if fuel.time <= 0 then
|
||||
return isBurning()
|
||||
end
|
||||
--meta:set_int("maxfuel", fuel.time)
|
||||
local fuel_level = (meta:get_int("fuel") or 0)
|
||||
if fuel.time + fuel_level >= 1000 then
|
||||
return isBurning()
|
||||
end
|
||||
meta:set_int("fuel", fuel.time + fuel_level)
|
||||
inv:set_list("fuel", sub.items)
|
||||
buildtest.pumps.types.combustion.set_pump_active_formspec(pos)
|
||||
-- print("pumping")
|
||||
return isBurning()
|
||||
end,
|
||||
|
||||
canHeat = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if minetest.get_node(pos).name=="buildtest:pump_combustion_yellow" then
|
||||
if meta:get_int("water") > 20 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end,
|
||||
|
||||
moveCount = 99,
|
||||
explodes = true,
|
||||
}
|
||||
)
|
|
@ -0,0 +1,66 @@
|
|||
buildtest.pumps.gfx = {
|
||||
frames = {
|
||||
{90, 60},
|
||||
{45, 45},
|
||||
{15, 30},
|
||||
{1 , 15},
|
||||
}
|
||||
}
|
||||
|
||||
local def = {
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
visual = "mesh",
|
||||
mesh = "buildtest_pump.x",
|
||||
visual_size = {x=5, y=5},
|
||||
on_step = function(self, dtime)
|
||||
self.timer = self.timer + dtime
|
||||
if self.timer > 10 then
|
||||
-- print("removing entity")
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
||||
if self.config~=nil then -- self.timer > 1 and
|
||||
-- print("new entity")
|
||||
self:setTexture(self.config.texture)
|
||||
self:setAnim(self.config.speed)
|
||||
self.config = nil
|
||||
end
|
||||
end,
|
||||
setTexture = function(self, texture)
|
||||
prop = {
|
||||
visual_size = {x=5, y=5},
|
||||
drawtype = "front",
|
||||
visual = "mesh",
|
||||
mesh = "buildtest_pump.x",
|
||||
textures = {texture},
|
||||
}
|
||||
self.object:set_properties(prop)
|
||||
end,
|
||||
setAnim = function(self, level)
|
||||
local frameSeq = buildtest.pumps.gfx.frames[level or 1]
|
||||
self.object:set_animation(
|
||||
{
|
||||
x = frameSeq[1] -- start
|
||||
,y = frameSeq[1] + frameSeq[2] -- end
|
||||
},
|
||||
15 --frame rate
|
||||
, 0
|
||||
)
|
||||
end,
|
||||
get_staticdata = function(self)
|
||||
return minetest.serialize(config)
|
||||
end,
|
||||
on_activate = function(self, staticdata)
|
||||
-- if staticdata~=nil and staticdata~="" then
|
||||
-- self.config = minetest.deserialize(staticdata)
|
||||
-- return
|
||||
-- end
|
||||
-- print("removeing entity")
|
||||
-- self.object:remove()
|
||||
end,
|
||||
timer = 0,
|
||||
config = nil,
|
||||
}
|
||||
|
||||
minetest.register_entity("buildtest:pump_ent", def)
|
|
@ -0,0 +1,122 @@
|
|||
local def = {
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
visual = "mesh",
|
||||
mesh = "buildtest_pump.x",
|
||||
--textures = {"mobs_dirt_monster.png"},
|
||||
visual_size = {x=5, y=5},
|
||||
-- drawtype = "front",
|
||||
--paramtype = "light",
|
||||
on_step = function(self, dtime)
|
||||
-- print("ok")
|
||||
if self==nil or self.homepos==nil or self.homename==nil then
|
||||
--self.object:remove()
|
||||
return
|
||||
end
|
||||
if self.reset==true then
|
||||
self.resetSelf(self)
|
||||
return
|
||||
end
|
||||
--if self.inInit==true then return end
|
||||
|
||||
self.totTime=self.totTime+dtime
|
||||
if self.totTime > 1 then
|
||||
self.object:setpos(self.homepos)
|
||||
self.totTime = 0 --self.totTime - 1 / self.speed
|
||||
if minetest.get_node(self.homepos).name ~= self.homename then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
local def = minetest.registered_items[minetest.get_node(self.homepos).name]
|
||||
local meta = minetest.get_meta(self.homepos)
|
||||
local level = meta:get_int("level") or 1
|
||||
self.speed = level
|
||||
local texture = def.buildtest.pump.textures[1]
|
||||
if def.buildtest.pump.textures[level]~=nil then
|
||||
texture = texture.."^"..def.buildtest.pump.textures[level]
|
||||
end
|
||||
|
||||
self.setTexture(self.object, texture)
|
||||
self.setAnim(self, level)
|
||||
end
|
||||
end,
|
||||
speed = 1,
|
||||
totTime = 0,
|
||||
lastLevel = -1,
|
||||
reset = false,
|
||||
inInit = true,
|
||||
inited = false,
|
||||
setTexture = function(self, texture)
|
||||
prop = {
|
||||
visual_size = {x=5, y=5},
|
||||
drawtype = "front",
|
||||
visual = "mesh",
|
||||
mesh = "buildtest_pump.x",
|
||||
textures = {texture},
|
||||
}
|
||||
self:set_properties(prop)
|
||||
end,
|
||||
resetTexture = function(self)
|
||||
local def = minetest.registered_items[minetest.get_node(self.homepos).name]
|
||||
local texture = def.buildtest.pump.textures[1]
|
||||
self.setTexture(self.object, texture)
|
||||
end,
|
||||
resetSelf = function(self)
|
||||
--print("a: ok")
|
||||
self.reset = false
|
||||
self.object:setpos(self.homepos)
|
||||
self.resetAnim(self)
|
||||
self.resetTexture(self)
|
||||
-- self.inInit = false
|
||||
end,
|
||||
setAnim = function(self, level)
|
||||
if self.lastLevel ~= level then
|
||||
self.lastLevel = level
|
||||
--print("ok")
|
||||
self.object:set_animation(
|
||||
{
|
||||
x=1 -- start
|
||||
,y=30 -- end
|
||||
},
|
||||
level*15 --frame rate
|
||||
--15
|
||||
, 0
|
||||
)
|
||||
end
|
||||
end,
|
||||
resetAnim = function(self)
|
||||
local meta = minetest.get_meta(self.homepos)
|
||||
local level = meta:get_int("level") or 1
|
||||
self.setAnim(self, level)
|
||||
end,
|
||||
get_staticdata = function(self)
|
||||
if self.homepos==nil then return "?" end
|
||||
--return minetest.pos_to_string(self.homepos)
|
||||
--local homepos = minetest.pos_to_string(self.homepos)
|
||||
-- self.homeposAsText = minetest.pos_to_string(self.homepos)
|
||||
-- --local texture = self.textures[1]
|
||||
-- return minetest.serialize({
|
||||
---- self.homeposAsText,
|
||||
-- self.homename,
|
||||
-- })
|
||||
return minetest.pos_to_string(self.homepos) or "?"
|
||||
end,
|
||||
on_activate = function(self, staticdata)
|
||||
-- local item = minetest.deserialize(staticdata)
|
||||
-- self.homepos = minetest.string_to_pos(item.homeposAsText)
|
||||
-- self.homename = item.homename
|
||||
-- --self.setTexture(self, "buildtest_pump_mesecon.png")
|
||||
-- self.reset = true
|
||||
-- print("ok")
|
||||
-- if self.handmade==true then return end
|
||||
if staticdata==nil or staticdata=="" then return end
|
||||
self.object:remove()
|
||||
--------------------
|
||||
--------------------
|
||||
-- local pos = minetest.string_to_pos(staticdata)
|
||||
-- if pos~=nil then
|
||||
-- buildtest.pumps.on_construct(pos)
|
||||
-- end
|
||||
end,
|
||||
}
|
||||
|
||||
minetest.register_entity("buildtest:pump_ent", def)
|
|
@ -0,0 +1,14 @@
|
|||
buildtest.pumps.register_pump("buildtest:pump_mesecon", "default_wood.png", {
|
||||
description = "Buildtest Mesecon Pump",
|
||||
},
|
||||
{
|
||||
abm = function(pos)
|
||||
buildtest.pumps.send(pos)
|
||||
end,
|
||||
|
||||
runConf = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
return true
|
||||
end,
|
||||
}
|
||||
)
|
|
@ -0,0 +1,25 @@
|
|||
minetest.register_node("buildtest:pump", {
|
||||
--tiles = {"buildtest_pump_mesecon.png"},
|
||||
description = "Buildtest Liquids Pump",
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
buildtest = {
|
||||
pipe=1,
|
||||
connects={
|
||||
--{"buildtest:pipe_wood"},
|
||||
buildtest.pipes.defaultPipes,
|
||||
},
|
||||
},
|
||||
on_construct = function(pos)
|
||||
end,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {{-0.5,-0.5,-0.5,0.5,0.5,0.5}}
|
||||
},
|
||||
selection_box = {{
|
||||
0.5,0.5,0.5,-0.5,-0.5,-0.5,
|
||||
}},
|
||||
})
|
|
@ -0,0 +1,379 @@
|
|||
buildtest.pumps = {
|
||||
types = {},
|
||||
colours = {
|
||||
[1] = "blue",
|
||||
[2] = "green",
|
||||
[3] = "yellow",
|
||||
[4] = "red",
|
||||
},
|
||||
pulls = {
|
||||
["default:chest"] = {"main"},
|
||||
["default:furnace_active"] = {"dst"},
|
||||
["default:furnace"] = {"dst"},
|
||||
["buildtest:autocraft"] = {"in"},
|
||||
["itest:macerator"] = {"dst"},
|
||||
["itest:macerator_active"] = {"dst"},
|
||||
["itest:iron_furnace_active"] = {"dst"},
|
||||
["itest:iron_furnace"] = {"dst"},
|
||||
["itest:electric_furnace_active"] = {"dst"},
|
||||
["itest:electric_furnace"] = {"dst"},
|
||||
["itest:extractor_active"] = {"dst"},
|
||||
["itest:extractor"] = {"dst"},
|
||||
},
|
||||
hacky_swap_node = function(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
--local meta0 = meta:to_table()
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
node.name = name
|
||||
local meta0 = meta:to_table()
|
||||
minetest.set_node(pos,node)
|
||||
meta = minetest.get_meta(pos)
|
||||
meta:from_table(meta0)
|
||||
end,
|
||||
temp = function(pos, amnt)
|
||||
local prev = minetest.registered_items[minetest.get_node(pos).name].buildtest.pump[amnt]
|
||||
if prev~=nil then
|
||||
buildtest.pumps.hacky_swap_node(pos, prev)
|
||||
end
|
||||
end,
|
||||
findpipe = function(pos)
|
||||
for i=1,6 do
|
||||
local tmpPos=buildtest.posADD(pos,buildtest.toXY(i))
|
||||
if buildtest.pipeAt(tmpPos)==true then
|
||||
return tmpPos
|
||||
end
|
||||
end
|
||||
return {x=pos.x,y=pos.y+1,z=pos.z}
|
||||
end,
|
||||
findchest = function(pos)
|
||||
for i=1,6 do
|
||||
local tmpPos=buildtest.posADD(pos,buildtest.toXY(i))
|
||||
if buildtest.pumps.pulls[minetest.get_node(tmpPos).name]~=nil then
|
||||
return tmpPos
|
||||
end
|
||||
end
|
||||
return {x=pos.x,y=pos.y+1,z=pos.z}
|
||||
end,
|
||||
}
|
||||
|
||||
buildtest.pumps.register_pump = function(name, textureBase, flags, def)
|
||||
local abm = def.abm
|
||||
for typeId, typeName in pairs(buildtest.pumps.colours) do
|
||||
local sideTexture = textureBase.."^buildtest_pump_mask_"..typeName.."_side.png"
|
||||
local def = {
|
||||
tiles = {textureBase, textureBase, sideTexture, sideTexture, sideTexture, sideTexture},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
buildtest = {
|
||||
pipe=1,
|
||||
connects={
|
||||
-- "buildtest:pipe_wood",
|
||||
},
|
||||
pump = {
|
||||
-- maxSpeed = 0.5,
|
||||
-- moveCount = 1,
|
||||
-- maxLevel = 5,
|
||||
upTime = 10,
|
||||
next = name.."_"..(buildtest.pumps.colours[typeId + 1] or typeName),
|
||||
prev = name.."_"..(buildtest.pumps.colours[typeId - 1] or typeName),
|
||||
colour = typeName,
|
||||
stepSpeed = typeId,--#buildtest.pumps.colours + 1 - typeId,
|
||||
typeId = typeId,
|
||||
moveCount = def.moveCount or 1,
|
||||
runConf = def.runConf,
|
||||
explodes = def.explodes or false,
|
||||
canHeat = def.canHeat,
|
||||
|
||||
-- textures = {
|
||||
-- "buildtest_pump_mesecon.png",
|
||||
-- "buildtest_pump_blue.png",
|
||||
-- "buildtest_pump_green.png",
|
||||
-- "buildtest_pump_orange.png",
|
||||
-- "buildtest_pump_red.png",
|
||||
-- }
|
||||
}
|
||||
},
|
||||
on_construct = function(pos)
|
||||
buildtest.pumps.on_construct(pos)
|
||||
end,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
--{0,0,0,0,0,0},
|
||||
{-5/16, -5/16, -5/16, 5/16, 8/16, 5/16},
|
||||
{-8/16, -8/16, -8/16, 8/16, -5/16, 8/16},
|
||||
}
|
||||
},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {name.."_"..buildtest.pumps.colours[1]} }
|
||||
}
|
||||
},
|
||||
mesecons = {
|
||||
effector = {
|
||||
action_off = function (pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("on", 0)
|
||||
end,
|
||||
action_on = function (pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("on", 1)
|
||||
end,
|
||||
},
|
||||
},
|
||||
-- selection_box = {{
|
||||
-- 0.5,0.5,0.5,-0.5,-0.5,-0.5,
|
||||
-- }},
|
||||
}
|
||||
for name, val in pairs(flags) do
|
||||
def[name] = val
|
||||
end
|
||||
if typeId~=1 then
|
||||
def.groups.not_in_creative_inventory=1
|
||||
end
|
||||
if buildtest.pumps.colours[typeId + 1]==nil then
|
||||
def.buildtest.pump.next=nil
|
||||
end
|
||||
if buildtest.pumps.colours[typeId - 1]==nil then
|
||||
def.buildtest.pump.prev=nil
|
||||
end
|
||||
minetest.register_node(name.."_"..typeName, def)
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {name.."_"..typeName},
|
||||
interval = 0.5,
|
||||
chance = 1,
|
||||
action = abm
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
buildtest.pumps.send = function(pos)
|
||||
-- print("ok")
|
||||
-- local facedir = minetest.get_node(pos).param2
|
||||
-- facedir = buildtest.facedir_to_dir(facedir)
|
||||
-- facedir = buildtest.posADD(pos,facedir)
|
||||
-- local chestpos=buildtest.pipes.getConns(facedir)
|
||||
-- if #chestpos == 0 then
|
||||
-- return
|
||||
-- end
|
||||
-- chestpos = chestpos[0]
|
||||
local pipepos = buildtest.pumps.findpipe(pos) --{x=pos.x,y=pos.y+1,z=pos.z}
|
||||
local chestpos = buildtest.pumps.findchest(pipepos) --{x=pipepos.x,y=pipepos.y+1,z=pipepos.z}
|
||||
local speedup = 0
|
||||
local thisMeta = minetest.get_meta(pos)
|
||||
|
||||
if thisMeta:get_int("on")~=1 then
|
||||
buildtest.pumps.temp(pos, "prev")
|
||||
return
|
||||
end
|
||||
|
||||
local def = minetest.registered_items[minetest.get_node(pos).name]
|
||||
if def.buildtest.pump~=nil then
|
||||
|
||||
if def.buildtest.pump.runConf~=nil then
|
||||
if def.buildtest.pump.runConf(pos)==false then
|
||||
buildtest.pumps.temp(pos, "prev")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local timerCount = thisMeta:get_int("timer") or 0
|
||||
--if timerCount==nil then timerCount=0 end
|
||||
timerCount = timerCount + 1
|
||||
-- if timerCount % def.buildtest.pump.upTime == 0 then
|
||||
-- local id
|
||||
-- for name,value in pairs(minetest.luaentities) do
|
||||
-- --print(name)
|
||||
-- if strs:starts(value.name, "buildtest:") and value.homepos==pos then
|
||||
-- id=name
|
||||
-- end
|
||||
-- end
|
||||
-- if not id then
|
||||
-- buildtest.pumps.on_construct(pos)
|
||||
-- end
|
||||
-- --timerCount = 0
|
||||
-- local level = thisMeta:get_int("level") or 1
|
||||
-- --if level==nil then level=0 end
|
||||
-- level = level + 1
|
||||
-- if level <= def.buildtest.pump.maxLevel then
|
||||
-- thisMeta:set_int("level", level)
|
||||
-- end
|
||||
-- end
|
||||
local canHeat = false
|
||||
if timerCount >= def.buildtest.pump.upTime then
|
||||
canHeat = true
|
||||
|
||||
for name,value in pairs(minetest.luaentities) do
|
||||
if strs:starts(value.name, "buildtest:") and value.homepos==pos then -- :get_luaentity()
|
||||
value:remove()
|
||||
end
|
||||
end
|
||||
buildtest.pumps.on_construct(pos, "default_wood.png", def.buildtest.pump.typeId)
|
||||
end
|
||||
if def.buildtest.pump.canHeat~=nil then
|
||||
if def.buildtest.pump.canHeat(pos)==false then
|
||||
canHeat=false
|
||||
end
|
||||
end
|
||||
if canHeat==true then
|
||||
--print("ok: "..def.buildtest.pump.next)
|
||||
-- local node = minetest.get_node(pos)
|
||||
-- node.name = def.buildtest.pump.next
|
||||
-- minetest.set_node(pos, node)
|
||||
if def.buildtest.pump.next~=nil then
|
||||
buildtest.pumps.hacky_swap_node(pos, def.buildtest.pump.next)
|
||||
elseif def.buildtest.pump.explodes == true then
|
||||
minetest.remove_node(pos)
|
||||
tnt:blowup(pos, 0.5, nil)
|
||||
end
|
||||
|
||||
thisMeta:set_int("timer", 0)
|
||||
return
|
||||
end
|
||||
thisMeta:set_int("timer", timerCount)
|
||||
end
|
||||
|
||||
--if not buildtest.pipeAt(pipepos) then return end
|
||||
|
||||
--local speed = thisMeta:get_int("level") or 1
|
||||
local speed = def.buildtest.pump.stepSpeed
|
||||
--minetest.set_node(chestpos, {name="default:cobble"})
|
||||
--if thisMeta:get_int("timer") % (def.buildtest.pump.maxLevel + 1 - speed) ~= 0 then
|
||||
if thisMeta:get_int("timer") % (#buildtest.pumps.colours + 1 - speed) ~= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
if buildtest.pumps.pulls[minetest.get_node(chestpos).name]~=nil and (strs:starts(minetest.get_node(pipepos).name, "buildtest:pipe_wood_") or strs:starts(minetest.get_node(pipepos).name, "buildtest:pipe_emr_")) then -- was minetest.get_node(chestpos).name=="default:chest"
|
||||
local inv = minetest.get_meta(chestpos):get_inventory()
|
||||
local tosend = nil
|
||||
local pipeinv = minetest.get_meta(pipepos):get_inventory()
|
||||
local listname = buildtest.pumps.pulls[minetest.get_node(chestpos).name][1]
|
||||
---------------------------------
|
||||
for i=1, inv:get_size(listname) do
|
||||
local cell = inv:get_stack(listname, i):to_table()
|
||||
if tosend==nil and cell~=nil and inv:get_stack(listname, i):is_empty()==false then
|
||||
if strs:starts(minetest.get_node(pipepos).name, "buildtest:pipe_wood_") or pipeinv:contains_item("main", {name = cell.name}) then
|
||||
local move = math.min(cell.count,
|
||||
def.buildtest.pump.moveCount)
|
||||
|
||||
tosend=ItemStack(cell):to_table()
|
||||
tosend.count = move
|
||||
cell.count = cell.count - move
|
||||
inv:set_stack(listname, i, cell)
|
||||
end
|
||||
end
|
||||
end
|
||||
if tosend==nil then return end
|
||||
local entity = buildtest.makeEnt(pipepos, tosend, speed)
|
||||
if entity then
|
||||
entity:setpos(chestpos)
|
||||
entity:setvelocity({x=0, y=0-speed, z=0})
|
||||
end
|
||||
elseif strs:starts(minetest.get_node(pipepos).name, "buildtest:pipe_obsidian_") then
|
||||
for _,object in ipairs(minetest.get_objects_inside_radius(pos, speed*def.buildtest.pump.moveCount)) do
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||
if object:get_luaentity().itemstring ~= "" then
|
||||
---- local titem=tube_item(pos,object:get_luaentity().itemstring)
|
||||
---- titem:get_luaentity().start_pos = {x=pos.x,y=pos.y-1,z=pos.z}
|
||||
---- titem:setvelocity({x=0.01,y=1,z=-0.01})
|
||||
---- titem:setacceleration({x=0, y=0, z=0})
|
||||
buildtest.makeEnt(pipepos, ItemStack(object:get_luaentity().itemstring):to_table(), speed)
|
||||
end
|
||||
--object:setvelocity
|
||||
object:get_luaentity().itemstring = ""
|
||||
object:remove()
|
||||
end
|
||||
end
|
||||
elseif minetest.get_node(pipepos).name=="buildtest:pump" then
|
||||
local ent=minetest.add_entity(pipepos, "buildtest:entity_liquid")
|
||||
ent:get_luaentity().pos = pipepos
|
||||
elseif strs:starts(minetest.get_node(pipepos).name, "buildtest:pipe_stripe_") then
|
||||
local itemName = minetest.get_node(chestpos).name
|
||||
if itemName~="air" and itemName~="ignore" then
|
||||
-- print("currently cutting: "..itemName)
|
||||
local drops = minetest.get_node_drops(itemName, "default:pick_mese")--minetest.registered_nodes[itemName].drop
|
||||
|
||||
for _,item in ipairs(drops) do
|
||||
local count, name
|
||||
if type(item) == "string" then
|
||||
count = 1
|
||||
name = item
|
||||
else
|
||||
count = item:get_count()
|
||||
name = item:get_name()
|
||||
end
|
||||
|
||||
local entity = buildtest.makeEnt(pipepos, {name = name, count = count}, speed)
|
||||
if entity then
|
||||
entity:setpos(chestpos)
|
||||
entity:setvelocity({x=0, y=0-speed, z=0})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.set_node(chestpos, {name = "air"})
|
||||
nodeupdate(chestpos)
|
||||
end
|
||||
else
|
||||
speedup = speed
|
||||
end
|
||||
|
||||
thisMeta:set_int("speedup", speedup)
|
||||
end
|
||||
|
||||
buildtest.facedir_to_dir = function(param)
|
||||
local list={
|
||||
{x= 0,y=0,z= 1},
|
||||
{x= 1,y=0,z= 0},
|
||||
{x= 0,y=0,z=-1},
|
||||
{x=-1,y=0,z= 0},
|
||||
}
|
||||
return list[param+1]
|
||||
end
|
||||
|
||||
buildtest.makeEnt = function(pos, tosend, speed)
|
||||
if speed < 1 then speed = 1 end
|
||||
local entity=minetest.add_entity(pos, "buildtest:entity_flat")
|
||||
if entity then
|
||||
entity:get_luaentity().nextpos = pos
|
||||
entity:get_luaentity().speed = speed
|
||||
entity:setpos(pos)
|
||||
entity:setvelocity({x=0, y=0, z=0})
|
||||
entity:get_luaentity():set_item(tosend)
|
||||
--entity:get_luaentity().inInit = false
|
||||
end
|
||||
return entity
|
||||
end
|
||||
|
||||
buildtest.pumps.on_construct = function(pos, texture, speed)
|
||||
--print("ok")
|
||||
local ent = minetest.add_entity(pos, "buildtest:pump_ent")
|
||||
if ent then
|
||||
local luaent = ent:get_luaentity()
|
||||
ent:setpos(pos)
|
||||
--ent:get_luaentity():setTexture(texture)
|
||||
--ent:get_luaentity():setAnim(speed)
|
||||
ent:get_luaentity().config = {
|
||||
texture = texture,
|
||||
speed = speed,
|
||||
}
|
||||
ent:get_luaentity().homepos = pos
|
||||
-- ent:get_luaentity().handmade = true
|
||||
--ent:get_luaentity().setTexture(ent, "buildtest_pump_mesecon.png")
|
||||
-- ent:get_luaentity().homename = minetest.get_node(pos).name
|
||||
-- ent:get_luaentity().reset = true
|
||||
end
|
||||
end
|
||||
|
||||
dofile(minetest.get_modpath("buildtest").."/pumps/graphics/init.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pumps/mesecon.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pumps/sterling.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pumps/pump.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/pumps/combustion.lua")
|
|
@ -0,0 +1,176 @@
|
|||
--minetest.register_node("buildtest:pump_sterling", {
|
||||
-- --tiles = {"buildtest_pump_mesecon.png"},
|
||||
-- description = "Buildtest Sterling Pump",
|
||||
-- groups = {choppy=1,oddly_breakable_by_hand=3},
|
||||
-- paramtype = "light",
|
||||
-- paramtype2 = "facedir",
|
||||
-- sunlight_propagates = true,
|
||||
-- buildtest = {
|
||||
-- pipe=1,
|
||||
-- connects={
|
||||
-- "buildtest:pipe_wood",
|
||||
-- },
|
||||
-- pump = {
|
||||
-- maxSpeed = 0.5,
|
||||
-- moveCount = 2,
|
||||
-- maxLevel = 10,
|
||||
-- upTime = 20,
|
||||
-- textures = {
|
||||
-- "buildtest_pump_sterling.png",
|
||||
-- "buildtest_pump_blue.png",
|
||||
-- "buildtest_pump_green.png",
|
||||
-- "buildtest_pump_orange.png",
|
||||
-- "buildtest_pump_red.png",
|
||||
-- }
|
||||
-- }
|
||||
-- },
|
||||
-- on_construct = function(pos)
|
||||
-- local ent = minetest.add_entity(pos, "buildtest:pump_ent")
|
||||
-- if ent then
|
||||
-- ent:setpos(pos)
|
||||
-- ent:get_luaentity().homepos = pos
|
||||
-- ent:get_luaentity().setTexture(ent, "buildtest_pump_sterling.png")
|
||||
-- --ent:get_luaentity().homename = minetest.get_node(pos).name
|
||||
-- end
|
||||
-- end,
|
||||
-- drawtype = "nodebox",
|
||||
-- node_box = {
|
||||
-- type = "fixed",
|
||||
-- fixed = {{0,0,0,0,0,0}}
|
||||
-- },
|
||||
-- selection_box = {{
|
||||
-- 0.5,0.5,0.5,-0.5,-0.5,-0.5,
|
||||
-- }},
|
||||
--})
|
||||
--
|
||||
--minetest.register_abm({
|
||||
-- nodenames = {"buildtest:pump_sterling"},
|
||||
-- interval = 0.5,
|
||||
-- chance = 1,
|
||||
-- action = function(pos)
|
||||
-- buildtest.pumps.send(pos)
|
||||
-- end,
|
||||
--})
|
||||
|
||||
buildtest.pumps.types.stirling = {
|
||||
get_pump_active_formspec = function(percent)
|
||||
local formspec =
|
||||
"size[8,9]"..
|
||||
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..percent..":default_furnace_fire_fg.png]"..
|
||||
"list[context;fuel;2,3;1,1;]"..
|
||||
"list[context;heat;4,1;1,1;]"..
|
||||
"list[context;out;6,1;2,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
return formspec
|
||||
end,
|
||||
set_pump_active_formspec = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local fuel_level = meta:get_int("fuel")
|
||||
local max_fuel = meta:get_int("maxfuel")
|
||||
local percent = (fuel_level / max_fuel) * 100
|
||||
local formspec = buildtest.pumps.types.stirling.get_pump_active_formspec(percent)
|
||||
meta:set_string("formspec", formspec)
|
||||
end,
|
||||
handleCooling = function(pos, inv)
|
||||
if inv:get_stack("heat", 1):is_empty() then
|
||||
return false
|
||||
end
|
||||
local name = inv:get_stack("heat", 1):get_name()
|
||||
local def = minetest.registered_items[minetest.get_node(pos).name]
|
||||
if name=="bucket:bucket_lava" then
|
||||
if def.buildtest.pump.next~=nil then
|
||||
buildtest.pumps.hacky_swap_node(pos, def.buildtest.pump.next)
|
||||
inv:set_stack("heat", 1, ItemStack(nil))
|
||||
inv:add_item("out", ItemStack("bucket:bucket_empty"))
|
||||
return true
|
||||
end
|
||||
end
|
||||
if name=="bucket:bucket_water" then
|
||||
if def.buildtest.pump.prev~=nil then
|
||||
buildtest.pumps.hacky_swap_node(pos, def.buildtest.pump.prev)
|
||||
inv:set_stack("heat", 1, ItemStack(nil))
|
||||
inv:add_item("out", ItemStack("bucket:bucket_empty"))
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end,
|
||||
}
|
||||
|
||||
buildtest.pumps.register_pump("buildtest:pump_stirling", "default_cobble.png", {
|
||||
description = "Buildtest Stirling Engine",
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
---------------------------
|
||||
-- local formspec =
|
||||
-- "size[8,9]"..
|
||||
-- "image[2,2;1,1;default_furnace_fire_bg.png]"..
|
||||
-- "list[context;fuel;2,3;1,1;]"..
|
||||
-- "list[current_player;main;0,5;8,4;]"
|
||||
local formspec = buildtest.pumps.types.stirling.get_pump_active_formspec(0)
|
||||
---------------------------
|
||||
meta:set_string("formspec", formspec)
|
||||
---------------------------
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("fuel", 1)
|
||||
inv:set_size("heat", 1)
|
||||
inv:set_size("out", 2*2)
|
||||
buildtest.pumps.on_construct(pos)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("fuel") then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
},
|
||||
{
|
||||
abm = function(pos)
|
||||
buildtest.pumps.send(pos)
|
||||
end,
|
||||
runConf = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
if buildtest.pumps.types.stirling.handleCooling(pos, inv)==true then
|
||||
return false
|
||||
end
|
||||
|
||||
local fuel_level = (meta:get_int("fuel") or 0)
|
||||
if fuel_level > 0 then
|
||||
fuel_level = fuel_level - 1
|
||||
meta:set_int("fuel", fuel_level)
|
||||
buildtest.pumps.types.stirling.set_pump_active_formspec(pos)
|
||||
return true
|
||||
end
|
||||
|
||||
if inv:get_stack("fuel", 1):is_empty() then
|
||||
return false
|
||||
end
|
||||
|
||||
local items = inv:get_list("fuel")
|
||||
-- print("item: "..inv:get_stack("fuel", 1):get_name())
|
||||
local fuel
|
||||
local sub
|
||||
fuel, sub = minetest.get_craft_result({
|
||||
method="fuel",
|
||||
width=1,
|
||||
items = items,
|
||||
})
|
||||
if fuel.time <= 0 then
|
||||
return false
|
||||
end
|
||||
meta:set_int("maxfuel", fuel.time)
|
||||
meta:set_int("fuel", fuel.time)
|
||||
inv:set_list("fuel", sub.items)
|
||||
buildtest.pumps.types.stirling.set_pump_active_formspec(pos)
|
||||
-- print("pumping")
|
||||
return true
|
||||
end,
|
||||
|
||||
moveCount = 2,
|
||||
explodes = true,
|
||||
}
|
||||
)
|
|
@ -0,0 +1,292 @@
|
|||
buildtest.canPumpInto = {
|
||||
["default:chest_locked"] = {"main"},
|
||||
["default:chest"] = {"main"},
|
||||
["morechests:dropbox"] = {"main"},
|
||||
["default:furnace_active"] = {"src", negy = "fuel"},
|
||||
["default:furnace"] = {"src", negy = "fuel"},
|
||||
--["buildtest:pump_stirling"] = {"heat", negy = "fuel"},
|
||||
["buildtest:autocraft"] = {"in", on_send = function(pos)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
buildtest.autocraft.do_craft(inv)
|
||||
end},
|
||||
["itest:macerator"] = {"src"},
|
||||
["itest:macerator_active"] = {"src"},
|
||||
|
||||
["itest:iron_furnace_active"] = {"src", negy = "fuel"},
|
||||
["itest:iron_furnace"] = {"src", negy = "fuel"},
|
||||
["itest:electric_furnace_active"] = {"src"},
|
||||
["itest:electric_furnace"] = {"src"},
|
||||
["itest:extractor_active"] = {"src"},
|
||||
["itest:extractor"] = {"src"},
|
||||
["itest:generator_active"] = {"src"},
|
||||
["itest:generator"] = {"src"},
|
||||
}
|
||||
|
||||
buildtest.get_listname_for_dir_in = function(dir, posname)
|
||||
local listName = buildtest.canPumpInto[posname][1]
|
||||
local dirName = ""
|
||||
if dir.x+dir.y+dir.z > 0 then
|
||||
dirName = dirName .. "neg"
|
||||
end
|
||||
if dir.x~=0 then
|
||||
dirName = dirName .. "x"
|
||||
end
|
||||
if dir.y~=0 then
|
||||
dirName = dirName .. "y"
|
||||
end
|
||||
if dir.z~=0 then
|
||||
dirName = dirName .. "z"
|
||||
end
|
||||
if buildtest.canPumpInto[posname][dirName]~=nil then
|
||||
listName = buildtest.canPumpInto[posname][dirName]
|
||||
end
|
||||
return listName
|
||||
end
|
||||
|
||||
minetest.register_entity("buildtest:entity_flat", {
|
||||
initial_properties = {
|
||||
visual = "cube",
|
||||
visual_size = {x=0.5, y=0.5},
|
||||
--visual_size = {x=1, y=1},
|
||||
-- textures = {"worldedit_pos1.png", "worldedit_pos1.png",
|
||||
-- "worldedit_pos1.png", "worldedit_pos1.png",
|
||||
-- "worldedit_pos1.png", "worldedit_pos1.png"},
|
||||
-- collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
physical = false,
|
||||
},
|
||||
on_step = function(self, dtime)
|
||||
self.totTime=self.totTime+dtime
|
||||
local pos=self.object:getpos()
|
||||
-- pos.x=pos.x+dtime
|
||||
-- self.object:setpos(pos)
|
||||
if self.totTime > 1 / self.speed then
|
||||
self.totTime = 0 --self.totTime - 1 / self.speed
|
||||
--self.lastTime=math.toint(self.totTime)
|
||||
--print(self.totTime)
|
||||
--local acc=self.object:getacceleration()
|
||||
--acc.x=0-acc.x
|
||||
--acc.y=0-acc.y
|
||||
--acc.z=0-acc.z
|
||||
--self.object:setacceleration(acc)
|
||||
if self.nextpos~=nil then
|
||||
local newDir=nil
|
||||
local posname = minetest.get_node(self.nextpos).name
|
||||
--if posname=="default:chest" or posname=="default:chest_locked" then
|
||||
if buildtest.canPumpInto[posname]~=nil then
|
||||
local listName = buildtest.get_listname_for_dir_in(self.olddir, posname)
|
||||
|
||||
local inv = minetest.get_meta(self.nextpos):get_inventory()
|
||||
if inv:room_for_item(listName, self.content)==true then
|
||||
inv:add_item(listName, self.content)
|
||||
else
|
||||
self.turn_into_item(self, self.content)
|
||||
end
|
||||
-- local leftover = inv:add_item("main", self.content)
|
||||
-- if leftover~=nil and leftover:get_count()>0 then
|
||||
-- self.turn_into_item(self, leftover)
|
||||
-- return
|
||||
-- end
|
||||
self.object:remove()
|
||||
|
||||
if buildtest.canPumpInto[posname].on_send~=nil then
|
||||
buildtest.canPumpInto[posname].on_send(self.nextpos)
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
--if self.nextpos==nil then
|
||||
-- return
|
||||
--end
|
||||
--self.object:setpos({x=self.nextpos.x, y=self.nextpos.y+2, z=self.nextpos.z}) -- snap to grid
|
||||
|
||||
if strs:starts(posname, "buildtest:pipe_iron_") then
|
||||
newDir = buildtest.pipes.types.iron.getDir(self.nextpos)
|
||||
end
|
||||
|
||||
if strs:starts(posname, "buildtest:pipe_diamond_") then
|
||||
newDir = buildtest.pipes.types.diamond.getDir(self.nextpos, self.content)
|
||||
end
|
||||
|
||||
if strs:starts(posname, "buildtest:pipe_stripe_") then
|
||||
local targetPos = self.addpos(self.object:getpos(), self.olddir)
|
||||
if minetest.get_node(targetPos).name == "air"
|
||||
and self.content.count==1 and minetest.registered_nodes[self.content.name]~=nil then
|
||||
minetest.set_node(targetPos, self.content)
|
||||
self.object:remove()
|
||||
nodeupdate(targetPos)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if strs:starts(posname, "buildtest:pipe_gate") then
|
||||
local getRunAction = buildtest.pipes.types.gate.types[posname].getRunAction(self.nextpos).entProcess(self.content)
|
||||
end
|
||||
|
||||
self.object:setpos(self.nextpos) -- snap to grid
|
||||
if newDir==nil then
|
||||
newDir = self.get_dir(self)
|
||||
end
|
||||
if newDir==nil then
|
||||
self.turn_into_item(self, self.content)
|
||||
--self.nextpos = nil
|
||||
return
|
||||
end
|
||||
|
||||
---------------
|
||||
local posUnder = {x=self.nextpos.x, y=self.nextpos.y - 1, z=self.nextpos.z}
|
||||
if strs:starts(minetest.get_node(posUnder).name, "buildtest:pump_") then
|
||||
local speedup = minetest.get_meta(posUnder):get_int("speedup")
|
||||
if speedup==nil then speedup=0 end
|
||||
self.speed = self.speed + speedup
|
||||
end
|
||||
|
||||
if strs:starts(posname, "buildtest:pipe_gold_") then
|
||||
local speedup = minetest.get_meta(self.nextpos):get_int("on")
|
||||
--print("ok: "..speedup)
|
||||
self.speed = self.speed + (speedup * 1)
|
||||
end
|
||||
|
||||
local pipedef = minetest.registered_items[posname]
|
||||
if pipedef~=nil then
|
||||
if pipedef.buildtest~=nil then
|
||||
if pipedef.buildtest.slowdown~=nil then
|
||||
self.speed = self.speed - pipedef.buildtest.slowdown
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if self.speed > 20 then self.speed = 20 end
|
||||
if self.speed < 1 then self.speed = 1 end
|
||||
---------------
|
||||
|
||||
self.olddir=newDir
|
||||
self.nextpos=self.addpos(self.nextpos,newDir)
|
||||
self.object:setvelocity(buildtest.posMult(newDir, self.speed))
|
||||
self.direction = newDir
|
||||
--print("old: "..minetest.pos_to_string(self.currpos))
|
||||
--print("new: "..minetest.pos_to_string(self.currpos))
|
||||
else
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_punch = function(self, hitter)
|
||||
end,
|
||||
get_dir = function(self)
|
||||
local poses={
|
||||
{x= 0,y= 0,z=-1},
|
||||
{x= 0,y= 0,z= 1},
|
||||
{x=-1,y= 0,z= 0},
|
||||
{x= 1,y= 0,z= 0},
|
||||
{x= 0,y=-1,z= 0},
|
||||
{x= 0,y= 1,z= 0},
|
||||
}
|
||||
local prohib={self.invertpos(self.direction)}
|
||||
for i=1,#prohib do
|
||||
for j=1,#poses do
|
||||
if minetest.pos_to_string(poses[j])==minetest.pos_to_string(prohib[i]) then
|
||||
poses[j]=0
|
||||
elseif buildtest.pipeConn(self.addpos(self.nextpos,poses[j]),self.nextpos)==false then -- minetest.get_node(self.addpos(self.nextpos,poses[j]))
|
||||
poses[j]=0
|
||||
end
|
||||
end
|
||||
end
|
||||
for i=1,#poses do
|
||||
if poses[i]~=0 then
|
||||
return poses[i]
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end,
|
||||
invertpos = function(pos)
|
||||
return {x=0-pos.x, y=0-pos.y, z=0-pos.z}
|
||||
end,
|
||||
addpos = function(posa, posb)
|
||||
return {x=posa.x+posb.x, y=posa.y+posb.y, z=posa.z+posb.z}
|
||||
end,
|
||||
ispipe = function(node)
|
||||
if node.name=="air" then
|
||||
return false
|
||||
end
|
||||
local def=minetest.registered_items[node.name]
|
||||
if def.buildtest==nil then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
------------------------------------------------
|
||||
set_item = function(self, itemstring)
|
||||
self.content = itemstring
|
||||
-- print("ok")
|
||||
local stack = ItemStack(itemstring)
|
||||
local itemtable = stack:to_table()
|
||||
local itemname = nil
|
||||
if itemtable then
|
||||
itemname = stack:to_table().name
|
||||
end
|
||||
local item_texture = nil
|
||||
local item_type = ""
|
||||
if minetest.registered_items[itemname] then
|
||||
item_texture = minetest.registered_items[itemname].inventory_image
|
||||
item_type = minetest.registered_items[itemname].type
|
||||
end
|
||||
prop = {
|
||||
is_visible = true,
|
||||
visual = "sprite",
|
||||
textures = {"unknown_item.png"}
|
||||
}
|
||||
if item_texture and item_texture ~= "" then
|
||||
prop.visual = "sprite"
|
||||
prop.textures = {item_texture}
|
||||
--prop.visual_size = {x=0.3, y=0.3}
|
||||
prop.visual_size = {x=0.6, y=0.6}
|
||||
else
|
||||
prop.visual = "wielditem"
|
||||
prop.textures = {itemname}
|
||||
--prop.visual_size = {x=0.15, y=0.15}
|
||||
prop.visual_size = {x=0.3, y=0.3}
|
||||
end
|
||||
self.object:set_properties(prop)
|
||||
end,
|
||||
------------------------------------------------
|
||||
turn_into_item = function(self, stack)
|
||||
minetest.add_item(self.addpos(self.object:getpos(),self.olddir), stack)
|
||||
self.object:remove()
|
||||
end,
|
||||
--------------------------------------------------
|
||||
get_staticdata = function(self)
|
||||
--local nextpoz = minetest.pos_to_string(self.nextpos)
|
||||
return minetest.serialize({
|
||||
self.nextpos,
|
||||
self.olddir,
|
||||
self.content,
|
||||
self.speed,
|
||||
self.direction,
|
||||
})
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
-- if staticdata=="" or staticdata==nil then return end
|
||||
-- local item = minetest.deserialize(staticdata)
|
||||
|
||||
|
||||
-- self.olddir = item.olddir
|
||||
-- self.speed = item.speed
|
||||
--self.direction = item.direction
|
||||
--self.nextpos = minetest.pos_to_string(item.nextpos)
|
||||
|
||||
--self.object:setpos(self.nextpos)
|
||||
|
||||
--self:set_item(self.content)
|
||||
end,
|
||||
|
||||
totTime=0,
|
||||
lastTime=0,
|
||||
olddir={x=0,y=0,z=0},
|
||||
content={name="default:dirt",count=0},
|
||||
speed = 1,
|
||||
direction = {x=0,y=0,z=0},
|
||||
})
|
|
@ -0,0 +1,126 @@
|
|||
minetest.register_entity("buildtest:entity_liquid", {
|
||||
initial_properties = {
|
||||
visual = "cube",
|
||||
visual_size = {x=0.5, y=0.5},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
physical = false,
|
||||
},
|
||||
on_step = function(self, dtime)
|
||||
self.object:remove()
|
||||
-- self.totTime=self.totTime+dtime
|
||||
-- if self.totTime > 2 then
|
||||
-- self.totTime = 0
|
||||
-- if self.pos~=nil and buildtest.pipeAt(self.pos) then
|
||||
-- self.spread(self)
|
||||
-- else
|
||||
-- self.object:remove()
|
||||
-- end
|
||||
-- end
|
||||
end,
|
||||
on_punch = function(self, hitter)
|
||||
end,
|
||||
spread = function(self)
|
||||
local poses={
|
||||
{x= 0,y= 0,z=-1},
|
||||
{x= 0,y= 0,z= 1},
|
||||
{x= 0,y=-1,z= 0},
|
||||
{x= 0,y= 1,z= 0},
|
||||
{x=-1,y= 0,z= 0},
|
||||
{x= 1,y= 0,z= 0},
|
||||
}
|
||||
for _,object in ipairs(minetest.get_objects_inside_radius(self.pos, 5)) do
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == self.name then
|
||||
if object~=self.object then
|
||||
if object:get_luaentity().pos~=nil and object:get_luaentity().posOfs~=nil then
|
||||
if object:get_luaentity().pos~=self.pos then
|
||||
--return
|
||||
local remPos = object:get_luaentity().pos
|
||||
for i=1, #poses do
|
||||
if poses[i]~=nil then
|
||||
if poses[i].x==remPos.x and poses[i].y==remPos.y and poses[i].z==remPos.z then
|
||||
poses[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for i=1,#poses do
|
||||
if poses[i]~=nil then
|
||||
local newPos = self.addpos(poses[i], self.pos)
|
||||
if buildtest.pipeConn(newPos, self.pos) then
|
||||
--local posOfs = {x=poses[i].x/3,y=poses[i].y/3,z=poses[i].z/3}
|
||||
local ent = minetest.add_entity(newPos, "buildtest:entity_liquid")
|
||||
if ent then
|
||||
--print("ok")
|
||||
--ent:setpos(newPos)
|
||||
ent:get_luaentity().pos=newPos--self.pos
|
||||
-- ent:get_luaentity().posOfs=poses[i]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
addpos = function(posa, posb)
|
||||
return {x=posa.x+posb.x, y=posa.y+posb.y, z=posa.z+posb.z}
|
||||
end,
|
||||
-- can_goto = function(pos, refpos)
|
||||
-- local refnode = minetest.get_node(refpos)
|
||||
-- if strs:starts(refnode.name, "buildtest:pipe_") then
|
||||
-- local id = refnode.name:split("_")[3]
|
||||
-- if id=="0" then
|
||||
-- return false
|
||||
-- end
|
||||
-- return buildtest.pipeConn(pos, refpos)
|
||||
-- end
|
||||
-- return false
|
||||
-- end,
|
||||
------------------------------------------------
|
||||
set_item = function(self, itemstring)
|
||||
-- self.content = itemstring
|
||||
---- print("ok")
|
||||
-- local stack = ItemStack(itemstring)
|
||||
-- local itemtable = stack:to_table()
|
||||
-- local itemname = nil
|
||||
-- if itemtable then
|
||||
-- itemname = stack:to_table().name
|
||||
-- end
|
||||
-- local item_texture = nil
|
||||
-- local item_type = ""
|
||||
-- if minetest.registered_items[itemname] then
|
||||
-- item_texture = minetest.registered_items[itemname].inventory_image
|
||||
-- item_type = minetest.registered_items[itemname].type
|
||||
-- end
|
||||
-- prop = {
|
||||
-- is_visible = true,
|
||||
-- visual = "sprite",
|
||||
-- textures = {"unknown_item.png"}
|
||||
-- }
|
||||
-- if item_texture and item_texture ~= "" then
|
||||
-- prop.visual = "sprite"
|
||||
-- prop.textures = {item_texture}
|
||||
-- --prop.visual_size = {x=0.3, y=0.3}
|
||||
-- prop.visual_size = {x=0.6, y=0.6}
|
||||
-- else
|
||||
-- prop.visual = "wielditem"
|
||||
-- prop.textures = {itemname}
|
||||
-- --prop.visual_size = {x=0.15, y=0.15}
|
||||
-- prop.visual_size = {x=0.3, y=0.3}
|
||||
-- end
|
||||
-- self.object:set_properties(prop)
|
||||
end,
|
||||
--------------------------------------------------
|
||||
get_staticdata = function(self)
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
end,
|
||||
|
||||
totTime=0,
|
||||
lastTime=0,
|
||||
--pos={x=0,y=0,z=0},
|
||||
posOfs = {x=0,y=0,z=0},
|
||||
content={name="default:water_source"},
|
||||
})
|
Loading…
Reference in New Issue