From cd0509c2e695ce3c47a378be5f00f9ee3ee0844e Mon Sep 17 00:00:00 2001 From: Araca Date: Wed, 1 May 2024 22:15:56 +0000 Subject: [PATCH 1/2] Fix crash with ghast achievement fireball_redir_serv (#4179) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4179 Reviewed-by: Mikita Wiśniewski Co-authored-by: Araca Co-committed-by: Araca --- mods/ENTITIES/mobs_mc/ghast.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index 83277910e..d32140912 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -132,7 +132,7 @@ mcl_mobs.register_arrow("mobs_mc:fireball", { }, nil) 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 + if (not ent or ent.health <= 0) and self._puncher then awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv") end end, From 4dde321a041beb53d2e895ab0a622262fd484807 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Thu, 2 May 2024 00:18:43 +0200 Subject: [PATCH 2/2] Ghast fireball fixes --- mods/ENTITIES/mcl_mobs/init.lua | 2 +- mods/ENTITIES/mobs_mc/ghast.lua | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index 85e31b665..65272eebf 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -374,7 +374,7 @@ function mcl_mobs.register_arrow(name, def) rotate = def.rotate, on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) 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 end, collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0}, diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index d32140912..81855d0b6 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -126,13 +126,14 @@ mcl_mobs.register_arrow("mobs_mc:fireball", { end, hit_mob = function(self, mob) + local name = mob:get_luaentity().name mob:punch(self.object, 1.0, { full_punch_interval = 1.0, damage_groups = {fleshy = 6}, }, nil) mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true) local ent = mob:get_luaentity() - if (not ent or ent.health <= 0) and self._puncher 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") end end,