Destroy end portal when surrounding bedrock goes

This commit is contained in:
Wuzzy 2020-01-06 16:49:22 +01:00
parent 82f851e20d
commit 9b8d6c4cec

@ -6,6 +6,21 @@ local SPAWN_MAX = mcl_vars.mg_end_min+98
local mg_name = minetest.get_mapgen_setting("mg_name")
local destroy_portal = function(pos)
local neighbors = {
{ x=1, y=0, z=0 },
{ x=-1, y=0, z=0 },
{ x=0, y=0, z=1 },
{ x=0, y=0, z=-1 },
}
for n=1, #neighbors do
local npos = vector.add(pos, neighbors[n])
if minetest.get_node(npos).name == "mcl_portals:portal_end" then
minetest.remove_node(npos)
end
end
end
-- End portal
minetest.register_node("mcl_portals:portal_end", {
description = S("End Portal"),
@ -46,6 +61,7 @@ minetest.register_node("mcl_portals:portal_end", {
light_source = 14,
post_effect_color = {a = 192, r = 0, g = 0, b = 0},
alpha = 192,
after_destruct = destroy_portal,
-- This prevents “falling through”
collision_box = {
type = "fixed",
@ -398,4 +414,7 @@ minetest.override_item("mcl_end:ender_eye", {
return itemstack
end,
})
minetest.override_item("mcl_core:bedrock", {
after_destruct = destroy_portal,
})