2017-07-05 03:15:46 +02:00
|
|
|
--MCmobs v0.4
|
|
|
|
--maikerumine
|
|
|
|
--made for MC like Survival game
|
|
|
|
--License for code WTFPL and otherwise stated in readmes
|
|
|
|
|
2019-03-07 20:43:39 +01:00
|
|
|
local S = minetest.get_translator("mobs_mc")
|
2017-07-05 03:15:46 +02:00
|
|
|
|
|
|
|
--###################
|
|
|
|
--################### WITHER
|
|
|
|
--###################
|
|
|
|
|
|
|
|
mobs:register_mob("mobs_mc:wither", {
|
|
|
|
type = "monster",
|
|
|
|
hp_max = 300,
|
|
|
|
hp_min = 300,
|
|
|
|
armor = 80,
|
|
|
|
-- This deviates from MC Wiki's size, which makes no sense
|
|
|
|
collisionbox = {-0.9, 0.4, -0.9, 0.9, 2.45, 0.9},
|
|
|
|
visual = "mesh",
|
|
|
|
mesh = "mobs_mc_wither.b3d",
|
|
|
|
textures = {
|
|
|
|
{"mobs_mc_wither.png"},
|
|
|
|
},
|
|
|
|
visual_size = {x=4, y=4},
|
|
|
|
makes_footstep_sound = true,
|
|
|
|
view_range = 16,
|
|
|
|
fear_height = 4,
|
|
|
|
walk_velocity = 2,
|
|
|
|
run_velocity = 4,
|
|
|
|
stepheight = 1.2,
|
|
|
|
sounds = {
|
|
|
|
shoot_attack = "mobs_mc_ender_dragon_shoot",
|
|
|
|
attack = "mobs_mc_ender_dragon_attack",
|
2018-09-14 16:27:58 +02:00
|
|
|
-- TODO: sounds
|
2017-07-05 03:15:46 +02:00
|
|
|
distance = 60,
|
|
|
|
},
|
|
|
|
jump = true,
|
|
|
|
jump_height = 10,
|
|
|
|
jump_chance = 98,
|
|
|
|
fly = true,
|
|
|
|
dogshoot_switch = 1,
|
|
|
|
dogshoot_count_max =1,
|
|
|
|
attack_animals = true,
|
|
|
|
floats=1,
|
|
|
|
drops = {
|
|
|
|
{name = mobs_mc.items.nether_star,
|
|
|
|
chance = 1,
|
|
|
|
min = 1,
|
|
|
|
max = 1},
|
|
|
|
},
|
|
|
|
water_damage = 0,
|
|
|
|
lava_damage = 0,
|
|
|
|
light_damage = 0,
|
|
|
|
attack_type = "dogshoot",
|
|
|
|
explosion_radius = 3,
|
2017-07-12 22:09:37 +02:00
|
|
|
explosion_fire = false,
|
2017-07-05 03:15:46 +02:00
|
|
|
dogshoot_stop = true,
|
|
|
|
arrow = "mobs_mc:fireball",
|
|
|
|
reach = 5,
|
|
|
|
shoot_interval = 0.5,
|
|
|
|
shoot_offset = -1,
|
|
|
|
animation = {
|
|
|
|
walk_speed = 12, run_speed = 12, stand_speed = 12,
|
|
|
|
stand_start = 0, stand_end = 20,
|
|
|
|
walk_start = 0, walk_end = 20,
|
|
|
|
run_start = 0, run_end = 20,
|
|
|
|
},
|
|
|
|
blood_amount = 0,
|
|
|
|
})
|
|
|
|
|
2018-03-25 22:27:06 +02:00
|
|
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
|
|
|
|
2017-07-05 03:15:46 +02:00
|
|
|
mobs:register_arrow("mobs_mc:roar_of_the_dragon", {
|
|
|
|
visual = "sprite",
|
|
|
|
visual_size = {x = 1, y = 1},
|
|
|
|
textures = {"blank.png"},
|
|
|
|
velocity = 10,
|
|
|
|
|
|
|
|
on_step = function(self, dtime)
|
|
|
|
|
2019-02-01 06:33:07 +01:00
|
|
|
local pos = self.object:get_pos()
|
2017-07-05 03:15:46 +02:00
|
|
|
|
2017-07-12 22:09:37 +02:00
|
|
|
local n = minetest.get_node(pos).name
|
2017-07-05 03:15:46 +02: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 22:09:37 +02:00
|
|
|
local objects = minetest.get_objects_inside_radius(pos, 1)
|
2017-07-05 03:15:46 +02:00
|
|
|
for _,obj in ipairs(objects) do
|
2017-08-18 21:58:20 +02:00
|
|
|
local name = self.name
|
2017-07-05 03:15:46 +02:00
|
|
|
if name~="mobs_mc:roar_of_the_dragon" and name ~= "mobs_mc:wither" then
|
|
|
|
obj:set_hp(obj:get_hp()-0.05)
|
|
|
|
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 22:27:06 +02: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 03:15:46 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
--GOOD LUCK LOL!
|
|
|
|
-- fireball (weapon)
|
|
|
|
mobs:register_arrow(":mobs_mc:fireball", {
|
|
|
|
visual = "sprite",
|
2017-07-12 22:09:37 +02:00
|
|
|
visual_size = {x = 0.75, y = 0.75},
|
|
|
|
-- TODO: 3D projectile, replace tetxture
|
|
|
|
textures = {"mobs_mc_TEMP_wither_projectile.png"},
|
2017-07-05 03:15:46 +02:00
|
|
|
velocity = 6,
|
|
|
|
|
|
|
|
-- direct hit, no fire... just plenty of pain
|
|
|
|
hit_player = function(self, player)
|
2019-02-08 22:44:26 +01:00
|
|
|
minetest.sound_play("tnt_explode", {pos = player:get_pos(), gain = 1.5, max_hear_distance = 16})
|
2017-07-05 03:15:46 +02:00
|
|
|
player:punch(self.object, 1.0, {
|
|
|
|
full_punch_interval = 0.5,
|
|
|
|
damage_groups = {fleshy = 8},
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
2019-02-08 22:44:26 +01:00
|
|
|
hit_mob = function(self, mob)
|
|
|
|
minetest.sound_play("tnt_explode", {pos = mob:get_pos(), gain = 1.5,max_hear_distance = 16})
|
2017-07-05 03:15:46 +02:00
|
|
|
player:punch(self.object, 1.0, {
|
|
|
|
full_punch_interval = 0.5,
|
|
|
|
damage_groups = {fleshy = 8},
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- node hit, bursts into flame
|
|
|
|
hit_node = function(self, pos, node)
|
2017-08-06 14:09:25 +02:00
|
|
|
-- FIXME: Deprecated, switch to mobs:boom instead
|
2017-07-05 03:15:46 +02:00
|
|
|
mobs:explosion(pos, 3, 0, 1)
|
|
|
|
end
|
|
|
|
})
|
|
|
|
--Spawn egg
|
|
|
|
mobs:register_egg("mobs_mc:wither", S("Wither"), "mobs_mc_spawn_icon_wither.png", 0)
|
|
|
|
|
|
|
|
--Compatibility
|
|
|
|
mobs:alias_mob("nssm:mese_dragon", "mobs_mc:wither")
|