Rename deprecated functions
This commit is contained in:
parent
3c0d699fd1
commit
d86a85340c
4
init.lua
4
init.lua
|
@ -45,7 +45,7 @@ end
|
||||||
|
|
||||||
local function add_spawner(pos)
|
local function add_spawner(pos)
|
||||||
minetest.set_node(pos, {name="tsm_pyramids:spawner_mummy"})
|
minetest.set_node(pos, {name="tsm_pyramids:spawner_mummy"})
|
||||||
if not minetest.setting_getbool("only_peaceful_mobs") then tsm_pyramids.spawn_mummy({x=pos.x,y=pos.y,z=pos.z-2},2) end
|
if not minetest.settings:get_bool("only_peaceful_mobs") then tsm_pyramids.spawn_mummy({x=pos.x,y=pos.y,z=pos.z-2},2) end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function can_replace(pos)
|
local function can_replace(pos)
|
||||||
|
@ -141,7 +141,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
if not perlin1 then
|
if not perlin1 then
|
||||||
perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
|
perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
|
||||||
end
|
end
|
||||||
local noise1 = perlin1:get2d({x=minp.x,y=minp.y})--,z=minp.z})
|
local noise1 = perlin1:get_2d({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
|
||||||
local mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)}
|
local mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)}
|
||||||
|
|
46
mummy.lua
46
mummy.lua
|
@ -106,15 +106,15 @@ local spawner_DEF = {
|
||||||
|
|
||||||
spawner_DEF.on_activate = function(self)
|
spawner_DEF.on_activate = function(self)
|
||||||
mummy_update_visuals_def(self)
|
mummy_update_visuals_def(self)
|
||||||
self.object:setvelocity({x=0, y=0, z=0})
|
self.object:set_velocity({x=0, y=0, z=0})
|
||||||
self.object:setacceleration({x=0, y=0, z=0})
|
self.object:set_acceleration({x=0, y=0, z=0})
|
||||||
self.object:set_armor_groups({immortal=1})
|
self.object:set_armor_groups({immortal=1})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
spawner_DEF.on_step = function(self, dtime)
|
spawner_DEF.on_step = function(self, dtime)
|
||||||
self.timer = self.timer + 0.01
|
self.timer = self.timer + 0.01
|
||||||
local n = minetest.get_node_or_nil(self.object:getpos())
|
local n = minetest.get_node_or_nil(self.object:get_pos())
|
||||||
if self.timer > 1 then
|
if self.timer > 1 then
|
||||||
if n and n.name and n.name ~= "tsm_pyramids:spawner_mummy" then
|
if n and n.name and n.name ~= "tsm_pyramids:spawner_mummy" then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
@ -131,7 +131,7 @@ MUMMY_DEF.on_activate = function(self)
|
||||||
self.anim = get_animations()
|
self.anim = get_animations()
|
||||||
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, mummy_animation_speed, mummy_animation_blend)
|
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, mummy_animation_speed, mummy_animation_blend)
|
||||||
self.npc_anim = ANIM_STAND
|
self.npc_anim = ANIM_STAND
|
||||||
self.object:setacceleration({x=0,y=-20,z=0})--20
|
self.object:set_acceleration({x=0,y=-20,z=0})--20
|
||||||
self.state = 1
|
self.state = 1
|
||||||
self.object:set_hp(mummy_hp)
|
self.object:set_hp(mummy_hp)
|
||||||
self.object:set_armor_groups({fleshy=130})
|
self.object:set_armor_groups({fleshy=130})
|
||||||
|
@ -147,9 +147,9 @@ MUMMY_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabili
|
||||||
minetest.sound_play(sound, {to_player = puncher:get_player_name(), loop = false, gain = 0.3})
|
minetest.sound_play(sound, {to_player = puncher:get_player_name(), loop = false, gain = 0.3})
|
||||||
if time_from_last_punch >= 0.45 then
|
if time_from_last_punch >= 0.45 then
|
||||||
hit(self)
|
hit(self)
|
||||||
self.direction = {x=self.object:getvelocity().x, y=self.object:getvelocity().y, z=self.object:getvelocity().z}
|
self.direction = {x=self.object:get_velocity().x, y=self.object:get_velocity().y, z=self.object:get_velocity().z}
|
||||||
self.punch_timer = 0
|
self.punch_timer = 0
|
||||||
self.object:setvelocity({x=dir.x*mummy_chillaxin_speed,y=5,z=dir.z*mummy_chillaxin_speed})
|
self.object:set_velocity({x=dir.x*mummy_chillaxin_speed,y=5,z=dir.z*mummy_chillaxin_speed})
|
||||||
if self.state == 1 then
|
if self.state == 1 then
|
||||||
self.state = 8
|
self.state = 8
|
||||||
elseif self.state >= 2 then
|
elseif self.state >= 2 then
|
||||||
|
@ -159,7 +159,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.add_item(self.object:getpos(), mummy_drop.." "..math.random(0,3))
|
local obj = minetest.add_item(self.object:get_pos(), mummy_drop.." "..math.random(0,3))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ MUMMY_DEF.on_step = function(self, dtime)
|
||||||
self.attacking_timer = self.attacking_timer + 0.01
|
self.attacking_timer = self.attacking_timer + 0.01
|
||||||
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:get_pos()
|
||||||
local current_node = minetest.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
|
||||||
|
@ -216,10 +216,10 @@ MUMMY_DEF.on_step = function(self, dtime)
|
||||||
if self.state >= 8 then
|
if self.state >= 8 then
|
||||||
if self.punch_timer > 0.15 then
|
if self.punch_timer > 0.15 then
|
||||||
if self.state == 9 then
|
if self.state == 9 then
|
||||||
self.object:setvelocity({x=self.direction.x*mummy_chillaxin_speed,y=-20,z=self.direction.z*mummy_chillaxin_speed})
|
self.object:set_velocity({x=self.direction.x*mummy_chillaxin_speed,y=-20,z=self.direction.z*mummy_chillaxin_speed})
|
||||||
self.state = 2
|
self.state = 2
|
||||||
elseif self.state == 8 then
|
elseif self.state == 8 then
|
||||||
self.object:setvelocity({x=0,y=-20,z=0})
|
self.object:set_velocity({x=0,y=-20,z=0})
|
||||||
self.state = 1
|
self.state = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -229,29 +229,29 @@ 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.get_objects_inside_radius(self.object:getpos(), 4)) do
|
for _,object in ipairs(minetest.get_objects_inside_radius(self.object:get_pos(), 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:get_pos()
|
||||||
local PLAYER = object:getpos()
|
local PLAYER = object:get_pos()
|
||||||
self.vec = {x=PLAYER.x-NPC.x, y=PLAYER.y-NPC.y, z=PLAYER.z-NPC.z}
|
self.vec = {x=PLAYER.x-NPC.x, y=PLAYER.y-NPC.y, z=PLAYER.z-NPC.z}
|
||||||
self.yaw = math.atan(self.vec.z/self.vec.x)+math.pi^2
|
self.yaw = math.atan(self.vec.z/self.vec.x)+math.pi^2
|
||||||
if PLAYER.x > NPC.x then
|
if PLAYER.x > NPC.x then
|
||||||
self.yaw = self.yaw + math.pi
|
self.yaw = self.yaw + math.pi
|
||||||
end
|
end
|
||||||
self.yaw = self.yaw - 2
|
self.yaw = self.yaw - 2
|
||||||
self.object:setyaw(self.yaw)
|
self.object:set_yaw(self.yaw)
|
||||||
self.attacker = object
|
self.attacker = object
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.attacker == "" and self.turn_timer > math.random(1,4) then
|
if self.attacker == "" and self.turn_timer > math.random(1,4) then
|
||||||
self.yaw = 360 * math.random()
|
self.yaw = 360 * math.random()
|
||||||
self.object:setyaw(self.yaw)
|
self.object:set_yaw(self.yaw)
|
||||||
self.turn_timer = 0
|
self.turn_timer = 0
|
||||||
self.direction = {x = math.sin(self.yaw)*-1, y = -20, z = math.cos(self.yaw)}
|
self.direction = {x = math.sin(self.yaw)*-1, y = -20, z = math.cos(self.yaw)}
|
||||||
end
|
end
|
||||||
self.object:setvelocity({x=0,y=self.object:getvelocity().y,z=0})
|
self.object:set_velocity({x=0,y=self.object:get_velocity().y,z=0})
|
||||||
if self.npc_anim ~= ANIM_STAND then
|
if self.npc_anim ~= ANIM_STAND then
|
||||||
self.anim = get_animations()
|
self.anim = get_animations()
|
||||||
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, mummy_animation_speed, mummy_animation_blend)
|
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, mummy_animation_speed, mummy_animation_blend)
|
||||||
|
@ -266,11 +266,11 @@ MUMMY_DEF.on_step = function(self, dtime)
|
||||||
if self.state == 2 then
|
if self.state == 2 then
|
||||||
|
|
||||||
if self.direction ~= nil then
|
if self.direction ~= nil then
|
||||||
self.object:setvelocity({x=self.direction.x*mummy_chillaxin_speed,y=self.object:getvelocity().y,z=self.direction.z*mummy_chillaxin_speed})
|
self.object:set_velocity({x=self.direction.x*mummy_chillaxin_speed,y=self.object:get_velocity().y,z=self.direction.z*mummy_chillaxin_speed})
|
||||||
end
|
end
|
||||||
if self.turn_timer > math.random(1,4) and not self.attacker then
|
if self.turn_timer > math.random(1,4) and not self.attacker then
|
||||||
self.yaw = 360 * math.random()
|
self.yaw = 360 * math.random()
|
||||||
self.object:setyaw(self.yaw)
|
self.object:set_yaw(self.yaw)
|
||||||
self.turn_timer = 0
|
self.turn_timer = 0
|
||||||
self.direction = {x = math.sin(self.yaw)*-1, y = -20, z = math.cos(self.yaw)}
|
self.direction = {x = math.sin(self.yaw)*-1, y = -20, z = math.cos(self.yaw)}
|
||||||
end
|
end
|
||||||
|
@ -280,9 +280,9 @@ MUMMY_DEF.on_step = function(self, dtime)
|
||||||
self.npc_anim = ANIM_WALK
|
self.npc_anim = ANIM_WALK
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.attacker ~= "" and minetest.setting_getbool("enable_damage") then
|
if self.attacker ~= "" and minetest.settings:get_bool("enable_damage") then
|
||||||
local s = self.object:getpos()
|
local s = self.object:get_pos()
|
||||||
local p = self.attacker:getpos()
|
local p = self.attacker:get_pos()
|
||||||
if (s ~= nil and p ~= nil) then
|
if (s ~= nil and p ~= nil) then
|
||||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ minetest.register_craftitem("tsm_pyramids:spawn_egg", {
|
||||||
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.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.settings:get_bool("creative_mode") then itemstack:take_item() end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -358,7 +358,7 @@ minetest.register_node("tsm_pyramids:spawner_mummy", {
|
||||||
end,
|
end,
|
||||||
sounds = spawnersounds,
|
sounds = spawnersounds,
|
||||||
})
|
})
|
||||||
if not minetest.setting_getbool("only_peaceful_mobs") then
|
if not minetest.settings:get_bool("only_peaceful_mobs") then
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"tsm_pyramids:spawner_mummy"},
|
nodenames = {"tsm_pyramids:spawner_mummy"},
|
||||||
interval = 2.0,
|
interval = 2.0,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user