Add gear textures, and add quarrys
|
@ -0,0 +1 @@
|
|||
dofile(minetest.get_modpath("buildtest").."/bt factory/quarry.lua")
|
|
@ -0,0 +1,76 @@
|
|||
minetest.register_node("buildtest:quarry", {
|
||||
tiles = {
|
||||
"buildtest_quarry_top.png",
|
||||
"buildtest_quarry.png",
|
||||
"buildtest_quarry.png",
|
||||
"buildtest_quarry.png",
|
||||
"buildtest_quarry.png",
|
||||
"buildtest_quarry_front.png",
|
||||
},
|
||||
description = "Buildtest Quarry",
|
||||
groups = {cracky=1},
|
||||
paramtype2 = "facedir",
|
||||
buildtest = {
|
||||
pipe_groups = {
|
||||
type = "transp",
|
||||
},
|
||||
power = {
|
||||
},
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local nextTo = buildtest.landmarks.getNextTo(pos)
|
||||
local bounds = buildtest.landmarks.getBounds(nextTo)
|
||||
buildtest.landmarks.removeMarks(nextTo)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("pmin", minetest.pos_to_string(bounds.pmin))
|
||||
meta:set_string("pmax", minetest.pos_to_string(bounds.pmax))
|
||||
meta:set_int("size", (bounds.pmax.x-bounds.pmin.x)*(bounds.pmax.z-bounds.pmin.z))
|
||||
meta:set_int("power", 0)
|
||||
end,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local itemstk=minetest.item_place(itemstack, placer, pointed_thing)
|
||||
for i=1,6 do
|
||||
buildtest.pipes.processNode(vector.add(pointed_thing.above,buildtest.toXY(i)))
|
||||
end
|
||||
return itemstk
|
||||
end
|
||||
})
|
||||
|
||||
buildtest.pumps.pumpible["buildtest:quarry"] = {
|
||||
power = function(pos, speed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local power = meta:get_int("power")
|
||||
power = power + speed
|
||||
local size = meta:get_int("size")
|
||||
if power < size then
|
||||
meta:set_int("power", power)
|
||||
end
|
||||
power = power - size
|
||||
meta:set_int("power", power)
|
||||
|
||||
local pmin = minetest.string_to_pos(meta:get_string("pmin"))
|
||||
local pmax = minetest.string_to_pos(meta:get_string("pmax"))
|
||||
print(meta:get_string("pmin"))
|
||||
|
||||
local topos = buildtest.pumps.findpipe(pos)
|
||||
local l = pmin.y-1
|
||||
while minetest.get_node({x=pmin.x, y=l, z=pmin.z}).name=="air" do
|
||||
l=l-1
|
||||
end
|
||||
pmin.y = l
|
||||
|
||||
for x=pmin.x,pmax.x do
|
||||
for z=pmin.z,pmax.z do
|
||||
local bpos = {x=x, y=pmin.y, z=z}
|
||||
local n = minetest.get_node(bpos)
|
||||
if n.name~="ignore" then
|
||||
minetest.remove_node(bpos)
|
||||
local itemstacks = minetest.get_node_drops(n.name)
|
||||
for _, itemname in ipairs(itemstacks) do
|
||||
buildtest.makeEnt(topos, {name=itemname}, 1, bpos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
14
crafts.lua
|
@ -53,8 +53,18 @@ for name, val in pairs(buildtest.pumps.crafts) do
|
|||
output = "buildtest:engine_"..name.."_blue",
|
||||
recipe = {
|
||||
{ val.mat, val.mat, val.mat },
|
||||
{ "", "default:glass", "" },
|
||||
{ "", "default:glass", "" },
|
||||
{ val.gear, piston, val.gear },
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "buildtest:quarry",
|
||||
recipe = {
|
||||
{ "buildtest:gear_steel", "mesecons:wire_00000000_off", "buildtest:gear_steel" },
|
||||
{ "buildtest:gear_gold", "buildtest:gear_steel", "buildtest:gear_gold" },
|
||||
{ "buildtest:gear_diamond", "default:pick_diamond", "buildtest:gear_diamond" },
|
||||
}
|
||||
})
|
1
init.lua
|
@ -45,6 +45,7 @@ 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").."/misc/init.lua")
|
||||
dofile(minetest.get_modpath("buildtest").."/bt factory/init.lua")
|
||||
|
||||
dofile(minetest.get_modpath("buildtest").."/crafts.lua")
|
||||
|
||||
|
|
|
@ -5,6 +5,81 @@ buildtest.landmarks = {
|
|||
addBeam = function()
|
||||
removeBeam()
|
||||
end,
|
||||
|
||||
getNextTo = function(pos)
|
||||
local dirs = {
|
||||
{x= 1,y= 0,z= 0},
|
||||
{x=-1,y= 0,z= 0},
|
||||
{x= 0,y= 0,z= 1},
|
||||
{x= 0,y= 0,z=-1},
|
||||
}
|
||||
|
||||
for i=1, #dirs do
|
||||
local ppos = vector.add(pos, dirs[i])
|
||||
if minetest.get_node(ppos).name=="buildtest:landmark" then
|
||||
return ppos
|
||||
end
|
||||
end
|
||||
|
||||
return pos
|
||||
end,
|
||||
|
||||
getMarkPositions = function(pos)
|
||||
local dirs = {
|
||||
{x= 1,y= 0,z= 0},
|
||||
{x=-1,y= 0,z= 0},
|
||||
{x= 0,y= 0,z= 1},
|
||||
{x= 0,y= 0,z=-1},
|
||||
}
|
||||
|
||||
local marks = {}
|
||||
|
||||
for i=1, #dirs do
|
||||
local ppos = pos
|
||||
for ii=1, 20 do
|
||||
ppos = vector.add(ppos, dirs[i])
|
||||
if minetest.get_node(ppos).name=="buildtest:landmark" then
|
||||
marks[#marks+1] = ppos
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return marks
|
||||
end,
|
||||
|
||||
removeMarks = function(pos)
|
||||
local marks = buildtest.landmarks.getMarkPositions(pos)
|
||||
|
||||
for i=1, #marks do
|
||||
local ppos = marks[i]
|
||||
minetest.remove_node(ppos)
|
||||
minetest.add_item(ppos, "buildtest:landmark")
|
||||
end
|
||||
|
||||
if minetest.get_node(pos).name=="buildtest:landmark" then
|
||||
minetest.remove_node(pos)
|
||||
minetest.add_item(pos, "buildtest:landmark")
|
||||
end
|
||||
end,
|
||||
|
||||
getBounds = function(pos)
|
||||
local marks = buildtest.landmarks.getMarkPositions(pos)
|
||||
|
||||
local pmin = {x=pos.x, y=pos.y, z=pos.z}
|
||||
local pmax = {x=pos.x, y=pos.y, z=pos.z}
|
||||
|
||||
for i=1, #marks do
|
||||
local ppos = marks[i]
|
||||
pmin.x = math.min(pmin.x, ppos.x)
|
||||
pmax.x = math.max(pmax.x, ppos.x)
|
||||
|
||||
pmin.z = math.min(pmin.z, ppos.z)
|
||||
pmax.z = math.max(pmax.z, ppos.z)
|
||||
end
|
||||
|
||||
return {pmin=pmin, pmax=pmax}
|
||||
end,
|
||||
}
|
||||
|
||||
minetest.register_node("buildtest:landmark", {
|
||||
|
|
|
@ -254,6 +254,7 @@ end
|
|||
|
||||
buildtest.pipes.defaultVPipes = {
|
||||
"buildtest:pump",
|
||||
"buildtest:quarry",
|
||||
}
|
||||
|
||||
buildtest.pipes.defaultPipes = {
|
||||
|
|
After Width: | Height: | Size: 522 B |
After Width: | Height: | Size: 506 B |
After Width: | Height: | Size: 525 B |
After Width: | Height: | Size: 487 B |
After Width: | Height: | Size: 298 B |
After Width: | Height: | Size: 209 B |
After Width: | Height: | Size: 259 B |
After Width: | Height: | Size: 271 B |
After Width: | Height: | Size: 274 B |