From 6294a61d0d4000045fade66d651ed94ccff5a9cc Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Thu, 11 May 2023 10:45:06 -0600 Subject: [PATCH] Make end crystals explode when nearby crystals are punched and explode --- mods/CORE/mcl_explosions/init.lua | 17 +++++++++++++++++ mods/ITEMS/mcl_end/end_crystal.lua | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 2b8b25b1e..c6a6d192f 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -352,6 +352,23 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc end end end + + -- Punch End Crystals to make them explode + if ent and ent.name == "mcl_end:crystal" then + if direct then + local puncher = direct:get_luaentity() + if puncher and puncher.name == "mcl_end:crystal" then + ent.object:punch(direct, 1.0, { -- End Crystal nearby, trigger it. + full_punch_interval = 1.0, + damage_groups = {fleshy = 1}, + }, nil, nil) + else + ent.object:remove() -- Direct Exists, but it is not an end crystal, remove crystal. + end + else + ent.object:remove() -- Node exploded the end crystal, remove it. + end + end end local airs, fires = {}, {} diff --git a/mods/ITEMS/mcl_end/end_crystal.lua b/mods/ITEMS/mcl_end/end_crystal.lua index b7882a155..78fe658b4 100644 --- a/mods/ITEMS/mcl_end/end_crystal.lua +++ b/mods/ITEMS/mcl_end/end_crystal.lua @@ -40,8 +40,8 @@ local function crystal_explode(self, puncher) mcl_damage.finish_reason(reason) source = reason.source end - mcl_explosions.explode(vector.add(self.object:get_pos(), {x = 0, y = 1.5, z = 0}), strength, {drop_chance = 1}, self.object, source) minetest.after(0, self.object.remove, self.object) + mcl_explosions.explode(vector.add(self.object:get_pos(), {x = 0, y = 1.5, z = 0}), strength, {drop_chance = 1}, self.object, source) end local function set_crystal_animation(self)