morvalar0 delay after announcing attack, fix call to unknown function, reduce attack period to 3sec

This commit is contained in:
Tai Kedzierski 2019-01-05 19:58:23 +00:00
parent b165e2d395
commit df7c6fd6df

View File

@ -775,9 +775,6 @@ mobs:register_mob("nssm:morvalar0", {
damage = 4, damage = 4,
runaway = true, runaway = true,
jump = true, jump = true,
sounds = {
random = "kamehameha",
},
drops = { drops = {
{name = "nssm:death_scythe", {name = "nssm:death_scythe",
chance = 1, chance = 1,
@ -813,21 +810,28 @@ mobs:register_mob("nssm:morvalar0", {
end, end,
custom_attack = function (self) custom_attack = function (self)
self.morvalar1_timer = (self.morvalar1_timer or os.time()) self.morvalar1_timer = (self.morvalar1_timer or os.time())
if (os.time() - self.morvalar1_timer) > 1 then if (os.time() - self.morvalar1_timer) > 3 then
self.morvalar1_timer = os.time() self.morvalar1_timer = os.time()
local s = self.object:getpos() minetest.sound_play("kamehameha", {
local p = self.attack:getpos() pos = self.object:getpos(),
gain = 1.0,
})
mobs:set_animation(self, "punch") minetest.after(1, function()
local s = self.object:getpos()
local p = self.attack:getpos()
local m = 5 --velocity of the kamehameha mobs:set_animation(self, "punch")
local obj = minetest.add_entity(s, "nssm:kamehameha_bad")
s.y = s.y+0.5 local m = 5 --velocity of the kamehameha
p.y = p.y+0.9 local obj = minetest.add_entity(s, "nssm:kamehameha_bad")
local dir = {x=(p.x-s.x)*m, y=(p.y-s.y)*m, z=(p.z-s.z)*m} --direction of the kamehameha
obj:setvelocity(dir) s.y = s.y+0.5
p.y = p.y+0.9
local dir = {x=(p.x-s.x)*m, y=(p.y-s.y)*m, z=(p.z-s.z)*m} --direction of the kamehameha
obj:setvelocity(dir)
end)
end end
end, end,
on_die = function(self) on_die = function(self)
@ -850,8 +854,6 @@ mobs:register_mob("nssm:morvalar0", {
vertical = false, vertical = false,
texture = "morparticle.png", texture = "morparticle.png",
}) })
minetest.set_node(posmorvalarblock, {name="nssb:dis_morvalar_block"})
--minetest.add_entity(pos, "nssm:morvalar3")
end, end,
}) })
@ -867,6 +869,7 @@ minetest.register_entity("nssm:kamehameha_bad", {
self.object:remove() self.object:remove()
end end
-- Damage things around the entity
local objects = minetest.env:get_objects_inside_radius(pos, 2) local objects = minetest.env:get_objects_inside_radius(pos, 2)
for _,obj in ipairs(objects) do for _,obj in ipairs(objects) do
if obj:is_player() then if obj:is_player() then
@ -885,27 +888,24 @@ minetest.register_entity("nssm:kamehameha_bad", {
end end
end end
end end
-- Explode things near to the entity
local objects = minetest.env:get_objects_inside_radius(pos, 1) local objects = minetest.env:get_objects_inside_radius(pos, 1)
for _,obj in ipairs(objects) do for _,obj in ipairs(objects) do
if obj:is_player() then if obj:is_player() then
tnt_boom_nssm(pos, {damage_radius=6,radius=5,ignore_protection=false}) tnt_boom_nssm(pos, {damage_radius=6,radius=5})
self.object:remove() self.object:remove()
--minetest.chat_send_all("Dentro il raggio piccolo") --minetest.chat_send_all("Dentro il raggio piccolo")
end end
if obj:get_luaentity() then if obj:get_luaentity() then
local name = obj:get_luaentity().name local name = obj:get_luaentity().name
if name ~= "nssm:morvalar0" and name ~="nssm:kamehameha_bad" then if name ~= "nssm:morvalar0" and name ~="nssm:kamehameha_bad" then
tnt_boom_nssm(pos, {damage_radius=6,radius=5,ignore_protection=false}) tnt_boom_nssm(pos, {damage_radius=6,radius=5})
self.object:remove() self.object:remove()
end end
end end
end end
local nodename = minetest.env:get_node(pos).name
if nodename ~= "air" then
explosion(pos, 5, 0, 1, true)
self.object:remove()
end
end, end,
life_time = 40, life_time = 40,
timer = 0, timer = 0,