From 5c5c2ea1095a82a2ba9beef08b0b53c383cb45b3 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 17 Aug 2017 04:36:08 +0200 Subject: [PATCH] Fix portal corner metadata being able to be killed This was possible by re-using the same frame for multiple portals. --- mods/MAPGEN/mcl_portals/portal_end.lua | 8 ++++++++ mods/MAPGEN/mcl_portals/portal_nether.lua | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/mods/MAPGEN/mcl_portals/portal_end.lua b/mods/MAPGEN/mcl_portals/portal_end.lua index 75ef9415fc..126e7ae328 100644 --- a/mods/MAPGEN/mcl_portals/portal_end.lua +++ b/mods/MAPGEN/mcl_portals/portal_end.lua @@ -199,6 +199,14 @@ local function move_check2(p1, max, dir) if minetest.get_node(p).name ~= portal_frame then return false end + -- Abort if any of the portal frame blocks already has metadata. + -- This mod does not yet portals which neighbor each other directly. + -- TODO: Reorganize the way how portal frame coordinates are stored. + local meta = minetest.get_meta(p) + local p1 = meta:get_string("portal_frame1") + if minetest.string_to_pos(p1) ~= nil then + return false + end end return true diff --git a/mods/MAPGEN/mcl_portals/portal_nether.lua b/mods/MAPGEN/mcl_portals/portal_nether.lua index e99cace5f7..3e6b280217 100644 --- a/mods/MAPGEN/mcl_portals/portal_nether.lua +++ b/mods/MAPGEN/mcl_portals/portal_nether.lua @@ -196,6 +196,14 @@ local function move_check(p1, max, dir) if minetest.get_node(p).name ~= "mcl_core:obsidian" then return false end + -- Abort if any of the portal frame blocks already has metadata. + -- This mod does not yet portals which neighbor each other directly. + -- TODO: Reorganize the way how portal frame coordinates are stored. + local meta = minetest.get_meta(p) + local p1 = meta:get_string("portal_frame1") + if minetest.string_to_pos(p1) ~= nil then + return false + end end return true