MineClone2/mods/ENTITIES/mobs_mc/wither.lua

121 lines
2.9 KiB
Lua
Raw Normal View History

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
local S = minetest.get_translator("mobs_mc")
2017-07-05 03:15:46 +02:00
--###################
--################### WITHER
--###################
mobs:register_mob("mobs_mc:wither", {
2021-04-25 17:30:15 +02:00
description = S("Wither"),
2017-07-05 03:15:46 +02:00
type = "monster",
2020-04-11 02:46:03 +02:00
spawn_class = "hostile",
2017-07-05 03:15:46 +02:00
hp_max = 300,
hp_min = 300,
2020-12-06 15:46:42 +01:00
xp_min = 50,
xp_max = 50,
2021-03-29 20:29:39 +02:00
armor = {undead = 80, fleshy = 100},
2017-07-05 03:15:46 +02:00
-- 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,
sounds = {
shoot_attack = "mobs_mc_ender_dragon_shoot",
attack = "mobs_mc_ender_dragon_attack",
-- TODO: sounds
2017-07-05 03:15:46 +02:00
distance = 60,
},
jump = true,
jump_height = 10,
fly = true,
makes_footstep_sound = false,
2017-07-05 03:15:46 +02:00
dogshoot_switch = 1,
dogshoot_count_max =1,
attack_animals = true,
can_despawn = false,
2017-07-05 03:15:46 +02:00
drops = {
{name = mobs_mc.items.nether_star,
chance = 1,
min = 1,
max = 1},
},
lava_damage = 0,
fire_damage = 0,
2017-07-05 03:15:46 +02:00
attack_type = "dogshoot",
2020-05-02 18:50:25 +02:00
explosion_strength = 8,
2017-07-05 03:15:46 +02:00
dogshoot_stop = true,
2019-12-10 01:01:04 +01:00
arrow = "mobs_mc:wither_skull",
2017-07-05 03:15:46 +02:00
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,
},
harmed_by_heal = true,
2021-03-29 20:29:39 +02:00
do_custom = function(self)
if self.health < (self.hp_max / 2) then
self.base_texture = "mobs_mc_wither_half_health.png"
self.fly = false
self.object:set_properties({textures={self.base_texture}})
self.armor = {undead = 80, fleshy = 80}
end
2021-04-11 17:30:32 +02:00
mcl_bossbars.update_boss(self.object, "Wither", "dark_purple")
2021-03-29 20:29:39 +02:00
end,
2020-12-05 20:13:14 +01:00
on_spawn = function(self)
minetest.sound_play("mobs_mc_wither_spawn", {object=self.object, gain=1.0, max_hear_distance=64})
end,
2017-07-05 03:15:46 +02:00
})
2018-03-25 22:27:06 +02:00
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
2019-12-10 01:01:04 +01:00
mobs:register_arrow("mobs_mc:wither_skull", {
2017-07-05 03:15:46 +02:00
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,
2019-12-10 01:01:04 +01:00
-- direct hit
2017-07-05 03:15:46 +02:00
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 0.5,
damage_groups = {fleshy = 8},
}, nil)
2019-12-10 01:01:04 +01:00
mobs:boom(self, self.object:get_pos(), 1)
2017-07-05 03:15:46 +02:00
end,
2019-02-08 22:44:26 +01:00
hit_mob = function(self, mob)
2019-03-11 13:23:55 +01:00
mob:punch(self.object, 1.0, {
2017-07-05 03:15:46 +02:00
full_punch_interval = 0.5,
damage_groups = {fleshy = 8},
}, nil)
2019-12-10 01:01:04 +01:00
mobs:boom(self, self.object:get_pos(), 1)
2017-07-05 03:15:46 +02:00
end,
2019-12-10 01:01:04 +01:00
-- node hit, explode
2017-07-05 03:15:46 +02:00
hit_node = function(self, pos, node)
2019-12-10 01:01:04 +01:00
mobs:boom(self, pos, 1)
2017-07-05 03:15:46 +02:00
end
})
2019-12-10 01:01:04 +01:00
-- TODO: Add blue wither skull
2017-07-05 03:15:46 +02:00
--Spawn egg
2019-12-11 00:46:55 +01:00
mobs:register_egg("mobs_mc:wither", S("Wither"), "mobs_mc_spawn_icon_wither.png", 0, true)
2021-03-07 00:42:34 +01:00
2021-04-06 14:50:34 +02:00
mcl_wip.register_wip_item("mobs_mc:wither")