From 273297640413492ce5bf701baf9883ed7fde303d Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 15 Dec 2024 09:16:24 -0600 Subject: [PATCH] Move fireball redirection service award check to ghast from fireball --- mods/ENTITIES/mobs_mc/ghast.lua | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index 8cbad4eb4..f385f714f 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -82,6 +82,19 @@ mcl_mobs.register_mob("mobs_mc:ghast", { self.object:set_properties({textures=self.base_texture}) end end, + do_punch = function(self, hitter) + local le = hitter:get_luaentity() + self._last_hit = { + fireball = le and le.name == "mobs_mc:fireball", + owner = le and le._owner, + } + end, + on_die = function(self) + local last_hit = self._last_hit or {} + if last_hit.fireball and last_hit.owner then + awards.unlock(last_hit.owner, "mcl:fireball_redir_serv") + end + end, }) @@ -127,11 +140,6 @@ mcl_mobs.register_arrow("mobs_mc:fireball", { hit_mob = function(self, mob) local name = mob:get_luaentity().name 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._owner and core.get_player_by_name(self._owner) - and name == "mobs_mc:ghast" then - awards.unlock(self._owner, "mcl:fireball_redir_serv") - end end, hit_node = function(self, pos, node) @@ -139,8 +147,6 @@ mcl_mobs.register_arrow("mobs_mc:fireball", { end }) - - mcl_mobs:non_spawn_specific("mobs_mc:ghast","overworld","0","7") -- spawn eggs mcl_mobs.register_egg("mobs_mc:ghast", S("Ghast"), "#f9f9f9", "#bcbcbc", 0)