1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 01:30:38 +01:00

Removing all the olds minetest.env calls

- All the minetest.env calls removed

It took me about 2 hours, but I did it, and it works!
This commit is contained in:
LeMagnesium 2014-11-08 18:36:57 +01:00
parent 28c92fbaa8
commit 27836d2835
57 changed files with 442 additions and 441 deletions

View File

@ -328,8 +328,8 @@ minetest.register_node("default:sand", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -359,8 +359,8 @@ minetest.register_node("default:desert_sand", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -390,8 +390,8 @@ minetest.register_node("default:gravel", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then

View File

@ -26,7 +26,7 @@ minetest.register_chatcommand("future_ban", {
minetest.chat_send_player(name, "Future ban list: " .. dump(future_ban_list))
return
end
if not minetest.env:get_player_by_name(param) then
if not minetest.get_player_by_name(param) then
table.insert(future_ban_list, param)
minetest.chat_send_player(name, param .. " to future ban list added.")
minetest.log("action", name .. " added " .. param .. " to future ban list.")

View File

@ -84,7 +84,7 @@ minetest.register_chatcommand("ban", {
-- description = "Teleport to the spawn location.",
-- privs = {shout=true},
-- func = function(name, param)
-- local player = minetest.env:get_player_by_name(name)
-- local player = minetest.:get_player_by_name(name)
-- minetest.chat_send_player(name, "Teleported to spawn!")
-- player:setpos({x=0.0, y=5.0, z=0.0})
-- return true
@ -97,7 +97,7 @@ minetest.register_chatcommand("sethome", {
description = "Set your home location.",
privs = {shout=true},
func = function(name, param)
player = minetest.env:get_player_by_name(name)
player = minetest.:get_player_by_name(name)
test = player:getpos()
local file = io.open(minetest.get_worldpath().."/home/"..player:get_player_name().."_home", "w")
if not file then
@ -116,7 +116,7 @@ minetest.register_chatcommand("home", {
description = "Vous teleporte a l'emplacement de votre 'home'.",
privs = {shout=true},
func = function(name, param)
player = minetest.env:get_player_by_name(name)
player = minetest.:get_player_by_name(name)
local file = io.open(minetest.get_worldpath().."/home/"..player:get_player_name().."_home", "r")
if not file then
minetest.chat_send_player(name, "Vous devez definir votre emplacement 'home' ! Pour ce faire, utilisez la commande /sethome.")
@ -129,7 +129,7 @@ minetest.register_chatcommand("home", {
minetest.chat_send_player(name, "Il y a eut une erreur, s'il vous plait contactez le detenteur du serveur.")
return
end
minetest.env:get_player_by_name(name):setpos(pos)
minetest.:get_player_by_name(name):setpos(pos)
minetest.chat_send_player(name, "Vous voilà chez vous.")
end
})

View File

@ -130,7 +130,7 @@ local music = {
}
local is_daytime = function()
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
return (minetest.:get_timeofday() > 0.2 and minetest.:get_timeofday() < 0.8)
end
--[[old
@ -140,7 +140,7 @@ local nodes_in_range = function(pos, search_distance, node_name)
for p_x=(pos.x-search_distance), (pos.x+search_distance) do
for p_y=(pos.y-search_distance), (pos.y+search_distance) do
for p_z=(pos.z-search_distance), (pos.z+search_distance) do
local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z})
local search_n = minetest.:get_node({x=p_x, y=p_y, z=p_z})
if search_n.name == node_name then
nodes_found = nodes_found + 1
end
@ -154,7 +154,7 @@ end --]]
local nodes_in_range = function(pos, search_distance, node_name)
minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.:find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
return #nodes
end
@ -163,7 +163,7 @@ end
local get_ambience = function(player)
local pos = player:getpos()
pos.y = pos.y+1.0
local nodename = minetest.env:get_node(pos).name
local nodename = minetest.:get_node(pos).name
if string.find(nodename, "default:water") then
if music then
return {water=water, water_frequent=water_frequent, music=music}

View File

@ -148,7 +148,7 @@ local music = {
}
local is_daytime = function()
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
return (minetest.:get_timeofday() > 0.2 and minetest.:get_timeofday() < 0.8)
end
--[[old
@ -158,7 +158,7 @@ local nodes_in_range = function(pos, search_distance, node_name)
for p_x=(pos.x-search_distance), (pos.x+search_distance) do
for p_y=(pos.y-search_distance), (pos.y+search_distance) do
for p_z=(pos.z-search_distance), (pos.z+search_distance) do
local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z})
local search_n = minetest.:get_node({x=p_x, y=p_y, z=p_z})
if search_n.name == node_name then
nodes_found = nodes_found + 1
end
@ -172,7 +172,7 @@ end --]]
local nodes_in_range = function(pos, search_distance, node_name)
minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.:find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
return #nodes
end
@ -181,7 +181,7 @@ end
local get_ambience = function(player)
local pos = player:getpos()
pos.y = pos.y+1.0
local nodename = minetest.env:get_node(pos).name
local nodename = minetest.:get_node(pos).name
if string.find(nodename, "default:water") then
if music then
return {water=water, water_frequent=water_frequent, music=music}
@ -204,7 +204,7 @@ local get_ambience = function(player)
end
end
pos.y = pos.y-2
nodename = minetest.env:get_node(pos).name
nodename = minetest.:get_node(pos).name
--minetest.chat_send_all("Found " .. nodename .. pos.y )
if string.find(nodename, "default:sand") and pos.y < 5 then
if music then

View File

@ -232,19 +232,19 @@ local music = {
}
local is_daytime = function()
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
return (minetest.get_timeofday() > 0.2 and minetest.get_timeofday() < 0.8)
end
local nodes_in_range = function(pos, search_distance, node_name)
minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
--minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
return #nodes
end
local nodes_in_coords = function(minp, maxp, node_name)
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
--minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
return #nodes
end
@ -254,7 +254,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
-- minetest.chat_send_all("counter: (" .. counter .. ")")
minp = {x=pos.x-search_distance,y=height, z=pos.z+20}
maxp = {x=pos.x+search_distance,y=height, z=pos.z+20}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("z+Found (" .. node_name .. ": " .. #nodes .. ")")
if #nodes >= threshold then
return true
@ -262,7 +262,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
totalnodes = #nodes
minp = {x=pos.x-search_distance,y=height, z=pos.z-20}
maxp = {x=pos.x+search_distance,y=height, z=pos.z-20}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("z-Found (" .. node_name .. ": " .. #nodes .. ")")
if #nodes >= threshold then
return true
@ -270,7 +270,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
totalnodes = totalnodes + #nodes
maxp = {x=pos.x+20,y=height, z=pos.z+search_distance}
minp = {x=pos.x+20,y=height, z=pos.z-search_distance}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
if #nodes >= threshold then
return true
@ -278,7 +278,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
totalnodes = totalnodes + #nodes
maxp = {x=pos.x-20,y=height, z=pos.z+search_distance}
minp = {x=pos.x-20,y=height, z=pos.z-search_distance}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
if #nodes >= threshold then
return true
@ -293,14 +293,14 @@ end
local get_immediate_nodes = function(pos)
pos.y = pos.y-1
node_under_feet = minetest.env:get_node(pos).name
node_under_feet = minetest.get_node(pos).name
pos.y = pos.y-3
node_3_under_feet = minetest.env:get_node(pos).name
node_3_under_feet = minetest.get_node(pos).name
pos.y = pos.y+3
pos.y = pos.y+2.2
node_at_upper_body = minetest.env:get_node(pos).name
node_at_upper_body = minetest.get_node(pos).name
pos.y = pos.y-1.19
node_at_lower_body = minetest.env:get_node(pos).name
node_at_lower_body = minetest.get_node(pos).name
pos.y = pos.y+0.99
--minetest.chat_send_all("node_under_feet(" .. nodename .. ")")
end
@ -459,7 +459,7 @@ local get_ambience = function(player)
end
-- pos.y = pos.y-2
-- nodename = minetest.env:get_node(pos).name
-- nodename = minetest.get_node(pos).name
-- minetest.chat_send_all("Found " .. nodename .. pos.y )
@ -780,7 +780,7 @@ minetest.register_chatcommand("svol", {
privs = {server=true},
func = function(name, param)
SOUNDVOLUME = param
-- local player = minetest.env:get_player_by_name(name)
-- local player = minetest.get_player_by_name(name)
-- ambiences = get_ambience(player)
-- stop_sound({}, player)
minetest.chat_send_player(name, "Sound volume set.")
@ -791,7 +791,7 @@ minetest.register_chatcommand("mvol", {
privs = {server=true},
func = function(name, param)
MUSICVOLUME = param
-- local player = minetest.env:get_player_by_name(name)
-- local player = minetest.get_player_by_name(name)
-- stop_sound({}, player)
-- ambiences = get_ambience(player)
minetest.chat_send_player(name, "Music volume set.")

View File

@ -83,7 +83,7 @@ local music = {
}
local is_daytime = function()
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
return (minetest.get_timeofday() > 0.2 and minetest.get_timeofday() < 0.8)
end
local get_ambience = function(player)
@ -97,12 +97,12 @@ local get_ambience = function(player)
local pos = player:getpos()
pos.y = pos.y+1.5
local nodename = minetest.env:get_node(pos).name
local nodename = minetest.get_node(pos).name
if string.find(nodename, "default:water") then
play_water = true
elseif nodename == "air" then
pos.y = pos.y-1.5
local nodename = minetest.env:get_node(pos).name
local nodename = minetest.get_node(pos).name
if string.find(nodename, "default:water") then
play_splash = true
end

View File

@ -148,7 +148,7 @@ local music = {
}
local is_daytime = function()
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
return (minetest.get_timeofday() > 0.2 and minetest.get_timeofday() < 0.8)
end
--[[old
@ -158,7 +158,7 @@ local nodes_in_range = function(pos, search_distance, node_name)
for p_x=(pos.x-search_distance), (pos.x+search_distance) do
for p_y=(pos.y-search_distance), (pos.y+search_distance) do
for p_z=(pos.z-search_distance), (pos.z+search_distance) do
local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z})
local search_n = minetest.get_node({x=p_x, y=p_y, z=p_z})
if search_n.name == node_name then
nodes_found = nodes_found + 1
end
@ -172,7 +172,7 @@ end --]]
local nodes_in_range = function(pos, search_distance, node_name)
minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
return #nodes
end
@ -181,7 +181,7 @@ end
local get_ambience = function(player)
local pos = player:getpos()
pos.y = pos.y+1.0
local nodename = minetest.env:get_node(pos).name
local nodename = minetest.get_node(pos).name
if string.find(nodename, "default:water") then
if music then
return {water=water, water_frequent=water_frequent, music=music}
@ -204,7 +204,7 @@ local get_ambience = function(player)
end
end
pos.y = pos.y-2
nodename = minetest.env:get_node(pos).name
nodename = minetest.get_node(pos).name
--minetest.chat_send_all("Found " .. nodename .. pos.y )
if string.find(nodename, "default:sand") and pos.y < 5 then
if music then

View File

@ -156,7 +156,7 @@ local music = {
}
local is_daytime = function()
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
return (minetest.get_timeofday() > 0.2 and minetest.get_timeofday() < 0.8)
end
--[[old
@ -166,7 +166,7 @@ local nodes_in_range = function(pos, search_distance, node_name)
for p_x=(pos.x-search_distance), (pos.x+search_distance) do
for p_y=(pos.y-search_distance), (pos.y+search_distance) do
for p_z=(pos.z-search_distance), (pos.z+search_distance) do
local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z})
local search_n = minetest.get_node({x=p_x, y=p_y, z=p_z})
if search_n.name == node_name then
nodes_found = nodes_found + 1
end
@ -180,7 +180,7 @@ end --]]
local nodes_in_range = function(pos, search_distance, node_name)
minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
return #nodes
end
@ -189,7 +189,7 @@ end
local get_ambience = function(player)
local pos = player:getpos()
pos.y = pos.y+1.0
local nodename = minetest.env:get_node(pos).name
local nodename = minetest.get_node(pos).name
if string.find(nodename, "default:water") then
if music then
return {water=water, water_frequent=water_frequent, music=music}
@ -198,7 +198,7 @@ local get_ambience = function(player)
end
elseif nodename == "air" then
pos.y = pos.y-1.5
local nodename = minetest.env:get_node(pos).name
local nodename = minetest.get_node(pos).name
pos.y = pos.y+1.5
if string.find(nodename, "default:water") then
if music then
@ -224,7 +224,7 @@ local get_ambience = function(player)
end
end
pos.y = pos.y-2
nodename = minetest.env:get_node(pos).name
nodename = minetest.get_node(pos).name
--minetest.chat_send_all("Found " .. nodename .. pos.y )
if string.find(nodename, "default:sand") and pos.y < 5 then
if music then

View File

@ -210,19 +210,19 @@ local music = {
}
local is_daytime = function()
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
return (minetest.get_timeofday() > 0.2 and minetest.get_timeofday() < 0.8)
end
local nodes_in_range = function(pos, search_distance, node_name)
minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
--minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
return #nodes
end
local nodes_in_coords = function(minp, maxp, node_name)
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
--minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
return #nodes
end
@ -232,7 +232,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
-- minetest.chat_send_all("counter: (" .. counter .. ")")
minp = {x=pos.x-search_distance,y=height, z=pos.z+20}
maxp = {x=pos.x+search_distance,y=height, z=pos.z+20}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("z+Found (" .. node_name .. ": " .. #nodes .. ")")
if #nodes >= threshold then
return true
@ -240,7 +240,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
totalnodes = #nodes
minp = {x=pos.x-search_distance,y=height, z=pos.z-20}
maxp = {x=pos.x+search_distance,y=height, z=pos.z-20}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("z-Found (" .. node_name .. ": " .. #nodes .. ")")
if #nodes >= threshold then
return true
@ -248,7 +248,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
totalnodes = totalnodes + #nodes
maxp = {x=pos.x+20,y=height, z=pos.z+search_distance}
minp = {x=pos.x+20,y=height, z=pos.z-search_distance}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
if #nodes >= threshold then
return true
@ -256,7 +256,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
totalnodes = totalnodes + #nodes
maxp = {x=pos.x-20,y=height, z=pos.z+search_distance}
minp = {x=pos.x-20,y=height, z=pos.z-search_distance}
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
if #nodes >= threshold then
return true
@ -271,14 +271,14 @@ end
local get_immediate_nodes = function(pos)
pos.y = pos.y-1
node_under_feet = minetest.env:get_node(pos).name
node_under_feet = minetest.get_node(pos).name
pos.y = pos.y-3
node_3_under_feet = minetest.env:get_node(pos).name
node_3_under_feet = minetest.get_node(pos).name
pos.y = pos.y+3
pos.y = pos.y+2.2
node_at_upper_body = minetest.env:get_node(pos).name
node_at_upper_body = minetest.get_node(pos).name
pos.y = pos.y-1.19
node_at_lower_body = minetest.env:get_node(pos).name
node_at_lower_body = minetest.get_node(pos).name
pos.y = pos.y+0.99 --1.6
--minetest.chat_send_all("node_under_feet(" .. nodename .. ")")
end
@ -416,7 +416,7 @@ local get_ambience = function(player)
end
pos.y = pos.y-2
nodename = minetest.env:get_node(pos).name
nodename = minetest.get_node(pos).name
-- minetest.chat_send_all("Found " .. nodename .. pos.y )

View File

@ -75,17 +75,17 @@ end
function generate_tree(pos, trunk, leaves)
pos.y = pos.y-1
local nodename = minetest.env:get_node(pos).name
local nodename = minetest.get_node(pos).name
pos.y = pos.y+1
if not minetest.env:get_node_light(pos) then
if not minetest.get_node_light(pos) then
return
end
node = {name = ""}
for dy=1,4 do
pos.y = pos.y+dy
if minetest.env:get_node(pos).name ~= "air" then
if minetest.get_node(pos).name ~= "air" then
return
end
pos.y = pos.y-dy
@ -93,7 +93,7 @@ function generate_tree(pos, trunk, leaves)
node = {name = "default:tree"}
for dy=0,4 do
pos.y = pos.y+dy
minetest.env:set_node(pos, node)
minetest.set_node(pos, node)
pos.y = pos.y-dy
end
@ -111,40 +111,40 @@ function generate_tree(pos, trunk, leaves)
pos.z = pos.z+dz
if dx == 0 and dz == 0 and dy==3 then
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.env:set_node(pos, node)
if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.set_node(pos, node)
if rarity == 1 then
minetest.env:set_node(pos, apple_leave())
minetest.set_node(pos, apple_leave())
else
minetest.env:set_node(pos, air_leave())
minetest.set_node(pos, air_leave())
end
end
elseif dx == 0 and dz == 0 and dy==4 then
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.env:set_node(pos, node)
if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.set_node(pos, node)
if rarity == 1 then
minetest.env:set_node(pos, apple_leave())
minetest.set_node(pos, apple_leave())
else
minetest.env:set_node(pos, air_leave())
minetest.set_node(pos, air_leave())
end
end
elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then
if minetest.env:get_node(pos).name == "air" then
minetest.env:set_node(pos, node)
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, node)
if rarity == 1 then
minetest.env:set_node(pos, apple_leave())
minetest.set_node(pos, apple_leave())
else
minetest.env:set_node(pos, air_leave())
minetest.set_node(pos, air_leave())
end
end
else
if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.env:set_node(pos, node)
if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.set_node(pos, node)
if rarity == 1 then
minetest.env:set_node(pos, apple_leave())
minetest.set_node(pos, apple_leave())
else
minetest.env:set_node(pos, air_leave())
minetest.set_node(pos, air_leave())
end
end
end
@ -181,34 +181,34 @@ end)
local function duengen(pointed_thing)
pos = pointed_thing.under
n = minetest.env:get_node(pos)
n = minetest.get_node(pos)
if n.name == "" then return end
local stage = ""
if n.name == "default:sapling" then
minetest.env:set_node(pos, {name="air"})
minetest.set_node(pos, {name="air"})
generate_tree(pos, "default:tree", "default:leaves")
elseif string.find(n.name, "farming:wheat_") ~= nil then
stage = string.sub(n.name, 15)
if stage == "3" then
minetest.env:set_node(pos, {name="farming:wheat"})
minetest.set_node(pos, {name="farming:wheat"})
elseif math.random(1,5) < 3 then
minetest.env:set_node(pos, {name="farming:wheat"})
minetest.set_node(pos, {name="farming:wheat"})
else
minetest.env:set_node(pos, {name="farming:wheat_"..math.random(2,3)})
minetest.set_node(pos, {name="farming:wheat_"..math.random(2,3)})
end
elseif string.find(n.name, "farming:cotton_") ~= nil then
stage = tonumber(string.sub(n.name, 16))
if stage == 1 then
minetest.env:set_node(pos, {name="farming:cotton_"..math.random(stage,2)})
minetest.set_node(pos, {name="farming:cotton_"..math.random(stage,2)})
else
minetest.env:set_node(pos, {name="farming:cotton"})
minetest.set_node(pos, {name="farming:cotton"})
end
elseif string.find(n.name, "farming:pumpkin_") ~= nil then
stage = tonumber(string.sub(n.name, 17))
if stage == 1 then
minetest.env:set_node(pos, {name="farming:pumpkin_"..math.random(stage,2)})
minetest.set_node(pos, {name="farming:pumpkin_"..math.random(stage,2)})
else
minetest.env:set_node(pos, {name="farming:pumpkin"})
minetest.set_node(pos, {name="farming:pumpkin"})
end
elseif n.name == "default:dirt_with_grass" then
@ -216,14 +216,14 @@ elseif n.name == "default:dirt_with_grass" then
for j = -3, 2, 1 do
pos = pointed_thing.above
pos = {x=pos.x+i, y=pos.y, z=pos.z+j}
n = minetest.env:get_node(pos)
n2 = minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z})
n = minetest.get_node(pos)
n2 = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
if n.name ~= "" and n.name == "air" and n2.name == "default:dirt_with_grass" then
if math.random(0,5) > 3 then
minetest.env:set_node(pos, {name=plant_tab[math.random(0, rnd_max)]})
minetest.set_node(pos, {name=plant_tab[math.random(0, rnd_max)]})
else
minetest.env:set_node(pos, {name=plant_tab[math.random(0, 5)]})
minetest.set_node(pos, {name=plant_tab[math.random(0, 5)]})
end

View File

@ -192,7 +192,7 @@ function nodeupdate_single(p, delay)
core.after(0.1, nodeupdate_single, {x=p.x, y=p.y, z=p.z}, false)
else
n.level = core.get_node_level(p)
local meta = minetest.env:get_meta(p)
local meta = minetest.get_meta(p)
--print('get owner '.. meta:get_string("owner"))
spawn_falling_node(p, n, meta:get_string("owner"))
core.remove_node(p)

View File

@ -26,16 +26,16 @@ local function get_chest_neighborpos(pos, param2, side)
end
local function hacky_swap_node(pos,name, param2)
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)
if node.name == name then
return
end
node.name = name
node.param2 = param2 or node.param2
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
@ -49,10 +49,10 @@ minetest.register_node(":default:chest", {
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local param2 = minetest.env:get_node(pos).param2
local meta = minetest.env:get_meta(pos)
if minetest.env:get_node(get_chest_neighborpos(pos, param2, "right")).name == "default:chest" then
minetest.env:set_node(pos, {name="chest:chest_right",param2=param2})
local param2 = minetest.get_node(pos).param2
local meta = minetest.get_meta(pos)
if minetest.get_node(get_chest_neighborpos(pos, param2, "right")).name == "default:chest" then
minetest.set_node(pos, {name="chest:chest_right",param2=param2})
local p = get_chest_neighborpos(pos, param2, "right")
meta:set_string("formspec",
"size[9,11.5]"..
@ -62,7 +62,7 @@ minetest.register_node(":default:chest", {
"list[current_player;main;0,10.5;9,1;]")
meta:set_string("infotext", "Large Chest")
hacky_swap_node(p, "chest:chest_left", param2)
local m = minetest.env:get_meta(p)
local m = minetest.get_meta(p)
m:set_string("formspec",
"size[9,11.5]"..
"list[current_name;main;0,0;9,3;]"..
@ -70,8 +70,8 @@ minetest.register_node(":default:chest", {
"list[current_player;main;0,7;9,3;9]"..
"list[current_player;main;0,10.5;9,1;]")
m:set_string("infotext", "Large Chest")
elseif minetest.env:get_node(get_chest_neighborpos(pos, param2, "left")).name == "default:chest" then
minetest.env:set_node(pos, {name="chest:chest_left",param2=param2})
elseif minetest.get_node(get_chest_neighborpos(pos, param2, "left")).name == "default:chest" then
minetest.set_node(pos, {name="chest:chest_left",param2=param2})
local p = get_chest_neighborpos(pos, param2, "left")
meta:set_string("formspec",
"size[9,11.5]"..
@ -81,7 +81,7 @@ minetest.register_node(":default:chest", {
"list[current_player;main;0,10.5;9,1;]")
meta:set_string("infotext", "Large Chest")
hacky_swap_node(p, "chest:chest_right", param2)
local m = minetest.env:get_meta(p)
local m = minetest.get_meta(p)
m:set_string("formspec",
"size[9,11.5]"..
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0;9,3;]"..
@ -101,7 +101,7 @@ minetest.register_node(":default:chest", {
inv:set_size("main", 9*3)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
local meta2 = meta
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
@ -109,7 +109,7 @@ minetest.register_node(":default:chest", {
local stack = inv:get_stack("main", i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.env:add_item(p, stack)
minetest.add_item(p, stack)
end
end
meta:from_table(meta2:to_table())
@ -136,16 +136,16 @@ minetest.register_node("chest:chest_left", {
drop = "default:chest",
sounds = default.node_sound_wood_defaults(),
on_destruct = function(pos)
local m = minetest.env:get_meta(pos)
local m = minetest.get_meta(pos)
if m:get_string("infotext") == "Chest" then
return
end
local param2 = minetest.env:get_node(pos).param2
local param2 = minetest.get_node(pos).param2
local p = get_chest_neighborpos(pos, param2, "left")
if not p or minetest.env:get_node(p).name ~= "chest:chest_right" then
if not p or minetest.get_node(p).name ~= "chest:chest_right" then
return
end
local meta = minetest.env:get_meta(p)
local meta = minetest.get_meta(p)
meta:set_string("formspec",
"size[9,8.5]"..
"list[current_name;main;0,0;9,3;]"..
@ -155,7 +155,7 @@ minetest.register_node("chest:chest_left", {
hacky_swap_node(p, "default:chest")
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
local meta2 = meta
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
@ -163,7 +163,7 @@ minetest.register_node("chest:chest_left", {
local stack = inv:get_stack("main", i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.env:add_item(p, stack)
minetest.add_item(p, stack)
end
end
meta:from_table(meta2:to_table())
@ -190,16 +190,16 @@ minetest.register_node("chest:chest_right", {
drop = "default:chest",
sounds = default.node_sound_wood_defaults(),
on_destruct = function(pos)
local m = minetest.env:get_meta(pos)
local m = minetest.get_meta(pos)
if m:get_string("infotext") == "Chest" then
return
end
local param2 = minetest.env:get_node(pos).param2
local param2 = minetest.get_node(pos).param2
local p = get_chest_neighborpos(pos, param2, "right")
if not p or minetest.env:get_node(p).name ~= "chest:chest_left" then
if not p or minetest.get_node(p).name ~= "chest:chest_left" then
return
end
local meta = minetest.env:get_meta(p)
local meta = minetest.get_meta(p)
meta:set_string("formspec",
"size[9,8.5]"..
"list[current_name;main;0,0;9,3;]"..
@ -209,7 +209,7 @@ minetest.register_node("chest:chest_right", {
hacky_swap_node(p, "default:chest")
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
local meta2 = meta
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
@ -217,7 +217,7 @@ minetest.register_node("chest:chest_right", {
local stack = inv:get_stack("main", i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.env:add_item(p, stack)
minetest.add_item(p, stack)
end
end
meta:from_table(meta2:to_table())

View File

@ -21,12 +21,12 @@ if( minetest.get_modpath( 'pipeworks' )) then
tubedevice = 1, tubedevice_receiver = 1 };
chesttools.chest_add.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,
@ -429,7 +429,7 @@ minetest.register_node( 'chesttools:shared_chest', {
local name = user:get_player_name();
local pos = minetest.get_pointed_thing_position( pointed_thing, mode );
local node = minetest.env:get_node_or_nil( pos );
local node = minetest.get_node_or_nil( pos );
if( node == nil or not( node.name )) then
return nil;

View File

@ -1002,7 +1002,7 @@ colormachine.main_menu_formspec = function( pos, option )
form = form.."label[0.5,0.25;CREATIVE MODE:]".."label[0.5,0.75;no dyes or input consumed]";
end
local meta = minetest.env:get_meta(pos);
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory();
-- display the name of the color the machine is set to
@ -1232,7 +1232,7 @@ end
colormachine.check_owner = function( pos, player )
-- only the owner can put something in
local meta = minetest.env:get_meta(pos);
local meta = minetest.get_meta(pos);
if( meta:get_string('owner') ~= player:get_player_name() ) then
minetest.chat_send_player( player:get_player_name(),
@ -1294,7 +1294,7 @@ end
colormachine.on_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();
-- nothing to do if onnly a dye was inserted
@ -1352,7 +1352,7 @@ end
colormachine.on_metadata_inventory_take = function( pos, listname, index, stack, player )
local meta = minetest.env:get_meta(pos);
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory();
@ -1758,7 +1758,7 @@ minetest.register_node("colormachine:colormachine", {
on_construct = function(pos)
local meta = minetest.env:get_meta(pos);
local meta = minetest.get_meta(pos);
meta:set_string('selected_shade', 3 ); -- grey-shade
meta:set_string('selected_grey_shade', 1 );
@ -1780,7 +1780,7 @@ minetest.register_node("colormachine:colormachine", {
end,
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", "Spray booth (owned by "..( meta:get_string( "owner" ) or "" )..")");
@ -1792,7 +1792,7 @@ minetest.register_node("colormachine:colormachine", {
return 0;
end
local meta = minetest.env:get_meta(pos);
local meta = minetest.get_meta(pos);
for k,v in pairs( fields ) do
if( k == 'main_menu' ) then
meta:set_string( 'formspec', colormachine.main_menu_formspec(pos, "analyze") );
@ -1880,7 +1880,7 @@ minetest.register_node("colormachine:colormachine", {
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( colormachine.check_owner( pos, player ))) then

View File

@ -79,7 +79,7 @@ end
-------------------------------------------------------------------------------
function factions_chat.cmdhandler(playername,parameter)
local player = minetest.env:get_player_by_name(playername)
local player = minetest.get_player_by_name(playername)
local params = parameter:split(" ")
local cmd = params[1]
@ -136,7 +136,7 @@ function factions_chat.cmdhandler(playername,parameter)
if cmd == "leave" then
if params[2] ~= nil then
if params[3] ~= nil then
local toremove = minetest.env:get_player_by_name(params[3])
local toremove = minetest.get_player_by_name(params[3])
--allowed if faction_admin, admin of faction or player itself
if minetest.check_player_privs(playername,{ faction_admin=true }) or
factions.is_admin(params[2],playername) and
@ -182,7 +182,7 @@ function factions_chat.cmdhandler(playername,parameter)
if params[3] ~= nil and
minetest.check_player_privs(playername,{ faction_admin=true }) then
local toadd = minetest.env:get_player_by_name(params[3])
local toadd = minetest.get_player_by_name(params[3])
if toadd ~= nil then
if factions.member_add(params[2],toadd) then
@ -354,7 +354,7 @@ end
-------------------------------------------------------------------------------
function factions_chat.allfactions_chathandler(playername,parameter)
local player = minetest.env:get_player_by_name(playername)
local player = minetest.get_player_by_name(playername)
if player ~= nil then
local recipients = {}
@ -391,7 +391,7 @@ end
-------------------------------------------------------------------------------
function factions_chat.chathandler(playername,parameter)
local player = minetest.env:get_player_by_name(playername)
local player = minetest.get_player_by_name(playername)
if player ~= nil then
local line = parameter:split(" ")

View File

@ -12,48 +12,48 @@ local function find_dock(pos, second)
return false
end
local h1 = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z})
local v1 = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z})
local r1 = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1})
local l1 = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1})
local h1 = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
local v1 = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
local r1 = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
local l1 = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
local code = 0
if dockable(l1.name) then
code = code+1
if second < 2 then
minetest.env:punch_node({x=pos.x, y=pos.y, z=pos.z-1})
minetest.punch_node({x=pos.x, y=pos.y, z=pos.z-1})
end
end
if dockable(r1.name) then
code = code+2
if second < 2 then
minetest.env:punch_node({x=pos.x, y=pos.y, z=pos.z+1})
minetest.punch_node({x=pos.x, y=pos.y, z=pos.z+1})
end
end
if dockable(v1.name) then
code = code+11
if second < 2 then
minetest.env:punch_node({x=pos.x-1, y=pos.y, z=pos.z})
minetest.punch_node({x=pos.x-1, y=pos.y, z=pos.z})
end
end
if dockable(h1.name) then
code = code+21
if second < 2 then
minetest.env:punch_node({x=pos.x+1, y=pos.y, z=pos.z})
minetest.punch_node({x=pos.x+1, y=pos.y, z=pos.z})
end
end
local me = minetest.env:get_node(pos)
local me = minetest.get_node(pos)
if code > 0 then
local tmp_name = "fences:fence_wood_"..code
--minetest.chat_send_all(tmp_name)
local tmp_node = {name=tmp_name, param1=me.param1, param2=me.param2}
if second > 0 then
local tmp_node = {name=tmp_name, param1=me.param1, param2=me.param2}
minetest.env:set_node(pos, tmp_node)
minetest.set_node(pos, tmp_node)
end
elseif code == 0 then
if second == 2 then
local tmp_node = {name="fences:fence_wood", param1=me.param1, param2=me.param2}
minetest.env:set_node(pos, tmp_node)
minetest.set_node(pos, tmp_node)
end
end
@ -575,11 +575,11 @@ local meta2
local state2 = 0
local function update_gate(pos, node)
minetest.env:set_node(pos, node)
minetest.set_node(pos, node)
end
local function punch_gate(pos, node)
meta2 = minetest.env:get_meta(pos)
meta2 = minetest.get_meta(pos)
state2 = meta2:get_int("state")
local tmp_node2
if state2 == 1 then
@ -669,8 +669,8 @@ minetest.register_node("fences:fencegate", {
}
},
on_construct = function(pos)
me2 = minetest.env:get_node(pos)
meta2 = minetest.env:get_meta(pos)
me2 = minetest.get_node(pos)
meta2 = minetest.get_meta(pos)
meta2:set_int("state", 0)
state2 = 0
find_dock(pos, -1)
@ -691,8 +691,8 @@ if override_original == true then
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local tmp_node3 = {name="fences:fence_wood"}
minetest.env:set_node(pos, tmp_node3)
minetest.env:punch_node(pos)
minetest.set_node(pos, tmp_node3)
minetest.punch_node(pos)
end
})
end

View File

@ -35,7 +35,7 @@ minetest.register_craftitem("fishing:fishing_rod_baited", {
liquids_pointable = true,
on_use = function (itemstack, user, pointed_thing)
if pointed_thing and pointed_thing.under then
local node = minetest.env:get_node(pointed_thing.under)
local node = minetest.get_node(pointed_thing.under)
if string.find(node.name, "default:water_source") then
if math.random(1, 100) < 5 then
local inv = user:get_inventory()

View File

@ -15,7 +15,7 @@ function hp_bar:on_step(dtime)
if wielder == nil then
self.object:remove()
return
elseif minetest.env:get_player_by_name(wielder:get_player_name()) == nil then
elseif minetest.get_player_by_name(wielder:get_player_name()) == nil then
self.object:remove()
return
end
@ -28,7 +28,7 @@ minetest.register_entity("gauges:hp_bar", hp_bar)
function add_HP_gauge(pl)
local pos = pl:getpos()
local ent = minetest.env:add_entity(pos, "gauges:hp_bar")
local ent = minetest.add_entity(pos, "gauges:hp_bar")
if ent ~= nil then
ent:set_attach(pl, "", {x = 0, y = 10, z = 0}, {x = 0, y = 0, z = 0})
ent = ent:get_luaentity()

View File

@ -30,7 +30,7 @@ computer.register = function ( name, def )
if (def.on_turn_off(pos, node, clicker, itemstack)) then return; end
end
node.name = OFFSTATE;
minetest.env:set_node(pos, node);
minetest.set_node(pos, node);
nodeupdate(pos);
end;
});
@ -55,7 +55,7 @@ computer.register = function ( name, def )
if (def.on_turn_on(pos, node, clicker, itemstack)) then return; end
end
node.name = ONSTATE;
minetest.env:set_node(pos, node);
minetest.set_node(pos, node);
nodeupdate(pos);
end;
drop = ONSTATE;

View File

@ -22,13 +22,13 @@ minetest.register_abm({
interval = 1,
chance = 1,
action = function(pos, node)
if minetest.env:find_node_near(pos, 1, {"default:water_source",
if minetest.find_node_near(pos, 1, {"default:water_source",
"default:water_flowing","default:lava_source",
"default:lava_flowing"}) then
minetest.sound_play("fire_extinguish",
{gain = 1.0, max_hear_distance = 20,})
node.name = "air"
minetest.env:set_node(pos, node)
minetest.set_node(pos, node)
end
end
})

View File

@ -15,9 +15,9 @@ minetest.register_craftitem("fake_fire:old_flint_and_steel", {
stack_max = 1,
liquids_pointable = false,
on_use = function(itemstack, user, pointed_thing)
n = minetest.env:get_node(pointed_thing)
n = minetest.get_node(pointed_thing)
if pointed_thing.type == "node" then
minetest.env:add_node(pointed_thing.above,
minetest.add_node(pointed_thing.above,
{name="fake_fire:fake_fire"})
minetest.sound_play("",
{gain = 1.0, max_hear_distance = 20,})

View File

@ -26,7 +26,7 @@ minetest.register_node("lrfurn:coffeetable_back", {
},
on_construct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
node.name = "lrfurn:coffeetable_front"
if param2 == 0 then
@ -38,13 +38,13 @@ minetest.register_node("lrfurn:coffeetable_back", {
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.env:set_node(pos, node)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.set_node(pos, node)
end
end,
on_destruct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
if param2 == 0 then
pos.z = pos.z+1
@ -55,9 +55,9 @@ minetest.register_node("lrfurn:coffeetable_back", {
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:coffeetable_front" ) then
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.env:remove_node(pos)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:coffeetable_front" ) then
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.remove_node(pos)
end
end
end,

View File

@ -48,7 +48,7 @@ for i in ipairs(longsofas_list) do
},
on_construct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
node.name = "lrfurn:longsofa_middle_"..colour
if param2 == 0 then
@ -60,8 +60,8 @@ for i in ipairs(longsofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.env:set_node(pos, node)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.set_node(pos, node)
node.name = "lrfurn:longsofa_left_"..colour
if param2 == 0 then
pos.z = pos.z+1
@ -72,14 +72,14 @@ for i in ipairs(longsofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.env:set_node(pos, node)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.set_node(pos, node)
end
end
end,
on_destruct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
if param2 == 0 then
pos.z = pos.z+1
@ -90,9 +90,9 @@ for i in ipairs(longsofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:longsofa_middle_"..colour ) then
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.env:remove_node(pos)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:longsofa_middle_"..colour ) then
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.remove_node(pos)
if param2 == 0 then
pos.z = pos.z+1
elseif param2 == 1 then
@ -102,9 +102,9 @@ for i in ipairs(longsofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:longsofa_left_"..colour ) then
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.env:remove_node(pos)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:longsofa_left_"..colour ) then
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.remove_node(pos)
end
end
end

View File

@ -48,7 +48,7 @@ for i in ipairs(sofas_list) do
},
on_construct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
node.name = "lrfurn:sofa_left_"..colour
if param2 == 0 then
@ -60,13 +60,13 @@ for i in ipairs(sofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.env:set_node(pos, node)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "air" ) then
minetest.set_node(pos, node)
end
end,
on_destruct = function(pos)
local node = minetest.env:get_node(pos)
local node = minetest.get_node(pos)
local param2 = node.param2
if param2 == 0 then
pos.z = pos.z+1
@ -77,9 +77,9 @@ for i in ipairs(sofas_list) do
elseif param2 == 3 then
pos.x = pos.x-1
end
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:sofa_left_"..colour ) then
if( minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.env:remove_node(pos)
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "lrfurn:sofa_left_"..colour ) then
if( minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).param2 == param2 ) then
minetest.remove_node(pos)
end
end
end,

View File

@ -215,146 +215,146 @@ after_place_node = function(pos,placer,itemstack)
local p = {x=pos.x, y=pos.y, z=pos.z}
if param2 == 0 then
pos.x = pos.x-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen4", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x+2
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen6", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.y = pos.y+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen3", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen2", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen1", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
elseif param2 == 1 then
pos.z = pos.z+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen4", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z-2
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen6", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.y = pos.y+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen3", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen2", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen1", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
elseif param2 == 2 then
pos.x = pos.x+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen4", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x-2
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen6", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.y = pos.y+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen3", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen2", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.x = pos.x+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen1", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
elseif param2 == 3 then
pos.z = pos.z-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen4", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z+2
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen6", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.y = pos.y+1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen3", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen2", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
pos.z = pos.z-1
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
minetest.set_node(pos,{name="plasmascreen:screen1", param2=minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.env:remove_node(p)
minetest.remove_node(p)
return true
end
end

View File

@ -47,9 +47,9 @@ facedir[3] = {x = -1, y = 0, z = 0}
local remove_item = function(pos, node)
local objs = nil
if node.name == "itemframes:frame" then
objs = minetest.env:get_objects_inside_radius(pos, 0.5)
objs = minetest.get_objects_inside_radius(pos, 0.5)
elseif node.name == "itemframes:pedestal" then
objs = minetest.env:get_objects_inside_radius({x = pos.x, y = pos.y + 1, z = pos.z}, 0.5)
objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y + 1, z = pos.z}, 0.5)
end
if objs then
for _, obj in ipairs(objs) do
@ -62,7 +62,7 @@ end
local update_item = function(pos, node)
remove_item(pos, node)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("item") ~= "" then
if node.name == "itemframes:frame" then
local posad = facedir[node.param2]
@ -74,7 +74,7 @@ local update_item = function(pos, node)
end
tmp.nodename = node.name
tmp.texture = ItemStack(meta:get_string("item")):get_name()
local e = minetest.env:add_entity(pos,"itemframes:item")
local e = minetest.add_entity(pos,"itemframes:item")
if node.name == "itemframes:frame" then
local yaw = math.pi*2 - node.param2 * math.pi/2
e:setyaw(yaw)
@ -83,12 +83,12 @@ local update_item = function(pos, node)
end
local drop_item = function(pos, node)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("item") ~= "" then
if node.name == "itemframes:frame" then
minetest.env:add_item(pos, meta:get_string("item"))
minetest.add_item(pos, meta:get_string("item"))
elseif node.name == "itemframes:pedestal" then
minetest.env:add_item({x=pos.x,y=pos.y+1,z=pos.z}, meta:get_string("item"))
minetest.add_item({x=pos.x,y=pos.y+1,z=pos.z}, meta:get_string("item"))
end
meta:set_string("item","")
end
@ -109,13 +109,13 @@ minetest.register_node("itemframes:frame",{
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
after_place_node = function(pos, placer, itemstack)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("owner",placer:get_player_name())
meta:set_string("infotext","Item frame (owned by "..placer:get_player_name()..")")
end,
on_rightclick = function(pos, node, clicker, itemstack)
if not itemstack then return end
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if clicker:get_player_name() == meta:get_string("owner") then
drop_item(pos,node)
local s = itemstack:take_item()
@ -125,14 +125,14 @@ minetest.register_node("itemframes:frame",{
return itemstack
end,
on_punch = function(pos,node,puncher)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if puncher:get_player_name() == meta:get_string("owner") then
drop_item(pos, node)
end
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
return player:get_player_name() == meta:get_string("owner")
end,
})
@ -153,14 +153,14 @@ minetest.register_node("itemframes:pedestal",{
sounds = default.node_sound_defaults(),
after_place_node = function(pos, placer, itemstack)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("owner",placer:get_player_name())
meta:set_string("infotext","Pedestal (owned by "..placer:get_player_name()..")")
end,
on_rightclick = function(pos, node, clicker, itemstack)
if not itemstack then return end
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if clicker:get_player_name() == meta:get_string("owner") then
drop_item(pos,node)
local s = itemstack:take_item()
@ -171,14 +171,14 @@ minetest.register_node("itemframes:pedestal",{
end,
on_punch = function(pos,node,puncher)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if puncher:get_player_name() == meta:get_string("owner") then
drop_item(pos,node)
end
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
return player:get_player_name() == meta:get_string("owner")
end,
})

View File

@ -21,7 +21,7 @@ local trampoline_punch = function(pos, node)
local id = string.sub(node.name, #node.name)
id = id + 1
if id == 7 then id = 1 end
minetest.env:add_node(pos, {name = string.sub(node.name, 1, #node.name - 1)..id})
minetest.add_node(pos, {name = string.sub(node.name, 1, #node.name - 1)..id})
end
for i = 1, 6 do

View File

@ -56,7 +56,7 @@ for i in ipairs(lavalamps_list) do
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
on_rightclick = function(pos, node, clicker)
node.name = "lavalamp:"..colour.."_off"
minetest.env:set_node(pos, node)
minetest.set_node(pos, node)
end,
})
@ -97,7 +97,7 @@ for i in ipairs(lavalamps_list) do
drop = "lavalamp:"..colour,
on_rightclick = function(pos, node, clicker)
node.name = "lavalamp:"..colour
minetest.env:set_node(pos, node)
minetest.set_node(pos, node)
end,
})

View File

@ -47,10 +47,11 @@ minetest.register_on_generated(function(minp,maxp,seed)
for x=pos1.x,pos2.x do
for y=pos1.y,pos2.y do
for z=pos1.z,pos2.z do
minetest.env:remove_node({x=x,y=y,z=z})
minetest.remove_node({x=x,y=y,z=z})
end end end
-- Deserialize the temple
worldedit.deserialize(ltp, contents, minetest.env)
--worldedit.deserialize(ltp, contents, minetest|.env)
worldedit.deserialize(ltp, contents, minetest)
end
end)

View File

@ -21,32 +21,32 @@ minetest.register_node("locked_sign:sign_wall_locked", {
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
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", "\"\" (owned by " .. placer:get_player_name() .. ")")
end,
on_construct = function(pos)
--local n = minetest.env:get_node(pos)
local meta = minetest.env:get_meta(pos)
--local n = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "hack:sign_text_input")
meta:set_string("infotext", "\"\"")
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local meta = minetest.get_meta(pos);
local owner = meta:get_string("owner")
local pname = player:get_player_name()
return pname == owner or pname == minetest.setting_get("name")
or minetest.check_player_privs(pname, {sign_editor=true})
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
local pname = sender:get_player_name()
if pname ~= owner and pname ~= minetest.setting_get("name")
and not minetest.check_player_privs(pname, {sign_editor=true}) then
return
end
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
fields.text = fields.text or ""
print((sender:get_player_name() or "").." wrote \""..fields.text..
"\" to sign at "..minetest.pos_to_string(pos))

View File

@ -84,7 +84,7 @@ markers.marker_placed = function( pos, placer, itemstack )
return;
end
local meta = minetest.env:get_meta( pos );
local meta = minetest.get_meta( pos );
local name = placer:get_player_name();
meta:set_string( 'infotext', 'Marker at '..minetest.pos_to_string( pos )..
@ -199,7 +199,7 @@ markers.marker_can_dig = function(pos,player)
return true;
end
local meta = minetest.env:get_meta( pos );
local meta = minetest.get_meta( pos );
local owner = meta:get_string( 'owner' );
local time = meta:get_string( 'time' );
@ -273,7 +273,7 @@ end
markers.get_marker_formspec = function(player, pos, error_msg)
local formspec = "";
local meta = minetest.env:get_meta( pos );
local meta = minetest.get_meta( pos );
local owner = meta:get_string( 'owner' );
local name = player:get_player_name();
@ -424,7 +424,7 @@ markers.marker_on_receive_fields = function(pos, formname, fields, sender)
end
local meta = minetest.env:get_meta( pos );
local meta = minetest.get_meta( pos );
local name = sender:get_player_name();

View File

@ -49,7 +49,7 @@ minetest.register_craftitem("mobs:bee", {
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.env:add_entity(pointed_thing.above, "mobs:bee")
minetest.add_entity(pointed_thing.above, "mobs:bee")
itemstack:take_item()
end
return itemstack
@ -88,7 +88,7 @@ minetest.register_node("mobs:beehive", {
after_place_node = function(pos, placer, itemstack)
if placer:is_player() then
minetest.set_node(pos, {name="mobs:beehive", param2=1})
minetest.env:add_entity(pos, "mobs:bee")
minetest.add_entity(pos, "mobs:bee")
end
end,

View File

@ -54,7 +54,7 @@ minetest.register_craftitem("mobs:chicken", {
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.env:add_entity(pointed_thing.above, "mobs:chicken")
minetest.add_entity(pointed_thing.above, "mobs:chicken")
itemstack:take_item()
end
return itemstack

View File

@ -91,12 +91,12 @@ mobs:register_arrow("mobs:fireball", {
for dy=-1,1 do
for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
local n = minetest.get_node(p).name
if n ~= "default:obsidian" and n ~= "ethereal:obsidian_brick" then
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 30 then
minetest.env:set_node(p, {name="fire:basic_flame"})
minetest.set_node(p, {name="fire:basic_flame"})
else
minetest.env:set_node(p, {name="air"})
minetest.set_node(p, {name="air"})
end
end
end

View File

@ -38,7 +38,7 @@ minetest.register_craftitem("mobs:rat", {
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.env:add_entity(pointed_thing.above, "mobs:rat")
minetest.add_entity(pointed_thing.above, "mobs:rat")
itemstack:take_item()
end
return itemstack

View File

@ -217,12 +217,12 @@ minetest.register_node("money:shop", {
sounds = default.node_sound_wood_defaults(),
paramtype2 = "facedir",
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())
meta:set_string("infotext", "Untuned Shop (owned by " .. placer:get_player_name() .. ")")
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[8,6.6]"..
"field[0.256,0.5;8,1;shopname;Name of your shop:;]"..
"field[0.256,1.5;8,1;action;Do you want buy(B) or sell(S) or buy and sell(BS):;]"..
@ -238,12 +238,12 @@ minetest.register_node("money:shop", {
meta:set_string("form", "yes")
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") and (meta:get_string("owner") == player:get_player_name() or minetest.get_player_privs(player:get_player_name())["money_admin"])
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)
if not has_shop_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a shop belonging to "..
@ -254,7 +254,7 @@ minetest.register_node("money:shop", {
return count
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if not has_shop_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a shop belonging to "..
@ -265,7 +265,7 @@ minetest.register_node("money:shop", {
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if not has_shop_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a shop belonging to "..
@ -288,7 +288,7 @@ minetest.register_node("money:shop", {
" takes stuff from shop at "..minetest.pos_to_string(pos))
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("form") == "yes" then
if fields.shopname ~= "" and (fields.action == "B" or fields.action == "S" or fields.action == "BS") and minetest.registered_items[fields.nodename] and tonumber(fields.amount) and tonumber(fields.amount) >= 1 and (meta:get_string("owner") == sender:get_player_name() or minetest.get_player_privs(sender:get_player_name())["money_admin"]) then
if fields.action == "B" then
@ -332,7 +332,7 @@ minetest.register_node("money:shop", {
s = " buy and sell "
ss = "button[1,5;2,1;buttonbuy;Buy("..fields.costsell..")]" .. "button[5,5;2,1;buttonsell;Sell("..fields.costbuy..")]"
end
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[8,10;]"..
"list[context;main;0,0;8,4;]"..
"label[0.256,4.5;You can"..s..fields.amount.." "..fields.nodename.."]"..
@ -408,12 +408,12 @@ minetest.register_node("money:barter_shop", {
sounds = default.node_sound_wood_defaults(),
paramtype2 = "facedir",
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())
meta:set_string("infotext", "Untuned Barter Shop (owned by " .. placer:get_player_name() .. ")")
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[8,5.6]"..
"field[0.256,0.5;8,1;bartershopname;Name of your barter shop:;]"..
"field[0.256,1.5;8,1;nodename1;What kind of a node do you want to exchange:;]"..
@ -426,12 +426,12 @@ minetest.register_node("money:barter_shop", {
meta:set_string("form", "yes")
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") and (meta:get_string("owner") == player:get_player_name() or minetest.get_player_privs(player:get_player_name())["money_admin"])
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)
if not has_shop_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a barter shop belonging to "..
@ -442,7 +442,7 @@ minetest.register_node("money:barter_shop", {
return count
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if not has_shop_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a barter shop belonging to "..
@ -453,7 +453,7 @@ minetest.register_node("money:barter_shop", {
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if not has_shop_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a barter shop belonging to "..
@ -476,7 +476,7 @@ minetest.register_node("money:barter_shop", {
" takes stuff from barter shop at "..minetest.pos_to_string(pos))
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("form") == "yes" then
if fields.bartershopname ~= "" and minetest.registered_items[fields.nodename1] and minetest.registered_items[fields.nodename2] and tonumber(fields.amount1) and tonumber(fields.amount1) >= 1 and tonumber(fields.amount2) and tonumber(fields.amount2) >= 1 and (meta:get_string("owner") == sender:get_player_name() or minetest.get_player_privs(sender:get_player_name())["money_admin"]) then
meta:set_string("formspec", "size[8,10;]"..
@ -540,7 +540,7 @@ minetest.register_node("money:admin_shop", {
sounds = default.node_sound_wood_defaults(),
paramtype2 = "facedir",
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Untuned Admin Shop")
meta:set_string("formspec", "size[8,5.6]"..
"field[0.256,0.5;8,1;action;Do you want buy(B) or sell(S) or buy and sell(BS):;]"..
@ -555,7 +555,7 @@ minetest.register_node("money:admin_shop", {
return minetest.get_player_privs(player:get_player_name())["money_admin"]
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("form") == "yes" then
if (fields.action == "B" or fields.action == "S" or fields.action == "BS") and minetest.registered_items[fields.nodename] and tonumber(fields.amount) and tonumber(fields.amount) >= 1 and (meta:get_string("owner") == sender:get_player_name() or minetest.get_player_privs(sender:get_player_name())["money_admin"]) then
if fields.action == "B" then
@ -599,7 +599,7 @@ minetest.register_node("money:admin_shop", {
s = " buy and sell "
ss = "button[1,0.5;2,1;buttonbuy;Buy("..fields.costsell..")]" .. "button[5,0.5;2,1;buttonsell;Sell("..fields.costbuy..")]"
end
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[8,5.5;]"..
"label[0.256,0;You can"..s..fields.amount.." "..fields.nodename.."]"..
ss..
@ -650,7 +650,7 @@ minetest.register_node("money:admin_barter_shop", {
sounds = default.node_sound_wood_defaults(),
paramtype2 = "facedir",
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[8,4.6]"..
"field[0.256,0.5;8,1;nodename1;What kind of a node do you want to exchange:;]"..
"field[0.256,1.5;8,1;nodename2;for:;]"..
@ -664,7 +664,7 @@ minetest.register_node("money:admin_barter_shop", {
return minetest.get_player_privs(player:get_player_name())["money_admin"]
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("form") == "yes" then
if minetest.registered_items[fields.nodename1] and minetest.registered_items[fields.nodename2] and tonumber(fields.amount1) and tonumber(fields.amount1) >= 1 and tonumber(fields.amount2) and tonumber(fields.amount2) >= 1 and (meta:get_string("owner") == sender:get_player_name() or minetest.get_player_privs(sender:get_player_name())["money_admin"]) then
meta:set_string("formspec", "size[8,6;]"..

View File

@ -14,13 +14,13 @@ minetest.register_node("more_chests:cobble", {
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
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", "Locked Chest (owned by "..
meta:get_string("owner")..")")]]
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,9]"..
"list[current_name;main;0,0;8,4;]"..
@ -31,12 +31,12 @@ minetest.register_node("more_chests:cobble", {
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,
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 not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
@ -47,7 +47,7 @@ minetest.register_node("more_chests:cobble", {
return count
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
@ -58,7 +58,7 @@ minetest.register_node("more_chests:cobble", {
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..

View File

@ -14,13 +14,13 @@ minetest.register_node("more_chests:dropbox", {
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
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", "Dropbox (owned by "..
meta:get_string("owner")..")")
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,9]"..
"list[current_name;main;0,0;8,4;]"..
@ -30,12 +30,12 @@ minetest.register_node("more_chests:dropbox", {
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,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a dropbox belonging to "..

View File

@ -21,13 +21,13 @@ minetest.register_node("more_chests:secret", {
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
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", "Secret Chest (owned by "..
meta:get_string("owner")..")")
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", open)
meta:set_string("infotext", "Secret Chest")
meta:set_string("owner", "")
@ -35,12 +35,12 @@ minetest.register_node("more_chests:secret", {
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,
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 not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a secret chest belonging to "..
@ -51,7 +51,7 @@ minetest.register_node("more_chests:secret", {
return count
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a secret chest belonging to "..
@ -62,7 +62,7 @@ minetest.register_node("more_chests:secret", {
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a secret chest belonging to "..
@ -85,7 +85,7 @@ minetest.register_node("more_chests:secret", {
" takes stuff from secret chest at "..minetest.pos_to_string(pos))
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if has_locked_chest_privilege(meta, sender) then
if fields.open == "open" then
meta:set_string("formspec", open)

View File

@ -28,13 +28,13 @@ minetest.register_node("more_chests:shared", {
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
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", "Shared Chest (owned by "..
meta:get_string("owner")..")")
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", get_formspec(""))
meta:set_string("infotext", "Shared Chest")
meta:set_string("owner", "")
@ -42,12 +42,12 @@ minetest.register_node("more_chests:shared", {
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,
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 not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a shared chest belonging to "..
@ -58,7 +58,7 @@ minetest.register_node("more_chests:shared", {
return count
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a shared chest belonging to "..
@ -69,7 +69,7 @@ minetest.register_node("more_chests:shared", {
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a shared chest belonging to "..
@ -92,7 +92,7 @@ minetest.register_node("more_chests:shared", {
" takes stuff from shared chest at "..minetest.pos_to_string(pos))
end,
on_receive_fields = function(pos, formspec, fields, sender)
local meta = minetest.env:get_meta(pos);
local meta = minetest.get_meta(pos);
if fields.shared then
if meta:get_string("owner") == sender:get_player_name() then
meta:set_string("shared", fields.shared);

View File

@ -9,7 +9,7 @@ minetest.register_node("more_chests:wifi", {
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",
"size[8,9]"..
"list[current_player;more_chests:wifi;0,0;8,4;]"..

View File

@ -724,8 +724,8 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume,
local y2 = y0+y1
local z2 = z0+z1
local p2 = {x=x2, y=y2, z=z2}
if minetest.env:get_node(p2).name == wherein then
minetest.env:set_node(p2, {name=name})
if minetest.get_node(p2).name == wherein then
minetest.set_node(p2, {name=name})
end
end
end

View File

@ -40,7 +40,7 @@ minetest.register_globalstep(function(dtime)
pos = near
-- am I touching the cactus? if so it hurts
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1.0)) do
for _,object in ipairs(minetest.get_objects_inside_radius(pos, 1.0)) do
if object:get_hp() > 0 then
object:set_hp(object:get_hp()-1)
end

View File

@ -91,8 +91,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal
local env = minetest.env --Should make things a bit faster.
local perlin1 = env:get_perlin(51,3, 0.5, perlin_scale) --Get map specific perlin
--local env = minetest|.env --Should make things a bit faster.
local perlin1 = minetest.get_perlin(51,3, 0.5, perlin_scale) --Get map specific perlin
--[[if not (perlin1:get2d({x=x0, y=z0}) > 0.53) and not (perlin1:get2d({x=x1, y=z1}) > 0.53)
and not (perlin1:get2d({x=x0, y=z1}) > 0.53) and not (perlin1:get2d({x=x1, y=z0}) > 0.53)
@ -137,9 +137,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
end
--[[remove usual stuff
local trees = env:find_nodes_in_area(minp, maxp, USUAL_STUFF)
local trees = minetest.find_nodes_in_area(minp, maxp, USUAL_STUFF)
for i,v in pairs(trees) do
env:remove_node(v)
minetest.remove_node(v)
end]]
@ -221,15 +221,15 @@ minetest.register_on_generated(function(minp, maxp, seed)
elseif pr:next(1,5000) == 1 then
riesenpilz_circle(c.riesenpilz_glowshroom, boden, 3, 3)
--[[elseif pr:next(1,80) == 1 then
env:add_node(boden, {name="riesenpilz:brown"})
minetest.add_node(boden, {name="riesenpilz:brown"})
elseif pr:next(1,90) == 1 then
env:add_node(boden, {name="riesenpilz:red"})
minetest.add_node(boden, {name="riesenpilz:red"})
elseif pr:next(1,100) == 1 then
env:add_node(boden, {name="riesenpilz:fly_agaric"})
minetest.add_node(boden, {name="riesenpilz:fly_agaric"})
elseif pr:next(1,4000) == 1 then
env:add_node(boden, {name="riesenpilz:lavashroom"})
minetest.add_node(boden, {name="riesenpilz:lavashroom"})
elseif pr:next(1,5000) == 1 then
env:add_node(boden, {name="riesenpilz:glowshroom"})]]
minetest.add_node(boden, {name="riesenpilz:glowshroom"})]]
elseif pr:next(1,380) == 1 then
tab[num] = {1, boden}
num = num+1
@ -275,8 +275,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
end)
--[[ if maxp.y < -10 then
local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal
local env = minetest.env --Should make things a bit faster.
local perlin1 = env:get_perlin(11,3, 0.5, 200) --Get map specific perlin
local env = minetest.|env --Should make things a bit faster.
local perlin1 = minetest.get_perlin(11,3, 0.5, 200) --Get map specific perlin
--[if not (perlin1:get2d({x=x0, y=z0}) > 0.53) and not (perlin1:get2d({x=x1, y=z1}) > 0.53)
and not (perlin1:get2d({x=x0, y=z1}) > 0.53) and not (perlin1:get2d({x=x1, y=z0}) > 0.53)
@ -303,12 +303,12 @@ end)
for y=minp.y,maxp.y,1 do
local pos = {x=x, y=y, z=z}
if env:get_node(pos).name == "air"
and env:get_node({x=x, y=y-1, z=z}).name == "default:stone"
if minetest.get_node(pos).name == "air"
and minetest.get_node({x=x, y=y-1, z=z}).name == "default:stone"
and pr:next(1,40) == 33
and env:find_node_near(pos, 4, "group:igniter")
and not env:find_node_near(pos, 3, "group:igniter") then
env:add_node(pos, {name="riesenpilz:lavashroom"})
and minetest.find_node_near(pos, 4, "group:igniter")
and not minetest.find_node_near(pos, 3, "group:igniter") then
minetest.add_node(pos, {name="riesenpilz:lavashroom"})
end
end
end

View File

@ -6,10 +6,10 @@ function riesenpilz_circle(nam, pos, radius, rand, seed)
if math.floor( math.sqrt(i^2+j^2) +0.5) == radius then
random = PseudoRandom(ra)
p={x=pos.x+i, y=pos.y, z=pos.z+j}
if minetest.env:get_node(p).name == "air"
if minetest.get_node(p).name == "air"
and random:next(1,rand) == 1
and minetest.env:get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name ~= "air" then
minetest.env:add_node(p, {name=nam})
and minetest.get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name ~= "air" then
minetest.add_node(p, {name=nam})
end
ra = ra+1
end
@ -32,10 +32,10 @@ function riesenpilz_circle(nam, pos, radius, chance)
for i = -radius, radius, 1 do
for j = -radius, radius, 1 do
if math.floor( math.sqrt(i^2+j^2) +0.5) == radius
and minetest.env:get_node({x=pos.x+i, y=pos.y, z=pos.z+j}).name == "air"
and minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z+j}).name == "air"
and math.random(1,chance) == 1
and minetest.env:get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name == "riesenpilz:ground" then
minetest.env:add_node({x=pos.x+i, y=pos.y, z=pos.z+j}, {name=nam})
and minetest.get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name == "riesenpilz:ground" then
minetest.add_node({x=pos.x+i, y=pos.y, z=pos.z+j}, {name=nam})
end
end
end
@ -43,7 +43,7 @@ end
local function find_ground(pos, nodes)
for _, evground in ipairs(nodes) do
if minetest.env:get_node(pos).name == evground then
if minetest.get_node(pos).name == evground then
return true
end
end
@ -55,8 +55,8 @@ USUAL_STUFF = {"default:leaves","default:apple","default:tree","default:cactus",
minetest.register_on_generated(function(minp, maxp, seed)
if maxp.y >= -10 then
local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal
local env = minetest.env --Should make things a bit faster.
local perlin1 = env:get_perlin(11,3, 0.5, 200) --Get map specific perlin
--local env = minetest.|env --Should make things a bit faster.
local perlin1 = minetest.get_perlin(11,3, 0.5, 200) --Get map specific perlin
--[[if not (perlin1:get2d({x=x0, y=z0}) > 0.53) and not (perlin1:get2d({x=x1, y=z1}) > 0.53)
and not (perlin1:get2d({x=x0, y=z1}) > 0.53) and not (perlin1:get2d({x=x1, y=z0}) > 0.53)
@ -77,9 +77,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
local pr = PseudoRandom(seed+68)
--remove usual stuff
local trees = env:find_nodes_in_area(minp, maxp, USUAL_STUFF)
local trees = minetest.find_nodes_in_area(minp, maxp, USUAL_STUFF)
for i,v in pairs(trees) do
env:remove_node(v)
minetest.remove_node(v)
end
--Information:
@ -113,18 +113,18 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
end
if ground_y then
env:add_node({x=x,y=ground_y,z=z}, {name="riesenpilz:ground"})
minetest.add_node({x=x,y=ground_y,z=z}, {name="riesenpilz:ground"})
for i = -1,-5,-1 do
local pos = {x=x,y=ground_y+i,z=z}
if env:get_node(pos).name == "default:desert_sand" then
env:add_node(pos, {name="default:dirt"})
if minetest.get_node(pos).name == "default:desert_sand" then
minetest.add_node(pos, {name="default:dirt"})
else
break
end
end
local boden = {x=x,y=ground_y+1,z=z}
if pr:next(1,15) == 1 then
env:add_node(boden, {name="default:dry_shrub"})
minetest.add_node(boden, {name="default:dry_shrub"})
elseif pr:next(1,80) == 1 then
riesenpilz_circle("riesenpilz:brown", boden, pr:next(3,4), 3)
elseif pr:next(1,90) == 1 then
@ -136,15 +136,15 @@ minetest.register_on_generated(function(minp, maxp, seed)
elseif pr:next(1,5000) == 1 then
riesenpilz_circle("riesenpilz:glowshroom", boden, 3, 3)
--[[elseif pr:next(1,80) == 1 then
env:add_node(boden, {name="riesenpilz:brown"})
minetest.add_node(boden, {name="riesenpilz:brown"})
elseif pr:next(1,90) == 1 then
env:add_node(boden, {name="riesenpilz:red"})
minetest.add_node(boden, {name="riesenpilz:red"})
elseif pr:next(1,100) == 1 then
env:add_node(boden, {name="riesenpilz:fly_agaric"})
minetest.add_node(boden, {name="riesenpilz:fly_agaric"})
elseif pr:next(1,4000) == 1 then
env:add_node(boden, {name="riesenpilz:lavashroom"})
minetest.add_node(boden, {name="riesenpilz:lavashroom"})
elseif pr:next(1,5000) == 1 then
env:add_node(boden, {name="riesenpilz:glowshroom"})]]
minetest.add_node(boden, {name="riesenpilz:glowshroom"})]]
elseif pr:next(1,380) == 1 then
riesenpilz_hybridpilz(boden)
elseif pr:next(1,340) == 10 then
@ -161,8 +161,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
if maxp.y < -10 then
local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal
local env = minetest.env --Should make things a bit faster.
local perlin1 = env:get_perlin(11,3, 0.5, 200) --Get map specific perlin
--local env = minetest.|env --Should make things a bit faster.
local perlin1 = minetest.get_perlin(11,3, 0.5, 200) --Get map specific perlin
--[[if not (perlin1:get2d({x=x0, y=z0}) > 0.53) and not (perlin1:get2d({x=x1, y=z1}) > 0.53)
and not (perlin1:get2d({x=x0, y=z1}) > 0.53) and not (perlin1:get2d({x=x1, y=z0}) > 0.53)
@ -189,12 +189,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
for y=minp.y,maxp.y,1 do
local pos = {x=x, y=y, z=z}
if env:get_node(pos).name == "air"
and env:get_node({x=x, y=y-1, z=z}).name == "default:stone"
if minetest.get_node(pos).name == "air"
and minetest.get_node({x=x, y=y-1, z=z}).name == "default:stone"
and pr:next(1,40) == 33
and env:find_node_near(pos, 4, "group:igniter")
and not env:find_node_near(pos, 3, "group:igniter") then
env:add_node(pos, {name="riesenpilz:lavashroom"})
and minetest.find_node_near(pos, 4, "group:igniter")
and not minetest.find_node_near(pos, 3, "group:igniter") then
minetest.add_node(pos, {name="riesenpilz:lavashroom"})
end
end
end

View File

@ -25,8 +25,8 @@ minetest.register_node("clams:sandalgae", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -70,8 +70,8 @@ minetest.register_node("clams:sandalgaeused", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then

View File

@ -136,8 +136,8 @@ minetest.register_node("seacoral:seacoralsandcyan", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -171,8 +171,8 @@ minetest.register_node("seacoral:seacoralsandmagenta", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -206,8 +206,8 @@ minetest.register_node("seacoral:seacoralsandaqua", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -241,8 +241,8 @@ minetest.register_node("seacoral:seacoralsandlime", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -276,8 +276,8 @@ minetest.register_node("seacoral:seacoralsandskyblue", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -311,8 +311,8 @@ minetest.register_node("seacoral:seacoralsandredviolet", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -720,7 +720,7 @@ action = function(pos, node, active_object_count, active_object_count_wider)
minetest.get_node(yp).name == "noairblocks:water_sourcex") and
(minetest.get_node(yyp).name == "default:water_source" or
minetest.get_node(yyp).name == "noairblocks:water_sourcex")) then
local objs = minetest.env:get_objects_inside_radius(pos, 2)
local objs = minetest.get_objects_inside_radius(pos, 2)
for k, obj in pairs(objs) do
obj:set_hp(obj:get_hp()+ 1)
end

View File

@ -18,8 +18,8 @@ minetest.register_node("seagravel:seagravel", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -46,8 +46,8 @@ minetest.register_node("seagravel:seagravel_cyan", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -74,8 +74,8 @@ minetest.register_node("seagravel:seagravel_magenta", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -102,8 +102,8 @@ minetest.register_node("seagravel:seagravel_lime", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -130,8 +130,8 @@ minetest.register_node("seagravel:seagravel_aqua", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -158,8 +158,8 @@ minetest.register_node("seagravel:seagravel_skyblue", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -186,8 +186,8 @@ minetest.register_node("seagravel:seagravel_redviolet", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -217,8 +217,8 @@ stairs.register_stair_and_slab("seagravel", "seagravel:seagravel",
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -244,8 +244,8 @@ stairs.register_stair_and_slab("seagravel_cyan", "seagravel:seagravel_cyan",
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -271,8 +271,8 @@ stairs.register_stair_and_slab("seagravel_magenta", "seagravel:seagravel_magenta
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -298,8 +298,8 @@ stairs.register_stair_and_slab("seagravel_lime", "seagravel:seagravel_lime",
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -325,8 +325,8 @@ stairs.register_stair_and_slab("seagravel_aqua", "seagravel:seagravel_aqua",
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -352,8 +352,8 @@ stairs.register_stair_and_slab("seagravel_skyblue", "seagravel:seagravel_skyblue
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -379,8 +379,8 @@ stairs.register_stair_and_slab("seagravel_redviolet", "seagravel:seagravel_redvi
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then

View File

@ -141,8 +141,8 @@ minetest.register_node("seaplants:seaplantssandkelpgreen", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -176,8 +176,8 @@ minetest.register_node("seaplants:seaplantssandkelpbrown", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -211,8 +211,8 @@ minetest.register_node("seaplants:seaplantssandseagrassgreen", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then
@ -246,8 +246,8 @@ minetest.register_node("seaplants:seaplantssandseagrassred", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then

View File

@ -15,8 +15,8 @@ minetest.register_node("seawrecks:woodship", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then

View File

@ -28,8 +28,8 @@ minetest.register_node("whiteshell:whiteshell", {
if minetest.is_protected(pointed_thing.above, pn) then
return itemstack
end
minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.env:get_meta(pointed_thing.above)
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
local meta = minetest.get_meta(pointed_thing.above)
meta:set_string("owner", pn)
nodeupdate(pointed_thing.above)
if not minetest.setting_getbool("creative_mode") then

View File

@ -79,7 +79,7 @@ if snow.enable_snowfall then
local get_snow = function(pos)
--Legacy support.
if weather_legacy == "snow" then
local perlin1 = minetest.env:get_perlin(112,3, 0.5, 150)
local perlin1 = minetest.:get_perlin(112,3, 0.5, 150)
if perlin1:get2d( {x=pos.x, y=pos.z} ) > 0.53 then
return true
else
@ -106,13 +106,13 @@ if snow.enable_snowfall then
local snow_fall=function (pos, player, animate)
local ground_y = nil
for y=pos.y+10,pos.y+20,1 do
local n = minetest.env:get_node({x=pos.x,y=y,z=pos.z}).name
local n = minetest.:get_node({x=pos.x,y=y,z=pos.z}).name
if n ~= "air" and n ~= "ignore" then
return
end
end
for y=pos.y+10,pos.y-15,-1 do
local n = minetest.env:get_node({x=pos.x,y=y,z=pos.z}).name
local n = minetest.:get_node({x=pos.x,y=y,z=pos.z}).name
if n ~= "air" and n ~= "ignore" then
ground_y = y
break
@ -151,7 +151,7 @@ if snow.enable_snowfall then
local smaxp = addvectors(ppos, {x= 20, y=0, z= 20})
-- Make sure player is not in a cave/house...
if get_snow(ppos) and minetest.env:get_node_light(ppos, 0.5) == 15 then
if get_snow(ppos) and minetest.:get_node_light(ppos, 0.5) == 15 then
local minp = addvectors(ppos, {x=-9, y=3, z=-9})
local maxp = addvectors(ppos, {x= 9, y=5, z= 9})

View File

@ -68,30 +68,30 @@ local xmas_tree = {
--Makes pine tree
function snow.make_pine(pos,snow,xmas)
local env = minetest.env
local perlin1 = env:get_perlin(112,3, 0.5, 150)
local perlin1 = minetest.get_perlin(112,3, 0.5, 150)
local try_node = function(pos, node)
local n = env:get_node(pos).name
local n = minetest.get_node(pos).name
if n == "air" or n == "ignore" then
env:add_node(pos,node)
minetest.add_node(pos,node)
end
end
--Clear ground.
for x=-1,1 do
for z=-1,1 do
if env:get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snow" then
env:remove_node({x=pos.x+x,y=pos.y,z=pos.z+z})
if minetest.get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snow" then
minetest.remove_node({x=pos.x+x,y=pos.y,z=pos.z+z})
end
if env:get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snowblock" then
env:remove_node({x=pos.x+x,y=pos.y,z=pos.z+z})
if minetest.get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snowblock" then
minetest.remove_node({x=pos.x+x,y=pos.y,z=pos.z+z})
end
end
end
if xmas then
env:remove_node(pos)
minetest.env:spawn_tree(pos, xmas_tree)
minetest.remove_node(pos)
minetest.spawn_tree(pos, xmas_tree)
else
minetest.env:spawn_tree(pos, pine_tree)
minetest.spawn_tree(pos, pine_tree)
end
if snow then
local x,z = pos.x,pos.z

View File

@ -53,7 +53,7 @@ than I originally planned. :p ~ LazyJ
--
local function is_water(pos)
local nn = minetest.env:get_node(pos).name
local nn = minetest:get_node(pos).name
return minetest.get_item_group(nn, "water") ~= 0
end
@ -182,7 +182,7 @@ minetest.register_craftitem("snow:sled", {
local player_pos = placer:getpos()
if not players_sled[name] then
if minetest.get_node({x=player_pos.x,y=player_pos.y, z=player_pos.z}).name == "default:snow" then
local sled = minetest.env:add_entity(pos, "snow:sled")
local sled = minetest:add_entity(pos, "snow:sled")
sled:get_luaentity():on_rightclick(placer)
end
end

View File

@ -2,7 +2,7 @@ minetest.register_on_chat_message(function(name, message, playername, player)
local cmd = "/spawn"
if message:sub(0, #cmd) == cmd then
if message == '/spawn' then
local player = minetest.env:get_player_by_name(name)
local player = minetest.get_player_by_name(name)
if minetest.setting_get_pos("static_spawnpoint") then
minetest.chat_send_player(player:get_player_name(), "Teleporting to spawn...")
player:setpos(minetest.setting_get_pos("static_spawnpoint"))

View File

@ -21,13 +21,13 @@ minetest.register_node("sponge:sponge", {
local on_water = false
local pos = pointed_thing.above
-- verifier si il est dans l'eau ou a cotée
if string.find(minetest.env:get_node(pointed_thing.above).name, "water_source")
or string.find(minetest.env:get_node(pointed_thing.above).name, "water_flowing") then
if string.find(minetest.get_node(pointed_thing.above).name, "water_source")
or string.find(minetest.get_node(pointed_thing.above).name, "water_flowing") then
on_water = true
end
for i=-1,1 do
p = {x=pos.x+i, y=pos.y, z=pos.z}
n = minetest.env:get_node(p)
n = minetest.get_node(p)
-- On verifie si il y a de l'eau
if (n.name=="default:water_flowing") or (n.name == "default:water_source") then
on_water = true
@ -35,7 +35,7 @@ minetest.register_node("sponge:sponge", {
end
for i=-1,1 do
p = {x=pos.x, y=pos.y+i, z=pos.z}
n = minetest.env:get_node(p)
n = minetest.get_node(p)
-- On verifie si il y a de l'eau
if (n.name=="default:water_flowing") or (n.name == "default:water_source") then
on_water = true
@ -43,7 +43,7 @@ minetest.register_node("sponge:sponge", {
end
for i=-1,1 do
p = {x=pos.x, y=pos.y, z=pos.z+i}
n = minetest.env:get_node(p)
n = minetest.get_node(p)
-- On verifie si il y a de l'eau
if (n.name=="default:water_flowing") or (n.name == "default:water_source") then
on_water = true
@ -55,10 +55,10 @@ minetest.register_node("sponge:sponge", {
for j=-3,3 do
for k=-3,3 do
p = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
n = minetest.env:get_node(p)
n = minetest.get_node(p)
-- On Supprime l'eau
if (n.name=="default:water_flowing") or (n.name == "default:water_source")then
minetest.env:add_node(p, {name="air"})
minetest.add_node(p, {name="air"})
change = true
end
end
@ -66,11 +66,11 @@ minetest.register_node("sponge:sponge", {
end
end
p = {x=pos.x, y=pos.y, z=pos.z}
n = minetest.env:get_node(p)
n = minetest.get_node(p)
if change == true then
minetest.env:add_node(pointed_thing.above, {name = "sponge:sponge_wet"})
minetest.add_node(pointed_thing.above, {name = "sponge:sponge_wet"})
else
minetest.env:add_node(pointed_thing.above, {name = "sponge:sponge"})
minetest.add_node(pointed_thing.above, {name = "sponge:sponge"})
end
return itemstack