forked from mtcontrib/pipeworks
minetest.env:* --> minetest.*
This commit is contained in:
parent
28cef5e82f
commit
614f6f4da1
@ -116,12 +116,12 @@ minetest.override_item("default:chest_locked", {
|
|||||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1, tubedevice_receiver = 1},
|
groups = {choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||||
tube = {
|
tube = {
|
||||||
insert_object = function(pos, node, stack, direction)
|
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()
|
local inv = meta:get_inventory()
|
||||||
return inv:add_item("main", stack)
|
return inv:add_item("main", stack)
|
||||||
end,
|
end,
|
||||||
can_insert = function(pos, node, stack, direction)
|
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()
|
local inv = meta:get_inventory()
|
||||||
return inv:room_for_item("main", stack)
|
return inv:room_for_item("main", stack)
|
||||||
end,
|
end,
|
||||||
|
@ -520,7 +520,7 @@ if pipeworks.enable_mese_sand_tube then
|
|||||||
mese_sand_end_textures, mese_sand_short_texture,mese_sand_inv_texture,
|
mese_sand_end_textures, mese_sand_short_texture,mese_sand_inv_texture,
|
||||||
{groups = {mese_sand_tube = 1},
|
{groups = {mese_sand_tube = 1},
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_int("dist", 0)
|
meta:set_int("dist", 0)
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec",
|
||||||
"size[2,1]"..
|
"size[2,1]"..
|
||||||
@ -528,7 +528,7 @@ if pipeworks.enable_mese_sand_tube then
|
|||||||
meta:set_string("infotext", "Adjustable Vacuuming Pneumatic Tube Segment")
|
meta:set_string("infotext", "Adjustable Vacuuming Pneumatic Tube Segment")
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos,formname,fields,sender)
|
on_receive_fields = function(pos,formname,fields,sender)
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local dist
|
local dist
|
||||||
_, dist = pcall(tonumber, fields.dist)
|
_, dist = pcall(tonumber, fields.dist)
|
||||||
if dist and 0 <= dist and dist <= 8 then meta:set_int("dist", dist) end
|
if dist and 0 <= dist and dist <= 8 then meta:set_int("dist", dist) end
|
||||||
@ -538,7 +538,7 @@ if pipeworks.enable_mese_sand_tube then
|
|||||||
local function get_objects_with_square_radius(pos, rad)
|
local function get_objects_with_square_radius(pos, rad)
|
||||||
rad = rad + .5;
|
rad = rad + .5;
|
||||||
local objs = {}
|
local objs = {}
|
||||||
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, math.sqrt(3)*rad)) do
|
for _,object in ipairs(minetest.get_objects_inside_radius(pos, math.sqrt(3)*rad)) do
|
||||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||||
local opos = object:getpos()
|
local opos = object:getpos()
|
||||||
if pos.x - rad <= opos.x and opos.x <= pos.x + rad and pos.y - rad <= opos.y and opos.y <= pos.y + rad and pos.z - rad <= opos.z and opos.z <= pos.z + rad then
|
if pos.x - rad <= opos.x and opos.x <= pos.x + rad and pos.y - rad <= opos.y and opos.y <= pos.y + rad and pos.z - rad <= opos.z and opos.z <= pos.z + rad then
|
||||||
@ -553,7 +553,7 @@ if pipeworks.enable_mese_sand_tube then
|
|||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
for _,object in ipairs(get_objects_with_square_radius(pos, minetest.env:get_meta(pos):get_int("dist"))) do
|
for _,object in ipairs(get_objects_with_square_radius(pos, minetest.get_meta(pos):get_int("dist"))) do
|
||||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||||
if object:get_luaentity().itemstring ~= "" then
|
if object:get_luaentity().itemstring ~= "" then
|
||||||
pipeworks.tube_inject_item(pos, pos, vector.new(0, 0, 0), object:get_luaentity().itemstring)
|
pipeworks.tube_inject_item(pos, pos, vector.new(0, 0, 0), object:get_luaentity().itemstring)
|
||||||
|
Loading…
Reference in New Issue
Block a user