1
0
Fork 0

Merge pull request 'Make end crystals explode when nearby crystals are punched and explode' (#3714) from end_crystal_explosion into master

Reviewed-on: MineClone2/MineClone2#3714
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
This commit is contained in:
ancientmarinerdev 2023-05-17 21:25:43 +00:00
commit 00a950721d
2 changed files with 18 additions and 1 deletions

View File

@ -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 = {}, {}

View File

@ -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)