Change everything to use mod storage through functions.
Also (re?) fixed problems with the TARDIS spawining into ungenerated chunks. Fixed collision boxes for TARDIS and interior doors. Made navigation formspec have default values based on current nav data. Made things use functions rather than raw tables, which allowed the use of default values to make the game more stable. Added .luacheckrcentity
parent
66d2ba8607
commit
e32e097e62
|
@ -0,0 +1,14 @@
|
|||
unused_args = false
|
||||
allow_defined_top = true
|
||||
|
||||
read_globals = {
|
||||
"DIR_DELIM",
|
||||
"minetest", "core",
|
||||
"dump",
|
||||
"vector", "nodeupdate",
|
||||
"VoxelManip", "VoxelArea",
|
||||
"PseudoRandom", "ItemStack",
|
||||
"intllib",
|
||||
"default",
|
||||
table = { fields = { "copy", "getn" } }
|
||||
}
|
350
demat.lua
350
demat.lua
|
@ -1,229 +1,231 @@
|
|||
function tardis.demat (owner, name)
|
||||
if owner ~= name then return false, "You don't own that TARDIS!" end
|
||||
local pos = tardis.tardises [owner]["exterior"]
|
||||
|
||||
minetest.forceload_block(pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat"})
|
||||
function tardis.demat(name)
|
||||
local pos = tardis.get_exterior(name)
|
||||
|
||||
tardis.tardises [owner]["in_vortex"] = true
|
||||
if (minetest.forceload_block(pos)) then
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat"})
|
||||
|
||||
minetest.sound_play ("tardis_demat", {
|
||||
pos = pos ,
|
||||
max_hear_distance = 100 ,
|
||||
gain = 10 ,
|
||||
})
|
||||
return true
|
||||
tardis.set_vortex(true, name)
|
||||
|
||||
minetest.sound_play ("tardis_demat", {
|
||||
pos = pos,
|
||||
max_hear_distance = 100,
|
||||
gain = 10 ,
|
||||
})
|
||||
return true
|
||||
else return false
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node ("tardis:tardis_demat", {
|
||||
tiles = {"tardis_exterior.png^[opacity:255"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
light_source = 5 ,
|
||||
minetest.register_node("tardis:tardis_demat", {
|
||||
tiles = {"tardis_exterior.png^[opacity:255"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
light_source = 5,
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat_1"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "tardis:tardis_demat_1"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(7)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(7)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_demat_1", {
|
||||
tiles = {"tardis_exterior.png^[opacity:225"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
light_source = 10 ,
|
||||
minetest.register_node("tardis:tardis_demat_1", {
|
||||
tiles = {"tardis_exterior.png^[opacity:225"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
light_source = 10,
|
||||
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat_2"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "tardis:tardis_demat_2"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_demat_2", {
|
||||
tiles = {"tardis_exterior.png^[opacity:200"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:tardis_demat_2", {
|
||||
tiles = {"tardis_exterior.png^[opacity:200"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat_3"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "tardis:tardis_demat_3"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("tardis:tardis_demat_3", {
|
||||
tiles = {"tardis_exterior.png^[opacity:175"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
light_source = 10 ,
|
||||
tiles = {"tardis_exterior.png^[opacity:175"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
light_source = 10,
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat_4"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "tardis:tardis_demat_4"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_demat_4", {
|
||||
tiles = {"tardis_exterior.png^[opacity:150"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:tardis_demat_4", {
|
||||
tiles = {"tardis_exterior.png^[opacity:150"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat_5"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "tardis:tardis_demat_5"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(0.5)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(0.5)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_demat_5", {
|
||||
tiles = {"tardis_exterior.png^[opacity:125"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
light_source = 10 ,
|
||||
minetest.register_node("tardis:tardis_demat_5", {
|
||||
tiles = {"tardis_exterior.png^[opacity:125"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
light_source = 10,
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat_6"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "tardis:tardis_demat_6"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_demat_6", {
|
||||
tiles = {"tardis_exterior.png^[opacity:100"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:tardis_demat_6", {
|
||||
tiles = {"tardis_exterior.png^[opacity:100"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat_7"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "tardis:tardis_demat_7"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_demat_7", {
|
||||
tiles = {"tardis_exterior.png^[opacity:75"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
light_source = 10 ,
|
||||
minetest.register_node("tardis:tardis_demat_7", {
|
||||
tiles = {"tardis_exterior.png^[opacity:75"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
light_source = 10,
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat_8"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "tardis:tardis_demat_8"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_demat_8", {
|
||||
tiles = {"tardis_exterior.png^[opacity:50"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:tardis_demat_8", {
|
||||
tiles = {"tardis_exterior.png^[opacity:50"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat_9"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "tardis:tardis_demat_9"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_demat_9", {
|
||||
tiles = {"tardis_exterior.png^[opacity:25"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
light_source = 7 ,
|
||||
minetest.register_node("tardis:tardis_demat_9", {
|
||||
tiles = {"tardis_exterior.png^[opacity:25"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
light_source = 7,
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat_10"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "tardis:tardis_demat_10"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_demat_10", {
|
||||
tiles = {"tardis_exterior.png^[opacity:10"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:tardis_demat_10", {
|
||||
tiles = {"tardis_exterior.png^[opacity:10"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "tardis:tardis_demat_11"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "tardis:tardis_demat_11"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(0.5)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(0.5)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_demat_11", {
|
||||
minetest.register_node("tardis:tardis_demat_11", {
|
||||
tiles = {"tardis_exterior.png^[opacity:5"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
light_source = 5 ,
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
light_source = 5,
|
||||
|
||||
on_timer = function (pos)
|
||||
minetest.set_node (pos, {name = "air"})
|
||||
minetest.forceload_free_block (pos)
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
minetest.forceload_free_block(pos)
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
|
223
functions.lua
223
functions.lua
|
@ -1,6 +1,108 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local worldpath = minetest.get_worldpath()
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local mod_storage = minetest.get_mod_storage()
|
||||
|
||||
-- Functions are fairly self explanitory, get or set the specified value.
|
||||
function tardis.set_nav(pos, name)
|
||||
local pos_string = (minetest.pos_to_string(pos))
|
||||
|
||||
if (pos_string) then
|
||||
if (mod_storage:set_string("tardis:"..name..":destination", pos_string)) then
|
||||
return true
|
||||
else return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function tardis.get_nav(name)
|
||||
local pos = minetest.string_to_pos(mod_storage:get_string("tardis:"..name..":destination"))
|
||||
|
||||
if (pos) then
|
||||
return pos
|
||||
elseif (tardis.get_exterior(name)) then
|
||||
return tardis.get_exterior(name)
|
||||
else return { x = 0, y = 0, z = 0 }
|
||||
end
|
||||
end
|
||||
|
||||
function tardis.set_exterior(pos, name)
|
||||
local pos_string = (minetest.pos_to_string(pos))
|
||||
|
||||
if (pos_string) then
|
||||
if (mod_storage:set_string("tardis:"..name..":exterior", pos_string)) then
|
||||
return true
|
||||
else return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function tardis.get_exterior(name)
|
||||
local pos = minetest.string_to_pos(mod_storage:get_string("tardis:"..name..":exterior"))
|
||||
|
||||
if (pos) then
|
||||
return pos
|
||||
else return false
|
||||
end
|
||||
end
|
||||
|
||||
function tardis.set_interior(pos, name)
|
||||
local pos_string = (minetest.pos_to_string(pos))
|
||||
|
||||
if (pos_string) then
|
||||
if (mod_storage:set_string("tardis:"..name..":interior", pos_string)) then
|
||||
return true
|
||||
else return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function tardis.get_interior(name)
|
||||
local pos = minetest.string_to_pos(mod_storage:get_string("tardis:"..name..":interior"))
|
||||
|
||||
if (pos) then
|
||||
return pos
|
||||
else return false
|
||||
end
|
||||
end
|
||||
|
||||
function tardis.add_count()
|
||||
local current_count = tonumber(mod_storage:get_string("tardis:count"))
|
||||
|
||||
if (current_count) then
|
||||
if (mod_storage:set_string("tardis:count", tostring(current_count+1))) then
|
||||
return true
|
||||
else return false
|
||||
end
|
||||
|
||||
elseif (mod_storage:set_string("tardis:count", "1")) then
|
||||
return true
|
||||
else return false
|
||||
end
|
||||
end
|
||||
|
||||
function tardis.get_count()
|
||||
local current_count = tonumber(mod_storage:get_string("tardis:count"))
|
||||
|
||||
if (current_count) then
|
||||
return current_count
|
||||
else return 0
|
||||
end
|
||||
end
|
||||
|
||||
function tardis.set_vortex(bool, name)
|
||||
if (mod_storage:set_string("tardis:"..name..":vortex", tostring(bool))) then
|
||||
return true
|
||||
else return nil
|
||||
end
|
||||
end
|
||||
|
||||
function tardis.get_vortex(name)
|
||||
if (mod_storage:get_string("tardis:"..name..":vortex") == "true") then
|
||||
return true
|
||||
else return false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Hacky node swap function since minetest.swap_node doesnt call any callbacks
|
||||
function tardis.swap_node (pos, name)
|
||||
|
@ -9,103 +111,102 @@ function tardis.swap_node (pos, name)
|
|||
|
||||
minetest.set_node (pos, name)
|
||||
|
||||
local meta = minetest.get_meta (pos)
|
||||
meta = minetest.get_meta (pos)
|
||||
meta:from_table (meta_old)
|
||||
end
|
||||
|
||||
|
||||
-- Spawn a TARDIS and set the controls/doors meta with relative coordinates
|
||||
function tardis:spawn_interior (pos, owner)
|
||||
function tardis:spawn_interior (pos, name)
|
||||
local place_pos = {
|
||||
x = tardis.count * 12,
|
||||
x = tardis.get_count() * 12,
|
||||
y = 30000,
|
||||
z = 0,
|
||||
}
|
||||
tardis.count = tardis.count + 1
|
||||
tardis.add_count()
|
||||
local interior_doors_pos = {
|
||||
x = (place_pos ["x"] + 5) ,
|
||||
y = (place_pos ["y"] + 1) ,
|
||||
z = (place_pos ["z"] + 1) ,
|
||||
x = (place_pos["x"] + 5) ,
|
||||
y = (place_pos["y"] + 1) ,
|
||||
z = (place_pos["z"] + 1) ,
|
||||
}
|
||||
local demat_lever_pos = {
|
||||
x = (place_pos ["x"] + 4) ,
|
||||
y = (place_pos ["y"] + 2) ,
|
||||
z = (place_pos ["z"] + 7) ,
|
||||
x = (place_pos["x"] + 4) ,
|
||||
y = (place_pos["y"] + 2) ,
|
||||
z = (place_pos["z"] + 7) ,
|
||||
}
|
||||
local nav_pos = {
|
||||
x = (place_pos ["x"] + 4) ,
|
||||
y = (place_pos ["y"] + 2) ,
|
||||
z = (place_pos ["z"] + 8) ,
|
||||
x = (place_pos["x"] + 4) ,
|
||||
y = (place_pos["y"] + 2) ,
|
||||
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")
|
||||
|
||||
-- Add TARDIS to index
|
||||
tardis.tardises [owner] = {}
|
||||
tardis.tardises [owner]["exterior"] = pos
|
||||
tardis.tardises [owner]["interior"] = interior_doors_pos
|
||||
tardis.tardises [owner]["in_vortex"] = false
|
||||
tardis.set_exterior(pos, name)
|
||||
tardis.set_interior(interior_doors_pos, name)
|
||||
tardis.set_vortex(false, name)
|
||||
|
||||
--Set meta
|
||||
local demat_meta = minetest.get_meta (demat_lever_pos)
|
||||
demat_meta:set_string ("owner", owner)
|
||||
|
||||
local nav_meta = minetest.get_meta (nav_pos)
|
||||
nav_meta:set_string ("owner", owner)
|
||||
local demat_meta = minetest.get_meta(demat_lever_pos)
|
||||
demat_meta:set_string("owner", name)
|
||||
|
||||
local interior_doors_meta = minetest.get_meta (interior_doors_pos)
|
||||
interior_doors_meta:set_string ("owner", owner)
|
||||
local nav_meta = minetest.get_meta(nav_pos)
|
||||
nav_meta:set_string("owner", name)
|
||||
|
||||
minetest.log("info", minetest.pos_to_string (tardis.tardises [owner]["interior"] ))
|
||||
local interior_doors_meta = minetest.get_meta(interior_doors_pos)
|
||||
interior_doors_meta:set_string("owner", name)
|
||||
|
||||
local count_file = io.open (worldpath .. "/tardis.tardises", "w+")
|
||||
count_file:write ( minetest.serialize (tardis.count) )
|
||||
count_file:close()
|
||||
|
||||
local count_file = io.open(worldpath .. "/tardis.count", "w+")
|
||||
count_file:write(minetest.serialize(tardis.count))
|
||||
count_file:close()
|
||||
minetest.log("info", minetest.pos_to_string(tardis.get_interior(name)))
|
||||
end
|
||||
|
||||
|
||||
-- Set navigation, uses a formspec
|
||||
function tardis.set_nav (player, owner)
|
||||
local player_name = player:get_player_name()
|
||||
if player_name ~= owner then minetest.chat_send_player(player_name, "You don't own that TARDIS!"); return end
|
||||
if tardis.tardises[owner]["in_vortex"] == false then minetest.chat_send_player(player_name, "You must dematerialize the TARDIS first!"); return end
|
||||
function tardis.show_nav_formspec(player_name, owner_name)
|
||||
if (player_name ~= owner_name) then
|
||||
minetest.chat_send_player(player_name, "You don't own that TARDIS!")
|
||||
return false end
|
||||
|
||||
minetest.show_formspec (player_name, "tardis:remat_form",
|
||||
"size[7,3]" ..
|
||||
"field[1,1.5;2,1;x;X;]" ..
|
||||
"field[3,1.5;2,1;y;Y;]" ..
|
||||
"field[5,1.5;2,1;z;Z;]" ..
|
||||
"button_exit[1,2;2,1;exit;Go!]")
|
||||
local pos = tardis.get_nav(owner_name)
|
||||
|
||||
minetest.register_on_player_receive_fields (function (player, formname, fields)
|
||||
if formname ~= "tardis:remat_form" then
|
||||
if (pos) then
|
||||
minetest.show_formspec(player_name, "tardis:remat_form",
|
||||
"size[7,3]" ..
|
||||
"field[1,1.5;2,1;x;X;"..pos.x.."]" ..
|
||||
"field[3,1.5;2,1;y;Y;"..pos.y.."]" ..
|
||||
"field[5,1.5;2,1;z;Z;"..pos.z.."]" ..
|
||||
"button_exit[1,2;2,1;exit;Go!]")
|
||||
else return false end
|
||||
|
||||
minetest.register_on_player_receive_fields(function (player, formname, fields)
|
||||
if (formname ~= "tardis:remat_form") then
|
||||
return false
|
||||
end
|
||||
|
||||
local coords = {x = tonumber(fields.x), y = tonumber(fields.y), z = tonumber(fields.z)}
|
||||
pos = {x = tonumber(fields.x), y = tonumber(fields.y), z = tonumber(fields.z)}
|
||||
|
||||
if (coords == nil or coords.x == nil or coords.y == nil or coords.z == nil) then
|
||||
minetest.chat_send_player (player_name, "Please enter valid coordinates.")
|
||||
else
|
||||
tardis.tardises [owner]["destination"] = coords
|
||||
if (pos == nil or pos.x == nil or pos.y == nil or pos.z == nil) then
|
||||
minetest.chat_send_player(player_name, "Please enter valid coordinates.")
|
||||
elseif (tardis.set_nav(pos, owner_name)) then
|
||||
return true
|
||||
else return false
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
-- When a player teleports into a previously generated mapblock with the TARDIS, we want it to appear.
|
||||
-- Make sure TARDISes places in ungenerated chunks exist and have meta set correctly.
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
for owner,table in pairs(tardis.tardises) do
|
||||
local exterior = table["exterior"]
|
||||
if exterior.x >= minp.x and exterior.y >= minp.y and exterior.z >= minp.z and
|
||||
exterior.x <= maxp.x and exterior.y <= maxp.y and exterior.z <= maxp.z then
|
||||
minetest.set_node(exterior, {name="tardis:tardis"})
|
||||
minetest.get_meta(exterior):set_string("owner", owner)
|
||||
local table = mod_storage:to_table()
|
||||
|
||||
for k, v in pairs(table.fields) do
|
||||
if ((k == string.match(k, "tardis:.+:exterior")) and
|
||||
(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
|
||||
(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"})
|
||||
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)
|
||||
|
|
57
init.lua
57
init.lua
|
@ -1,54 +1,11 @@
|
|||
-- Define global table and TARDIS index
|
||||
-- Define global table
|
||||
tardis = {}
|
||||
tardis.count = 0
|
||||
tardis.tardises = {}
|
||||
tardis.done = {}
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath (modname)
|
||||
local worldpath = minetest.get_worldpath()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
dofile (modpath .. "/remat.lua")
|
||||
dofile (modpath .. "/demat.lua")
|
||||
dofile (modpath .. "/functions.lua")
|
||||
dofile (modpath .. "/nodes.lua")
|
||||
|
||||
-- Open TARDIS index from file
|
||||
local file = io.open (worldpath .. "/tardis.tardises", "r")
|
||||
local count_file = io.open (worldpath .. "/tardis.count", "r")
|
||||
|
||||
-- If file exists, write into current index
|
||||
if file then
|
||||
tardis.tardises = minetest.deserialize (file:read("*all"))
|
||||
file:close()
|
||||
end
|
||||
|
||||
if count_file then
|
||||
tardis.count = minetest.deserialize (count_file:read("*all"))
|
||||
count_file:close()
|
||||
end
|
||||
|
||||
-- Register chatcommand to set navigation, return a help message if user doe not own a TARDIS
|
||||
minetest.register_chatcommand ("set_nav", {
|
||||
description = "Sets the navigation coordinates for your TARDIS.",
|
||||
func = function (name, param)
|
||||
if (tardis.tardises [name] == nil) then
|
||||
minetest.chat_send_player (name, "Must be owner!")
|
||||
else
|
||||
local owner = name
|
||||
local player = minetest.get_player_by_name (name)
|
||||
|
||||
tardis.set_nav (player, owner)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Save index on shutdown
|
||||
minetest.register_on_shutdown( function()
|
||||
local file = io.open (worldpath .. "/tardis.tardises", "w+")
|
||||
file:write(minetest.serialize (tardis.tardises) )
|
||||
file:close()
|
||||
|
||||
local count_file = io.open(worldpath .. "/tardis.count", "w+")
|
||||
count_file:write(minetest.serialize(tardis.count))
|
||||
count_file:close()
|
||||
end )
|
||||
dofile(modpath .. "/remat.lua")
|
||||
dofile(modpath .. "/demat.lua")
|
||||
dofile(modpath .. "/functions.lua")
|
||||
dofile(modpath .. "/nodes.lua")
|
||||
|
|
184
nodes.lua
184
nodes.lua
|
@ -1,70 +1,71 @@
|
|||
minetest.register_node ("tardis:tardis", {
|
||||
decription = "Time And Relative Dimension In Space" ,
|
||||
tiles = { "tardis_exterior.png" } ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:tardis", {
|
||||
decription = "Time And Relative Dimension In Space",
|
||||
tiles = { "tardis_exterior.png" },
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}},
|
||||
collision_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}},
|
||||
|
||||
-- Setup Meta, clone meta if not placed by a player
|
||||
on_place = function (itemstack, placer, pointed_thing)
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos = pointed_thing.above
|
||||
local player = placer:get_player_name()
|
||||
tardis.swap_node (pos, {name = "tardis:tardis"})
|
||||
local name = placer:get_player_name()
|
||||
tardis.swap_node(pos, {name = "tardis:tardis"})
|
||||
|
||||
if (player == nil) then
|
||||
local meta = minetest.get_meta (pos)
|
||||
local player = meta:get_string ("owner")
|
||||
tardis.tardises [player]["exterior"] = pos
|
||||
elseif (tardis.tardises [player] == nil) then
|
||||
tardis:spawn_interior (pos, player)
|
||||
if (name) then
|
||||
tardis:spawn_interior (pos, name)
|
||||
else
|
||||
tardis.tardises [player]["exterior"] = pos
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
if (tardis.get_interior(owner)) then
|
||||
tardis.set_exerior(pos, owner)
|
||||
|
||||
else tardis.set_exterior(pos, name)
|
||||
end
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta (pos)
|
||||
meta:set_string ("owner", player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string ("owner", name)
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
end ,
|
||||
end,
|
||||
|
||||
|
||||
-- Teleport Player
|
||||
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
|
||||
local meta = minetest.get_meta (pos)
|
||||
local owner = meta:get_string ("owner")
|
||||
local teleport = { x = tardis.tardises[owner]["interior"]["x"], y = tardis.tardises[owner]["interior"]["y"], z = tardis.tardises[owner]["interior"]["z"] + 1 }
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local name = meta:get_string("owner")
|
||||
local teleport = tardis.get_interior(name)
|
||||
teleport.z = teleport.z + 1
|
||||
|
||||
player.setpos (player, teleport)
|
||||
--player.set_look_horizontal(0)
|
||||
end ,
|
||||
player.setpos(player, teleport)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- Initialize materialization, fail if nav is not set, then swap node to off pos
|
||||
minetest.register_node ("tardis:demat_lever_on", {
|
||||
tiles = {"tardis_demat.png"} ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_demat_on.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:demat_lever_on", {
|
||||
tiles = {"tardis_demat.png"},
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_demat_on.obj",
|
||||
paramtype = "light",
|
||||
|
||||
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
|
||||
local player_name = player:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local name = player:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
|
||||
local rematted, msg = tardis.remat (owner, player:get_player_name())
|
||||
if (rematted == false) then
|
||||
minetest.chat_send_player (player_name, msg)
|
||||
else
|
||||
if (tardis.remat(owner)) then
|
||||
minetest.sound_play ("tardis_remat", {
|
||||
pos = pos ,
|
||||
max_hear_distance = 100 ,
|
||||
gain = 10 ,
|
||||
})
|
||||
minetest.swap_node (pos, {name = "tardis:demat_lever_off"})
|
||||
})
|
||||
minetest.swap_node(pos, {name = "tardis:demat_lever_off"})
|
||||
else
|
||||
minetest.chat_send_player(name, "Failed to remat")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -72,20 +73,17 @@ minetest.register_node ("tardis:demat_lever_on", {
|
|||
|
||||
-- Initialize dematerialization, then set lever to on pos
|
||||
minetest.register_node ("tardis:demat_lever_off", {
|
||||
groups = {crumbly = 1} ,
|
||||
tiles = {"tardis_demat.png"} ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_demat_off.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
tiles = {"tardis_demat.png"},
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_demat_off.obj",
|
||||
paramtype = "light",
|
||||
|
||||
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local name = player:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
|
||||
local dematted, msg = tardis.demat (owner, player:get_player_name())
|
||||
|
||||
if dematted then
|
||||
if (tardis.demat(owner)) then
|
||||
minetest.sound_play ("tardis_demat", {
|
||||
pos = pos ,
|
||||
max_hear_distance = 10 ,
|
||||
|
@ -94,63 +92,59 @@ minetest.register_node ("tardis:demat_lever_off", {
|
|||
|
||||
minetest.swap_node (pos, {name = "tardis:demat_lever_on"})
|
||||
else
|
||||
minetest.chat_send_player(player:get_player_name(), msg)
|
||||
minetest.chat_send_player(name, "Failed to demat")
|
||||
end
|
||||
end ,
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:navigator", {
|
||||
groups = {crumbly = 1} ,
|
||||
tiles = {"tardis_navigator.png"} ,
|
||||
drawtype = "signlike" ,
|
||||
paramtype = "light" ,
|
||||
paramtype2 = "wallmounted" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:navigator", {
|
||||
tiles = {"tardis_navigator.png"},
|
||||
drawtype = "signlike",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
|
||||
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local name = player:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
|
||||
tardis.set_nav(player, owner)
|
||||
end ,
|
||||
tardis.show_nav_formspec(name, owner)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- Teleports player to exterior is in_vortex is set to false
|
||||
minetest.register_node ("tardis:interior_doors", {
|
||||
tiles = {"tardis_doors.png"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_interior_doors.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:interior_doors", {
|
||||
tiles = {"tardis_doors.png"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_interior_doors.obj",
|
||||
paramtype = "light",
|
||||
selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}},
|
||||
collision_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}},
|
||||
|
||||
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
|
||||
local meta = minetest.get_meta (pos)
|
||||
local owner = meta:get_string ("owner")
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local name = player:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
|
||||
if (tardis.tardises == nil) or
|
||||
(tardis.tardises [owner] == nil) or
|
||||
(tardis.tardises [owner]["in_vortex"] == nil) then
|
||||
minetest.log ("error", "in_vortex not initialised for " .. owner)
|
||||
return
|
||||
end
|
||||
|
||||
if (tardis.tardises [owner]["in_vortex"] == false) then
|
||||
local teleport = { x = tardis.tardises[owner]["exterior"]["x"], y = tardis.tardises[owner]["exterior"]["y"], z = tardis.tardises[owner]["exterior"]["z"] - 1 }
|
||||
player:setpos (teleport)
|
||||
if (tardis.get_vortex(owner)) then
|
||||
minetest.chat_send_player (name, "The TARDIS is in the Vortex - the doors have been locked automatically.")
|
||||
else
|
||||
player_name = player:get_player_name()
|
||||
minetest.chat_send_player (player_name, "The TARDIS is in the Vortex - the doors have been locked automatically.")
|
||||
local teleport = tardis.get_exterior(owner)
|
||||
teleport["z"] = teleport["z"] - 1
|
||||
player:setpos(teleport)
|
||||
end
|
||||
end,
|
||||
|
||||
on_timer = function (pos)
|
||||
local meta = minetest.get_meta (pos)
|
||||
local owner = meta:get_string ("owner")
|
||||
|
||||
if tardis.tardises[owner]["in_vortex"] then -- If we're in a vortex, we must have been activated from the remat function.
|
||||
tardis.tardises[owner]["in_vortex"] = false -- exit it.
|
||||
|
||||
on_timer = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
|
||||
if (tardis.get_vortex(owner)) then -- If we're in a vortex, we must have been activated from the remat function.
|
||||
tardis.set_vortex(false, owner) -- exit it.
|
||||
|
||||
tardis.swap_node((tardis.get_exterior(owner)), {name = "tardis:tardis"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
288
remat.lua
288
remat.lua
|
@ -1,197 +1,183 @@
|
|||
function tardis.remat (owner, name)
|
||||
if owner ~= name then return false, "You don't own that TARDIS!" end
|
||||
if (tardis.tardises [owner]["destination"] == nil) then
|
||||
return false, "Coordinates haven't been set yet!"
|
||||
else
|
||||
local pos = tardis.tardises [owner]["destination"]
|
||||
function tardis.remat(name)
|
||||
local pos = tardis.get_nav(name)
|
||||
|
||||
minetest.set_node (pos, {name = "tardis:tardis_remat"})
|
||||
if (minetest.forceload_block(pos)) then
|
||||
minetest.set_node(pos, {name = "tardis:tardis_remat"})
|
||||
|
||||
local meta = minetest.get_meta (pos)
|
||||
meta:set_string ("owner", owner)
|
||||
|
||||
minetest.get_node_timer(tardis.tardises [owner]["interior"]):start(22.5)
|
||||
tardis.set_exterior(pos, name)
|
||||
|
||||
tardis.tardises [owner]["exterior"] = pos
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", name)
|
||||
|
||||
minetest.get_node_timer(tardis.get_interior(name)):start(21)
|
||||
return true
|
||||
else return false
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("tardis:tardis_remat", {
|
||||
tiles = {"tardis_exterior.png^[opacity:1"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
|
||||
minetest.register_node ("tardis:tardis_remat", {
|
||||
tiles = {"tardis_exterior.png^[opacity:1"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
on_timer = function(pos)
|
||||
tardis.swap_node(pos, {name = "tardis:tardis_remat_1"})
|
||||
end,
|
||||
|
||||
on_timer = function (pos)
|
||||
tardis.swap_node (pos, {name = "tardis:tardis_remat_1"})
|
||||
end ,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(11)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(11)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_remat_1", {
|
||||
tiles = {"tardis_exterior.png^[opacity:25"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
light_source = 7 ,
|
||||
minetest.register_node("tardis:tardis_remat_1", {
|
||||
tiles = {"tardis_exterior.png^[opacity:25"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
light_source = 7,
|
||||
|
||||
on_timer = function(pos)
|
||||
tardis.swap_node(pos, {name = "tardis:tardis_remat_2"})
|
||||
end,
|
||||
|
||||
on_timer = function (pos)
|
||||
tardis.swap_node (pos, {name = "tardis:tardis_remat_2"})
|
||||
end ,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1.5)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1.5)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_remat_2", {
|
||||
tiles = {"tardis_exterior.png^[opacity:50"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:tardis_remat_2", {
|
||||
tiles = {"tardis_exterior.png^[opacity:50"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
|
||||
on_timer = function (pos)
|
||||
tardis.swap_node (pos, {name = "tardis:tardis_remat_3"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
tardis.swap_node(pos, {name = "tardis:tardis_remat_3"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_remat_3", {
|
||||
tiles = {"tardis_exterior.png^[opacity:75"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
light_source = 10 ,
|
||||
minetest.register_node("tardis:tardis_remat_3", {
|
||||
tiles = {"tardis_exterior.png^[opacity:75"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
light_source = 10,
|
||||
|
||||
on_timer = function (pos)
|
||||
tardis.swap_node (pos, {name = "tardis:tardis_remat_4"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
tardis.swap_node(pos, {name = "tardis:tardis_remat_4"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_remat_4", {
|
||||
tiles = {"tardis_exterior.png^[opacity:100"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:tardis_remat_4", {
|
||||
tiles = {"tardis_exterior.png^[opacity:100"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
|
||||
on_timer = function (pos)
|
||||
tardis.swap_node (pos, {name = "tardis:tardis_remat_5"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
tardis.swap_node(pos, {name = "tardis:tardis_remat_5"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(0.5)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(0.5)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_remat_5", {
|
||||
tiles = {"tardis_exterior.png^[opacity:125"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
light_source = 10 ,
|
||||
minetest.register_node("tardis:tardis_remat_5", {
|
||||
tiles = {"tardis_exterior.png^[opacity:125"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
light_source = 10,
|
||||
|
||||
on_timer = function (pos)
|
||||
tardis.swap_node (pos, {name = "tardis:tardis_remat_6"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
tardis.swap_node(pos, {name = "tardis:tardis_remat_6"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_remat_6", {
|
||||
tiles = {"tardis_exterior.png^[opacity:150"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:tardis_remat_6", {
|
||||
tiles = {"tardis_exterior.png^[opacity:150"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
|
||||
on_timer = function (pos)
|
||||
tardis.swap_node (pos, {name = "tardis:tardis_remat_7"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
tardis.swap_node(pos, {name = "tardis:tardis_remat_7"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_remat_7", {
|
||||
tiles = {"tardis_exterior.png^[opacity:175"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
light_source = 10 ,
|
||||
minetest.register_node("tardis:tardis_remat_7", {
|
||||
tiles = {"tardis_exterior.png^[opacity:175"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
light_source = 10,
|
||||
|
||||
on_timer = function (pos)
|
||||
tardis.swap_node (pos, {name = "tardis:tardis_remat_8"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
tardis.swap_node(pos, {name = "tardis:tardis_remat_8"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_remat_8", {
|
||||
tiles = {"tardis_exterior.png^[opacity:200"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
minetest.register_node("tardis:tardis_remat_8", {
|
||||
tiles = {"tardis_exterior.png^[opacity:200"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
|
||||
on_timer = function (pos)
|
||||
tardis.swap_node (pos, {name = "tardis:tardis_remat_9"})
|
||||
end ,
|
||||
on_timer = function(pos)
|
||||
tardis.swap_node(pos, {name = "tardis:tardis_remat_9"})
|
||||
end,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(0.5)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(0.5)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node ("tardis:tardis_remat_9", {
|
||||
tiles = {"tardis_exterior.png^[opacity:225"} ,
|
||||
use_texture_alpha = true ,
|
||||
drawtype = "mesh" ,
|
||||
mesh = "tardis_exterior.obj" ,
|
||||
paramtype = "light" ,
|
||||
is_ground_content = true ,
|
||||
light_source = 10 ,
|
||||
minetest.register_node("tardis:tardis_remat_9", {
|
||||
tiles = {"tardis_exterior.png^[opacity:225"},
|
||||
use_texture_alpha = true,
|
||||
drawtype = "mesh",
|
||||
mesh = "tardis_exterior.obj",
|
||||
paramtype = "light",
|
||||
light_source = 10,
|
||||
|
||||
on_timer = function (pos)
|
||||
tardis.swap_node (pos, {name = "tardis:tardis"})
|
||||
on_timer = function(pos)
|
||||
tardis.swap_node(pos, {name = "tardis:tardis"})
|
||||
minetest.forceload_free_block(pos)
|
||||
end,
|
||||
|
||||
local meta = minetest.get_meta (pos)
|
||||
owner = meta:get_string ("owner")
|
||||
end ,
|
||||
|
||||
on_construct = function (pos)
|
||||
minetest.get_node_timer (pos):start(1)
|
||||
end ,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue