From a8ad631864c7468a625a5338bdf513f815f54bc3 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Thu, 25 Jan 2024 14:16:09 +0100 Subject: [PATCH] Added ghast achievement and nerfed ghast * ghast now attacks less frequently * killing ghast with a ghast fireball now awards an achievement --- mods/ENTITIES/mcl_mobs/init.lua | 1 + mods/ENTITIES/mobs_mc/ghast.lua | 6 +++++- mods/HUD/mcl_achievements/init.lua | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index 15ca47050..fb39fa151 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -368,6 +368,7 @@ function mcl_mobs.register_arrow(name, def) 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._puncher = puncher end, collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0}, automatic_face_movement_dir = def.rotate diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index 01e01f079..83277910e 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -53,7 +53,7 @@ mcl_mobs.register_mob("mobs_mc:ghast", { view_range = 64, attack_type = "dogshoot", arrow = "mobs_mc:fireball", - shoot_interval = 3, + shoot_interval = 5, shoot_offset = -0.5, dogshoot_switch = 1, dogshoot_count_max =1, @@ -131,6 +131,10 @@ mcl_mobs.register_arrow("mobs_mc:fireball", { 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 then + awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv") + end end, hit_node = function(self, pos, node) diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index 61ef9a9f2..361a3e659 100755 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -550,6 +550,13 @@ awards.register_achievement("mcl:obsidian", { type = "Advancement", 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", { title = S("Hero of the Village"),