nssm/mobs/pumpking.lua

98 lines
2.1 KiB
Lua
Raw Normal View History

2018-08-08 12:56:14 +03:00
mobs:register_mob("nssm:pumpking", {
type = "monster",
hp_max = 220,
hp_min = 220,
collisionbox = {-0.4, 0.00, -0.4, 0.4, 3.2, 0.4},
visual = "mesh",
mesh = "pumpking.x",
textures = {
{"pumpking.png"}
},
visual_size = {x = 2.5, y = 2.5},
2018-08-08 12:56:14 +03:00
makes_footstep_sound = true,
lifetimer = 500,
rotate = 270,
2018-08-08 12:56:14 +03:00
fear_height = 4,
view_range = 35,
walk_velocity = 2,
run_velocity = 4,
2018-08-09 13:57:31 +03:00
sounds = {
2018-08-08 12:56:14 +03:00
random = "king",
explode = "tnt_explode",
},
damage = 13,
jump = true,
drops = {
{name = "nssm:life_energy", chance = 1, min = 7, max = 9},
{name = "nssm:cursed_pumpkin_seed", chance = 1, min = 1, max = 1},
{name = "nssm:black_powder", chance = 1, min = 9, max = 12},
2018-08-08 12:56:14 +03:00
},
armor = 40,
2018-08-08 12:56:14 +03:00
drawtype = "front",
water_damage = 2,
lava_damage = 5,
light_damage = 0,
blood_texture = "nssm_blood.png",
blood_amount = 25,
stepheight = 2.1,
knock_back = 0,
jump_height = 12,
2018-08-08 12:56:14 +03:00
attack_type = "dogfight",
animation = {
stand_start = 165, stand_end = 210,
walk_start = 220, walk_end = 260,
run_start = 220, run_end = 260,
punch_start = 300, punch_end = 330,
speed_normal = 15, speed_run = 15,
},
2018-08-08 12:56:14 +03:00
on_die=function(self,pos)
2018-08-08 12:56:14 +03:00
self.object:remove()
2018-08-08 12:56:14 +03:00
minetest.after(0.2, function(pos)
tnt.boom(pos, {damage_radius = 5, radius = 4, ignore_protection = false})
2018-08-08 12:56:14 +03:00
end, pos)
end,
2018-08-08 12:56:14 +03:00
custom_attack = function(self)
self.pumpking_timer = self.pumpking_timer or os.time()
if (os.time() - self.pumpking_timer) > 3 then
mobs:set_animation(self, "punch")
2018-08-08 12:56:14 +03:00
self.pumpking_timer = os.time()
2018-08-08 14:20:07 +03:00
local s = self.object:get_pos()
local p = self.attack:get_pos()
2018-08-08 12:56:14 +03:00
p.y = p.y + 1.5
s.y = s.y + 1.5
2018-08-08 12:56:14 +03:00
if minetest.line_of_sight(p, s) == true then
2018-08-08 12:56:14 +03:00
-- play attack sound
if self.sounds.attack then
minetest.sound_play(self.sounds.attack, {
object = self.object,
max_hear_distance = self.sounds.distance
})
end
local pos1 = {
x = s.x + math.random(-1, 1),
y = s.y - 1.5,
z = s.z + math.random(-1, 1)
}
2018-08-08 12:56:14 +03:00
minetest.after(1, function(pos1)
minetest.set_node(pos1, {name = "nssm:pumpbomb"})
2018-08-08 12:56:14 +03:00
minetest.get_node_timer(pos1):start(2)
end, pos1)
2018-08-08 12:56:14 +03:00
end
end
end
})