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
|
|
|
|
|
2022-02-13 21:40:12 +01:00
|
|
|
local S = minetest.get_translator("mobs_mc")
|
2017-07-05 03:15:46 +02:00
|
|
|
|
|
|
|
--###################
|
|
|
|
--################### GHAST
|
|
|
|
--###################
|
|
|
|
|
|
|
|
|
2022-11-09 04:09:58 +01:00
|
|
|
mcl_mobs.register_mob("mobs_mc:ghast", {
|
2021-04-25 17:30:15 +02:00
|
|
|
description = S("Ghast"),
|
2017-07-05 03:15:46 +02:00
|
|
|
type = "monster",
|
2020-04-11 02:46:03 +02:00
|
|
|
spawn_class = "hostile",
|
2022-02-13 21:40:12 +01:00
|
|
|
pathfinding = 1,
|
2017-07-05 03:15:46 +02:00
|
|
|
group_attack = true,
|
|
|
|
hp_min = 10,
|
|
|
|
hp_max = 10,
|
2020-12-06 15:46:42 +01:00
|
|
|
xp_min = 5,
|
|
|
|
xp_max = 5,
|
2024-01-21 07:15:08 +01:00
|
|
|
collisionbox = {-2, 0, -2, 2, 4, 2, rotate=true},
|
2017-07-05 03:15:46 +02:00
|
|
|
visual = "mesh",
|
|
|
|
mesh = "mobs_mc_ghast.b3d",
|
2022-07-17 02:20:51 +02:00
|
|
|
spawn_in_group = 1,
|
2017-07-05 03:15:46 +02:00
|
|
|
textures = {
|
|
|
|
{"mobs_mc_ghast.png"},
|
|
|
|
},
|
|
|
|
visual_size = {x=12, y=12},
|
|
|
|
sounds = {
|
2018-09-14 16:27:58 +02:00
|
|
|
shoot_attack = "mobs_fireball",
|
|
|
|
death = "mobs_mc_zombie_death",
|
2017-07-05 03:15:46 +02:00
|
|
|
attack = "mobs_fireball",
|
|
|
|
random = "mobs_eerie",
|
2023-11-16 07:44:11 +01:00
|
|
|
distance = 80,
|
2018-09-14 16:27:58 +02:00
|
|
|
-- TODO: damage
|
|
|
|
-- TODO: better death
|
2017-07-05 03:15:46 +02:00
|
|
|
},
|
|
|
|
walk_velocity = 1.6,
|
|
|
|
run_velocity = 3.2,
|
|
|
|
drops = {
|
2022-05-25 23:25:15 +02:00
|
|
|
{name = "mcl_mobitems:gunpowder", chance = 1, min = 0, max = 2, looting = "common"},
|
|
|
|
{name = "mcl_mobitems: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,
|
|
|
|
},
|
|
|
|
fall_damage = 0,
|
2023-11-16 07:44:11 +01:00
|
|
|
view_range = 64,
|
2022-02-13 21:40:12 +01:00
|
|
|
attack_type = "dogshoot",
|
|
|
|
arrow = "mobs_mc:fireball",
|
2024-01-25 14:16:09 +01:00
|
|
|
shoot_interval = 5,
|
2024-01-25 03:50:00 +01:00
|
|
|
shoot_offset = -0.5,
|
2022-02-13 21:40:12 +01:00
|
|
|
dogshoot_switch = 1,
|
|
|
|
dogshoot_count_max =1,
|
|
|
|
passive = false,
|
|
|
|
jump = true,
|
|
|
|
jump_height = 4,
|
2017-07-05 03:15:46 +02:00
|
|
|
floats=1,
|
|
|
|
fly = true,
|
2020-12-05 14:48:58 +01:00
|
|
|
makes_footstep_sound = false,
|
2022-02-13 21:40:12 +01:00
|
|
|
instant_death = true,
|
2020-12-24 17:48:40 +01:00
|
|
|
fire_resistant = true,
|
2022-07-21 01:02:43 +02:00
|
|
|
can_spawn = function(pos)
|
|
|
|
if not minetest.get_item_group(minetest.get_node(pos).name,"solid") then return false end
|
|
|
|
local p1=vector.offset(pos,-2,1,-2)
|
|
|
|
local p2=vector.offset(pos,2,5,2)
|
|
|
|
local nn = minetest.find_nodes_in_area(p1,p2,{"air"})
|
|
|
|
if #nn< 41 then return false end
|
|
|
|
return true
|
|
|
|
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,
|
2017-07-05 03:15:46 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
|
2022-05-25 14:44:49 +02:00
|
|
|
mcl_mobs:spawn_specific(
|
2021-04-14 15:46:52 +02:00
|
|
|
"mobs_mc:ghast",
|
|
|
|
"nether",
|
2021-04-08 14:12:43 +02:00
|
|
|
"ground",
|
2021-04-08 13:39:18 +02:00
|
|
|
{
|
2022-06-18 16:28:03 +02:00
|
|
|
"Nether",
|
|
|
|
"SoulsandValley",
|
|
|
|
"BasaltDelta",
|
2021-04-08 13:39:18 +02:00
|
|
|
},
|
2021-04-14 15:46:52 +02:00
|
|
|
0,
|
2022-06-18 16:28:03 +02:00
|
|
|
7,
|
2021-04-14 15:46:52 +02:00
|
|
|
30,
|
2023-11-27 10:47:55 +01:00
|
|
|
400,
|
2021-04-14 15:46:52 +02:00
|
|
|
2,
|
2022-05-25 23:25:15 +02:00
|
|
|
mcl_vars.mg_nether_min,
|
|
|
|
mcl_vars.mg_nether_max)
|
2017-08-16 22:08:17 +02:00
|
|
|
|
2019-12-10 01:01:04 +01:00
|
|
|
-- fireball (projectile)
|
2022-11-09 04:09:58 +01:00
|
|
|
mcl_mobs.register_arrow("mobs_mc: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"},
|
2023-11-16 07:44:11 +01:00
|
|
|
velocity = 5,
|
2021-04-04 03:07:51 +02:00
|
|
|
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
|
2024-01-25 03:50:00 +01:00
|
|
|
_lifetime = 10,
|
2021-04-14 15:46:52 +02:00
|
|
|
_is_fireball = true,
|
2017-07-05 03:15:46 +02:00
|
|
|
|
|
|
|
hit_player = function(self, player)
|
|
|
|
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)
|
2022-06-19 21:21:49 +02:00
|
|
|
local p = self.object:get_pos()
|
|
|
|
if p then
|
2022-11-10 15:28:51 +01:00
|
|
|
mcl_mobs.mob_class.boom(self,p, 1, true)
|
2022-06-19 21:21:49 +02:00
|
|
|
else
|
2022-11-10 15:28:51 +01:00
|
|
|
mcl_mobs.mob_class.boom(self,player:get_pos(), 1, true)
|
2022-06-19 21:21:49 +02:00
|
|
|
end
|
2017-07-05 03:15:46 +02:00
|
|
|
end,
|
|
|
|
|
2019-03-11 13:25:06 +01:00
|
|
|
hit_mob = function(self, mob)
|
2024-05-02 00:18:43 +02:00
|
|
|
local name = mob:get_luaentity().name
|
2019-03-11 13:25:06 +01:00
|
|
|
mob:punch(self.object, 1.0, {
|
2017-07-05 03:15:46 +02:00
|
|
|
full_punch_interval = 1.0,
|
2022-02-13 21:40:12 +01:00
|
|
|
damage_groups = {fleshy = 6},
|
2017-07-05 03:15:46 +02:00
|
|
|
}, nil)
|
2022-11-10 15:28:51 +01:00
|
|
|
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true)
|
2024-01-25 14:16:09 +01:00
|
|
|
local ent = mob:get_luaentity()
|
2024-10-24 13:39:37 +02:00
|
|
|
if (not ent or ent.health <= 0) and self._owner and minetest.get_player_by_name(self._owner) and name == "mobs_mc:ghast" then
|
|
|
|
awards.unlock(self._owner, "mcl:fireball_redir_serv")
|
2024-01-25 14:16:09 +01:00
|
|
|
end
|
2017-07-05 03:15:46 +02:00
|
|
|
end,
|
|
|
|
|
|
|
|
hit_node = function(self, pos, node)
|
2022-11-10 15:28:51 +01:00
|
|
|
mcl_mobs.mob_class.boom(self,pos, 1, true)
|
2017-07-05 03:15:46 +02:00
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-10 03:46:23 +01:00
|
|
|
mcl_mobs:non_spawn_specific("mobs_mc:ghast","overworld","0","7")
|
2017-07-05 03:15:46 +02:00
|
|
|
-- spawn eggs
|
2022-11-09 04:09:58 +01:00
|
|
|
mcl_mobs.register_egg("mobs_mc:ghast", S("Ghast"), "#f9f9f9", "#bcbcbc", 0)
|