Merge pull request 'Ghast fixes' (#4277) from ghast_fixes into master

Reviewed-on: MineClone2/MineClone2#4277
Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
This commit is contained in:
the-real-herowl 2024-05-03 12:57:32 +00:00
commit 7d999535e7
2 changed files with 3 additions and 2 deletions

View File

@ -374,7 +374,7 @@ function mcl_mobs.register_arrow(name, def)
rotate = def.rotate, rotate = def.rotate,
on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
local vel = self.object:get_velocity():length() local vel = self.object:get_velocity():length()
self.object:set_velocity({x=dir.x * vel, y=dir.y * vel, z=dir.z * vel}) self.object:set_velocity(dir * vel)
self._puncher = puncher 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},

View File

@ -126,13 +126,14 @@ mcl_mobs.register_arrow("mobs_mc:fireball", {
end, end,
hit_mob = function(self, mob) hit_mob = function(self, mob)
local name = mob:get_luaentity().name
mob:punch(self.object, 1.0, { mob:punch(self.object, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,
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() local ent = mob:get_luaentity()
if not ent or ent.health <= 0 then if (not ent or ent.health <= 0) and self._puncher and name == "mobs_mc:ghast" then
awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv") awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv")
end end
end, end,