nssm/mobs/pumpking.lua

89 lines
2.1 KiB
Lua
Raw Normal View History

2016-05-13 14:35:07 -07:00
mobs:register_mob("nssm:pumpking", {
2016-02-22 07:53:56 -08:00
type = "monster",
2016-10-18 14:29:25 -07:00
hp_max = 220,
hp_min = 220,
2016-02-22 07:53:56 -08:00
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},
makes_footstep_sound = true,
lifetimer=500,
rotate=270,
2016-03-15 11:59:39 -07:00
fear_height = 4,
2016-02-22 07:53:56 -08:00
view_range = 35,
walk_velocity = 2,
run_velocity = 4,
sounds = {
random = "king",
explode = "tnt_explode",
},
2016-10-18 14:29:25 -07:00
damage = 13,
2016-02-22 07:53:56 -08:00
jump = true,
drops = {
{name = "nssm:life_energy",
chance = 1,
min = 7,
max = 9,},
2016-05-01 06:53:49 -07:00
{name = "nssm:cursed_pumpkin_seed",
chance = 1,
min = 1,
max = 1,},
2016-10-31 02:48:53 -07:00
{name = "nssm:black_powder",
chance = 1,
min = 9,
max = 12,},
2016-02-22 07:53:56 -08:00
},
2016-10-18 14:29:25 -07:00
armor =40,
2016-02-22 07:53:56 -08:00
drawtype = "front",
water_damage = 2,
lava_damage = 5,
light_damage = 0,
2016-11-08 13:01:47 -08:00
blood_texture="nssm_blood.png",
2016-11-12 06:42:48 -08:00
blood_amount=25,
2016-11-08 13:01:47 -08:00
stepheight=2.1,
knock_back=0,
jump_height=12,
2016-02-22 07:53:56 -08:00
on_rightclick = nil,
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,
2016-02-22 07:53:56 -08:00
speed_normal = 15, speed_run = 15,
},
on_die=function(self,pos)
self.object:remove()
2016-11-12 06:42:48 -08:00
minetest.after(0.2, function(pos)
tnt.boom(pos, {damage_radius=5,radius=4,ignore_protection=false})
end, pos)
2016-04-25 12:46:45 -07:00
end,
custom_attack = function(self)
2016-11-10 12:43:27 -08:00
self.pumpking_timer = (self.pumpking_timer or os.time())
if (os.time() - self.pumpking_timer) >3 then
2016-11-12 06:42:48 -08:00
set_animation(self, "punch")
2016-11-10 12:43:27 -08:00
self.pumpking_timer = os.time()
2016-04-25 12:46:45 -07:00
local s = self.object:getpos()
local p = self.attack:getpos()
p.y = p.y + 1.5
s.y = s.y + 1.5
if minetest.line_of_sight(p, s) == true then
-- 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)}
2016-11-12 06:42:48 -08:00
minetest.after(1, function(pos1)
minetest.set_node(pos1, {name="nssm:pumpbomb"})
minetest.get_node_timer(pos1):start(2)
end,
pos1)
2016-04-25 12:46:45 -07:00
end
end
2016-02-22 07:53:56 -08:00
end
})