mirror of
https://git.minetest.land/Mineclonia/Mineclonia.git
synced 2024-12-01 05:32:59 +00:00
Rename portal node metadata
This commit is contained in:
parent
6018f0c7cd
commit
29873b96c1
2 changed files with 34 additions and 26 deletions
|
@ -20,8 +20,8 @@ local portal_frame = "mcl_nether:quartz_block"
|
||||||
local destroy_portal = function(pos)
|
local destroy_portal = function(pos)
|
||||||
-- Deactivate Nether portal
|
-- Deactivate Nether portal
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local p1 = minetest.string_to_pos(meta:get_string("p1"))
|
local p1 = minetest.string_to_pos(meta:get_string("portal_frame1"))
|
||||||
local p2 = minetest.string_to_pos(meta:get_string("p2"))
|
local p2 = minetest.string_to_pos(meta:get_string("portal_frame2"))
|
||||||
if not p1 or not p2 then
|
if not p1 or not p2 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -40,7 +40,7 @@ local destroy_portal = function(pos)
|
||||||
If it doesn't have metadata, another node propably triggred the delection
|
If it doesn't have metadata, another node propably triggred the delection
|
||||||
routine earlier, so we bail out earlier to avoid an infinite cascade
|
routine earlier, so we bail out earlier to avoid an infinite cascade
|
||||||
of on_destroy events. ]]
|
of on_destroy events. ]]
|
||||||
mp1 = minetest.string_to_pos(m:get_string("p1"))
|
mp1 = minetest.string_to_pos(m:get_string("portal_frame1"))
|
||||||
if not mp1 then
|
if not mp1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -52,9 +52,9 @@ local destroy_portal = function(pos)
|
||||||
minetest.remove_node(p)
|
minetest.remove_node(p)
|
||||||
end
|
end
|
||||||
-- Clear metadata of portal nodes and the frame
|
-- Clear metadata of portal nodes and the frame
|
||||||
m:set_string("p1", "")
|
m:set_string("portal_frame1", "")
|
||||||
m:set_string("p2", "")
|
m:set_string("portal_frame2", "")
|
||||||
m:set_string("target", "")
|
m:set_string("portal_target", "")
|
||||||
end
|
end
|
||||||
first = false
|
first = false
|
||||||
end
|
end
|
||||||
|
@ -146,9 +146,9 @@ local function build_end_portal(pos, target3)
|
||||||
minetest.set_node(p, {name = "mcl_portals:portal_end", param2 = 0})
|
minetest.set_node(p, {name = "mcl_portals:portal_end", param2 = 0})
|
||||||
end
|
end
|
||||||
local meta = minetest.get_meta(p)
|
local meta = minetest.get_meta(p)
|
||||||
meta:set_string("p1", minetest.pos_to_string(p1))
|
meta:set_string("portal_frame1", minetest.pos_to_string(p1))
|
||||||
meta:set_string("p2", minetest.pos_to_string(p2))
|
meta:set_string("portal_frame2", minetest.pos_to_string(p2))
|
||||||
meta:set_string("target3", minetest.pos_to_string(target3))
|
meta:set_string("portal_target", minetest.pos_to_string(target3))
|
||||||
|
|
||||||
if y ~= p1.y then
|
if y ~= p1.y then
|
||||||
for z = -2, 2 do
|
for z = -2, 2 do
|
||||||
|
@ -296,9 +296,13 @@ local function make_end_portal(pos)
|
||||||
minetest.set_node(p, {name = "mcl_portals:portal_end", param2 = param2})
|
minetest.set_node(p, {name = "mcl_portals:portal_end", param2 = param2})
|
||||||
end
|
end
|
||||||
local meta = minetest.get_meta(p)
|
local meta = minetest.get_meta(p)
|
||||||
meta:set_string("p1", minetest.pos_to_string(p1))
|
|
||||||
meta:set_string("p2", minetest.pos_to_string(p2))
|
-- Portal frame corners
|
||||||
meta:set_string("target3", minetest.pos_to_string(target3))
|
meta:set_string("portal_frame1", minetest.pos_to_string(p1))
|
||||||
|
meta:set_string("portal_frame2", minetest.pos_to_string(p2))
|
||||||
|
|
||||||
|
-- Portal target coordinates
|
||||||
|
meta:set_string("portal_target", minetest.pos_to_string(target3))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -315,7 +319,7 @@ minetest.register_abm({
|
||||||
local lua_entity = obj:get_luaentity() --maikerumine added for objects to travel
|
local lua_entity = obj:get_luaentity() --maikerumine added for objects to travel
|
||||||
if obj:is_player() or lua_entity then
|
if obj:is_player() or lua_entity then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local target3 = minetest.string_to_pos(meta:get_string("target3"))
|
local target3 = minetest.string_to_pos(meta:get_string("portal_target"))
|
||||||
if target3 then
|
if target3 then
|
||||||
-- force emerge of target3 area
|
-- force emerge of target3 area
|
||||||
minetest.get_voxel_manip():read_from_map(target3, target3)
|
minetest.get_voxel_manip():read_from_map(target3, target3)
|
||||||
|
|
|
@ -17,8 +17,8 @@ local np_cave = {
|
||||||
local destroy_portal = function(pos)
|
local destroy_portal = function(pos)
|
||||||
-- Deactivate Nether portal
|
-- Deactivate Nether portal
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local p1 = minetest.string_to_pos(meta:get_string("p1"))
|
local p1 = minetest.string_to_pos(meta:get_string("portal_frame1"))
|
||||||
local p2 = minetest.string_to_pos(meta:get_string("p2"))
|
local p2 = minetest.string_to_pos(meta:get_string("portal_frame2"))
|
||||||
if not p1 or not p2 then
|
if not p1 or not p2 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -37,7 +37,7 @@ local destroy_portal = function(pos)
|
||||||
If it doesn't have metadata, another node propably triggred the delection
|
If it doesn't have metadata, another node propably triggred the delection
|
||||||
routine earlier, so we bail out earlier to avoid an infinite cascade
|
routine earlier, so we bail out earlier to avoid an infinite cascade
|
||||||
of on_destroy events. ]]
|
of on_destroy events. ]]
|
||||||
mp1 = minetest.string_to_pos(m:get_string("p1"))
|
mp1 = minetest.string_to_pos(m:get_string("portal_frame1"))
|
||||||
if not mp1 then
|
if not mp1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -49,9 +49,9 @@ local destroy_portal = function(pos)
|
||||||
minetest.remove_node(p)
|
minetest.remove_node(p)
|
||||||
end
|
end
|
||||||
-- Clear metadata of portal nodes and the frame
|
-- Clear metadata of portal nodes and the frame
|
||||||
m:set_string("p1", "")
|
m:set_string("portal_frame1", "")
|
||||||
m:set_string("p2", "")
|
m:set_string("portal_frame2", "")
|
||||||
m:set_string("target", "")
|
m:set_string("portal_target", "")
|
||||||
end
|
end
|
||||||
first = false
|
first = false
|
||||||
end
|
end
|
||||||
|
@ -143,9 +143,9 @@ local function build_portal(pos, target)
|
||||||
minetest.set_node(p, {name = "mcl_portals:portal", param2 = 0})
|
minetest.set_node(p, {name = "mcl_portals:portal", param2 = 0})
|
||||||
end
|
end
|
||||||
local meta = minetest.get_meta(p)
|
local meta = minetest.get_meta(p)
|
||||||
meta:set_string("p1", minetest.pos_to_string(p1))
|
meta:set_string("portal_frame1", minetest.pos_to_string(p1))
|
||||||
meta:set_string("p2", minetest.pos_to_string(p2))
|
meta:set_string("portal_frame2", minetest.pos_to_string(p2))
|
||||||
meta:set_string("target", minetest.pos_to_string(target))
|
meta:set_string("portal_target", minetest.pos_to_string(target))
|
||||||
|
|
||||||
if y ~= p1.y then
|
if y ~= p1.y then
|
||||||
for z = -2, 2 do
|
for z = -2, 2 do
|
||||||
|
@ -294,9 +294,13 @@ local function make_portal(pos)
|
||||||
minetest.set_node(p, {name = "mcl_portals:portal", param2 = param2})
|
minetest.set_node(p, {name = "mcl_portals:portal", param2 = param2})
|
||||||
end
|
end
|
||||||
local meta = minetest.get_meta(p)
|
local meta = minetest.get_meta(p)
|
||||||
meta:set_string("p1", minetest.pos_to_string(p1))
|
|
||||||
meta:set_string("p2", minetest.pos_to_string(p2))
|
-- Portal frame corners
|
||||||
meta:set_string("target", minetest.pos_to_string(target))
|
meta:set_string("portal_frame1", minetest.pos_to_string(p1))
|
||||||
|
meta:set_string("portal_frame2", minetest.pos_to_string(p2))
|
||||||
|
|
||||||
|
-- Portal target coordinates
|
||||||
|
meta:set_string("portal_target", minetest.pos_to_string(target))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -330,7 +334,7 @@ minetest.register_abm({
|
||||||
local lua_entity = obj:get_luaentity() --maikerumine added for objects to travel
|
local lua_entity = obj:get_luaentity() --maikerumine added for objects to travel
|
||||||
if obj:is_player() or lua_entity then
|
if obj:is_player() or lua_entity then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local target = minetest.string_to_pos(meta:get_string("target"))
|
local target = minetest.string_to_pos(meta:get_string("portal_target"))
|
||||||
if target then
|
if target then
|
||||||
-- force emerge of target area
|
-- force emerge of target area
|
||||||
minetest.get_voxel_manip():read_from_map(target, target)
|
minetest.get_voxel_manip():read_from_map(target, target)
|
||||||
|
|
Loading…
Reference in a new issue