2017-07-05 04:15:46 +03:00
|
|
|
--###################
|
|
|
|
--################### ENDERDRAGON
|
|
|
|
--###################
|
|
|
|
|
2019-03-07 22:43:39 +03:00
|
|
|
local S = minetest.get_translator("mobs_mc")
|
2017-07-05 04:15:46 +03:00
|
|
|
|
|
|
|
mobs:register_mob("mobs_mc:enderdragon", {
|
|
|
|
type = "monster",
|
|
|
|
pathfinding = 1,
|
|
|
|
attacks_animals = true,
|
|
|
|
walk_chance = 100,
|
|
|
|
hp_max = 200,
|
|
|
|
hp_min = 200,
|
|
|
|
collisionbox = {-2, 3, -2, 2, 5, 2},
|
|
|
|
physical = false,
|
|
|
|
visual = "mesh",
|
|
|
|
mesh = "mobs_mc_dragon.b3d",
|
|
|
|
textures = {
|
|
|
|
{"mobs_mc_dragon.png"},
|
|
|
|
},
|
|
|
|
visual_size = {x=3, y=3},
|
|
|
|
view_range = 35,
|
|
|
|
walk_velocity = 6,
|
|
|
|
run_velocity = 6,
|
|
|
|
sounds = {
|
2018-09-14 17:27:58 +03:00
|
|
|
-- TODO: more sounds
|
2017-07-05 04:15:46 +03:00
|
|
|
shoot_attack = "mobs_mc_ender_dragon_shoot",
|
|
|
|
attack = "mobs_mc_ender_dragon_attack",
|
|
|
|
distance = 60,
|
|
|
|
},
|
|
|
|
physical = true,
|
|
|
|
damage = 10,
|
|
|
|
jump = true,
|
|
|
|
jump_height = 14,
|
|
|
|
stepheight = 1.2,
|
|
|
|
jump_chance = 100,
|
|
|
|
fly = true,
|
|
|
|
fly_in = {"air"},
|
|
|
|
dogshoot_switch = 1,
|
|
|
|
dogshoot_count_max =5,
|
|
|
|
dogshoot_count2_max = 5,
|
|
|
|
passive = false,
|
|
|
|
attack_animals = true,
|
|
|
|
drops = {
|
|
|
|
{name = mobs_mc.items.dragon_egg,
|
|
|
|
chance = 1,
|
|
|
|
min = 1,
|
|
|
|
max = 1},
|
|
|
|
},
|
|
|
|
lava_damage = 0,
|
2019-10-02 19:43:48 +03:00
|
|
|
fire_damage = 0,
|
2017-07-05 04:15:46 +03:00
|
|
|
on_rightclick = nil,
|
|
|
|
attack_type = "dogshoot",
|
|
|
|
arrow = "mobs_mc:fireball2",
|
|
|
|
shoot_interval = 0.5,
|
|
|
|
shoot_offset = -1,
|
|
|
|
animation = {
|
|
|
|
fly_speed = 8, stand_speed = 8,
|
|
|
|
stand_start = 0, stand_end = 20,
|
|
|
|
walk_start = 0, walk_end = 20,
|
|
|
|
run_start = 0, run_end = 20,
|
|
|
|
},
|
2018-05-30 12:34:17 +03:00
|
|
|
|
|
|
|
ignores_nametag = true,
|
2017-07-05 04:15:46 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
|
2018-03-25 23:27:06 +03:00
|
|
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
2017-07-05 04:15:46 +03:00
|
|
|
|
|
|
|
mobs:register_arrow("mobs_mc:roar_of_the_dragon2", {
|
|
|
|
visual = "sprite",
|
|
|
|
visual_size = {x = 1, y = 1},
|
|
|
|
--textures = {"transparent.png"},
|
|
|
|
textures = {"mese_egg.png"},
|
|
|
|
velocity = 10,
|
|
|
|
|
|
|
|
on_step = function(self, dtime)
|
|
|
|
|
2019-02-01 08:33:07 +03:00
|
|
|
local pos = self.object:get_pos()
|
2017-07-05 04:15:46 +03:00
|
|
|
|
2017-07-12 23:09:37 +03:00
|
|
|
local n = minetest.get_node(pos).name
|
2017-07-05 04:15:46 +03:00
|
|
|
|
|
|
|
if self.timer == 0 then
|
|
|
|
self.timer = os.time()
|
|
|
|
end
|
|
|
|
|
|
|
|
if os.time() - self.timer > 8 or minetest.is_protected(pos, "") then
|
|
|
|
self.object:remove()
|
|
|
|
end
|
|
|
|
|
2017-07-12 23:09:37 +03:00
|
|
|
local objects = minetest.get_objects_inside_radius(pos, 1)
|
2017-07-05 04:15:46 +03:00
|
|
|
for _,obj in ipairs(objects) do
|
2017-08-18 22:58:20 +03:00
|
|
|
local name = self.name
|
2017-07-05 04:15:46 +03:00
|
|
|
if name~="mobs_mc:roar_of_the_dragon2" and name ~= "mobs_mc:enderdragon" then
|
2019-03-08 22:22:01 +03:00
|
|
|
obj:set_hp(obj:get_hp()-5)
|
2017-07-05 04:15:46 +03:00
|
|
|
if (obj:get_hp() <= 0) then
|
|
|
|
if (not obj:is_player()) and name ~= self.object:get_luaentity().name then
|
|
|
|
obj:remove()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-25 23:27:06 +03:00
|
|
|
if mobs_griefing then
|
|
|
|
minetest.set_node(pos, {name="air"})
|
|
|
|
if math.random(1,2)==1 then
|
|
|
|
local dx = math.random(-1,1)
|
|
|
|
local dy = math.random(-1,1)
|
|
|
|
local dz = math.random(-1,1)
|
|
|
|
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
|
|
|
minetest.set_node(p, {name="air"})
|
|
|
|
end
|
2017-07-05 04:15:46 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
--GOOD LUCK LOL!
|
|
|
|
-- fireball (weapon)
|
|
|
|
mobs:register_arrow(":mobs_mc:fireball2", {
|
|
|
|
visual = "sprite",
|
|
|
|
visual_size = {x = 1.5, y = 1.5},
|
2017-07-12 23:09:37 +03:00
|
|
|
textures = {"mobs_mc_dragon_fireball.png"},
|
2017-07-05 04:15:46 +03:00
|
|
|
--textures = {"mobs_skeleton2_front.png^[makealpha:255,255,255 "},
|
|
|
|
velocity = 6,
|
|
|
|
|
|
|
|
-- direct hit, no fire... just plenty of pain
|
|
|
|
hit_player = function(self, player)
|
2019-02-01 08:33:07 +03:00
|
|
|
minetest.sound_play("tnt_explode", {pos = player:get_pos(), gain = 1.5, max_hear_distance = 2*64})
|
2017-07-05 04:15:46 +03:00
|
|
|
player:punch(self.object, 1.0, {
|
|
|
|
full_punch_interval = 0.5,
|
|
|
|
damage_groups = {fleshy = 6},
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
2017-08-06 15:09:25 +03:00
|
|
|
hit_mob = function(self, mob)
|
2019-02-01 08:33:07 +03:00
|
|
|
minetest.sound_play("tnt_explode", {pos = mob:get_pos(), gain = 1.5, max_hear_distance = 2*64})
|
2017-08-06 15:09:25 +03:00
|
|
|
mob:punch(self.object, 1.0, {
|
2017-07-05 04:15:46 +03:00
|
|
|
full_punch_interval = 0.5,
|
|
|
|
damage_groups = {fleshy = 12},
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- node hit, bursts into flame
|
|
|
|
hit_node = function(self, pos, node)
|
2017-07-12 23:09:37 +03:00
|
|
|
mobs:explosion(pos, 3, 0, 1)
|
2017-07-05 04:15:46 +03:00
|
|
|
--from tnt
|
|
|
|
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64})
|
|
|
|
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
mobs:register_egg("mobs_mc:enderdragon", S("Ender Dragon"), "mobs_mc_spawn_icon_dragon.png", 0)
|