forked from mtcontrib/homedecor_modpack
Phased out all deprecated minetest.env:* uses in favor of minetest.*
This commit is contained in:
parent
aedbcf5fde
commit
2efa203185
@ -85,8 +85,8 @@ for i in ipairs(sides) do
|
||||
},
|
||||
drop = "homedecor:door_"..doorname.."_bottom_"..side,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
if minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "homedecor:door_"..doorname.."_bottom_"..side then
|
||||
minetest.env:remove_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "homedecor:door_"..doorname.."_bottom_"..side then
|
||||
minetest.remove_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
end
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
@ -111,8 +111,8 @@ for i in ipairs(sides) do
|
||||
fixed = nodeboxes_bottomtom
|
||||
},
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_"..doorname.."_top_"..side then
|
||||
minetest.env:remove_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_"..doorname.."_top_"..side then
|
||||
minetest.remove_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
end
|
||||
end,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
@ -257,7 +257,7 @@ end
|
||||
function homedecor_place_door(itemstack, placer, pointed_thing, name, side)
|
||||
|
||||
local pointed = pointed_thing.under
|
||||
local pnode = minetest.env:get_node(pointed)
|
||||
local pnode = minetest.get_node(pointed)
|
||||
local pname = pnode.name
|
||||
|
||||
if not minetest.registered_nodes[pname]
|
||||
@ -274,8 +274,8 @@ function homedecor_place_door(itemstack, placer, pointed_thing, name, side)
|
||||
pos2 = {x=pointed_thing.above.x, y=pointed_thing.above.y+1, z=pointed_thing.above.z}
|
||||
end
|
||||
|
||||
local node_bottom = minetest.env:get_node(pos1)
|
||||
local node_top = minetest.env:get_node(pos2)
|
||||
local node_bottom = minetest.get_node(pos1)
|
||||
local node_top = minetest.get_node(pos2)
|
||||
|
||||
if not homedecor_node_is_owned(pos1, placer)
|
||||
and not homedecor_node_is_owned(pos2, placer) then
|
||||
@ -285,8 +285,8 @@ function homedecor_place_door(itemstack, placer, pointed_thing, name, side)
|
||||
minetest.chat_send_player( placer:get_player_name(), S('Not enough space above that spot to place a door!') )
|
||||
else
|
||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
minetest.env:add_node(pos1, { name = "homedecor:door_"..name.."_bottom_"..side, param2=fdir})
|
||||
minetest.env:add_node(pos2, { name = "homedecor:door_"..name.."_top_"..side, param2=fdir})
|
||||
minetest.add_node(pos1, { name = "homedecor:door_"..name.."_bottom_"..side, param2=fdir})
|
||||
minetest.add_node(pos2, { name = "homedecor:door_"..name.."_top_"..side, param2=fdir})
|
||||
if not homedecor_expect_infinite_stacks then
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
@ -320,8 +320,8 @@ function homedecor_flip_door(pos, node, player, name, side)
|
||||
gain = 2,
|
||||
})
|
||||
end
|
||||
minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_"..name.."_top_"..rside, param2=nfdir})
|
||||
minetest.env:add_node(pos, { name = "homedecor:door_"..name.."_bottom_"..rside, param2=nfdir})
|
||||
minetest.add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_"..name.."_top_"..rside, param2=nfdir})
|
||||
minetest.add_node(pos, { name = "homedecor:door_"..name.."_bottom_"..rside, param2=nfdir})
|
||||
end
|
||||
|
||||
function homedecor_flip_gate(pos, node, player, gate, oc)
|
||||
@ -339,16 +339,16 @@ function homedecor_flip_gate(pos, node, player, gate, oc)
|
||||
gateresult = "homedecor:gate_"..gate.."_closed"
|
||||
end
|
||||
|
||||
minetest.env:add_node(pos, { name = gateresult, param2=fdir})
|
||||
nodeabove = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
nodebelow = minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
minetest.add_node(pos, { name = gateresult, param2=fdir})
|
||||
nodeabove = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
nodebelow = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
|
||||
if string.find(nodeabove.name, "homedecor:gate_"..gate) then
|
||||
minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name=gateresult, param2=fdir} )
|
||||
minetest.add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name=gateresult, param2=fdir} )
|
||||
end
|
||||
|
||||
if string.find(nodebelow.name, "homedecor:gate_"..gate) then
|
||||
minetest.env:add_node({x=pos.x, y=pos.y-1, z=pos.z}, {name=gateresult, param2=fdir} )
|
||||
minetest.add_node({x=pos.x, y=pos.y-1, z=pos.z}, {name=gateresult, param2=fdir} )
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -160,7 +160,7 @@ local function reg_lamp(suffix, nxt, desc, tilesuffix, light)
|
||||
drop = "homedecor:table_lamp_off",
|
||||
on_punch = function(pos, node, puncher)
|
||||
node.name = "homedecor:table_lamp_"..repl[suffix]
|
||||
minetest.env:set_node(pos, node)
|
||||
minetest.set_node(pos, node)
|
||||
nodeupdate(pos)
|
||||
end,
|
||||
})
|
||||
|
@ -26,7 +26,7 @@ minetest.register_node("homedecor:toilet", {
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_punch = function (pos, node, puncher)
|
||||
node.name = "homedecor:toilet_open"
|
||||
minetest.env:set_node(pos, node)
|
||||
minetest.set_node(pos, node)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -62,7 +62,7 @@ minetest.register_node("homedecor:toilet_open", {
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_punch = function (pos, node, puncher)
|
||||
node.name = "homedecor:toilet"
|
||||
minetest.env:set_node(pos, node)
|
||||
minetest.set_node(pos, node)
|
||||
minetest.sound_play({name="homedecor_toilet_flush", pos=pos,})
|
||||
end,
|
||||
})
|
||||
|
@ -24,7 +24,7 @@ minetest.register_node('homedecor:kitchen_cabinet', {
|
||||
groups = { snappy = 3 },
|
||||
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",
|
||||
"size[8,8]"..
|
||||
"list[current_name;main;0,0;8,3;]"..
|
||||
@ -34,7 +34,7 @@ minetest.register_node('homedecor:kitchen_cabinet', {
|
||||
inv:set_size("main", 24)
|
||||
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,
|
||||
@ -82,7 +82,7 @@ minetest.register_node('homedecor:kitchen_cabinet_half', {
|
||||
groups = { snappy = 3 },
|
||||
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",
|
||||
"size[8,7]"..
|
||||
"list[current_name;main;1,0;6,2;]"..
|
||||
@ -92,7 +92,7 @@ minetest.register_node('homedecor:kitchen_cabinet_half', {
|
||||
inv:set_size("main", 12)
|
||||
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,
|
||||
@ -132,7 +132,7 @@ minetest.register_node('homedecor:kitchen_cabinet_with_sink', {
|
||||
groups = { snappy = 3 },
|
||||
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",
|
||||
"size[8,7]"..
|
||||
"list[current_name;main;0,0;8,2;]"..
|
||||
@ -142,7 +142,7 @@ minetest.register_node('homedecor:kitchen_cabinet_with_sink', {
|
||||
inv:set_size("main", 16)
|
||||
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,
|
||||
|
24
lighting.lua
24
lighting.lua
@ -16,14 +16,14 @@ local dirs2 = { 9, 18, 7, 12 }
|
||||
function homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
if not homedecor_node_is_owned(pointed_thing.under, placer)
|
||||
and not homedecor_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 pitch = placer:get_look_pitch()
|
||||
local pname = minetest.env:get_node(under).name
|
||||
local node = minetest.env:get_node(above)
|
||||
local pname = minetest.get_node(under).name
|
||||
local node = minetest.get_node(above)
|
||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
local wield_name = itemstack:get_name()
|
||||
|
||||
@ -39,14 +39,14 @@ function homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
iswall = false
|
||||
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
|
||||
|
||||
if iswall then
|
||||
minetest.env:add_node(pos1, {name = wield_name, param2 = dirs2[fdir+1] }) -- place wall variant
|
||||
minetest.add_node(pos1, {name = wield_name, param2 = dirs2[fdir+1] }) -- place wall variant
|
||||
elseif isceiling then
|
||||
minetest.env:add_node(pos1, {name = wield_name, param2 = 20 }) -- place upside down variant
|
||||
minetest.add_node(pos1, {name = wield_name, param2 = 20 }) -- place upside down variant
|
||||
else
|
||||
minetest.env:add_node(pos1, {name = wield_name, param2 = 0 }) -- place right side up
|
||||
minetest.add_node(pos1, {name = wield_name, param2 = 0 }) -- place right side up
|
||||
end
|
||||
|
||||
if not homedecor_expect_infinite_stacks then
|
||||
@ -70,7 +70,7 @@ for i in ipairs(colors) do
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:add_node(pos, {name = "homedecor:glowlight_quarter_"..color, param2 = 20})
|
||||
minetest.add_node(pos, {name = "homedecor:glowlight_quarter_"..color, param2 = 20})
|
||||
end,
|
||||
})
|
||||
|
||||
@ -79,7 +79,7 @@ for i in ipairs(colors) do
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:add_node(pos, {name = "homedecor:glowlight_half_"..color, param2 = 20})
|
||||
minetest.add_node(pos, {name = "homedecor:glowlight_half_"..color, param2 = 20})
|
||||
end,
|
||||
})
|
||||
|
||||
@ -90,7 +90,7 @@ for i in ipairs(colors) do
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local fdir = node.param2 or 0
|
||||
nfdir = dirs2[fdir+1]
|
||||
minetest.env:add_node(pos, {name = "homedecor:glowlight_quarter_"..color, param2 = nfdir})
|
||||
minetest.add_node(pos, {name = "homedecor:glowlight_quarter_"..color, param2 = nfdir})
|
||||
end,
|
||||
})
|
||||
|
||||
@ -101,7 +101,7 @@ for i in ipairs(colors) do
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local fdir = node.param2 or 0
|
||||
nfdir = dirs2[fdir+1]
|
||||
minetest.env:add_node(pos, {name = "homedecor:glowlight_half_"..color, param2 = nfdir})
|
||||
minetest.add_node(pos, {name = "homedecor:glowlight_half_"..color, param2 = nfdir})
|
||||
end,
|
||||
})
|
||||
|
||||
@ -110,7 +110,7 @@ for i in ipairs(colors) do
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:add_node(pos, {name = "homedecor:glowlight_small_cube_"..color, param2 = 20})
|
||||
minetest.add_node(pos, {name = "homedecor:glowlight_small_cube_"..color, param2 = 20})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
@ -53,7 +53,7 @@ local function create_locked ( name, infotext )
|
||||
def.description = S("%s (Locked)"):format(def.description)
|
||||
local after_place_node = def.after_place_node
|
||||
def.after_place_node = function(pos, placer)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
meta:set_string("infotext", S("%s (owned by %s)"):format(infotext,meta:get_string("owner")))
|
||||
if (after_place_node) then
|
||||
@ -62,7 +62,7 @@ local function create_locked ( name, infotext )
|
||||
end
|
||||
local allow_metadata_inventory_move = def.allow_metadata_inventory_move;
|
||||
def.allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if (player:get_player_name() ~= meta:get_string("owner")) then
|
||||
minetest.log("action", S("%s tried to access a %s belonging to %s at %s"):format(
|
||||
player:get_player_name(),
|
||||
@ -80,7 +80,7 @@ local function create_locked ( name, infotext )
|
||||
end
|
||||
local allow_metadata_inventory_put = def.allow_metadata_inventory_put;
|
||||
def.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if (player:get_player_name() ~= meta:get_string("owner")) then
|
||||
minetest.log("action", S("%s tried to access a %s belonging to %s at %s"):format(
|
||||
player:get_player_name(),
|
||||
@ -98,7 +98,7 @@ local function create_locked ( name, infotext )
|
||||
end
|
||||
local allow_metadata_inventory_take = def.allow_metadata_inventory_take;
|
||||
def.allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if (player:get_player_name() ~= meta:get_string("owner")) then
|
||||
minetest.log("action", S("%s tried to access a %s belonging to %s at %s"):format(
|
||||
player:get_player_name(),
|
||||
|
@ -38,7 +38,7 @@ minetest.register_node("homedecor:microwave_oven", {
|
||||
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", mw_oven_inactive_formspec)
|
||||
meta:set_string("infotext", S("Microwave Oven"))
|
||||
local inv = meta:get_inventory()
|
||||
@ -47,7 +47,7 @@ minetest.register_node("homedecor:microwave_oven", {
|
||||
inv:set_size("dst", 2)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("fuel") then
|
||||
return false
|
||||
@ -59,7 +59,7 @@ minetest.register_node("homedecor:microwave_oven", {
|
||||
return true
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if listname == "fuel" then
|
||||
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
|
||||
@ -77,7 +77,7 @@ minetest.register_node("homedecor:microwave_oven", {
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
if to_list == "fuel" then
|
||||
@ -120,7 +120,7 @@ minetest.register_node("homedecor:microwave_oven_active", {
|
||||
legacy_facedir_simple = true,
|
||||
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", mw_oven_inactive_formspec)
|
||||
meta:set_string("infotext", S("Microwave Oven"))
|
||||
local inv = meta:get_inventory()
|
||||
@ -129,7 +129,7 @@ minetest.register_node("homedecor:microwave_oven_active", {
|
||||
inv:set_size("dst", 2)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("fuel") then
|
||||
return false
|
||||
@ -141,7 +141,7 @@ minetest.register_node("homedecor:microwave_oven_active", {
|
||||
return true
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if listname == "fuel" then
|
||||
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
|
||||
@ -159,7 +159,7 @@ minetest.register_node("homedecor:microwave_oven_active", {
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
if to_list == "fuel" then
|
||||
@ -180,16 +180,16 @@ minetest.register_node("homedecor:microwave_oven_active", {
|
||||
})
|
||||
|
||||
local 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()
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
node.name = name
|
||||
local meta0 = meta:to_table()
|
||||
minetest.env:set_node(pos,node)
|
||||
meta = minetest.env:get_meta(pos)
|
||||
minetest.set_node(pos,node)
|
||||
meta = minetest.get_meta(pos)
|
||||
meta:from_table(meta0)
|
||||
end
|
||||
|
||||
@ -198,7 +198,7 @@ minetest.register_abm({
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
for i, name in ipairs({
|
||||
"fuel_totaltime",
|
||||
"fuel_time",
|
||||
|
@ -41,7 +41,7 @@ minetest.register_node('homedecor:nightstand_oak_one_drawer', {
|
||||
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",
|
||||
"size[8,6]"..
|
||||
"list[current_name;main;0,0;8,1;]"..
|
||||
@ -51,7 +51,7 @@ minetest.register_node('homedecor:nightstand_oak_one_drawer', {
|
||||
inv:set_size("main", 8)
|
||||
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,
|
||||
@ -104,7 +104,7 @@ minetest.register_node('homedecor:nightstand_oak_two_drawers', {
|
||||
groups = { snappy = 3 },
|
||||
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",
|
||||
"size[8,7]"..
|
||||
"list[current_name;main;0,0;8,2;]"..
|
||||
@ -114,7 +114,7 @@ minetest.register_node('homedecor:nightstand_oak_two_drawers', {
|
||||
inv:set_size("main", 16)
|
||||
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,
|
||||
@ -170,7 +170,7 @@ minetest.register_node('homedecor:nightstand_mahogany_one_drawer', {
|
||||
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",
|
||||
"size[8,6]"..
|
||||
"list[current_name;main;0,0;8,1;]"..
|
||||
@ -180,7 +180,7 @@ minetest.register_node('homedecor:nightstand_mahogany_one_drawer', {
|
||||
inv:set_size("main", 8)
|
||||
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,
|
||||
@ -233,7 +233,7 @@ minetest.register_node('homedecor:nightstand_mahogany_two_drawers', {
|
||||
groups = { snappy = 3 },
|
||||
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",
|
||||
"size[8,7]"..
|
||||
"list[current_name;main;0,0;8,2;]"..
|
||||
@ -243,7 +243,7 @@ minetest.register_node('homedecor:nightstand_mahogany_two_drawers', {
|
||||
inv:set_size("main", 16)
|
||||
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,
|
||||
|
26
oven.lua
26
oven.lua
@ -26,7 +26,7 @@ minetest.register_node("homedecor:oven", {
|
||||
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", oven_inactive_formspec)
|
||||
meta:set_string("infotext", S("Oven"))
|
||||
local inv = meta:get_inventory()
|
||||
@ -35,7 +35,7 @@ minetest.register_node("homedecor:oven", {
|
||||
inv:set_size("dst", 2)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("fuel") then
|
||||
return false
|
||||
@ -47,7 +47,7 @@ minetest.register_node("homedecor:oven", {
|
||||
return true
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if listname == "fuel" then
|
||||
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
|
||||
@ -65,7 +65,7 @@ minetest.register_node("homedecor:oven", {
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
if to_list == "fuel" then
|
||||
@ -96,7 +96,7 @@ minetest.register_node("homedecor:oven_active", {
|
||||
legacy_facedir_simple = true,
|
||||
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", mw_oven_inactive_formspec)
|
||||
meta:set_string("infotext", S("Oven"))
|
||||
local inv = meta:get_inventory()
|
||||
@ -105,7 +105,7 @@ minetest.register_node("homedecor:oven_active", {
|
||||
inv:set_size("dst", 2)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("fuel") then
|
||||
return false
|
||||
@ -117,7 +117,7 @@ minetest.register_node("homedecor:oven_active", {
|
||||
return true
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if listname == "fuel" then
|
||||
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
|
||||
@ -135,7 +135,7 @@ minetest.register_node("homedecor:oven_active", {
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
if to_list == "fuel" then
|
||||
@ -156,16 +156,16 @@ minetest.register_node("homedecor:oven_active", {
|
||||
})
|
||||
|
||||
local 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()
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
node.name = name
|
||||
local meta0 = meta:to_table()
|
||||
minetest.env:set_node(pos,node)
|
||||
meta = minetest.env:get_meta(pos)
|
||||
minetest.set_node(pos,node)
|
||||
meta = minetest.get_meta(pos)
|
||||
meta:from_table(meta0)
|
||||
end
|
||||
|
||||
@ -174,7 +174,7 @@ minetest.register_abm({
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
for i, name in ipairs({
|
||||
"fuel_totaltime",
|
||||
"fuel_time",
|
||||
|
@ -38,7 +38,7 @@ minetest.register_node('homedecor:refrigerator', {
|
||||
|
||||
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",
|
||||
"size[10,10]"..
|
||||
"list[current_name;main;0,0;10,5;]"..
|
||||
@ -50,7 +50,7 @@ minetest.register_node('homedecor:refrigerator', {
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos = pointed_thing.above
|
||||
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
|
||||
minetest.chat_send_player( placer:get_player_name(), S('Not enough vertical space to place a refrigerator!') )
|
||||
return
|
||||
end
|
||||
@ -58,7 +58,7 @@ minetest.register_node('homedecor:refrigerator', {
|
||||
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,
|
||||
|
@ -53,13 +53,13 @@ local sign_groups = {choppy=2, dig_immediate=2}
|
||||
local fences_with_sign = { }
|
||||
|
||||
homedecor_construct_sign = function(pos)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", "field[text;;${text}]")
|
||||
meta:set_string("infotext", "")
|
||||
end
|
||||
|
||||
homedecor_destruct_sign = function(pos)
|
||||
local objects = minetest.env:get_objects_inside_radius(pos, 0.5)
|
||||
local objects = minetest.get_objects_inside_radius(pos, 0.5)
|
||||
for _, v in ipairs(objects) do
|
||||
if v:get_entity_name() == "signs:text" then
|
||||
v:remove()
|
||||
@ -68,13 +68,13 @@ homedecor_destruct_sign = function(pos)
|
||||
end
|
||||
|
||||
homedecor_update_sign = function(pos, fields)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if fields then
|
||||
meta:set_string("infotext", table.concat(homedecor_create_lines(fields.text), "\n"))
|
||||
meta:set_string("text", fields.text)
|
||||
end
|
||||
local text = meta:get_string("text")
|
||||
local objects = minetest.env:get_objects_inside_radius(pos, 0.5)
|
||||
local objects = minetest.get_objects_inside_radius(pos, 0.5)
|
||||
for _, v in ipairs(objects) do
|
||||
if v:get_entity_name() == "signs:text" then
|
||||
v:set_properties({textures={homedecor_generate_texture(homedecor_create_lines(text))}})
|
||||
@ -84,17 +84,17 @@ homedecor_update_sign = function(pos, fields)
|
||||
|
||||
-- if there is no entity
|
||||
local sign_info
|
||||
if minetest.env:get_node(pos).name == "signs:sign_yard" then
|
||||
sign_info = signs_yard[minetest.env:get_node(pos).param2 + 1]
|
||||
elseif minetest.env:get_node(pos).name == "default:sign_wall" then
|
||||
sign_info = signs[minetest.env:get_node(pos).param2 + 1]
|
||||
else --if minetest.env:get_node(pos).name == "signs:sign_post" then
|
||||
sign_info = signs_post[minetest.env:get_node(pos).param2 + 1]
|
||||
if minetest.get_node(pos).name == "signs:sign_yard" then
|
||||
sign_info = signs_yard[minetest.get_node(pos).param2 + 1]
|
||||
elseif minetest.get_node(pos).name == "default:sign_wall" then
|
||||
sign_info = signs[minetest.get_node(pos).param2 + 1]
|
||||
else --if minetest.get_node(pos).name == "signs:sign_post" then
|
||||
sign_info = signs_post[minetest.get_node(pos).param2 + 1]
|
||||
end
|
||||
if sign_info == nil then
|
||||
return
|
||||
end
|
||||
local text = minetest.env:add_entity({x = pos.x + sign_info.delta.x,
|
||||
local text = minetest.add_entity({x = pos.x + sign_info.delta.x,
|
||||
y = pos.y + sign_info.delta.y,
|
||||
z = pos.z + sign_info.delta.z}, "signs:text")
|
||||
text:setyaw(sign_info.yaw)
|
||||
@ -116,13 +116,13 @@ minetest.register_node(":default:sign_wall", {
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local name
|
||||
name = minetest.env:get_node(pointed_thing.under).name
|
||||
name = minetest.get_node(pointed_thing.under).name
|
||||
if fences_with_sign[name] then
|
||||
if homedecor_node_is_owned(pointed_thing.under, placer) then
|
||||
return itemstack
|
||||
end
|
||||
else
|
||||
name = minetest.env:get_node(pointed_thing.above).name
|
||||
name = minetest.get_node(pointed_thing.above).name
|
||||
local def = minetest.registered_nodes[name]
|
||||
if homedecor_node_is_owned(pointed_thing.above, placer)
|
||||
or (not def.buildable_to) then
|
||||
@ -130,7 +130,7 @@ minetest.register_node(":default:sign_wall", {
|
||||
end
|
||||
end
|
||||
|
||||
local node=minetest.env:get_node(pointed_thing.under)
|
||||
local node=minetest.get_node(pointed_thing.under)
|
||||
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
|
||||
@ -155,27 +155,27 @@ minetest.register_node(":default:sign_wall", {
|
||||
local fdir = minetest.dir_to_facedir(dir)
|
||||
|
||||
local sign_info
|
||||
local pt_name = minetest.env:get_node(under).name
|
||||
local pt_name = minetest.get_node(under).name
|
||||
print(dump(pt_name))
|
||||
|
||||
if fences_with_sign[pt_name] then
|
||||
minetest.env:add_node(under, {name = fences_with_sign[pt_name], param2 = fdir})
|
||||
minetest.add_node(under, {name = fences_with_sign[pt_name], param2 = fdir})
|
||||
sign_info = signs_post[fdir + 1]
|
||||
|
||||
elseif wdir == 0 then
|
||||
--how would you add sign to ceiling?
|
||||
minetest.env:add_item(above, "default:sign_wall")
|
||||
minetest.add_item(above, "default:sign_wall")
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
elseif wdir == 1 then
|
||||
minetest.env:add_node(above, {name = "signs:sign_yard", param2 = fdir})
|
||||
minetest.add_node(above, {name = "signs:sign_yard", param2 = fdir})
|
||||
sign_info = signs_yard[fdir + 1]
|
||||
else
|
||||
minetest.env:add_node(above, {name = "default:sign_wall", param2 = fdir})
|
||||
minetest.add_node(above, {name = "default:sign_wall", param2 = fdir})
|
||||
sign_info = signs[fdir + 1]
|
||||
end
|
||||
|
||||
local text = minetest.env:add_entity({x = above.x + sign_info.delta.x,
|
||||
local text = minetest.add_entity({x = above.x + sign_info.delta.x,
|
||||
y = above.y + sign_info.delta.y,
|
||||
z = above.z + sign_info.delta.z}, "signs:text")
|
||||
text:setyaw(sign_info.yaw)
|
||||
@ -288,7 +288,7 @@ minetest.register_entity(":signs:text", {
|
||||
textures = {},
|
||||
|
||||
on_activate = function(self)
|
||||
local meta = minetest.env:get_meta(self.object:getpos())
|
||||
local meta = minetest.get_meta(self.object:getpos())
|
||||
local text = meta:get_string("text")
|
||||
self.object:set_properties({textures={homedecor_generate_texture(homedecor_create_lines(text))}})
|
||||
end
|
||||
@ -422,8 +422,8 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
|
||||
fences_with_sign[fencename] = fencewithsignname
|
||||
|
||||
def.on_place = function(itemstack, placer, pointed_thing, ...)
|
||||
local node_above = minetest.env:get_node(pointed_thing.above)
|
||||
local node_under = minetest.env:get_node(pointed_thing.under)
|
||||
local node_above = minetest.get_node(pointed_thing.above)
|
||||
local node_under = minetest.get_node(pointed_thing.under)
|
||||
local def_above = minetest.registered_nodes[node_above.name]
|
||||
local def_under = minetest.registered_nodes[node_under.name]
|
||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
@ -431,7 +431,7 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
|
||||
return def_under.on_rightclick(pointed_thing.under, node_under, placer, itemstack) or itemstack
|
||||
elseif (not homedecor_node_is_owned(pointed_thing.under, placer))
|
||||
and def_under.buildable_to then
|
||||
minetest.env:add_node(pointed_thing.under, {name = fencename, param2 = fdir})
|
||||
minetest.add_node(pointed_thing.under, {name = fencename, param2 = fdir})
|
||||
if not homedecor_expect_infinite_stacks then
|
||||
itemstack:take_item()
|
||||
end
|
||||
@ -439,7 +439,7 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
|
||||
return itemstack
|
||||
elseif (not homedecor_node_is_owned(pointed_thing.above, placer))
|
||||
and def_above.buildable_to then
|
||||
minetest.env:add_node(pointed_thing.above, {name = fencename, param2 = fdir})
|
||||
minetest.add_node(pointed_thing.above, {name = fencename, param2 = fdir})
|
||||
if not homedecor_expect_infinite_stacks then
|
||||
itemstack:take_item()
|
||||
end
|
||||
@ -470,7 +470,7 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
|
||||
local fencename = fencename
|
||||
def_sign.after_dig_node = function(pos, node, ...)
|
||||
node.name = fencename
|
||||
minetest.env:add_node(pos, node)
|
||||
minetest.add_node(pos, node)
|
||||
end
|
||||
def_sign.drop = "default:sign_wall"
|
||||
minetest.register_node(":"..fencename, def)
|
||||
|
30
tables.lua
30
tables.lua
@ -61,23 +61,23 @@ for i in ipairs(materials) do
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
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 pitch = placer:get_look_pitch()
|
||||
local node = minetest.env:get_node(above)
|
||||
local node = minetest.get_node(above)
|
||||
|
||||
if node.name ~= "air" then return end
|
||||
|
||||
if above.x ~= under.x or above.z ~= under.z then
|
||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_small_square_s', param2 = fdir})
|
||||
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_square_s', param2 = fdir})
|
||||
elseif pitch > 0 then
|
||||
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_small_square_t'})
|
||||
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_square_t'})
|
||||
else
|
||||
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_small_square_b'})
|
||||
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_square_b'})
|
||||
end
|
||||
if not homedecor_expect_infinite_stacks then
|
||||
itemstack:take_item()
|
||||
@ -189,23 +189,23 @@ for i in ipairs(materials) do
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
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 pitch = placer:get_look_pitch()
|
||||
local node = minetest.env:get_node(above)
|
||||
local node = minetest.get_node(above)
|
||||
|
||||
if node.name ~= "air" then return end
|
||||
|
||||
if above.x ~= under.x or above.z ~= under.z then
|
||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_small_round_s', param2 = fdir})
|
||||
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_round_s', param2 = fdir})
|
||||
elseif pitch > 0 then
|
||||
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_small_round_t'})
|
||||
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_round_t'})
|
||||
else
|
||||
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_small_round_b'})
|
||||
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_round_b'})
|
||||
end
|
||||
if not homedecor_expect_infinite_stacks then
|
||||
itemstack:take_item()
|
||||
@ -316,23 +316,23 @@ for i in ipairs(materials) do
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
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 pitch = placer:get_look_pitch()
|
||||
local node = minetest.env:get_node(above)
|
||||
local node = minetest.get_node(above)
|
||||
|
||||
if node.name ~= "air" then return end
|
||||
|
||||
if above.x ~= under.x or above.z ~= under.z then
|
||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_large_s', param2 = fdir})
|
||||
minetest.add_node(above, {name = 'homedecor:'..m..'_table_large_s', param2 = fdir})
|
||||
elseif pitch > 0 then
|
||||
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_large_t'})
|
||||
minetest.add_node(above, {name = 'homedecor:'..m..'_table_large_t'})
|
||||
else
|
||||
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_large_b'})
|
||||
minetest.add_node(above, {name = 'homedecor:'..m..'_table_large_b'})
|
||||
end
|
||||
if not homedecor_expect_infinite_stacks then
|
||||
itemstack:take_item()
|
||||
|
Loading…
Reference in New Issue
Block a user