mirror of
http://repo.or.cz/minetest_pyramids/tsm_pyramids.git
synced 2024-12-22 23:40:18 +01:00
Replace minetest.env with minetest
This commit is contained in:
parent
05bef9bf6e
commit
eb3590ce68
2
init.lua
2
init.lua
@ -138,7 +138,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
math.randomseed(seed)
|
math.randomseed(seed)
|
||||||
local cnt = 0
|
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})
|
local noise1 = perlin1:get2d({x=minp.x,y=minp.y})--,z=minp.z})
|
||||||
|
|
||||||
if noise1 > 0.25 or noise1 < -0.26 then
|
if noise1 > 0.25 or noise1 < -0.26 then
|
||||||
|
18
mummy.lua
18
mummy.lua
@ -165,7 +165,7 @@ MUMMY_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabili
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.object:get_hp() == 0 then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ MUMMY_DEF.on_step = function(self, dtime)
|
|||||||
self.sound_timer = self.sound_timer + 0.01
|
self.sound_timer = self.sound_timer + 0.01
|
||||||
|
|
||||||
local current_pos = self.object:getpos()
|
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
|
if self.time_passed == nil then
|
||||||
self.time_passed = 0
|
self.time_passed = 0
|
||||||
end
|
end
|
||||||
@ -235,7 +235,7 @@ MUMMY_DEF.on_step = function(self, dtime)
|
|||||||
if self.state == 1 then
|
if self.state == 1 then
|
||||||
self.yawwer = true
|
self.yawwer = true
|
||||||
self.attacker = ""
|
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
|
if object:is_player() then
|
||||||
self.yawwer = false
|
self.yawwer = false
|
||||||
local NPC = self.object:getpos()
|
local NPC = self.object:getpos()
|
||||||
@ -319,7 +319,7 @@ minetest.register_craftitem("tsm_pyramids:spawn_egg", {
|
|||||||
stack_max = 99,
|
stack_max = 99,
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
if pointed_thing.type == "node" then
|
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
|
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
@ -329,7 +329,7 @@ minetest.register_craftitem("tsm_pyramids:spawn_egg", {
|
|||||||
|
|
||||||
function pyramids.spawn_mummy (pos, number)
|
function pyramids.spawn_mummy (pos, number)
|
||||||
for i=0,number do
|
for i=0,number do
|
||||||
minetest.env:add_entity(pos,"tsm_pyramids:mummy")
|
minetest.add_entity(pos,"tsm_pyramids:mummy")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -351,10 +351,10 @@ minetest.register_node("tsm_pyramids:spawner_mummy", {
|
|||||||
drop = "",
|
drop = "",
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
pos.y = pos.y - 0.28
|
pos.y = pos.y - 0.28
|
||||||
minetest.env:add_entity(pos,"tsm_pyramids:mummy_spawner")
|
minetest.add_entity(pos,"tsm_pyramids:mummy_spawner")
|
||||||
end,
|
end,
|
||||||
on_destruct = function(pos)
|
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 not obj:is_player() then
|
||||||
if obj ~= nil and obj:get_luaentity().m_name == "dummy" then
|
if obj ~= nil and obj:get_luaentity().m_name == "dummy" then
|
||||||
obj:remove()
|
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)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local player_near = false
|
local player_near = false
|
||||||
local mobs = 0
|
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
|
if obj:is_player() then
|
||||||
player_near = true
|
player_near = true
|
||||||
else
|
else
|
||||||
@ -385,7 +385,7 @@ if not minetest.setting_getbool("only_peaceful_mobs") then
|
|||||||
if mobs < spawner_max_mobs then
|
if mobs < spawner_max_mobs then
|
||||||
pos.x = pos.x+1
|
pos.x = pos.x+1
|
||||||
local p = minetest.find_node_near(pos, 5, {"air"})
|
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
|
end
|
||||||
end
|
end
|
||||||
|
@ -26,7 +26,7 @@ for i=1,3 do
|
|||||||
end
|
end
|
||||||
|
|
||||||
local trap_on_timer = function (pos, elapsed)
|
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
|
for i, obj in pairs(objs) do
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
local n = minetest.get_node(pos)
|
local n = minetest.get_node(pos)
|
||||||
@ -49,7 +49,7 @@ minetest.register_node("tsm_pyramids:trap", {
|
|||||||
groups = {crumbly=3,cracky=3},
|
groups = {crumbly=3,cracky=3},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.env:get_node_timer(pos):start(0.1)
|
minetest.get_node_timer(pos):start(0.1)
|
||||||
end,
|
end,
|
||||||
_tsm_pyramids_crack = 1,
|
_tsm_pyramids_crack = 1,
|
||||||
on_timer = trap_on_timer,
|
on_timer = trap_on_timer,
|
||||||
|
Loading…
Reference in New Issue
Block a user