Small fixes for last update.

entity
Benrob0329 2017-11-29 12:24:33 -05:00
parent e32e097e62
commit 871b004fab
3 changed files with 24 additions and 20 deletions

View File

@ -125,19 +125,19 @@ function tardis:spawn_interior (pos, name)
} }
tardis.add_count() tardis.add_count()
local interior_doors_pos = { local interior_doors_pos = {
x = (place_pos["x"] + 5) , x = (place_pos.x + 5) ,
y = (place_pos["y"] + 1) , y = (place_pos.y + 1) ,
z = (place_pos["z"] + 1) , z = (place_pos.z + 1) ,
} }
local demat_lever_pos = { local demat_lever_pos = {
x = (place_pos["x"] + 4) , x = (place_pos.x + 4) ,
y = (place_pos["y"] + 2) , y = (place_pos.y + 2) ,
z = (place_pos["z"] + 7) , z = (place_pos.z + 7) ,
} }
local nav_pos = { local nav_pos = {
x = (place_pos["x"] + 4) , x = (place_pos.x + 4) ,
y = (place_pos["y"] + 2) , y = (place_pos.y + 2) ,
z = (place_pos["z"] + 8) , z = (place_pos.z + 8) ,
} }
minetest.place_schematic(place_pos, modpath .. "/schematics/tardis_interior.mts") minetest.place_schematic(place_pos, modpath .. "/schematics/tardis_interior.mts")
@ -194,19 +194,24 @@ function tardis.show_nav_formspec(player_name, owner_name)
end) end)
end end
-- Make sure TARDISes places in ungenerated chunks exist and have meta set correctly. -- Make sure TARDISes placed in ungenerated chunks exist and have meta set correctly.
minetest.register_on_generated(function(minp, maxp, blockseed) minetest.register_on_generated(function(minp, maxp, blockseed)
local table = mod_storage:to_table() local table = mod_storage:to_table()
for k, v in pairs(table.fields) do for k, v in pairs(table.fields) do
if ((k == string.match(k, "tardis:.+:exterior")) and if (k == string.match(k, "tardis:.+:exterior")) then
(minetest.string_to_pos(v).x > minp.x) and (minetest.string_to_pos(v).y > minp.y) and (minetest.string_to_pos(v).z > minp.z) and local pos = minetest.string_to_pos(v)
(minetest.string_to_pos(v).x < maxp.x) and (minetest.string_to_pos(v).y < maxp.y) and (minetest.string_to_pos(v).z < maxp.z)) then
minetest.set_node(minetest.string_to_pos(v), {name = "tardis:tardis"}) if ((pos) and
local meta = minetest.get_meta(minetest.string_to_pos(v)) (pos.x >= minp.x) and (pos.y >= minp.y) and (pos.z >= minp.z) and
local owner = string.match(k, "tardis:(.+):exterior") (pos.x <= maxp.x) and (pos.y <= maxp.y) and (pos.z <= maxp.z)) then
meta:set_string("owner", owner) minetest.set_node(pos, {name = "tardis:tardis"})
local meta = minetest.get_meta(minetest.string_to_pos(v))
local owner = string.match(k, "tardis:(.+):exterior")
meta:set_string("owner", owner)
end
end end
end end
end) end)

View File

@ -1,6 +1,5 @@
-- Define global table -- Define global table
tardis = {} tardis = {}
tardis.done = {}
local modname = minetest.get_current_modname() local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)

View File

@ -1,5 +1,5 @@
minetest.register_node("tardis:tardis", { minetest.register_node("tardis:tardis", {
decription = "Time And Relative Dimension In Space", decription = "Testing And Relative Dimensions In (3D) Space",
tiles = { "tardis_exterior.png" }, tiles = { "tardis_exterior.png" },
use_texture_alpha = true, use_texture_alpha = true,
drawtype = "mesh", drawtype = "mesh",