mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 08:29:34 +01:00
Destroy end portal when surrounding bedrock goes
This commit is contained in:
parent
82f851e20d
commit
9b8d6c4cec
1 changed files with 19 additions and 0 deletions
|
@ -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,
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue