VoxeLibre/mods/ENTITIES/mobs_mc/ghast.lua

145 lines
3.4 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
--###################
--################### GHAST
--###################
mobs:register_mob("mobs_mc:ghast", {
type = "monster",
2020-04-11 02:46:03 +02:00
spawn_class = "hostile",
2017-07-05 03:15:46 +02:00
group_attack = true,
2021-04-23 04:40:16 +02:00
hostile = true,
2017-07-05 03:15:46 +02:00
hp_min = 10,
hp_max = 10,
2021-04-23 04:58:32 +02:00
rotate = 270,
2020-12-06 15:46:42 +01:00
xp_min = 5,
xp_max = 5,
2021-04-23 04:58:32 +02:00
reach = 20,
2021-04-23 04:59:03 +02:00
eye_height = 2.5,
2021-04-23 04:40:16 +02:00
collisionbox = {-2, 0, -2, 2, 4, 2},
2017-07-05 03:15:46 +02:00
visual = "mesh",
mesh = "mobs_mc_ghast.b3d",
textures = {
{"mobs_mc_ghast.png"},
},
visual_size = {x=12, y=12},
sounds = {
shoot_attack = "mobs_fireball",
death = "mobs_mc_zombie_death",
2017-07-05 03:15:46 +02:00
attack = "mobs_fireball",
random = "mobs_eerie",
distance = 16,
-- TODO: damage
-- TODO: better death
2017-07-05 03:15:46 +02:00
},
2021-04-23 04:40:16 +02:00
2017-07-05 03:15:46 +02:00
walk_velocity = 1.6,
run_velocity = 3.2,
2021-04-23 04:40:16 +02:00
2017-07-05 03:15:46 +02:00
drops = {
2020-12-23 17:41:42 +01:00
{name = mobs_mc.items.gunpowder, chance = 1, min = 0, max = 2, looting = "common"},
{name = mobs_mc.items.ghast_tear, chance = 10/6, min = 0, max = 1, looting = "common", looting_ignore_chance = true},
2017-07-05 03:15:46 +02:00
},
animation = {
stand_speed = 50, walk_speed = 50, run_speed = 50,
stand_start = 0, stand_end = 40,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
},
2021-04-23 04:40:16 +02:00
2017-07-05 03:15:46 +02:00
fall_damage = 0,
2021-04-23 04:58:32 +02:00
view_range = 28,
attack_type = "projectile",
arrow = "mobs_mc:ghast_fireball",
2017-07-05 03:15:46 +02:00
floats=1,
fly = true,
makes_footstep_sound = false,
2020-12-24 17:48:40 +01:00
fire_resistant = true,
projectile_cooldown_min = 5,
projectile_cooldown_max = 7,
2021-04-23 04:40:16 +02:00
shoot_arrow = function(self, pos, dir)
-- 2-4 damage per arrow
local dmg = math.random(2,4)
mobs.shoot_projectile_handling("mobs_mc:ghast_fireball", pos, dir, self.object:get_yaw(), self.object, 11, dmg,nil,nil,nil,-0.6)
2021-04-23 04:40:16 +02:00
end,
--[[
2021-04-04 03:39:20 +02:00
do_custom = function(self)
if self.firing == true then
self.base_texture = {"mobs_mc_ghast_firing.png"}
self.object:set_properties({textures=self.base_texture})
else
self.base_texture = {"mobs_mc_ghast.png"}
self.object:set_properties({textures=self.base_texture})
end
end,
2021-04-23 04:40:16 +02:00
]]--
2017-07-05 03:15:46 +02:00
})
2021-04-08 13:39:18 +02:00
mobs:spawn_specific(
"mobs_mc:ghast",
"nether",
"ground",
2021-04-08 13:39:18 +02:00
{
"Nether"
},
0,
minetest.LIGHT_MAX+1,
30,
18000,
2,
mobs_mc.spawn_height.nether_min,
mobs_mc.spawn_height.nether_max)
2019-12-10 01:01:04 +01:00
-- fireball (projectile)
mobs:register_arrow("mobs_mc:ghast_fireball", {
2017-07-05 03:15:46 +02:00
visual = "sprite",
2019-12-10 01:01:04 +01:00
visual_size = {x = 1, y = 1},
2017-07-06 00:43:34 +02:00
textures = {"mcl_fire_fire_charge.png"},
2019-12-10 01:01:04 +01:00
velocity = 15,
2021-04-04 03:07:51 +02:00
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
tail = 1,
tail_texture = "mobs_mc_spit.png^[colorize:black:255", --repurpose spit texture
tail_size = 5,
2017-07-05 03:15:46 +02:00
hit_player = function(self, player)
if rawget(_G, "armor") and armor.last_damage_types then
armor.last_damage_types[player:get_player_name()] = "fireball"
end
2021-04-23 04:40:16 +02:00
--[[
2017-07-05 03:15:46 +02:00
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
2019-12-10 01:01:04 +01:00
damage_groups = {fleshy = 6},
2017-07-05 03:15:46 +02:00
}, nil)
2021-04-23 04:40:16 +02:00
]]--
--mobs:boom(self, self.object:get_pos(), 1, true)
mcl_explosions.explode(self.object:get_pos(), 3,{ drop_chance = 1.0 })
2017-07-05 03:15:46 +02:00
end,
2019-03-11 13:25:06 +01:00
hit_mob = function(self, mob)
mob:punch(self.object, 1.0, {
2017-07-05 03:15:46 +02:00
full_punch_interval = 1.0,
damage_groups = {fleshy = self._damage},
2017-07-05 03:15:46 +02:00
}, nil)
2021-04-23 04:40:16 +02:00
--mobs:boom(self, self.object:get_pos(), 1, true)
mcl_explosions.explode(self.object:get_pos(), 3,{ drop_chance = 1.0 })
2017-07-05 03:15:46 +02:00
end,
hit_node = function(self, pos, node)
2021-04-23 04:40:16 +02:00
--mobs:boom(self, pos, 1, true)
mcl_explosions.explode(self.object:get_pos(), 3,{ drop_chance = 1.0 })
2017-07-05 03:15:46 +02:00
end
})
-- spawn eggs
mobs:register_egg("mobs_mc:ghast", S("Ghast"), "mobs_mc_spawn_icon_ghast.png", 0)