Changed many things.

Added setnav node and prevented setnavving before dematting.
Fixed the remat sound, I think.
Various things.
entity
rdococ 2017-07-27 08:28:13 +01:00
parent d734027784
commit 53a740a4e4
7 changed files with 57 additions and 20 deletions

View File

@ -1,4 +1,5 @@
function tardis.demat (owner) function tardis.demat (owner, name)
if owner ~= name then return false, "You don't own that TARDIS!" end
local pos = tardis.tardises [owner]["exterior"] local pos = tardis.tardises [owner]["exterior"]
minetest.set_node (pos, {name = "tardis:tardis_demat"}) minetest.set_node (pos, {name = "tardis:tardis_demat"})
@ -10,6 +11,7 @@ function tardis.demat (owner)
max_hear_distance = 100 , max_hear_distance = 100 ,
gain = 10 , gain = 10 ,
}) })
return true
end end

View File

@ -15,10 +15,11 @@ end
function tardis:spawn_interior (pos, owner) function tardis:spawn_interior (pos, owner)
local place_pos = { local place_pos = {
x = pos ["x"] , x = tardis.count * 12 ,
y = 30000 , y = 30000 ,
z = pos ["z"] , z = 0 ,
} }
tardis.count = tardis.count + 1
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) ,
@ -29,6 +30,11 @@ function tardis:spawn_interior (pos, owner)
y = (place_pos ["y"] + 2) , y = (place_pos ["y"] + 2) ,
z = (place_pos ["z"] + 7) , z = (place_pos ["z"] + 7) ,
} }
local nav_pos = {
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")
@ -39,6 +45,9 @@ function tardis:spawn_interior (pos, owner)
local demat_meta = minetest.get_meta (demat_lever_pos) local demat_meta = minetest.get_meta (demat_lever_pos)
demat_meta:set_string ("owner", owner) demat_meta:set_string ("owner", owner)
local nav_meta = minetest.get_meta (nav_pos)
nav_meta:set_string ("owner", owner)
local interior_doors_meta = minetest.get_meta (interior_doors_pos) local interior_doors_meta = minetest.get_meta (interior_doors_pos)
interior_doors_meta:set_string ("owner", owner) interior_doors_meta:set_string ("owner", owner)
@ -52,6 +61,8 @@ end
function tardis.set_nav (player, owner) function tardis.set_nav (player, owner)
local player_name = player:get_player_name() 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
minetest.show_formspec (player_name, "tardis:remat_form", minetest.show_formspec (player_name, "tardis:remat_form",
"size[7,3]" .. "size[7,3]" ..

View File

@ -1,4 +1,5 @@
tardis = {} tardis = {}
tardis.count = 0
tardis.tardises = {} tardis.tardises = {}
local modname = minetest.get_current_modname() local modname = minetest.get_current_modname()

View File

@ -1,5 +1,5 @@
minetest.register_node ("tardis:tardis", { minetest.register_node ("tardis:tardis", {
decription = "Time And Relative Dimention In Space" , decription = "Time And Relative Dimension In Space" ,
tiles = { "tardis_exterior.png" } , tiles = { "tardis_exterior.png" } ,
use_texture_alpha = true , use_texture_alpha = true ,
drawtype = "mesh" , drawtype = "mesh" ,
@ -51,15 +51,15 @@ minetest.register_node ("tardis:demat_lever_on", {
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
if (tardis.remat (owner) == false) then local rematted, msg = tardis.remat (owner, player:get_player_name())
minetest.chat_send_player (player_name, "Nav Not Set!!") if (rematted == false) then
minetest.chat_send_player (player_name, msg)
else else
minetest.sound_play ("tardis_demat", { minetest.sound_play ("tardis_remat", {
pos = pos , pos = pos ,
max_hear_distance = 10 , max_hear_distance = 100 ,
gain = 10 , gain = 10 ,
}) })
minetest.swap_node (pos, {name = "tardis:demat_lever_off"}) minetest.swap_node (pos, {name = "tardis:demat_lever_off"})
end end
end end
@ -77,15 +77,36 @@ minetest.register_node ("tardis:demat_lever_off", {
on_rightclick = function (pos, node, player, itemstack, pointed_thing) on_rightclick = function (pos, node, player, itemstack, pointed_thing)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
local dematted, msg = tardis.demat (owner, player:get_player_name())
tardis.demat (owner) if dematted then
minetest.sound_play ("tardis_demat", { minetest.sound_play ("tardis_demat", {
pos = pos , pos = pos ,
max_hear_distance = 10 , max_hear_distance = 10 ,
gain = 10 , gain = 10 ,
}) })
minetest.swap_node (pos, {name = "tardis:demat_lever_on"}) minetest.swap_node (pos, {name = "tardis:demat_lever_on"})
else
minetest.chat_send_player(player:get_player_name(), msg)
end
end ,
})
minetest.register_node ("tardis:navigator", {
groups = {crumbly = 1} ,
tiles = {"tardis_navigator.png"} ,
drawtype = "signlike" ,
paramtype = "light" ,
paramtype2 = "wallmounted" ,
is_ground_content = true ,
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
tardis.set_nav(player, owner)
end , end ,
}) })

View File

@ -1,6 +1,7 @@
function tardis.remat (owner) 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 if (tardis.tardises [owner]["destination"] == nil) then
return false return false, "Coordinates haven't been set yet!"
else else
local pos = tardis.tardises [owner]["destination"] local pos = tardis.tardises [owner]["destination"]
@ -17,6 +18,7 @@ function tardis.remat (owner)
max_hear_distance = 100 , max_hear_distance = 100 ,
gain = 10 , gain = 10 ,
}) })
return true
end end
end end

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B