tiles={"pipeworks_autocrafter.png"},
groups={snappy=3,tubedevice=1,tubedevice_receiver=1},
tube={insert_object=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
return inv:add_item("src",stack)
end,
can_insert=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
return inv:room_for_item("src",stack)
end,
input_inventory="dst"},
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,11]"..
"list[current_name;recipe;0,0;3,3;]"..
inv:set_size("dst",4*3)
end,
can_dig = function(pos,player)
- local meta = minetest.env:get_meta(pos);
+ local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return (inv:is_empty("src") and inv:is_empty("recipe") and inv:is_empty("dst"))
end,
minetest.register_abm({nodenames={"pipeworks:autocrafter"},interval=1,chance=1,
action=function(pos,node)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
autocraft(inv)
end
end
function pipe_autoroute(pos, state)
- nctr = minetest.env:get_node(pos)
+ nctr = minetest.get_node(pos)
if (string.find(nctr.name, "pipeworks:pipe_") == nil) then return end
pipes_scansurroundings(pos)
nsurround = pxm..pxp..pym..pyp..pzm..pzp
if nsurround == "000000" then nsurround = "110000" end
- minetest.env:add_node(pos, { name = "pipeworks:pipe_"..nsurround..state })
+ minetest.add_node(pos, { name = "pipeworks:pipe_"..nsurround..state })
end
-- autorouting for pneumatic tubes
local pzm=0
local pzp=0
- local nxm = minetest.env:get_node({ x=pos.x-1, y=pos.y , z=pos.z })
- local nxp = minetest.env:get_node({ x=pos.x+1, y=pos.y , z=pos.z })
- local nym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z })
- local nyp = minetest.env:get_node({ x=pos.x , y=pos.y+1, z=pos.z })
- local nzm = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z-1 })
- local nzp = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z+1 })
+ local nxm = minetest.get_node({ x=pos.x-1, y=pos.y , z=pos.z })
+ local nxp = minetest.get_node({ x=pos.x+1, y=pos.y , z=pos.z })
+ local nym = minetest.get_node({ x=pos.x , y=pos.y-1, z=pos.z })
+ local nyp = minetest.get_node({ x=pos.x , y=pos.y+1, z=pos.z })
+ local nzm = minetest.get_node({ x=pos.x , y=pos.y , z=pos.z-1 })
+ local nzp = minetest.get_node({ x=pos.x , y=pos.y , z=pos.z+1 })
- local nctr = minetest.env:get_node(pos)
+ local nctr = minetest.get_node(pos)
-- handle the tubes themselves
nsurround = pxm..pxp..pym..pyp..pzm..pzp
if is_tube(nctr.name) then
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local meta0=meta:to_table()
nctr.name=string.sub(nctr.name,1,-7)..nsurround
- minetest.env:add_node(pos, nctr)
- local meta=minetest.env:get_meta(pos)
+ minetest.add_node(pos, nctr)
+ local meta=minetest.get_meta(pos)
meta:from_table(meta0)
end
pzm=0
pzp=0
- nxm = minetest.env:get_node({ x=pos.x-1, y=pos.y , z=pos.z })
- nxp = minetest.env:get_node({ x=pos.x+1, y=pos.y , z=pos.z })
- nym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z })
- nyp = minetest.env:get_node({ x=pos.x , y=pos.y+1, z=pos.z })
- nzm = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z-1 })
- nzp = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z+1 })
+ nxm = minetest.get_node({ x=pos.x-1, y=pos.y , z=pos.z })
+ nxp = minetest.get_node({ x=pos.x+1, y=pos.y , z=pos.z })
+ nym = minetest.get_node({ x=pos.x , y=pos.y-1, z=pos.z })
+ nyp = minetest.get_node({ x=pos.x , y=pos.y+1, z=pos.z })
+ nzm = minetest.get_node({ x=pos.x , y=pos.y , z=pos.z-1 })
+ nzp = minetest.get_node({ x=pos.x , y=pos.y , z=pos.z+1 })
if (string.find(nxm.name, "pipeworks:pipe_") ~= nil) then pxm=1 end
if (string.find(nxp.name, "pipeworks:pipe_") ~= nil) then pxp=1 end
end
function pipe_look_for_stackable_tanks(pos)
- local tym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z })
+ local tym = minetest.get_node({ x=pos.x , y=pos.y-1, z=pos.z })
if string.find(tym.name, "pipeworks:storage_tank_") ~= nil or
string.find(tym.name, "pipeworks:expansion_tank_") ~= nil then
- minetest.env:add_node(pos, { name = "pipeworks:expansion_tank_0", param2 = tym.param2})
+ minetest.add_node(pos, { name = "pipeworks:expansion_tank_0", param2 = tym.param2})
end
end
furnace.groups.tubedevice=1
furnace.groups.tubedevice_receiver=1
furnace.tube={insert_object = function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
if direction.y==1 then
return inv:add_item("fuel",stack)
end
end,
can_insert=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
if direction.y==1 then
return inv:room_for_item("fuel",stack)
furnace.groups.tubedevice=1
furnace.groups.tubedevice_receiver=1
furnace.tube={insert_object=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
if direction.y==1 then
return inv:add_item("fuel",stack)
end
end,
can_insert=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
if direction.y==1 then
return inv:room_for_item("fuel",stack)
chest.groups.tubedevice=1
chest.groups.tubedevice_receiver=1
chest.tube={insert_object = function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
return inv:add_item("main",stack)
end,
can_insert=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
return inv:room_for_item("main",stack)
end,
})
function hacky_swap_node(pos,name)
- local node=minetest.env:get_node(pos)
- local meta=minetest.env:get_meta(pos)
+ local node=minetest.get_node(pos)
+ local meta=minetest.get_meta(pos)
local meta0=meta:to_table()
node.name=name
- minetest.env:add_node(pos, node)
- local meta=minetest.env:get_meta(pos)
+ minetest.add_node(pos, node)
+ local meta=minetest.get_meta(pos)
meta:from_table(meta0)
end
hacky_swap_node(pos,"pipeworks:deployer_on")
nodeupdate(pos)
- local inv = minetest.env:get_meta(pos):get_inventory()
+ local inv = minetest.get_meta(pos):get_inventory()
local invlist = inv:get_list("main")
for i, stack in ipairs(invlist) do
- if stack:get_name() ~= nil and stack:get_name() ~= "" and minetest.env:get_node(pos1).name == "air" then --obtain the first non-empty item slow
+ if stack:get_name() ~= nil and stack:get_name() ~= "" and minetest.get_node(pos1).name == "air" then --obtain the first non-empty item slow
local placer = {
get_player_name = function() return "deployer" end,
getpos = function() return pos end,
"pipeworks_deployer_back.png","pipeworks_deployer_front_off.png"},
mesecons = {effector={action_on=deployer_on,action_off=deployer_off}},
tube={insert_object=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
return inv:add_item("main",stack)
end,
can_insert=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
return inv:room_for_item("main",stack)
end,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,tubedevice=1, tubedevice_receiver=1},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;Deployer]"..
inv:set_size("main", 3*3)
end,
can_dig = function(pos,player)
- local meta = minetest.env:get_meta(pos);
+ local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
"pipeworks_deployer_back.png","pipeworks_deployer_front_on.png"},
mesecons = {effector={action_on=deployer_on,action_off=deployer_off}},
tube={insert_object=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
return inv:add_item("main",stack)
end,
can_insert=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
return inv:room_for_item("main",stack)
end,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,tubedevice=1, tubedevice_receiver=1,not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;Deployer]"..
inv:set_size("main", 3*3)
end,
can_dig = function(pos,player)
- local meta = minetest.env:get_meta(pos);
+ local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
walkable = true,
pipelike = 1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end,
after_place_node = function(pos)
drop = "pipeworks:pump_off",
mesecons = {effector = {
action_on = function (pos, node)
- minetest.env:add_node(pos,{name="pipeworks:pump_on", param2 = node.param2})
+ minetest.add_node(pos,{name="pipeworks:pump_on", param2 = node.param2})
end,
action_off = function (pos, node)
- minetest.env:add_node(pos,{name="pipeworks:pump_off", param2 = node.param2})
+ minetest.add_node(pos,{name="pipeworks:pump_off", param2 = node.param2})
end
}}
})
walkable = true,
pipelike = 1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end,
after_place_node = function(pos)
pipelike=1,
mesecons = {effector = {
action_on = function (pos, node)
- minetest.env:add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
+ minetest.add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
end,
action_off = function (pos, node)
- minetest.env:add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
+ minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
end
}}
})
walkable = true,
pipelike = 1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end,
after_place_node = function(pos)
pipelike=1,
mesecons = {effector = {
action_on = function (pos, node)
- minetest.env:add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
+ minetest.add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
end,
action_off = function (pos, node)
- minetest.env:add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
+ minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
end
}}
})
end,
pipelike=1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end,
})
walkable = true,
pipelike=1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end,
after_place_node = function(pos)
walkable = true,
pipelike=1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end,
after_place_node = function(pos)
end,
pipelike=1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end,
node_box = {
on_place = function(itemstack, placer, pointed_thing)
if not pipeworks_node_is_owned(pointed_thing.under, placer)
and not pipeworks_node_is_owned(pointed_thing.above, placer) then
- local node = minetest.env:get_node(pointed_thing.under)
+ local node = minetest.get_node(pointed_thing.under)
if not minetest.registered_nodes[node.name]
or not minetest.registered_nodes[node.name].on_rightclick then
local above = pointed_thing.above
local under = pointed_thing.under
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
- local undernode = minetest.env:get_node(under)
- local abovenode = minetest.env:get_node(above)
+ local undernode = minetest.get_node(under)
+ local abovenode = minetest.get_node(above)
local uname = undernode.name
local aname = abovenode.name
local isabove = (above.x == under.x) and (above.z == under.z) and (pitch > 0)
pos1 = under
end
- if not minetest.registered_nodes[minetest.env:get_node(pos1).name]["buildable_to"] then return end
+ if not minetest.registered_nodes[minetest.get_node(pos1).name]["buildable_to"] then return end
- minetest.env:add_node(pos1, {name = "pipeworks:entry_panel_empty", param2 = fdir })
+ minetest.add_node(pos1, {name = "pipeworks:entry_panel_empty", param2 = fdir })
pipe_scanforobjects(pos1)
if not pipeworks_expect_infinite_stacks then
end,
pipelike=1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end,
node_box = {
end,
pipelike=1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
if mesecon then
mesecon:receptor_off(pos, rules)
end,
pipelike=1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
if mesecon then
mesecon:receptor_on(pos, rules)
end,
pipelike=0,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",0)
end,
})
end,
pipelike=1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end,
})
minetest.register_on_punchnode(function (pos, node)
if node.name=="pipeworks:valve_on_empty" then
- fdir = minetest.env:get_node(pos).param2
- minetest.env:add_node(pos, { name = "pipeworks:valve_off_empty", param2 = fdir })
- local meta = minetest.env:get_meta(pos)
+ fdir = minetest.get_node(pos).param2
+ minetest.add_node(pos, { name = "pipeworks:valve_off_empty", param2 = fdir })
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",0)
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="pipeworks:valve_on_loaded" then
- fdir = minetest.env:get_node(pos).param2
- minetest.env:add_node(pos, { name = "pipeworks:valve_off_empty", param2 = fdir })
- local meta = minetest.env:get_meta(pos)
+ fdir = minetest.get_node(pos).param2
+ minetest.add_node(pos, { name = "pipeworks:valve_off_empty", param2 = fdir })
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",0)
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="pipeworks:valve_off_empty" then
- fdir = minetest.env:get_node(pos).param2
- minetest.env:add_node(pos, { name = "pipeworks:valve_on_empty", param2 = fdir })
- local meta = minetest.env:get_meta(pos)
+ fdir = minetest.get_node(pos).param2
+ minetest.add_node(pos, { name = "pipeworks:valve_on_empty", param2 = fdir })
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="pipeworks:pump_on" then
- fdir = minetest.env:get_node(pos).param2
- minetest.env:add_node(pos, { name = "pipeworks:pump_off", param2 = fdir })
+ fdir = minetest.get_node(pos).param2
+ minetest.add_node(pos, { name = "pipeworks:pump_off", param2 = fdir })
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="pipeworks:pump_off" then
- fdir = minetest.env:get_node(pos).param2
- minetest.env:add_node(pos, { name = "pipeworks:pump_on", param2 = fdir })
+ fdir = minetest.get_node(pos).param2
+ minetest.add_node(pos, { name = "pipeworks:pump_on", param2 = fdir })
end
end)
{x=pos.x,y=pos.y,z=pos.z-1},
{x=pos.x,y=pos.y,z=pos.z+1}, }
for i =1,6 do
- local name = minetest.env:get_node(coords[i]).name
+ local name = minetest.get_node(coords[i]).name
if string.find(name,'water') then
- minetest.env:remove_node(coords[i])
+ minetest.remove_node(coords[i])
return true
end
end
local source = false
for i =1,6 do
if newnode then break end
- local name = minetest.env:get_node(coords[i]).name
+ local name = minetest.get_node(coords[i]).name
if (name == 'pipeworks:pump_on' and check4liquids(coords[i])) or string.find(name,'_loaded') then
if string.find(name,'_loaded') then
- local source = minetest.env:get_meta(coords[i]):get_string('source')
+ local source = minetest.get_meta(coords[i]):get_string('source')
if source == minetest.pos_to_string(pos) then break end
end
newnode = string.gsub(node.name,'empty','loaded')
end
if newnode then
dbg(newnode..' to replace '..node.name)
- minetest.env:add_node(pos,{name=newnode, param2 = node.param2})
- minetest.env:get_meta(pos):set_string('source',minetest.pos_to_string(source))
+ minetest.add_node(pos,{name=newnode, param2 = node.param2})
+ minetest.get_meta(pos):set_string('source',minetest.pos_to_string(source))
end
end
local checksources = function(pos,node)
- local sourcepos = minetest.string_to_pos(minetest.env:get_meta(pos):get_string('source'))
+ local sourcepos = minetest.string_to_pos(minetest.get_meta(pos):get_string('source'))
if not sourcepos then return end
- local source = minetest.env:get_node(sourcepos).name
+ local source = minetest.get_node(sourcepos).name
local newnode = false
if not ((source == 'pipeworks:pump_on' and check4liquids(sourcepos)) or string.find(source,'_loaded') or source == 'ignore' ) then
newnode = string.gsub(node.name,'loaded','empty')
if newnode then dbg(newnode..' to replace '..node.name) end
if newnode then
- minetest.env:add_node(pos,{name=newnode, param2 = node.param2})
- minetest.env:get_meta(pos):set_string('source','')
+ minetest.add_node(pos,{name=newnode, param2 = node.param2})
+ minetest.get_meta(pos):set_string('source','')
end
end
local update_outlet = function(pos)
- local top = minetest.env:get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
+ local top = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
if string.find(top,'_loaded') then
- local name = minetest.env:get_node({x=pos.x,y=pos.y-1,z=pos.z}).name
+ local name = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name
if name == 'air' or name == "default:water_source" or name == "default:water_flowing" then
- minetest.env:add_node({x=pos.x,y=pos.y-1,z=pos.z},{name='default:water_source'})
+ minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z},{name='default:water_source'})
end
- elseif minetest.env:get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == 'default:water_source' then
- minetest.env:remove_node({x=pos.x,y=pos.y-1,z=pos.z})
+ elseif minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == 'default:water_source' then
+ minetest.remove_node({x=pos.x,y=pos.y-1,z=pos.z})
end
end
local fdir=node.param2
local check = {{x=pos.x,y=pos.y,z=pos.z+1},{x=pos.x+1,y=pos.y,z=pos.z},{x=pos.x,y=pos.y,z=pos.z-1},{x=pos.x-1,y=pos.y,z=pos.z} }
dbg(fdir..' checking '..minetest.pos_to_string(check[fdir+1])..' for spigot at '..minetest.pos_to_string(pos))
- local top = minetest.env:get_node(check[fdir+1]).name
+ local top = minetest.get_node(check[fdir+1]).name
dbg('found '..top)
- local name = minetest.env:get_node({x=pos.x,y=pos.y-1,z=pos.z}).name
+ local name = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name
if string.find(top,'_loaded') and (name == 'air' or name == "default:water_source" or name == "default:water_flowing") then
- minetest.env:add_node({x=pos.x,y=pos.y-1,z=pos.z},{name='default:water_source'})
- minetest.env:add_node(pos,{name='pipeworks:spigot_pouring', param2 = fdir})
+ minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z},{name='default:water_source'})
+ minetest.add_node(pos,{name='pipeworks:spigot_pouring', param2 = fdir})
else
- if minetest.env:get_node(pos).name == 'pipeworks:spigot_pouring' then
- minetest.env:add_node({x=pos.x,y=pos.y,z=pos.z},{name='pipeworks:spigot', param2 = fdir})
+ if minetest.get_node(pos).name == 'pipeworks:spigot_pouring' then
+ minetest.add_node({x=pos.x,y=pos.y,z=pos.z},{name='pipeworks:spigot', param2 = fdir})
if name == 'air' or name == "default:water_source" or name == "default:water_flowing" then
- minetest.env:remove_node({x=pos.x,y=pos.y-1,z=pos.z})
+ minetest.remove_node({x=pos.x,y=pos.y-1,z=pos.z})
end
end
end
drop = "pipeworks:pipe_110000_empty",
pipelike=1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end,
after_place_node = function(pos)
drop = "pipeworks:pipe_110000_empty",
pipelike=1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("pipelike",1)
end,
after_place_node = function(pos)
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"invsize[8,6.5;]"..
"list[current_name;main;0,0;8,2;]"..
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
- local meta = minetest.env:get_meta(pos);
+ local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
minetest.registered_nodes[node.name].on_punch(pos,node,nil)
end}},
on_punch = function (pos, node, puncher)
- local meta = minetest.env:get_meta(pos);
+ local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
local frompos
local dir
frompos={x=pos.x,y=pos.y,z=pos.z-1}
dir={x=0,y=0,z=1}
end
- local fromnode=minetest.env:get_node(frompos)
+ local fromnode=minetest.get_node(frompos)
local frominv
if not (minetest.registered_nodes[fromnode.name].tube and
minetest.registered_nodes[fromnode.name].tube.input_inventory) then
return
end
- local frommeta=minetest.env:get_meta(frompos)
+ local frommeta=minetest.get_meta(frompos)
local frominvname=minetest.registered_nodes[fromnode.name].tube.input_inventory
local frominv=frommeta:get_inventory()
for _,filter in ipairs(inv:get_list("main")) do
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"invsize[8,6.5;]"..
"list[current_name;main;0,0;8,2;]"..
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
- local meta = minetest.env:get_meta(pos);
+ local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
minetest.registered_nodes[node.name].on_punch(pos,node,nil)
end}},
on_punch = function (pos, node, puncher)
- local meta = minetest.env:get_meta(pos);
+ local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
local frompos
local dir
frompos={x=pos.x,y=pos.y,z=pos.z-1}
dir={x=0,y=0,z=1}
end
- local fromnode=minetest.env:get_node(frompos)
+ local fromnode=minetest.get_node(frompos)
local frominv
if not (minetest.registered_nodes[fromnode.name].tube and
minetest.registered_nodes[fromnode.name].tube.input_inventory) then
return
end
- local frommeta=minetest.env:get_meta(frompos)
+ local frommeta=minetest.get_meta(frompos)
local frominvname=minetest.registered_nodes[fromnode.name].tube.input_inventory
local frominv=frommeta:get_inventory()
for _,filter in ipairs(inv:get_list("main")) do
function tube_item(pos, item)
-- Take item in any format
local stack = ItemStack(item)
- local obj = minetest.env:add_entity(pos, "pipeworks:tubed_item")
+ local obj = minetest.add_entity(pos, "pipeworks:tubed_item")
obj:get_luaentity():set_item(stack:to_string())
return obj
end
self.start_pos=roundpos(pos)
end
local pos = self.object:getpos()
- local node = minetest.env:get_node(pos)
- local meta = minetest.env:get_meta(pos)
+ local node = minetest.get_node(pos)
+ local meta = minetest.get_meta(pos)
tubelike=meta:get_int("tubelike")
local stack = ItemStack(self.itemstring)
local drop_pos=nil
local sposcopy={x=self.start_pos.x,y=self.start_pos.y,z=self.start_pos.z}
- node = minetest.env:get_node(self.start_pos)
+ node = minetest.get_node(self.start_pos)
if moved and minetest.get_item_group(node.name,"tubedevice_receiver")==1 then
if minetest.registered_nodes[node.name].tube and minetest.registered_nodes[node.name].tube.insert_object then
leftover = minetest.registered_nodes[node.name].tube.insert_object(self.start_pos,node,stack,vel)
else
leftover = stack
end
- --drop_pos=minetest.env:find_node_near(self.start_pos,1,"air")
+ --drop_pos=minetest.find_node_near(self.start_pos,1,"air")
--if drop_pos and not leftover:is_empty() then minetest.item_drop(leftover,"",drop_pos) end
--self.object:remove()
if leftover:is_empty() then
if moved then
if go_next (self.start_pos, velocity, stack)==0 then
- drop_pos=minetest.env:find_node_near({x=self.start_pos.x+velocity.x,y=self.start_pos.y+velocity.y,z=self.start_pos.z+velocity.z}, 1, "air")
+ drop_pos=minetest.find_node_near({x=self.start_pos.x+velocity.x,y=self.start_pos.y+velocity.y,z=self.start_pos.z+velocity.z}, 1, "air")
if drop_pos then
minetest.item_drop(stack, "", drop_pos)
self.object:remove()
function go_next(pos,velocity,stack)
local chests={}
local tubes={}
- local cnode=minetest.env:get_node(pos)
- local cmeta=minetest.env:get_meta(pos)
+ local cnode=minetest.get_node(pos)
+ local cmeta=minetest.get_meta(pos)
local node
local meta
local tubelike
end
for _,vect in ipairs(can_go) do
npos=addVect(pos,vect)
- node=minetest.env:get_node(npos)
+ node=minetest.get_node(npos)
tube_receiver=minetest.get_item_group(node.name,"tubedevice_receiver")
- meta=minetest.env:get_meta(npos)
+ meta=minetest.get_meta(npos)
tubelike=meta:get_int("tubelike")
if tube_receiver==1 then
if minetest.registered_nodes[node.name].tube and
})
function hacky_swap_node(pos,name)
- local node=minetest.env:get_node(pos)
- local meta=minetest.env:get_meta(pos)
+ local node=minetest.get_node(pos)
+ local meta=minetest.get_meta(pos)
local meta0=meta:to_table()
node.name=name
- minetest.env:add_node(pos, node)
- local meta=minetest.env:get_meta(pos)
+ minetest.add_node(pos, node)
+ local meta=minetest.get_meta(pos)
meta:from_table(meta0)
end
z_velocity = 1
end
- local node = minetest.env:get_node(pos2)
+ local node = minetest.get_node(pos2)
if node.name == "air" or name == "ignore" then
return nil
elseif minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].liquidtype ~= "none" then
item1:setacceleration({x=0, y=0, z=0})
end
- minetest.env:remove_node(pos2)
+ minetest.remove_node(pos2)
--handle post-digging callback
if def.after_dig_node then
newtbl={}
changed=false
for _,val in ipairs(tbl) do
- local node = minetest.env:get_node(val)
- local meta = minetest.env:get_meta(val)
+ local node = minetest.get_node(val)
+ local meta = minetest.get_meta(val)
if node.name~="ignore" and (val.channel~=meta:get_string("channel") or val.cr~=meta:get_int("can_receive")) then
val.channel=meta:get_string("channel")
val.cr=meta:get_int("can_receive")
velocity.x=0
velocity.y=0
velocity.z=0
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
channel=meta:get_string("channel")
local target=get_tubes_in_file(pos,channel)
if target[1]==nil then return {} end
return meseadjlist
end},
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_string("channel","")
meta:set_int("can_receive",1)
meta:set_string("formspec","size[9,1;]"..
add_tube_in_file(pos,"")
end,
on_receive_fields = function(pos,formname,fields,sender)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
if fields.channel==nil then fields.channel=meta:get_string("channel") end
meta:set_string("channel",fields.channel)
remove_tube_in_file(pos)
drop = name.."_000000",
tubelike=1,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("tubelike",1)
if minetest.registered_nodes[name.."_"..tname].on_construct_ then
minetest.registered_nodes[name.."_"..tname].on_construct_(pos)
mese_end_textures,mese_short_texture,mese_inv_texture,
{tube={can_go=function(pos,node,velocity,stack)
tbl={}
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
local found=false
local name=stack:get_name()
return tbl
end},
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
for i=1,6 do
meta:set_int("l"..tostring(i).."s",1)
meta:set_string("infotext", "Mese pneumatic tube")
end,
on_receive_fields=function(pos,formname,fields,sender)
- local meta=minetest.env:get_meta(pos)
+ local meta=minetest.get_meta(pos)
local i
for key,_ in pairs(fields) do i=key end
if i==nil then return end
meta:set_string("formspec",frm)
end,
can_dig = function(pos,player)
- local meta = minetest.env:get_meta(pos);
+ local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return (inv:is_empty("line1") and inv:is_empty("line2") and inv:is_empty("line3") and
inv:is_empty("line4") and inv:is_empty("line5") and inv:is_empty("line6"))
register_tube("pipeworks:detector_tube_on","Detector tube segment on (you hacker you)",detector_plain_textures,noctr_textures,
end_textures,short_texture,detector_inv_texture,
{tube={can_go=function(pos,node,velocity,stack)
- local meta = minetest.env:get_meta(pos)
- local name = minetest.env:get_node(pos).name
+ local meta = minetest.get_meta(pos)
+ local name = minetest.get_node(pos).name
local nitems=meta:get_int("nitems")+1
meta:set_int("nitems", nitems)
minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos)
mesecons={receptor={state="on",
rules=mesecons_rules}},
item_exit = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
local nitems=meta:get_int("nitems")-1
- local name = minetest.env:get_node(pos).name
+ local name = minetest.get_node(pos).name
if nitems==0 then
- minetest.env:set_node(pos,{name=string.gsub(name,"on","off")})
+ minetest.set_node(pos,{name=string.gsub(name,"on","off")})
mesecon:receptor_off(pos,mesecons_rules)
else
meta:set_int("nitems", nitems)
end
end,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_int("nitems", 1)
- local name = minetest.env:get_node(pos).name
+ local name = minetest.get_node(pos).name
minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos)
end})
register_tube("pipeworks:detector_tube_off","Detector tube segment",detector_plain_textures,noctr_textures,
end_textures,short_texture,detector_inv_texture,
{tube={can_go=function(pos,node,velocity,stack)
- local name = minetest.env:get_node(pos).name
- minetest.env:set_node(pos,{name=string.gsub(name,"off","on")})
+ local name = minetest.get_node(pos).name
+ minetest.set_node(pos,{name=string.gsub(name,"off","on")})
mesecon:receptor_on(pos,mesecons_rules)
return notvel(meseadjlist,velocity)
end},
minetest.register_abm({nodenames={"group:sand_tube"},interval=1,chance=1,
action=function(pos, node, active_object_count, active_object_count_wider)
- for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do
+ for _,object in ipairs(minetest.get_objects_inside_radius(pos, 2)) 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)