Tweaked some parameters
This commit is contained in:
parent
4d579b2220
commit
d22f270e23
@ -102,7 +102,18 @@ minetest.register_entity("nssm:mortick", {
|
||||
visual = "mesh",
|
||||
mesh = "mortick.x",
|
||||
visual_size = {x=3, y=3},
|
||||
lifetime = 10,
|
||||
damage = 1,
|
||||
on_step = function(self, dtime)
|
||||
self.mortick_timer = self.mortick_timer or os.time()
|
||||
self.timer = self.timer or 0
|
||||
self.timer = self.timer+dtime
|
||||
|
||||
if (os.time()-self.mortick_timer > self.lifetime) then
|
||||
self.object:remove()
|
||||
end
|
||||
|
||||
--Find player to attack:
|
||||
self.attack = (self.attack or 0)
|
||||
local s = self.object:getpos()
|
||||
local objects = minetest.env:get_objects_inside_radius(s, 8)
|
||||
@ -111,6 +122,8 @@ minetest.register_entity("nssm:mortick", {
|
||||
self.attack = obj
|
||||
end
|
||||
end
|
||||
|
||||
--If found a player follow him
|
||||
if self.attack ~= 0 then
|
||||
local p = self.attack:getpos()
|
||||
local yawp = self.attack:get_look_yaw()
|
||||
@ -123,9 +136,15 @@ minetest.register_entity("nssm:mortick", {
|
||||
local v = {x=-(s.x-p.x)*m, y=-(s.y-p.y)*m, z=-(s.z-p.z)*m}
|
||||
local yaws = yawp +pi
|
||||
|
||||
--stay attached to players back:
|
||||
self.object:setvelocity(v)
|
||||
--self.object:setpos(p)
|
||||
self.object:setyaw(yaws)
|
||||
|
||||
--damage player every second:
|
||||
if (self.timer>1) then
|
||||
self.timer = 0
|
||||
self.attack:set_hp(self.attack:get_hp() - self.damage)
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -43,8 +43,10 @@ mobs:register_mob("nssm:morvy", {
|
||||
},
|
||||
|
||||
custom_attack = function(self)
|
||||
set_animation(self, "stand")
|
||||
self.morvy_counter = (self.morvy_counter or 0) + 1
|
||||
if self.morvy_counter == 4 then
|
||||
set_animation(self, "punch")
|
||||
self.morvy_counter = 0
|
||||
local counter = 0
|
||||
|
||||
@ -73,6 +75,19 @@ mobs:register_mob("nssm:morvy", {
|
||||
if (minetest.env:get_node(pos1).name == "air")
|
||||
and (counter < 5)
|
||||
then
|
||||
local bat
|
||||
local which = math.random(1,3)
|
||||
if which == 1 then
|
||||
bat = "nssm:morbat1"
|
||||
elseif which == 2 then
|
||||
bat = "nssm:morbat2"
|
||||
elseif which == 3 then
|
||||
bat = "nssm:morbat3"
|
||||
end
|
||||
if (bat=="nssm:morbat3") then
|
||||
pos1.y=pos1.y+1.5
|
||||
end
|
||||
minetest.add_entity(pos1, bat)
|
||||
minetest.add_particlespawner(
|
||||
20, --amount
|
||||
0.1, --time
|
||||
@ -89,17 +104,6 @@ mobs:register_mob("nssm:morvy", {
|
||||
false, --collisiondetection
|
||||
"morparticle.png" --texture
|
||||
)
|
||||
|
||||
local bat
|
||||
local which = math.random(1,3)
|
||||
if which == 1 then
|
||||
bat = "nssm:morbat1"
|
||||
elseif which == 2 then
|
||||
bat = "nssm:morbat2"
|
||||
elseif which == 3 then
|
||||
bat = "nssm:morbat3"
|
||||
end
|
||||
minetest.add_entity(pos1, bat)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user