Replace minetest.env with minetest

This commit is contained in:
Wuzzy 2018-05-24 23:06:17 +02:00
parent 05bef9bf6e
commit eb3590ce68
3 changed files with 12 additions and 12 deletions

View File

@ -138,7 +138,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
math.randomseed(seed)
local cnt = 0
local perlin1 = minetest.env:get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
local perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
local noise1 = perlin1:get2d({x=minp.x,y=minp.y})--,z=minp.z})
if noise1 > 0.25 or noise1 < -0.26 then

View File

@ -165,7 +165,7 @@ MUMMY_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabili
end
if self.object:get_hp() == 0 then
local obj = minetest.env:add_item(self.object:getpos(), mummy_drop.." "..math.random(0,3))
local obj = minetest.add_item(self.object:getpos(), mummy_drop.." "..math.random(0,3))
end
end
@ -181,7 +181,7 @@ MUMMY_DEF.on_step = function(self, dtime)
self.sound_timer = self.sound_timer + 0.01
local current_pos = self.object:getpos()
local current_node = minetest.env:get_node(current_pos)
local current_node = minetest.get_node(current_pos)
if self.time_passed == nil then
self.time_passed = 0
end
@ -235,7 +235,7 @@ MUMMY_DEF.on_step = function(self, dtime)
if self.state == 1 then
self.yawwer = true
self.attacker = ""
for _,object in ipairs(minetest.env:get_objects_inside_radius(self.object:getpos(), 4)) do
for _,object in ipairs(minetest.get_objects_inside_radius(self.object:getpos(), 4)) do
if object:is_player() then
self.yawwer = false
local NPC = self.object:getpos()
@ -319,7 +319,7 @@ minetest.register_craftitem("tsm_pyramids:spawn_egg", {
stack_max = 99,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type == "node" then
minetest.env:add_entity(pointed_thing.above,"tsm_pyramids:mummy")
minetest.add_entity(pointed_thing.above,"tsm_pyramids:mummy")
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
return itemstack
end
@ -329,7 +329,7 @@ minetest.register_craftitem("tsm_pyramids:spawn_egg", {
function pyramids.spawn_mummy (pos, number)
for i=0,number do
minetest.env:add_entity(pos,"tsm_pyramids:mummy")
minetest.add_entity(pos,"tsm_pyramids:mummy")
end
end
@ -351,10 +351,10 @@ minetest.register_node("tsm_pyramids:spawner_mummy", {
drop = "",
on_construct = function(pos)
pos.y = pos.y - 0.28
minetest.env:add_entity(pos,"tsm_pyramids:mummy_spawner")
minetest.add_entity(pos,"tsm_pyramids:mummy_spawner")
end,
on_destruct = function(pos)
for _,obj in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
if not obj:is_player() then
if obj ~= nil and obj:get_luaentity().m_name == "dummy" then
obj:remove()
@ -372,7 +372,7 @@ if not minetest.setting_getbool("only_peaceful_mobs") then
action = function(pos, node, active_object_count, active_object_count_wider)
local player_near = false
local mobs = 0
for _,obj in ipairs(minetest.env:get_objects_inside_radius(pos, spawner_range)) do
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, spawner_range)) do
if obj:is_player() then
player_near = true
else
@ -385,7 +385,7 @@ if not minetest.setting_getbool("only_peaceful_mobs") then
if mobs < spawner_max_mobs then
pos.x = pos.x+1
local p = minetest.find_node_near(pos, 5, {"air"})
minetest.env:add_entity(p,"tsm_pyramids:mummy")
minetest.add_entity(p,"tsm_pyramids:mummy")
end
end
end

View File

@ -26,7 +26,7 @@ for i=1,3 do
end
local trap_on_timer = function (pos, elapsed)
local objs = minetest.env:get_objects_inside_radius(pos, 2)
local objs = minetest.get_objects_inside_radius(pos, 2)
for i, obj in pairs(objs) do
if obj:is_player() then
local n = minetest.get_node(pos)
@ -49,7 +49,7 @@ minetest.register_node("tsm_pyramids:trap", {
groups = {crumbly=3,cracky=3},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
minetest.env:get_node_timer(pos):start(0.1)
minetest.get_node_timer(pos):start(0.1)
end,
_tsm_pyramids_crack = 1,
on_timer = trap_on_timer,