Merge pull request 'Fixed ghast hitbox' (#4156) from ghast_fix into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4156patch_skins
commit
c31226041f
|
@ -362,12 +362,13 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
|
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
|
||||||
timer = 0,
|
timer = 0,
|
||||||
switch = 0,
|
switch = 0,
|
||||||
_lifetime = def._lifetime or 150,
|
_lifetime = def._lifetime or 7,
|
||||||
owner_id = def.owner_id,
|
owner_id = def.owner_id,
|
||||||
rotate = def.rotate,
|
rotate = def.rotate,
|
||||||
on_punch = def.on_punch or function(self)
|
on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
|
||||||
local vel = self.object:get_velocity()
|
local vel = self.object:get_velocity():length()
|
||||||
self.object:set_velocity({x=vel.x * -1, y=vel.y * -1, z=vel.z * -1})
|
self.object:set_velocity({x=dir.x * vel, y=dir.y * vel, z=dir.z * vel})
|
||||||
|
self._puncher = puncher
|
||||||
end,
|
end,
|
||||||
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
|
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
|
||||||
automatic_face_movement_dir = def.rotate
|
automatic_face_movement_dir = def.rotate
|
||||||
|
@ -377,7 +378,7 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
|
|
||||||
on_step = def.on_step or function(self, dtime)
|
on_step = def.on_step or function(self, dtime)
|
||||||
|
|
||||||
self.timer = self.timer + 1
|
self.timer = self.timer + dtime
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
|
@ -443,24 +444,24 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
|
|
||||||
if self.hit_player or self.hit_mob or self.hit_object then
|
if self.hit_player or self.hit_mob or self.hit_object then
|
||||||
|
|
||||||
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
|
||||||
|
|
||||||
if self.hit_player
|
if self.hit_player
|
||||||
and player:is_player() then
|
and object:is_player() then
|
||||||
|
|
||||||
self.hit_player(self, player)
|
self.hit_player(self, object)
|
||||||
self.object:remove();
|
self.object:remove();
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local entity = player:get_luaentity()
|
local entity = object:get_luaentity()
|
||||||
|
|
||||||
if entity
|
if entity
|
||||||
and self.hit_mob
|
and self.hit_mob
|
||||||
and entity.is_mob == true
|
and entity.is_mob == true
|
||||||
and tostring(player) ~= self.owner_id
|
and (tostring(object) ~= self.owner_id or self.timer > 2)
|
||||||
and entity.name ~= self.object:get_luaentity().name then
|
and entity.name ~= self.object:get_luaentity().name then
|
||||||
self.hit_mob(self, player)
|
self.hit_mob(self, object)
|
||||||
self.object:remove();
|
self.object:remove();
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -468,9 +469,9 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
if entity
|
if entity
|
||||||
and self.hit_object
|
and self.hit_object
|
||||||
and (not entity.is_mob)
|
and (not entity.is_mob)
|
||||||
and tostring(player) ~= self.owner_id
|
and (tostring(object) ~= self.owner_id or self.timer > 2)
|
||||||
and entity.name ~= self.object:get_luaentity().name then
|
and entity.name ~= self.object:get_luaentity().name then
|
||||||
self.hit_object(self, player)
|
self.hit_object(self, object)
|
||||||
self.object:remove();
|
self.object:remove();
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,7 +20,7 @@ mcl_mobs.register_mob("mobs_mc:ghast", {
|
||||||
hp_max = 10,
|
hp_max = 10,
|
||||||
xp_min = 5,
|
xp_min = 5,
|
||||||
xp_max = 5,
|
xp_max = 5,
|
||||||
collisionbox = {-2, 5, -2, 2, 9, 2},
|
collisionbox = {-2, 0, -2, 2, 4, 2, rotate=true},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_ghast.b3d",
|
mesh = "mobs_mc_ghast.b3d",
|
||||||
spawn_in_group = 1,
|
spawn_in_group = 1,
|
||||||
|
@ -53,8 +53,8 @@ mcl_mobs.register_mob("mobs_mc:ghast", {
|
||||||
view_range = 64,
|
view_range = 64,
|
||||||
attack_type = "dogshoot",
|
attack_type = "dogshoot",
|
||||||
arrow = "mobs_mc:fireball",
|
arrow = "mobs_mc:fireball",
|
||||||
shoot_interval = 3,
|
shoot_interval = 5,
|
||||||
shoot_offset = -5,
|
shoot_offset = -0.5,
|
||||||
dogshoot_switch = 1,
|
dogshoot_switch = 1,
|
||||||
dogshoot_count_max =1,
|
dogshoot_count_max =1,
|
||||||
passive = false,
|
passive = false,
|
||||||
|
@ -109,6 +109,7 @@ mcl_mobs.register_arrow("mobs_mc:fireball", {
|
||||||
textures = {"mcl_fire_fire_charge.png"},
|
textures = {"mcl_fire_fire_charge.png"},
|
||||||
velocity = 5,
|
velocity = 5,
|
||||||
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
|
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
|
||||||
|
_lifetime = 10,
|
||||||
_is_fireball = true,
|
_is_fireball = true,
|
||||||
|
|
||||||
hit_player = function(self, player)
|
hit_player = function(self, player)
|
||||||
|
@ -130,6 +131,10 @@ mcl_mobs.register_arrow("mobs_mc:fireball", {
|
||||||
damage_groups = {fleshy = 6},
|
damage_groups = {fleshy = 6},
|
||||||
}, nil)
|
}, nil)
|
||||||
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true)
|
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true)
|
||||||
|
local ent = mob:get_luaentity()
|
||||||
|
if not ent or ent.health <= 0 then
|
||||||
|
awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv")
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hit_node = function(self, pos, node)
|
hit_node = function(self, pos, node)
|
||||||
|
|
Binary file not shown.
|
@ -463,7 +463,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull", {
|
||||||
},
|
},
|
||||||
velocity = 7,
|
velocity = 7,
|
||||||
rotate = 90,
|
rotate = 90,
|
||||||
_lifetime = 350,
|
_lifetime = 15,
|
||||||
on_punch = function(self) end,
|
on_punch = function(self) end,
|
||||||
|
|
||||||
-- direct hit
|
-- direct hit
|
||||||
|
@ -516,7 +516,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull_strong", {
|
||||||
},
|
},
|
||||||
velocity = 4,
|
velocity = 4,
|
||||||
rotate = 90,
|
rotate = 90,
|
||||||
_lifetime = 500,
|
_lifetime = 25,
|
||||||
on_punch = function(self) end,
|
on_punch = function(self) end,
|
||||||
|
|
||||||
-- direct hit
|
-- direct hit
|
||||||
|
|
|
@ -550,6 +550,13 @@ awards.register_achievement("mcl:obsidian", {
|
||||||
type = "Advancement",
|
type = "Advancement",
|
||||||
group = "Overworld",
|
group = "Overworld",
|
||||||
})
|
})
|
||||||
|
awards.register_achievement("mcl:fireball_redir_serv", {
|
||||||
|
title = S("Fireball Redirection Service"),
|
||||||
|
description = S("Defeat a ghast with his own weapon."),
|
||||||
|
icon = "mcl_fire_fire_charge.png",
|
||||||
|
type = "Advancement",
|
||||||
|
group = "Nether",
|
||||||
|
})
|
||||||
|
|
||||||
awards.register_achievement("mcl:hero_of_the_village", {
|
awards.register_achievement("mcl:hero_of_the_village", {
|
||||||
title = S("Hero of the Village"),
|
title = S("Hero of the Village"),
|
||||||
|
|
Loading…
Reference in New Issue