Replace minetest
with core
following engine name change to Luanti
This commit is contained in:
parent
c65226113a
commit
3f1eb8caf5
52
api.lua
52
api.lua
@ -20,8 +20,8 @@
|
|||||||
-- Power
|
-- Power
|
||||||
-- and more
|
-- and more
|
||||||
|
|
||||||
local data = minetest.get_mod_storage()
|
local data = core.get_mod_storage()
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
drwho_tardis.get = {}
|
drwho_tardis.get = {}
|
||||||
|
|
||||||
-- Returns the default depth Tardis interiors are placed at
|
-- Returns the default depth Tardis interiors are placed at
|
||||||
@ -47,7 +47,7 @@ end
|
|||||||
|
|
||||||
-- Returns the Tardis exterior list, or an empty table if for some reason "exterior_list" doesn't exist
|
-- Returns the Tardis exterior list, or an empty table if for some reason "exterior_list" doesn't exist
|
||||||
function drwho_tardis.get:exterior_list()
|
function drwho_tardis.get:exterior_list()
|
||||||
local ext_list = minetest.deserialize(data:get_string("exterior_list")) or {}
|
local ext_list = core.deserialize(data:get_string("exterior_list")) or {}
|
||||||
return ext_list
|
return ext_list
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ function _drwho_tardis:place_tardis_interior(id, type, pos)
|
|||||||
local exit_door_offset = {x=0,y=0,z=0}
|
local exit_door_offset = {x=0,y=0,z=0}
|
||||||
|
|
||||||
if _drwho_tardis.rooms[type] then
|
if _drwho_tardis.rooms[type] then
|
||||||
minetest.place_schematic(pos, _drwho_tardis.rooms[type].path) --minetest.get_modpath("drwho_tardis") .. "/schems/console_room.mts"
|
core.place_schematic(pos, _drwho_tardis.rooms[type].path) --core.get_modpath("drwho_tardis") .. "/schems/console_room.mts"
|
||||||
exit_door_offset = _drwho_tardis.rooms[type].exit_door_offset -- = {x=7,y=2,z=16}
|
exit_door_offset = _drwho_tardis.rooms[type].exit_door_offset -- = {x=7,y=2,z=16}
|
||||||
local exit_door_pos = vector.add(pos, exit_door_offset) -- Schematic adjustments so that the player gets teleported right in front of the door
|
local exit_door_pos = vector.add(pos, exit_door_offset) -- Schematic adjustments so that the player gets teleported right in front of the door
|
||||||
user.console_room.type = type -- Save what type of interior they have
|
user.console_room.type = type -- Save what type of interior they have
|
||||||
@ -105,8 +105,8 @@ end
|
|||||||
-- id is the username of the player who owns the Tardis
|
-- id is the username of the player who owns the Tardis
|
||||||
function _drwho_tardis:init_interior_door(id, exit_door_pos)
|
function _drwho_tardis:init_interior_door(id, exit_door_pos)
|
||||||
|
|
||||||
local d_meta = minetest.get_meta(exit_door_pos)
|
local d_meta = core.get_meta(exit_door_pos)
|
||||||
local d_timer = minetest.get_node_timer(exit_door_pos)
|
local d_timer = core.get_node_timer(exit_door_pos)
|
||||||
d_timer:start(0.2) --start door timer (in case it doesn't start on construct)
|
d_timer:start(0.2) --start door timer (in case it doesn't start on construct)
|
||||||
d_meta:set_string("id", id) --set door id
|
d_meta:set_string("id", id) --set door id
|
||||||
d_meta:set_string("type", "exit") -- set door type
|
d_meta:set_string("type", "exit") -- set door type
|
||||||
@ -157,11 +157,11 @@ function _drwho_tardis.is_time_rotor(id, pos)
|
|||||||
local user = _drwho_tardis.get_user(id) -- get user data
|
local user = _drwho_tardis.get_user(id) -- get user data
|
||||||
local r_pos = pos or table.copy(user.r_pos)
|
local r_pos = pos or table.copy(user.r_pos)
|
||||||
if not r_pos or r_pos == "" or r_pos == {} then return false, "r_pos doesn't exist", r_pos end
|
if not r_pos or r_pos == "" or r_pos == {} then return false, "r_pos doesn't exist", r_pos end
|
||||||
local rmeta = minetest.get_meta(r_pos)
|
local rmeta = core.get_meta(r_pos)
|
||||||
local rotor_node = minetest.get_node(r_pos)
|
local rotor_node = core.get_node(r_pos)
|
||||||
|
|
||||||
if minetest.get_item_group(rotor_node.name, 'tardis_time_rotor') == 1 or
|
if core.get_item_group(rotor_node.name, 'tardis_time_rotor') == 1 or
|
||||||
minetest.get_item_group(rotor_node.name, 'tardis_time_rotor_active') == 1 then
|
core.get_item_group(rotor_node.name, 'tardis_time_rotor_active') == 1 then
|
||||||
return true, "rotor is there", r_pos
|
return true, "rotor is there", r_pos
|
||||||
else
|
else
|
||||||
return false, "rotor is not there", r_pos
|
return false, "rotor is not there", r_pos
|
||||||
@ -176,18 +176,18 @@ function _drwho_tardis.switch_time_rotor(id, on_off)
|
|||||||
local is_it_there, msg = _drwho_tardis.is_time_rotor(id)
|
local is_it_there, msg = _drwho_tardis.is_time_rotor(id)
|
||||||
|
|
||||||
if is_it_there then
|
if is_it_there then
|
||||||
local rmeta = minetest.get_meta(r_pos)
|
local rmeta = core.get_meta(r_pos)
|
||||||
local style = rmeta:get_string("style")
|
local style = rmeta:get_string("style")
|
||||||
local rotor_node = minetest.get_node(r_pos)
|
local rotor_node = core.get_node(r_pos)
|
||||||
if on_off == "on" then
|
if on_off == "on" then
|
||||||
minetest.swap_node(r_pos, {name = "drwho_tardis:rotor_active"..style })
|
core.swap_node(r_pos, {name = "drwho_tardis:rotor_active"..style })
|
||||||
return true, r_pos
|
return true, r_pos
|
||||||
elseif on_off == "off" then
|
elseif on_off == "off" then
|
||||||
minetest.swap_node(r_pos, {name = "drwho_tardis:rotor"..style })
|
core.swap_node(r_pos, {name = "drwho_tardis:rotor"..style })
|
||||||
return true, r_pos
|
return true, r_pos
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(id, S("You need to have a Time Rotor!"))
|
core.chat_send_player(id, S("You need to have a Time Rotor!"))
|
||||||
return false, r_pos
|
return false, r_pos
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -198,32 +198,32 @@ function _drwho_tardis.toggle_int_door(id, on_off)
|
|||||||
local in_pos = table.copy(user.in_pos)
|
local in_pos = table.copy(user.in_pos)
|
||||||
|
|
||||||
if on_off == "lock" then
|
if on_off == "lock" then
|
||||||
minetest.set_node(in_pos, { name = "drwho_tardis:in_door_locked" })
|
core.set_node(in_pos, { name = "drwho_tardis:in_door_locked" })
|
||||||
local dmeta = minetest.get_meta(in_pos)
|
local dmeta = core.get_meta(in_pos)
|
||||||
dmeta:set_string("id", id) -- set door id
|
dmeta:set_string("id", id) -- set door id
|
||||||
dmeta:set_string("type", "exit") -- set door type
|
dmeta:set_string("type", "exit") -- set door type
|
||||||
return true, "Interior door locked"
|
return true, "Interior door locked"
|
||||||
elseif on_off == "unlock" then
|
elseif on_off == "unlock" then
|
||||||
minetest.set_node(in_pos, { name = "drwho_tardis:in_door" })
|
core.set_node(in_pos, { name = "drwho_tardis:in_door" })
|
||||||
-- Start door timer
|
-- Start door timer
|
||||||
local dtimer = minetest.get_node_timer(in_pos)
|
local dtimer = core.get_node_timer(in_pos)
|
||||||
local dmeta = minetest.get_meta(in_pos)
|
local dmeta = core.get_meta(in_pos)
|
||||||
dmeta:set_string("id", id) -- set door id
|
dmeta:set_string("id", id) -- set door id
|
||||||
dmeta:set_string("type", "exit") -- set door type
|
dmeta:set_string("type", "exit") -- set door type
|
||||||
dtimer:start(0.2) -- start door timer (in case it doesn't start on construct)
|
dtimer:start(0.2) -- start door timer (in case it doesn't start on construct)
|
||||||
return true, "Interior door unlocked"
|
return true, "Interior door unlocked"
|
||||||
else -- on_off is not given, toggle door
|
else -- on_off is not given, toggle door
|
||||||
if minetest.get_node(in_pos).name == "drwho_tardis:in_door" then
|
if core.get_node(in_pos).name == "drwho_tardis:in_door" then
|
||||||
minetest.set_node(in_pos, { name = "drwho_tardis:in_door_locked" })
|
core.set_node(in_pos, { name = "drwho_tardis:in_door_locked" })
|
||||||
local dmeta = minetest.get_meta(in_pos)
|
local dmeta = core.get_meta(in_pos)
|
||||||
dmeta:set_string("id", id) -- set door id
|
dmeta:set_string("id", id) -- set door id
|
||||||
dmeta:set_string("type", "exit") -- set door type
|
dmeta:set_string("type", "exit") -- set door type
|
||||||
return true, "Interior door locked"
|
return true, "Interior door locked"
|
||||||
else
|
else
|
||||||
minetest.set_node(in_pos, { name = "drwho_tardis:in_door" })
|
core.set_node(in_pos, { name = "drwho_tardis:in_door" })
|
||||||
-- Start door timer
|
-- Start door timer
|
||||||
local dtimer = minetest.get_node_timer(in_pos)
|
local dtimer = core.get_node_timer(in_pos)
|
||||||
local dmeta = minetest.get_meta(in_pos)
|
local dmeta = core.get_meta(in_pos)
|
||||||
dmeta:set_string("id", id) -- set door id
|
dmeta:set_string("id", id) -- set door id
|
||||||
dmeta:set_string("type", "exit") -- set door type
|
dmeta:set_string("type", "exit") -- set door type
|
||||||
dtimer:start(0.2) -- start door timer (in case it doesn't start on construct)
|
dtimer:start(0.2) -- start door timer (in case it doesn't start on construct)
|
||||||
|
18
armor.lua
18
armor.lua
@ -2,10 +2,10 @@
|
|||||||
-- Dalekanium Armor + Shield - definitions + crafting
|
-- Dalekanium Armor + Shield - definitions + crafting
|
||||||
-- Order: helmet, chestplate, leggings, boots, shield
|
-- Order: helmet, chestplate, leggings, boots, shield
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
|
|
||||||
if _drwho_tardis.GAMETYPE == "mtg" then -- Only run this section in MTG-based games
|
if _drwho_tardis.GAMETYPE == "mtg" then -- Only run this section in MTG-based games
|
||||||
if minetest.get_modpath("3d_armor") then -- and if 3d_armor is available
|
if core.get_modpath("3d_armor") then -- and if 3d_armor is available
|
||||||
|
|
||||||
--Dalekanium Armor (using 3d_armor) and Shield
|
--Dalekanium Armor (using 3d_armor) and Shield
|
||||||
-- Armor Values similar to nether armor
|
-- Armor Values similar to nether armor
|
||||||
@ -18,7 +18,7 @@ armor:register_armor("drwho_tardis:helmet_dalek", {
|
|||||||
armor_groups = {fleshy=18},
|
armor_groups = {fleshy=18},
|
||||||
damage_groups = {cracky=3, snappy=2, level=3},
|
damage_groups = {cracky=3, snappy=2, level=3},
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "drwho_tardis:helmet_dalek",
|
output = "drwho_tardis:helmet_dalek",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot"},
|
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot"},
|
||||||
@ -36,7 +36,7 @@ armor:register_armor("drwho_tardis:chestplate_dalek", {
|
|||||||
armor_groups = {fleshy=25},
|
armor_groups = {fleshy=25},
|
||||||
damage_groups = {cracky=3, snappy=2, level=3},
|
damage_groups = {cracky=3, snappy=2, level=3},
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "drwho_tardis:chestplate_dalek",
|
output = "drwho_tardis:chestplate_dalek",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"drwho_tardis:dalekanium_ingot", "", "drwho_tardis:dalekanium_ingot"},
|
{"drwho_tardis:dalekanium_ingot", "", "drwho_tardis:dalekanium_ingot"},
|
||||||
@ -54,7 +54,7 @@ armor:register_armor("drwho_tardis:leggings_dalek", {
|
|||||||
armor_groups = {fleshy=25},
|
armor_groups = {fleshy=25},
|
||||||
damage_groups = {cracky=3, snappy=2, level=3},
|
damage_groups = {cracky=3, snappy=2, level=3},
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "drwho_tardis:leggings_dalek",
|
output = "drwho_tardis:leggings_dalek",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot"},
|
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot"},
|
||||||
@ -72,7 +72,7 @@ armor:register_armor("drwho_tardis:boots_dalek", {
|
|||||||
armor_groups = {fleshy=18},
|
armor_groups = {fleshy=18},
|
||||||
damage_groups = {cracky=3, snappy=2, level=3},
|
damage_groups = {cracky=3, snappy=2, level=3},
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "drwho_tardis:boots_dalek",
|
output = "drwho_tardis:boots_dalek",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"drwho_tardis:dalekanium_ingot", "", "drwho_tardis:dalekanium_ingot"},
|
{"drwho_tardis:dalekanium_ingot", "", "drwho_tardis:dalekanium_ingot"},
|
||||||
@ -85,7 +85,7 @@ minetest.register_craft({
|
|||||||
-- values from Mithril
|
-- values from Mithril
|
||||||
|
|
||||||
-- Only if shields are enabled in 3d_armor settings
|
-- Only if shields are enabled in 3d_armor settings
|
||||||
if minetest.get_modpath("shields") then
|
if core.get_modpath("shields") then
|
||||||
|
|
||||||
armor:register_armor("drwho_tardis:shield_dalek", {
|
armor:register_armor("drwho_tardis:shield_dalek", {
|
||||||
description = (S("Dalekanium Shield")),
|
description = (S("Dalekanium Shield")),
|
||||||
@ -102,7 +102,7 @@ if minetest.get_modpath("shields") then
|
|||||||
--end,
|
--end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "drwho_tardis:shield_dalek",
|
output = "drwho_tardis:shield_dalek",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot"},
|
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot"},
|
||||||
@ -117,7 +117,7 @@ elseif _drwho_tardis.GAMETYPE == "mcl" then
|
|||||||
-- MineClone armor has not been made yet.
|
-- MineClone armor has not been made yet.
|
||||||
|
|
||||||
elseif _drwho_tardis.GAMETYPE == "rp" then
|
elseif _drwho_tardis.GAMETYPE == "rp" then
|
||||||
if minetest.get_modpath("rp_armor") then
|
if core.get_modpath("rp_armor") then
|
||||||
-- Will have to wait until we have the textures for them though
|
-- Will have to wait until we have the textures for them though
|
||||||
--[[
|
--[[
|
||||||
armor.register_armor_set("drwho_tardis", "dalek", {
|
armor.register_armor_set("drwho_tardis", "dalek", {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
times_travelled_in_tardis = 0 --defined in console.lua --increased by 1 every time you travel in YOUR Tardis
|
times_travelled_in_tardis = 0 --defined in console.lua --increased by 1 every time you travel in YOUR Tardis
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
|
|
||||||
-- Use rubenwardy's awards mod in MTG
|
-- Use rubenwardy's awards mod in MTG
|
||||||
if _drwho_tardis.GAMETYPE == "mtg" then
|
if _drwho_tardis.GAMETYPE == "mtg" then
|
||||||
if minetest.get_modpath("awards") then
|
if core.get_modpath("awards") then
|
||||||
|
|
||||||
_drwho_tardis.check_drwho_awards = function(name)
|
_drwho_tardis.check_drwho_awards = function(name)
|
||||||
local user = _drwho_tardis.get_user(name)
|
local user = _drwho_tardis.get_user(name)
|
||||||
@ -158,11 +158,11 @@ end -- MTG awards
|
|||||||
|
|
||||||
|
|
||||||
if _drwho_tardis.GAMETYPE == "mcl" then
|
if _drwho_tardis.GAMETYPE == "mcl" then
|
||||||
minetest.chat_send_all("Awards for MineClone do not exist yet!")
|
core.chat_send_all("Awards for MineClone do not exist yet!")
|
||||||
-- I believe their system is different, also it game me error
|
-- I believe their system is different, also it game me error
|
||||||
end
|
end
|
||||||
|
|
||||||
if _drwho_tardis.GAMETYPE == "rp" then
|
if _drwho_tardis.GAMETYPE == "rp" then
|
||||||
minetest.chat_send_all("Awards for Repixture do not exist yet!")
|
core.chat_send_all("Awards for Repixture do not exist yet!")
|
||||||
-- Use rp_achievements
|
-- Use rp_achievements
|
||||||
end
|
end
|
@ -3,41 +3,41 @@
|
|||||||
-- Only the CRAFTitems, none of the actual items in-game
|
-- Only the CRAFTitems, none of the actual items in-game
|
||||||
-- Includes the TARDIS biscuit
|
-- Includes the TARDIS biscuit
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
|
|
||||||
-- ALL CRAFTITEMS
|
-- ALL CRAFTITEMS
|
||||||
|
|
||||||
minetest.register_craftitem("drwho_tardis:arton_crystal", {
|
core.register_craftitem("drwho_tardis:arton_crystal", {
|
||||||
description = S("Arton Crystal"),
|
description = S("Arton Crystal"),
|
||||||
inventory_image = "arton_crystal.png",
|
inventory_image = "arton_crystal.png",
|
||||||
groups = {}
|
groups = {}
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:spacetime", {
|
core.register_node("drwho_tardis:spacetime", {
|
||||||
description = S("Compressed Spacetime"),
|
description = S("Compressed Spacetime"),
|
||||||
tiles = {"tardis_spacetime.png"},
|
tiles = {"tardis_spacetime.png"},
|
||||||
groups = {cracky = 1}
|
groups = {cracky = 1}
|
||||||
})
|
})
|
||||||
minetest.register_craftitem("drwho_tardis:circuitry_board", {
|
core.register_craftitem("drwho_tardis:circuitry_board", {
|
||||||
description = S("Tardis Circuitry"),
|
description = S("Tardis Circuitry"),
|
||||||
inventory_image = "tardis_circuit_board.png",
|
inventory_image = "tardis_circuit_board.png",
|
||||||
groups = {}
|
groups = {}
|
||||||
})
|
})
|
||||||
minetest.register_craftitem("drwho_tardis:biscuit", {
|
core.register_craftitem("drwho_tardis:biscuit", {
|
||||||
description = S("Biscuit"),
|
description = S("Biscuit"),
|
||||||
inventory_image = "tardis_biscuit.png",
|
inventory_image = "tardis_biscuit.png",
|
||||||
on_use = minetest.item_eat(8),
|
on_use = core.item_eat(8),
|
||||||
_rp_hunger_food = 8, -- RePixture compat
|
_rp_hunger_food = 8, -- RePixture compat
|
||||||
_rp_hunger_sat = 14, -- `rp_hunger`
|
_rp_hunger_sat = 14, -- `rp_hunger`
|
||||||
})
|
})
|
||||||
minetest.register_craftitem("drwho_tardis:azbantium_shard", {
|
core.register_craftitem("drwho_tardis:azbantium_shard", {
|
||||||
description = S("Azbantium Shard"),
|
description = S("Azbantium Shard"),
|
||||||
inventory_image = "azbantium_shard.png",
|
inventory_image = "azbantium_shard.png",
|
||||||
})
|
})
|
||||||
minetest.register_craftitem("drwho_tardis:dalekanium_ingot", {
|
core.register_craftitem("drwho_tardis:dalekanium_ingot", {
|
||||||
description = S("Dalekanium Ingot"),
|
description = S("Dalekanium Ingot"),
|
||||||
inventory_image = "dalekanium_ingot.png",
|
inventory_image = "dalekanium_ingot.png",
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:azbantium", {
|
core.register_node("drwho_tardis:azbantium", {
|
||||||
description = S("Azbantium"),
|
description = S("Azbantium"),
|
||||||
light_source = 4,
|
light_source = 4,
|
||||||
tiles = {"azbantium.png"},
|
tiles = {"azbantium.png"},
|
||||||
|
116
init.lua
116
init.lua
@ -3,21 +3,21 @@
|
|||||||
-- Chat Commands
|
-- Chat Commands
|
||||||
-- minor bug fix functions
|
-- minor bug fix functions
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
|
|
||||||
|
|
||||||
drwho_tardis = { -- Global definition for the API functions and metadata
|
drwho_tardis = { -- Global definition for the API functions and metadata
|
||||||
VERSION = "1.3.0-dev"
|
VERSION = "1.3.0-dev"
|
||||||
}
|
}
|
||||||
_drwho_tardis = { -- Private API + storage
|
_drwho_tardis = { -- Private API + storage
|
||||||
data = minetest.get_mod_storage(),
|
data = core.get_mod_storage(),
|
||||||
}
|
}
|
||||||
|
|
||||||
--
|
--
|
||||||
-- INIT FOR DEPENDENCIES AND LUA FILES
|
-- INIT FOR DEPENDENCIES AND LUA FILES
|
||||||
--
|
--
|
||||||
|
|
||||||
local MP = minetest.get_modpath("drwho_tardis")
|
local MP = core.get_modpath("drwho_tardis")
|
||||||
|
|
||||||
dofile(MP .. "/init_data.lua") -- Initiate data such as interior rooms and crafting aliases
|
dofile(MP .. "/init_data.lua") -- Initiate data such as interior rooms and crafting aliases
|
||||||
dofile(MP .. "/api.lua") -- The majority of API functions
|
dofile(MP .. "/api.lua") -- The majority of API functions
|
||||||
@ -34,11 +34,11 @@ dofile(MP .. "/armor.lua") -- Dalekanium Armor (if 3d_armor is enabled)
|
|||||||
dofile(MP .. "/awards.lua") -- Various achievements (if awards is enabled)
|
dofile(MP .. "/awards.lua") -- Various achievements (if awards is enabled)
|
||||||
|
|
||||||
-- Doctor Who Monsters (can be disabled in settings)
|
-- Doctor Who Monsters (can be disabled in settings)
|
||||||
if minetest.settings:get_bool("drwho_tardis.enable_daleks") == false then
|
if core.settings:get_bool("drwho_tardis.enable_daleks") == false then
|
||||||
return
|
return
|
||||||
else dofile(MP .. "/mobs/dalek.lua") end -- Daleks
|
else dofile(MP .. "/mobs/dalek.lua") end -- Daleks
|
||||||
|
|
||||||
if minetest.settings:get_bool("drwho_tardis.enable_cybermen") == false then
|
if core.settings:get_bool("drwho_tardis.enable_cybermen") == false then
|
||||||
return
|
return
|
||||||
else dofile(MP .. "/mobs/cybermen.lua") end -- Cybermen
|
else dofile(MP .. "/mobs/cybermen.lua") end -- Cybermen
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ dofile(MP .. "/migration.lua")
|
|||||||
|
|
||||||
|
|
||||||
-- Subtitles for sound effects
|
-- Subtitles for sound effects
|
||||||
if minetest.get_modpath("subtitles") then
|
if core.get_modpath("subtitles") then
|
||||||
subtitles.register_description('Dalek_Voice', S('"You will obey the Daleks!"')) -- Too long to fit the screen
|
subtitles.register_description('Dalek_Voice', S('"You will obey the Daleks!"')) -- Too long to fit the screen
|
||||||
subtitles.register_description('Shortened_Dalek_Voice', S('"You will be exterminated!"'))
|
subtitles.register_description('Shortened_Dalek_Voice', S('"You will be exterminated!"'))
|
||||||
subtitles.register_description('Laser', S('Laser blast'))
|
subtitles.register_description('Laser', S('Laser blast'))
|
||||||
@ -58,32 +58,32 @@ end
|
|||||||
|
|
||||||
--Data (11) : in_pos, out_pos, y_dest, x_dest, z_dest, factor, look, r_pos, waypoint1, waypoint2, waypoint3, biome_pos, type, door_0_offset
|
--Data (11) : in_pos, out_pos, y_dest, x_dest, z_dest, factor, look, r_pos, waypoint1, waypoint2, waypoint3, biome_pos, type, door_0_offset
|
||||||
-- This is going to be reworked in v1.3.0
|
-- This is going to be reworked in v1.3.0
|
||||||
local data = minetest.get_mod_storage()
|
local data = core.get_mod_storage()
|
||||||
|
|
||||||
--
|
--
|
||||||
-- CHAT COMMANDS
|
-- CHAT COMMANDS
|
||||||
--
|
--
|
||||||
|
|
||||||
-- Print the detected gametype, for devs
|
-- Print the detected gametype, for devs
|
||||||
minetest.register_chatcommand("tardis_gametype", {
|
core.register_chatcommand("tardis_gametype", {
|
||||||
params = "",
|
params = "",
|
||||||
description = S("Prints the type of game (mtg, mcl, rp)"),
|
description = S("Prints the type of game (mtg, mcl, rp)"),
|
||||||
privs = {debug = true},
|
privs = {debug = true},
|
||||||
func = function(name)
|
func = function(name)
|
||||||
minetest.chat_send_player(name, "Game type is: ".._drwho_tardis.GAMETYPE)
|
core.chat_send_player(name, "Game type is: ".._drwho_tardis.GAMETYPE)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- TEMPORARY - for devs
|
-- TEMPORARY - for devs
|
||||||
minetest.register_chatcommand("ext_list", {
|
core.register_chatcommand("ext_list", {
|
||||||
params = "",
|
params = "",
|
||||||
description = S("DEV COMMAND: temporary"),
|
description = S("DEV COMMAND: temporary"),
|
||||||
privs = {debug = true},
|
privs = {debug = true},
|
||||||
func = function(name)
|
func = function(name)
|
||||||
local ext_list = drwho_tardis.get:exterior_list()
|
local ext_list = drwho_tardis.get:exterior_list()
|
||||||
for i, ext in ipairs(ext_list) do
|
for i, ext in ipairs(ext_list) do
|
||||||
minetest.chat_send_player(name, minetest.serialize(ext))
|
core.chat_send_player(name, core.serialize(ext))
|
||||||
minetest.chat_send_player(name, minetest.serialize(ext.itemstring))
|
core.chat_send_player(name, core.serialize(ext.itemstring))
|
||||||
if i >= 20 then
|
if i >= 20 then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@ -92,7 +92,7 @@ minetest.register_chatcommand("ext_list", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Fix interior doors
|
-- Fix interior doors
|
||||||
minetest.register_chatcommand("reset_door", {
|
core.register_chatcommand("reset_door", {
|
||||||
params = "",
|
params = "",
|
||||||
description = S("Resets your Tardis interior console door and fixes it's timer"),
|
description = S("Resets your Tardis interior console door and fixes it's timer"),
|
||||||
privs = {},
|
privs = {},
|
||||||
@ -105,12 +105,12 @@ minetest.register_chatcommand("reset_door", {
|
|||||||
end
|
end
|
||||||
_drwho_tardis.save_user(name, user) -- save user data
|
_drwho_tardis.save_user(name, user) -- save user data
|
||||||
_drwho_tardis:init_interior_door(name, exit_door_pos)
|
_drwho_tardis:init_interior_door(name, exit_door_pos)
|
||||||
minetest.chat_send_player(name, S("interior door is now reset"))
|
core.chat_send_player(name, S("interior door is now reset"))
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_chatcommand("tardis_int", {
|
core.register_chatcommand("tardis_int", {
|
||||||
params = "<type>",
|
params = "<type>",
|
||||||
description = S("Change your Tardis interior type. Afterwards, remove everything from your Tardis and run /rebuild_tardis."),
|
description = S("Change your Tardis interior type. Afterwards, remove everything from your Tardis and run /rebuild_tardis."),
|
||||||
privs = {},
|
privs = {},
|
||||||
@ -118,29 +118,29 @@ minetest.register_chatcommand("tardis_int", {
|
|||||||
local Params = string.split(param, ' ')
|
local Params = string.split(param, ' ')
|
||||||
local user = _drwho_tardis.get_user(name)
|
local user = _drwho_tardis.get_user(name)
|
||||||
if Params[1] == nil or Params[1] == '' then
|
if Params[1] == nil or Params[1] == '' then
|
||||||
minetest.chat_send_player(name, "You must input the interior type after the command!")
|
core.chat_send_player(name, "You must input the interior type after the command!")
|
||||||
else
|
else
|
||||||
user.exterior_skin = Params[1]
|
user.exterior_skin = Params[1]
|
||||||
_drwho_tardis.save_user(name, user) -- save user data
|
_drwho_tardis.save_user(name, user) -- save user data
|
||||||
minetest.chat_send_player(name, "Set interior type to "..Params[1])
|
core.chat_send_player(name, "Set interior type to "..Params[1])
|
||||||
minetest.chat_send_player(name, "Now, remove everything from your Tardis and run /rebuild_tardis. Make sure to be outside it though!")
|
core.chat_send_player(name, "Now, remove everything from your Tardis and run /rebuild_tardis. Make sure to be outside it though!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Toggle 'respect_mavity'
|
-- Toggle 'respect_mavity'
|
||||||
minetest.register_chatcommand("tardis_mavity", {
|
core.register_chatcommand("tardis_mavity", {
|
||||||
params = "",
|
params = "",
|
||||||
description = S("Toggles your Tardis's system for landing on ground instead of in the air or underground"),
|
description = S("Toggles your Tardis's system for landing on ground instead of in the air or underground"),
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(name)
|
func = function(name)
|
||||||
local success, status = _drwho_tardis.toggle_mavity(name)
|
local success, status = _drwho_tardis.toggle_mavity(name)
|
||||||
minetest.chat_send_player(name, S(status))
|
core.chat_send_player(name, S(status))
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Summon TARDIS command
|
-- Summon TARDIS command
|
||||||
minetest.register_chatcommand("summon_tardis", {
|
core.register_chatcommand("summon_tardis", {
|
||||||
params = "",
|
params = "",
|
||||||
description = S("Summons your Tardis to your location"),
|
description = S("Summons your Tardis to your location"),
|
||||||
privs = {bring = true},
|
privs = {bring = true},
|
||||||
@ -149,30 +149,30 @@ minetest.register_chatcommand("summon_tardis", {
|
|||||||
if user.has_a_tardis == false then return false, S("You don't have a Tardis") else
|
if user.has_a_tardis == false then return false, S("You don't have a Tardis") else
|
||||||
if user.in_pos == "" then return false, S("Tardis not found") else
|
if user.in_pos == "" then return false, S("Tardis not found") else
|
||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = core.get_player_by_name(name)
|
||||||
local select_pos = player:get_pos()
|
local select_pos = player:get_pos()
|
||||||
if not r_pos then
|
if not r_pos then
|
||||||
minetest.chat_send_player(name, S("You do not have a Tardis!"))
|
core.chat_send_player(name, S("You do not have a Tardis!"))
|
||||||
elseif r_pos.x+50 > select_pos.x and r_pos.x-50 < select_pos.x and r_pos.z+50 > select_pos.z and r_pos.z-50 < select_pos.z and r_pos.y+50 > select_pos.y and r_pos.y-50 < select_pos.y then minetest.chat_send_player(name, "Your Tardis can not be summoned here!") else
|
elseif r_pos.x+50 > select_pos.x and r_pos.x-50 < select_pos.x and r_pos.z+50 > select_pos.z and r_pos.z-50 < select_pos.z and r_pos.y+50 > select_pos.y and r_pos.y-50 < select_pos.y then core.chat_send_player(name, "Your Tardis can not be summoned here!") else
|
||||||
if user.power < 3 then minetest.chat_send_player(name, "Not Enough Power In Tardis!") else
|
if user.power < 3 then core.chat_send_player(name, "Not Enough Power In Tardis!") else
|
||||||
local out_pos = user.out_pos
|
local out_pos = user.out_pos
|
||||||
minetest.set_node(out_pos, {name = "air"})
|
core.set_node(out_pos, {name = "air"})
|
||||||
out_pos.x = math.ceil(select_pos.x)
|
out_pos.x = math.ceil(select_pos.x)
|
||||||
out_pos.y = math.ceil(select_pos.y)
|
out_pos.y = math.ceil(select_pos.y)
|
||||||
out_pos.z = math.ceil(select_pos.z)
|
out_pos.z = math.ceil(select_pos.z)
|
||||||
minetest.set_node(out_pos, {name=user.exterior_skin})
|
core.set_node(out_pos, {name=user.exterior_skin})
|
||||||
local ometa = minetest.get_meta(out_pos)
|
local ometa = core.get_meta(out_pos)
|
||||||
ometa:set_string("id", name)
|
ometa:set_string("id", name)
|
||||||
user.out_pos = out_pos
|
user.out_pos = out_pos
|
||||||
user.power = user.power - 3
|
user.power = user.power - 3
|
||||||
local timer = minetest.get_node_timer(out_pos)
|
local timer = core.get_node_timer(out_pos)
|
||||||
timer:start(0.5)
|
timer:start(0.5)
|
||||||
minetest.chat_send_player(name, S("Tardis Summoned"))
|
core.chat_send_player(name, S("Tardis Summoned"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
_drwho_tardis.save_user(name, user) -- save user data
|
_drwho_tardis.save_user(name, user) -- save user data
|
||||||
--Unlock award:
|
--Unlock award:
|
||||||
if minetest.get_modpath("awards") and _drwho_tardis.GAMETYPE=="mtg" then
|
if core.get_modpath("awards") and _drwho_tardis.GAMETYPE=="mtg" then
|
||||||
awards.unlock(name, "drwho_tardis:command_summon_tardis")
|
awards.unlock(name, "drwho_tardis:command_summon_tardis")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -181,7 +181,7 @@ minetest.register_chatcommand("summon_tardis", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Rebuild TARDIS command
|
-- Rebuild TARDIS command
|
||||||
minetest.register_chatcommand("rebuild_tardis", {
|
core.register_chatcommand("rebuild_tardis", {
|
||||||
params = "",
|
params = "",
|
||||||
description = S("Rebuilds your Tardis interior. Do this when OUTSIDE of it. This will REMOVE anything else inside it!"),
|
description = S("Rebuilds your Tardis interior. Do this when OUTSIDE of it. This will REMOVE anything else inside it!"),
|
||||||
privs = {},
|
privs = {},
|
||||||
@ -195,19 +195,19 @@ minetest.register_chatcommand("rebuild_tardis", {
|
|||||||
_drwho_tardis.save_user(name, user) -- save user data
|
_drwho_tardis.save_user(name, user) -- save user data
|
||||||
|
|
||||||
if success then
|
if success then
|
||||||
minetest.chat_send_player(name, S("Tardis interior rebuilt!"))
|
core.chat_send_player(name, S("Tardis interior rebuilt!"))
|
||||||
minetest.chat_send_player(name, S("type: @1", user.console_room.type))
|
core.chat_send_player(name, S("type: @1", user.console_room.type))
|
||||||
minetest.chat_send_player(name, S("owner: @1", name))
|
core.chat_send_player(name, S("owner: @1", name))
|
||||||
minetest.chat_send_player(name, S("exterior location: @1, @2, @3 [X,Y,Z]", pos.x, pos.y, pos.z))
|
core.chat_send_player(name, S("exterior location: @1, @2, @3 [X,Y,Z]", pos.x, pos.y, pos.z))
|
||||||
minetest.chat_send_player(name, S("interior exit door location: @1, @2, @3 [X,Y,Z]", in_pos.x, in_pos.y, in_pos.z))
|
core.chat_send_player(name, S("interior exit door location: @1, @2, @3 [X,Y,Z]", in_pos.x, in_pos.y, in_pos.z))
|
||||||
else minetest.chat_send_player(name, S("Error message: @1", errmsg)) end
|
else core.chat_send_player(name, S("Error message: @1", errmsg)) end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Locate tardis command
|
-- Locate tardis command
|
||||||
-- This uses the public API function
|
-- This uses the public API function
|
||||||
-- Need to add a message if a player doesn't exist
|
-- Need to add a message if a player doesn't exist
|
||||||
minetest.register_chatcommand("locate_tardis", {
|
core.register_chatcommand("locate_tardis", {
|
||||||
params = "[<name>]",
|
params = "[<name>]",
|
||||||
description = S("Locate your Tardis's exterior. Admins (server priv) can locate other player's Tardises."),
|
description = S("Locate your Tardis's exterior. Admins (server priv) can locate other player's Tardises."),
|
||||||
privs = {},
|
privs = {},
|
||||||
@ -216,63 +216,63 @@ minetest.register_chatcommand("locate_tardis", {
|
|||||||
if Params[1] == nil or Params[1] == '' then
|
if Params[1] == nil or Params[1] == '' then
|
||||||
local success, _, pos = drwho_tardis.get:tardis_ext_position(name)
|
local success, _, pos = drwho_tardis.get:tardis_ext_position(name)
|
||||||
if success then
|
if success then
|
||||||
minetest.chat_send_player(name, S("Your Tardis is at: @1, @2, @3 [X,Y,Z]", pos.x, pos.y, pos.z))
|
core.chat_send_player(name, S("Your Tardis is at: @1, @2, @3 [X,Y,Z]", pos.x, pos.y, pos.z))
|
||||||
else minetest.chat_send_player(name, S("You do not have a Tardis!")) end
|
else core.chat_send_player(name, S("You do not have a Tardis!")) end
|
||||||
else -- Params[1] is another players name
|
else -- Params[1] is another players name
|
||||||
if minetest.check_player_privs(name, {server = true}) or minetest.check_player_privs(name, {debug = true}) then
|
if core.check_player_privs(name, {server = true}) or core.check_player_privs(name, {debug = true}) then
|
||||||
local success, _, pos = drwho_tardis.get:tardis_ext_position(Params[1])
|
local success, _, pos = drwho_tardis.get:tardis_ext_position(Params[1])
|
||||||
if success then
|
if success then
|
||||||
minetest.chat_send_player(name, S("@1's Tardis is at: @2, @3, @4 [X,Y,Z]", Params[1], pos.x, pos.y, pos.z))
|
core.chat_send_player(name, S("@1's Tardis is at: @2, @3, @4 [X,Y,Z]", Params[1], pos.x, pos.y, pos.z))
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("@1 does not have a Tardis!", Params[1]))
|
core.chat_send_player(name, S("@1 does not have a Tardis!", Params[1]))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("You need admin privileges to locate other people's Tardises!"))
|
core.chat_send_player(name, S("You need admin privileges to locate other people's Tardises!"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if fields.teleport then
|
if fields.teleport then
|
||||||
local pos = minetest.string_to_pos(fields.teleport_x..","..fields.teleport_y..","..fields.teleport_z)
|
local pos = core.string_to_pos(fields.teleport_x..","..fields.teleport_y..","..fields.teleport_z)
|
||||||
player:set_pos(pos)
|
player:set_pos(pos)
|
||||||
player:set_hp(2)
|
player:set_hp(2)
|
||||||
end
|
end
|
||||||
if fields.sonic_send then
|
if fields.sonic_send then
|
||||||
local meta = player:get_meta()
|
local meta = player:get_meta()
|
||||||
local pos = minetest.deserialize(meta:get_string("sonic_digiline"))
|
local pos = core.deserialize(meta:get_string("sonic_digiline"))
|
||||||
digilines.receptor_send(pos, digilines.rules.default, fields.sonic_channel, fields.sonic_message)
|
digilines.receptor_send(pos, digilines.rules.default, fields.sonic_channel, fields.sonic_message)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--fix death stuff with vortex (removed, so probably doesn't matter anymore?)
|
--fix death stuff with vortex (removed, so probably doesn't matter anymore?)
|
||||||
minetest.register_on_dieplayer(function(player)
|
core.register_on_dieplayer(function(player)
|
||||||
local pmeta = player:get_meta()
|
local pmeta = player:get_meta()
|
||||||
local id = pmeta:get_string("id")
|
local id = pmeta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id) -- get user data
|
local user = _drwho_tardis.get_user(id) -- get user data
|
||||||
pmeta:set_string("vortex", "no")
|
pmeta:set_string("vortex", "no")
|
||||||
if user.r_pos then
|
if user.r_pos then
|
||||||
local rmeta = minetest.get_meta(user.r_pos)
|
local rmeta = core.get_meta(user.r_pos)
|
||||||
local style = rmeta:get_string("style")
|
local style = rmeta:get_string("style")
|
||||||
_drwho_tardis.switch_time_rotor(player, "off")
|
_drwho_tardis.switch_time_rotor(player, "off")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--fix timers
|
--fix timers
|
||||||
minetest.register_lbm({
|
core.register_lbm({
|
||||||
name = "drwho_tardis:fix_timers",
|
name = "drwho_tardis:fix_timers",
|
||||||
nodenames = {"group:tardis_in_door", "group:tardis_in_door_locked"},
|
nodenames = {"group:tardis_in_door", "group:tardis_in_door_locked"},
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = core.get_node_timer(pos)
|
||||||
timer:start(0.2)
|
timer:start(0.2)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
--aliases
|
--aliases
|
||||||
minetest.register_alias("drwho_tardis:dalek_ingot", "drwho_tardis:dalekanium_ingot")
|
core.register_alias("drwho_tardis:dalek_ingot", "drwho_tardis:dalekanium_ingot")
|
||||||
minetest.register_alias("drwho_tardis:tardis_blue", "drwho_tardis:tardis")
|
core.register_alias("drwho_tardis:tardis_blue", "drwho_tardis:tardis")
|
||||||
minetest.register_alias("drwho_tardis:tardis_empty", "drwho_tardis:tardis_invisible")
|
core.register_alias("drwho_tardis:tardis_empty", "drwho_tardis:tardis_invisible")
|
||||||
minetest.register_alias("drwho_tardis:tardis_leave", "drwho_tardis:tardis_leaves")
|
core.register_alias("drwho_tardis:tardis_leave", "drwho_tardis:tardis_leaves")
|
||||||
minetest.register_alias("drwho_tardis:tardis_cool", "drwho_tardis:tardis_classic")
|
core.register_alias("drwho_tardis:tardis_cool", "drwho_tardis:tardis_classic")
|
||||||
minetest.register_alias("drwho_tardis:in_door_a", "drwho_tardis:in_door")
|
core.register_alias("drwho_tardis:in_door_a", "drwho_tardis:in_door")
|
@ -5,16 +5,16 @@
|
|||||||
-- Store itemstrings of our items
|
-- Store itemstrings of our items
|
||||||
-- ** In the future, function to initiate userdata
|
-- ** In the future, function to initiate userdata
|
||||||
|
|
||||||
local data = minetest.get_mod_storage()
|
local data = core.get_mod_storage()
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
|
|
||||||
-- DETECT GAME TYPE (MTG, MCL, RP)
|
-- DETECT GAME TYPE (MTG, MCL, RP)
|
||||||
_drwho_tardis.GAMETYPE = "???"
|
_drwho_tardis.GAMETYPE = "???"
|
||||||
if minetest.get_modpath("default") then
|
if core.get_modpath("default") then
|
||||||
_drwho_tardis.GAMETYPE = "mtg"
|
_drwho_tardis.GAMETYPE = "mtg"
|
||||||
elseif minetest.get_modpath("mcl_core") then
|
elseif core.get_modpath("mcl_core") then
|
||||||
_drwho_tardis.GAMETYPE = "mcl"
|
_drwho_tardis.GAMETYPE = "mcl"
|
||||||
elseif minetest.get_modpath("rp_default") then
|
elseif core.get_modpath("rp_default") then
|
||||||
_drwho_tardis.GAMETYPE = "rp"
|
_drwho_tardis.GAMETYPE = "rp"
|
||||||
else
|
else
|
||||||
_drwho_tardis.GAMETYPE = "other"
|
_drwho_tardis.GAMETYPE = "other"
|
||||||
@ -23,7 +23,7 @@ end
|
|||||||
-- Reset exterior list
|
-- Reset exterior list
|
||||||
-- if this is not done, every time the server is restarted it will add them again
|
-- if this is not done, every time the server is restarted it will add them again
|
||||||
-- eventually overcrowding the list and looking bad
|
-- eventually overcrowding the list and looking bad
|
||||||
data:set_string("ext_list", minetest.serialize({}))
|
data:set_string("ext_list", core.serialize({}))
|
||||||
|
|
||||||
-- Interior depth
|
-- Interior depth
|
||||||
_drwho_tardis.interiorDepth = -300 -- default value
|
_drwho_tardis.interiorDepth = -300 -- default value
|
||||||
@ -42,20 +42,20 @@ end
|
|||||||
_drwho_tardis.rooms = {
|
_drwho_tardis.rooms = {
|
||||||
old = {
|
old = {
|
||||||
type = "old",
|
type = "old",
|
||||||
path = minetest.get_modpath("drwho_tardis").."/schems/tardis_console_room_old.mts",
|
path = core.get_modpath("drwho_tardis").."/schems/tardis_console_room_old.mts",
|
||||||
exit_door_offset = {x=7,y=2,z=16},
|
exit_door_offset = {x=7,y=2,z=16},
|
||||||
requires = {"drwho_tardis"},
|
requires = {"drwho_tardis"},
|
||||||
},
|
},
|
||||||
default = {
|
default = {
|
||||||
type = "default",
|
type = "default",
|
||||||
-- size is 22x22x22
|
-- size is 22x22x22
|
||||||
path = minetest.get_modpath("drwho_tardis").."/schems/tardis_console_room_default.mts",
|
path = core.get_modpath("drwho_tardis").."/schems/tardis_console_room_default.mts",
|
||||||
exit_door_offset = {x=11,y=5,z=19},
|
exit_door_offset = {x=11,y=5,z=19},
|
||||||
requires = {"drwho_tardis"},
|
requires = {"drwho_tardis"},
|
||||||
},
|
},
|
||||||
--[[green = {
|
--[[green = {
|
||||||
type = "green",
|
type = "green",
|
||||||
path = minetest.get_modpath("drwho_tardis").."/schems/tardis_console_room_green.mts",
|
path = core.get_modpath("drwho_tardis").."/schems/tardis_console_room_green.mts",
|
||||||
exit_door_offset = {x=6,y=2,z=11},
|
exit_door_offset = {x=6,y=2,z=11},
|
||||||
requires = {"drwho_tardis", "scifi_nodes"},
|
requires = {"drwho_tardis", "scifi_nodes"},
|
||||||
},--]]
|
},--]]
|
||||||
@ -84,29 +84,29 @@ function _drwho_tardis.get_user(user_name)
|
|||||||
local user = data:get_string(user_name)
|
local user = data:get_string(user_name)
|
||||||
|
|
||||||
if user == nil or user == "" or user == {} then
|
if user == nil or user == "" or user == {} then
|
||||||
minetest.log("[drwho_tardis] Didn't find a user by name '"..user_name.."', creation occured")
|
core.log("[drwho_tardis] Didn't find a user by name '"..user_name.."', creation occured")
|
||||||
minetest.log(user)
|
core.log(user)
|
||||||
user = _drwho_tardis.init_new_user(user_name, {})
|
user = _drwho_tardis.init_new_user(user_name, {})
|
||||||
|
|
||||||
if _drwho_tardis.do_we_need_to_migrate_data(user_name) then
|
if _drwho_tardis.do_we_need_to_migrate_data(user_name) then
|
||||||
user = _drwho_tardis.migrate_user_data(user_name, user)
|
user = _drwho_tardis.migrate_user_data(user_name, user)
|
||||||
minetest.log("[drwho_tardis] Migrated user data with name '"..user_name.."' from data from pre-v1.3.0")
|
core.log("[drwho_tardis] Migrated user data with name '"..user_name.."' from data from pre-v1.3.0")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
--minetest.log("[drwho_tardis] Found '"..user_name.."' with '"..user.."' data")
|
--core.log("[drwho_tardis] Found '"..user_name.."' with '"..user.."' data")
|
||||||
minetest.log("[drwho_tardis] Retrieved user data")
|
core.log("[drwho_tardis] Retrieved user data")
|
||||||
user = minetest.deserialize(user)
|
user = core.deserialize(user)
|
||||||
--minetest.log(minetest.serialize(user))
|
--core.log(core.serialize(user))
|
||||||
end
|
end
|
||||||
--minetest.log("[drwho_tardis] Returning '"..minetest.serialize(user).."'")
|
--core.log("[drwho_tardis] Returning '"..core.serialize(user).."'")
|
||||||
return user
|
return user
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Saves the user's data
|
-- Saves the user's data
|
||||||
function _drwho_tardis.save_user(user_name, user_data)
|
function _drwho_tardis.save_user(user_name, user_data)
|
||||||
|
|
||||||
data:set_string(user_name, minetest.serialize(user_data))
|
data:set_string(user_name, core.serialize(user_data))
|
||||||
minetest.log("[drwho_tardis] Saved user data")
|
core.log("[drwho_tardis] Saved user data")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- for convenience' sake
|
-- for convenience' sake
|
||||||
@ -115,7 +115,7 @@ end
|
|||||||
function _drwho_tardis.update_one_value(user_name, key, value)
|
function _drwho_tardis.update_one_value(user_name, key, value)
|
||||||
local user = _drwho_tardis.get_user(user_name)
|
local user = _drwho_tardis.get_user(user_name)
|
||||||
user[key] = value
|
user[key] = value
|
||||||
--minetest.log(S("[drwho_tardis] Set key '@1' to value '@2' in @3's user data.", key, value, user_name))
|
--core.log(S("[drwho_tardis] Set key '@1' to value '@2' in @3's user data.", key, value, user_name))
|
||||||
_drwho_tardis.save_user(user_name, user)
|
_drwho_tardis.save_user(user_name, user)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ end
|
|||||||
-- Must be given the user data when run otherwise Stack Overflow
|
-- Must be given the user data when run otherwise Stack Overflow
|
||||||
function _drwho_tardis.init_new_user(user_name, user)
|
function _drwho_tardis.init_new_user(user_name, user)
|
||||||
if user.version ~= nil then
|
if user.version ~= nil then
|
||||||
minetest.log("[drwho_tardis] User '"..user_name.."' was found with data, rewriting data")
|
core.log("[drwho_tardis] User '"..user_name.."' was found with data, rewriting data")
|
||||||
end
|
end
|
||||||
|
|
||||||
user.version = drwho_tardis.VERSION -- Know when a user's data was initiated for compatability's sake when breaking changes are made
|
user.version = drwho_tardis.VERSION -- Know when a user's data was initiated for compatability's sake when breaking changes are made
|
||||||
@ -157,7 +157,7 @@ function _drwho_tardis.init_new_user(user_name, user)
|
|||||||
-- the difference in position between where we placed the schematic and where the door is
|
-- the difference in position between where we placed the schematic and where the door is
|
||||||
-- where we placed the schematic (anchor_pos)
|
-- where we placed the schematic (anchor_pos)
|
||||||
user.console_room = {
|
user.console_room = {
|
||||||
type = minetest.settings:get('drwho_tardis.default_interior') or 'default',
|
type = core.settings:get('drwho_tardis.default_interior') or 'default',
|
||||||
exit_door_pos = "",
|
exit_door_pos = "",
|
||||||
exit_door_offset = "",
|
exit_door_offset = "",
|
||||||
anchor_pos = vector.new(0, 0, 0) -- previously console_place_pos. The position given to the place interior schematic function.
|
anchor_pos = vector.new(0, 0, 0) -- previously console_place_pos. The position given to the place interior schematic function.
|
||||||
@ -177,7 +177,7 @@ function _drwho_tardis.migrate_user_data(user_name, user)
|
|||||||
local id = user_name
|
local id = user_name
|
||||||
if user == "" or user == nil then user = {} end
|
if user == "" or user == nil then user = {} end
|
||||||
if user.version ~= nil then
|
if user.version ~= nil then
|
||||||
minetest.log("[drwho_tardis] User '"..user_name.."' was found with data, rewriting data")
|
core.log("[drwho_tardis] User '"..user_name.."' was found with data, rewriting data")
|
||||||
end
|
end
|
||||||
|
|
||||||
user.version = drwho_tardis.VERSION
|
user.version = drwho_tardis.VERSION
|
||||||
@ -186,28 +186,28 @@ function _drwho_tardis.migrate_user_data(user_name, user)
|
|||||||
user.been_inside_tardis = true
|
user.been_inside_tardis = true
|
||||||
user.times_travelled_in_tardis = 0
|
user.times_travelled_in_tardis = 0
|
||||||
user.waypoints = {
|
user.waypoints = {
|
||||||
way1 = minetest.deserialize(data:get_string(id.."way1")),
|
way1 = core.deserialize(data:get_string(id.."way1")),
|
||||||
way2 = minetest.deserialize(data:get_string(id.."way2")),
|
way2 = core.deserialize(data:get_string(id.."way2")),
|
||||||
way3 = minetest.deserialize(data:get_string(id.."way3")),
|
way3 = core.deserialize(data:get_string(id.."way3")),
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Navigation related values
|
-- Navigation related values
|
||||||
user.in_pos = minetest.deserialize(data:get_string(id.."in_pos"))
|
user.in_pos = core.deserialize(data:get_string(id.."in_pos"))
|
||||||
user.out_pos = minetest.deserialize(data:get_string(id.."out_pos"))
|
user.out_pos = core.deserialize(data:get_string(id.."out_pos"))
|
||||||
user.prev_out_pos = minetest.deserialize(data:get_string(id.."out_pos"))
|
user.prev_out_pos = core.deserialize(data:get_string(id.."out_pos"))
|
||||||
user.dest_pos = vector.new(data:get_int(id.."x_dest"), data:get_int(id.."y_dest"), data:get_int(id.."z_dest"))
|
user.dest_pos = vector.new(data:get_int(id.."x_dest"), data:get_int(id.."y_dest"), data:get_int(id.."z_dest"))
|
||||||
user.r_pos = minetest.deserialize(data:get_string(id.."r_pos"))
|
user.r_pos = core.deserialize(data:get_string(id.."r_pos"))
|
||||||
user.travel_factor = data:get_string(id.."factor")
|
user.travel_factor = data:get_string(id.."factor")
|
||||||
user.respect_mavity = minetest.deserialize(data:get_string(id.."respect_mavity"))
|
user.respect_mavity = core.deserialize(data:get_string(id.."respect_mavity"))
|
||||||
user.finding_biome = ""
|
user.finding_biome = ""
|
||||||
|
|
||||||
user.exterior_skin = data:get_string(id.."look")
|
user.exterior_skin = data:get_string(id.."look")
|
||||||
|
|
||||||
user.console_room = {
|
user.console_room = {
|
||||||
type = data:get_string(id.."type"),
|
type = data:get_string(id.."type"),
|
||||||
exit_door_pos = minetest.deserialize(data:get_string(id.."door_pos_table")).door_0,
|
exit_door_pos = core.deserialize(data:get_string(id.."door_pos_table")).door_0,
|
||||||
exit_door_offset = minetest.deserialize(data:get_string(id.."door_offset_table")).door_0,
|
exit_door_offset = core.deserialize(data:get_string(id.."door_offset_table")).door_0,
|
||||||
anchor_pos = minetest.deserialize(data:get_string(id.."console_place_pos")),
|
anchor_pos = core.deserialize(data:get_string(id.."console_place_pos")),
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Remember that their data has been migrated
|
-- Remember that their data has been migrated
|
||||||
|
154
migration.lua
154
migration.lua
@ -2,15 +2,15 @@
|
|||||||
-- Conflicts with the hard coded aliases, so has been commented out.
|
-- Conflicts with the hard coded aliases, so has been commented out.
|
||||||
-- It just leads to everything being registered twice and lots of WARNING[Main] in the debug.txt .
|
-- It just leads to everything being registered twice and lots of WARNING[Main] in the debug.txt .
|
||||||
--[[
|
--[[
|
||||||
for name, _ in pairs(minetest.registered_nodes) do
|
for name, _ in pairs(core.registered_nodes) do
|
||||||
local split_name = {}
|
local split_name = {}
|
||||||
--split name in modname:name
|
--split name in modname:name
|
||||||
for str in (string.gmatch(name, "([^:]+)")) do
|
for str in (string.gmatch(name, "([^:]+)")) do
|
||||||
table.insert(split_name, str)
|
table.insert(split_name, str)
|
||||||
end
|
end
|
||||||
if split_name[1] == "drwho_tardis" then
|
if split_name[1] == "drwho_tardis" then
|
||||||
minetest.log("registered alias for " .. name)
|
core.log("registered alias for " .. name)
|
||||||
minetest.register_alias(name, "tardis_new:" .. split_name[2])
|
core.register_alias(name, "tardis_new:" .. split_name[2])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--]]
|
--]]
|
||||||
@ -19,95 +19,95 @@ end
|
|||||||
-- Hard-Coded Aliases
|
-- Hard-Coded Aliases
|
||||||
|
|
||||||
-- Console Units
|
-- Console Units
|
||||||
minetest.register_alias("tardis_new:consle_y", "drwho_tardis:console_y")
|
core.register_alias("tardis_new:consle_y", "drwho_tardis:console_y")
|
||||||
minetest.register_alias("tardis_new:consle_y_2", "drwho_tardis:console_y_2")
|
core.register_alias("tardis_new:consle_y_2", "drwho_tardis:console_y_2")
|
||||||
minetest.register_alias("tardis_new:consle_y_3", "drwho_tardis:console_y_3")
|
core.register_alias("tardis_new:consle_y_3", "drwho_tardis:console_y_3")
|
||||||
minetest.register_alias("tardis_new:consle_x", "drwho_tardis:console_x")
|
core.register_alias("tardis_new:consle_x", "drwho_tardis:console_x")
|
||||||
minetest.register_alias("tardis_new:consle_x_2", "drwho_tardis:console_x_2")
|
core.register_alias("tardis_new:consle_x_2", "drwho_tardis:console_x_2")
|
||||||
minetest.register_alias("tardis_new:consle_x_3", "drwho_tardis:console_x_3")
|
core.register_alias("tardis_new:consle_x_3", "drwho_tardis:console_x_3")
|
||||||
minetest.register_alias("tardis_new:consle_z", "drwho_tardis:console_z")
|
core.register_alias("tardis_new:consle_z", "drwho_tardis:console_z")
|
||||||
minetest.register_alias("tardis_new:consle_z_2", "drwho_tardis:console_z_2")
|
core.register_alias("tardis_new:consle_z_2", "drwho_tardis:console_z_2")
|
||||||
minetest.register_alias("tardis_new:consle_z_3", "drwho_tardis:console_z_3")
|
core.register_alias("tardis_new:consle_z_3", "drwho_tardis:console_z_3")
|
||||||
minetest.register_alias("tardis_new:consle_f", "drwho_tardis:console_f")
|
core.register_alias("tardis_new:consle_f", "drwho_tardis:console_f")
|
||||||
minetest.register_alias("tardis_new:consle_f_2", "drwho_tardis:console_f_2")
|
core.register_alias("tardis_new:consle_f_2", "drwho_tardis:console_f_2")
|
||||||
minetest.register_alias("tardis_new:consle_f_3", "drwho_tardis:console_f_3")
|
core.register_alias("tardis_new:consle_f_3", "drwho_tardis:console_f_3")
|
||||||
minetest.register_alias("tardis_new:consle_s", "drwho_tardis:console_s")
|
core.register_alias("tardis_new:consle_s", "drwho_tardis:console_s")
|
||||||
minetest.register_alias("tardis_new:consle_s_2", "drwho_tardis:console_s_2")
|
core.register_alias("tardis_new:consle_s_2", "drwho_tardis:console_s_2")
|
||||||
minetest.register_alias("tardis_new:consle_s_3", "drwho_tardis:console_s_3")
|
core.register_alias("tardis_new:consle_s_3", "drwho_tardis:console_s_3")
|
||||||
minetest.register_alias("tardis_new:consle_go", "drwho_tardis:console_go")
|
core.register_alias("tardis_new:consle_go", "drwho_tardis:console_go")
|
||||||
minetest.register_alias("tardis_new:consle_go_2", "drwho_tardis:console_go_2")
|
core.register_alias("tardis_new:consle_go_2", "drwho_tardis:console_go_2")
|
||||||
minetest.register_alias("tardis_new:consle_go_3", "drwho_tardis:console_go_3")
|
core.register_alias("tardis_new:consle_go_3", "drwho_tardis:console_go_3")
|
||||||
minetest.register_alias("tardis_new:consle_c", "drwho_tardis:console_c")
|
core.register_alias("tardis_new:consle_c", "drwho_tardis:console_c")
|
||||||
minetest.register_alias("tardis_new:consle_c_2", "drwho_tardis:console_c_2")
|
core.register_alias("tardis_new:consle_c_2", "drwho_tardis:console_c_2")
|
||||||
minetest.register_alias("tardis_new:consle_c_3", "drwho_tardis:console_c_3")
|
core.register_alias("tardis_new:consle_c_3", "drwho_tardis:console_c_3")
|
||||||
minetest.register_alias("tardis_new:consle_o", "drwho_tardis:console_o")
|
core.register_alias("tardis_new:consle_o", "drwho_tardis:console_o")
|
||||||
minetest.register_alias("tardis_new:consle_o_2", "drwho_tardis:console_o_2")
|
core.register_alias("tardis_new:consle_o_2", "drwho_tardis:console_o_2")
|
||||||
minetest.register_alias("tardis_new:consle_o_3", "drwho_tardis:console_o_3")
|
core.register_alias("tardis_new:consle_o_3", "drwho_tardis:console_o_3")
|
||||||
|
|
||||||
-- TARDIS Monitor Screen
|
-- TARDIS Monitor Screen
|
||||||
minetest.register_alias("tardis_new:screen", "drwho_tardis:monitor")
|
core.register_alias("tardis_new:screen", "drwho_tardis:monitor")
|
||||||
|
|
||||||
-- Time Rotors
|
-- Time Rotors
|
||||||
minetest.register_alias("tardis_new:rotor", "drwho_tardis:rotor")
|
core.register_alias("tardis_new:rotor", "drwho_tardis:rotor")
|
||||||
minetest.register_alias("tardis_new:rotor_2", "drwho_tardis:rotor_2")
|
core.register_alias("tardis_new:rotor_2", "drwho_tardis:rotor_2")
|
||||||
minetest.register_alias("tardis_new:rotor_3", "drwho_tardis:rotor_3")
|
core.register_alias("tardis_new:rotor_3", "drwho_tardis:rotor_3")
|
||||||
minetest.register_alias("tardis_new:rotor_active", "drwho_tardis:rotor_active")
|
core.register_alias("tardis_new:rotor_active", "drwho_tardis:rotor_active")
|
||||||
minetest.register_alias("tardis_new:rotor_active_2", "drwho_tardis:rotor_active_2")
|
core.register_alias("tardis_new:rotor_active_2", "drwho_tardis:rotor_active_2")
|
||||||
minetest.register_alias("tardis_new:rotor_active_3", "drwho_tardis:rotor_active_3")
|
core.register_alias("tardis_new:rotor_active_3", "drwho_tardis:rotor_active_3")
|
||||||
|
|
||||||
-- TARDIS Lights
|
-- TARDIS Lights
|
||||||
minetest.register_alias("tardis_new:light", "drwho_tardis:light")
|
core.register_alias("tardis_new:light", "drwho_tardis:light")
|
||||||
minetest.register_alias("tardis_new:light_2", "drwho_tardis:light_2")
|
core.register_alias("tardis_new:light_2", "drwho_tardis:light_2")
|
||||||
minetest.register_alias("tardis_new:light_3", "drwho_tardis:light_3")
|
core.register_alias("tardis_new:light_3", "drwho_tardis:light_3")
|
||||||
|
|
||||||
-- TARDIS Exterior Nodes
|
-- TARDIS Exterior Nodes
|
||||||
minetest.register_alias("tardis_new:tardis", "drwho_tardis:tardis")
|
core.register_alias("tardis_new:tardis", "drwho_tardis:tardis")
|
||||||
minetest.register_alias("tardis_new:tardis_locked", "drwho_tardis:tardis_locked")
|
core.register_alias("tardis_new:tardis_locked", "drwho_tardis:tardis_locked")
|
||||||
minetest.register_alias("tardis_new:tardis_pink", "drwho_tardis:tardis_pink")
|
core.register_alias("tardis_new:tardis_pink", "drwho_tardis:tardis_pink")
|
||||||
minetest.register_alias("tardis_new:tardis_pink_locked", "drwho_tardis:tardis_pink_locked")
|
core.register_alias("tardis_new:tardis_pink_locked", "drwho_tardis:tardis_pink_locked")
|
||||||
minetest.register_alias("tardis_new:tardis_yellow", "drwho_tardis:tardis_yellow")
|
core.register_alias("tardis_new:tardis_yellow", "drwho_tardis:tardis_yellow")
|
||||||
minetest.register_alias("tardis_new:tardis_yellow_locked", "drwho_tardis:tardis_yellow_locked")
|
core.register_alias("tardis_new:tardis_yellow_locked", "drwho_tardis:tardis_yellow_locked")
|
||||||
minetest.register_alias("tardis_new:tardis_old", "drwho_tardis:tardis_old")
|
core.register_alias("tardis_new:tardis_old", "drwho_tardis:tardis_old")
|
||||||
minetest.register_alias("tardis_new:tardis_old_locked", "drwho_tardis:tardis_old_locked")
|
core.register_alias("tardis_new:tardis_old_locked", "drwho_tardis:tardis_old_locked")
|
||||||
minetest.register_alias("tardis_new:tardis_soda", "drwho_tardis:tardis_old") -- Make old soda become gray
|
core.register_alias("tardis_new:tardis_soda", "drwho_tardis:tardis_old") -- Make old soda become gray
|
||||||
minetest.register_alias("tardis_new:tardis_soda_locked", "drwho_tardis:tardis_old_locked") -- Make old soda become gray
|
core.register_alias("tardis_new:tardis_soda_locked", "drwho_tardis:tardis_old_locked") -- Make old soda become gray
|
||||||
minetest.register_alias("tardis_new:tardis_stone", "drwho_tardis:tardis_stone")
|
core.register_alias("tardis_new:tardis_stone", "drwho_tardis:tardis_stone")
|
||||||
minetest.register_alias("tardis_new:tardis_stone_locked", "drwho_tardis:tardis_stone_locked")
|
core.register_alias("tardis_new:tardis_stone_locked", "drwho_tardis:tardis_stone_locked")
|
||||||
minetest.register_alias("tardis_new:tardis_empty", "drwho_tardis:tardis_empty")
|
core.register_alias("tardis_new:tardis_empty", "drwho_tardis:tardis_empty")
|
||||||
minetest.register_alias("tardis_new:tardis_empty_locked", "drwho_tardis:tardis_empty_locked")
|
core.register_alias("tardis_new:tardis_empty_locked", "drwho_tardis:tardis_empty_locked")
|
||||||
minetest.register_alias("tardis_new:tardis_cool", "drwho_tardis:tardis_cool")
|
core.register_alias("tardis_new:tardis_cool", "drwho_tardis:tardis_cool")
|
||||||
minetest.register_alias("tardis_new:tardis_cool_locked", "drwho_tardis:tardis_cool_locked")
|
core.register_alias("tardis_new:tardis_cool_locked", "drwho_tardis:tardis_cool_locked")
|
||||||
minetest.register_alias("tardis_new:tardis_leave", "drwho_tardis:tardis_leave")
|
core.register_alias("tardis_new:tardis_leave", "drwho_tardis:tardis_leave")
|
||||||
minetest.register_alias("tardis_new:tardis_leave_locked", "drwho_tardis:tardis_leave_locked")
|
core.register_alias("tardis_new:tardis_leave_locked", "drwho_tardis:tardis_leave_locked")
|
||||||
minetest.register_alias("tardis_new:tardis_funky", "drwho_tardis:tardis_funky")
|
core.register_alias("tardis_new:tardis_funky", "drwho_tardis:tardis_funky")
|
||||||
minetest.register_alias("tardis_new:tardis_funky_locked", "drwho_tardis:tardis_funky_locked")
|
core.register_alias("tardis_new:tardis_funky_locked", "drwho_tardis:tardis_funky_locked")
|
||||||
|
|
||||||
-- TARDIS Interior Nodes
|
-- TARDIS Interior Nodes
|
||||||
minetest.register_alias("tardis_new:wall", "drwho_tardis:wall")
|
core.register_alias("tardis_new:wall", "drwho_tardis:wall")
|
||||||
minetest.register_alias("tardis_new:wall_craftable", "drwho_tardis:wall_craftable")
|
core.register_alias("tardis_new:wall_craftable", "drwho_tardis:wall_craftable")
|
||||||
minetest.register_alias("tardis_new:stone", "drwho_tardis:stone")
|
core.register_alias("tardis_new:stone", "drwho_tardis:stone")
|
||||||
minetest.register_alias("tardis_new:in_door", "drwho_tardis:in_door")
|
core.register_alias("tardis_new:in_door", "drwho_tardis:in_door")
|
||||||
|
|
||||||
-- Craftitems
|
-- Craftitems
|
||||||
minetest.register_alias("tardis_new:arton", "drwho_tardis:arton_crystal")
|
core.register_alias("tardis_new:arton", "drwho_tardis:arton_crystal")
|
||||||
minetest.register_alias("tardis_new:biscut", "drwho_tardis:biscuit")
|
core.register_alias("tardis_new:biscut", "drwho_tardis:biscuit")
|
||||||
minetest.register_alias("tardis_new:shard", "drwho_tardis:azbantium_shard")
|
core.register_alias("tardis_new:shard", "drwho_tardis:azbantium_shard")
|
||||||
minetest.register_alias("tardis_new:azbantium", "drwho_tardis:azbantium")
|
core.register_alias("tardis_new:azbantium", "drwho_tardis:azbantium")
|
||||||
minetest.register_alias("tardis_new:spacetime", "drwho_tardis:spacetime")
|
core.register_alias("tardis_new:spacetime", "drwho_tardis:spacetime")
|
||||||
minetest.register_alias("tardis_new:board", "drwho_tardis:circuitry_board")
|
core.register_alias("tardis_new:board", "drwho_tardis:circuitry_board")
|
||||||
minetest.register_alias("tardis_new:bar", "drwho_tardis:dalekanium_ingot")
|
core.register_alias("tardis_new:bar", "drwho_tardis:dalekanium_ingot")
|
||||||
|
|
||||||
-- Dalekanium Tools
|
-- Dalekanium Tools
|
||||||
minetest.register_alias("tardis_new:pick_dalek", "drwho_tardis:pick_dalek")
|
core.register_alias("tardis_new:pick_dalek", "drwho_tardis:pick_dalek")
|
||||||
minetest.register_alias("tardis_new:shovel_dalek", "drwho_tardis:shovel_dalek")
|
core.register_alias("tardis_new:shovel_dalek", "drwho_tardis:shovel_dalek")
|
||||||
minetest.register_alias("tardis_new:axe_dalek", "drwho_tardis:axe_dalek")
|
core.register_alias("tardis_new:axe_dalek", "drwho_tardis:axe_dalek")
|
||||||
minetest.register_alias("tardis_new:sword_dalek", "drwho_tardis:sword_dalek")
|
core.register_alias("tardis_new:sword_dalek", "drwho_tardis:sword_dalek")
|
||||||
|
|
||||||
-- Other tools + weapons
|
-- Other tools + weapons
|
||||||
minetest.register_alias("tardis_new:gaunlet", "drwho_tardis:rassilon_gauntlet")
|
core.register_alias("tardis_new:gaunlet", "drwho_tardis:rassilon_gauntlet")
|
||||||
minetest.register_alias("tardis_new:vortex", "drwho_tardis:vortex_manipulator")
|
core.register_alias("tardis_new:vortex", "drwho_tardis:vortex_manipulator")
|
||||||
minetest.register_alias("tardis_new:sonic", "drwho_tardis:sonic_screwdriver")
|
core.register_alias("tardis_new:sonic", "drwho_tardis:sonic_screwdriver")
|
||||||
|
|
||||||
-- Gallifreyan Lab + Chest
|
-- Gallifreyan Lab + Chest
|
||||||
minetest.register_alias("tardis_new:lab", "drwho_tardis:lab")
|
core.register_alias("tardis_new:lab", "drwho_tardis:lab")
|
||||||
minetest.register_alias("tardis_new:chest", "drwho_tardis:chest")
|
core.register_alias("tardis_new:chest", "drwho_tardis:chest")
|
@ -2,10 +2,10 @@
|
|||||||
-- Cyberman
|
-- Cyberman
|
||||||
-- Melee Cyberman
|
-- Melee Cyberman
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
|
|
||||||
if _drwho_tardis.GAMETYPE == "mtg" then
|
if _drwho_tardis.GAMETYPE == "mtg" then
|
||||||
if minetest.get_modpath("mobs") then
|
if core.get_modpath("mobs") then
|
||||||
|
|
||||||
mobs:register_mob("drwho_tardis:cyberman", {
|
mobs:register_mob("drwho_tardis:cyberman", {
|
||||||
type = "monster",
|
type = "monster",
|
||||||
@ -91,7 +91,7 @@ mobs:register_mob("drwho_tardis:cyberman", {
|
|||||||
on_die = function(self)
|
on_die = function(self)
|
||||||
if self.cause_of_death.puncher ~= nil then
|
if self.cause_of_death.puncher ~= nil then
|
||||||
name = self.cause_of_death.puncher:get_player_name()
|
name = self.cause_of_death.puncher:get_player_name()
|
||||||
if minetest.get_modpath("awards") and name ~= nil then
|
if core.get_modpath("awards") and name ~= nil then
|
||||||
awards.unlock(name, "drwho_tardis:defeat_cyberman")
|
awards.unlock(name, "drwho_tardis:defeat_cyberman")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -179,7 +179,7 @@ mobs:register_mob("drwho_tardis:cyberman_melee", {
|
|||||||
on_die = function(self)
|
on_die = function(self)
|
||||||
if self.cause_of_death.puncher ~= nil then
|
if self.cause_of_death.puncher ~= nil then
|
||||||
name = self.cause_of_death.puncher:get_player_name()
|
name = self.cause_of_death.puncher:get_player_name()
|
||||||
if minetest.get_modpath("awards") and name ~= nil then
|
if core.get_modpath("awards") and name ~= nil then
|
||||||
awards.unlock(name, "drwho_tardis:defeat_cyberman")
|
awards.unlock(name, "drwho_tardis:defeat_cyberman")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -201,7 +201,7 @@ mobs:spawn({
|
|||||||
},
|
},
|
||||||
active_object_count = 4, -- Can spawn up to 4 Cybermen at a time
|
active_object_count = 4, -- Can spawn up to 4 Cybermen at a time
|
||||||
interval = 60, -- checks to spawn once a minute
|
interval = 60, -- checks to spawn once a minute
|
||||||
chance = tonumber(minetest.settings:get("drwho_tardis.cybermen_spawn_rate") or 60000), -- Should be at or above 60000, except when testing.
|
chance = tonumber(core.settings:get("drwho_tardis.cybermen_spawn_rate") or 60000), -- Should be at or above 60000, except when testing.
|
||||||
-- Everything else is handled by the default values
|
-- Everything else is handled by the default values
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ mobs:spawn({
|
|||||||
},
|
},
|
||||||
active_object_count = 4, -- Can spawn up to 4 Cybermen at a time
|
active_object_count = 4, -- Can spawn up to 4 Cybermen at a time
|
||||||
interval = 60, -- checks to spawn once a minute
|
interval = 60, -- checks to spawn once a minute
|
||||||
chance = tonumber(minetest.settings:get("drwho_tardis.cybermen_spawn_rate") or 60000), -- Should be at or above 60000, except when testing.
|
chance = tonumber(core.settings:get("drwho_tardis.cybermen_spawn_rate") or 60000), -- Should be at or above 60000, except when testing.
|
||||||
-- Everything else is handled by the default values
|
-- Everything else is handled by the default values
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
-- [8] Brown Dalek (new who) (can fly)
|
-- [8] Brown Dalek (new who) (can fly)
|
||||||
-- [110] Grey Dalek (classic who) (can't fly)
|
-- [110] Grey Dalek (classic who) (can't fly)
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
|
|
||||||
if _drwho_tardis.GAMETYPE == "mtg" then
|
if _drwho_tardis.GAMETYPE == "mtg" then
|
||||||
if minetest.get_modpath("mobs") then
|
if core.get_modpath("mobs") then
|
||||||
|
|
||||||
-- Brown New Who Dalek
|
-- Brown New Who Dalek
|
||||||
mobs:register_mob("drwho_tardis:dalek", {
|
mobs:register_mob("drwho_tardis:dalek", {
|
||||||
@ -97,7 +97,7 @@ mobs:register_mob("drwho_tardis:dalek", {
|
|||||||
on_die = function(self)
|
on_die = function(self)
|
||||||
if self.cause_of_death.puncher ~= nil then
|
if self.cause_of_death.puncher ~= nil then
|
||||||
name = self.cause_of_death.puncher:get_player_name()
|
name = self.cause_of_death.puncher:get_player_name()
|
||||||
if minetest.get_modpath("awards") and name ~= nil then
|
if core.get_modpath("awards") and name ~= nil then
|
||||||
awards.unlock(name, "drwho_tardis:defeat_dalek")
|
awards.unlock(name, "drwho_tardis:defeat_dalek")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -119,7 +119,7 @@ mobs:spawn({
|
|||||||
},
|
},
|
||||||
active_object_count = 2, -- Can spawn up to 2 Daleks at a time
|
active_object_count = 2, -- Can spawn up to 2 Daleks at a time
|
||||||
interval = 60, -- checks to spawn once a minute
|
interval = 60, -- checks to spawn once a minute
|
||||||
chance = tonumber(minetest.settings:get("drwho_tardis.dalek_spawn_rate") or 60000), -- Should be at or above 60000, except when testing.
|
chance = tonumber(core.settings:get("drwho_tardis.dalek_spawn_rate") or 60000), -- Should be at or above 60000, except when testing.
|
||||||
-- Everything else is handled by the default values
|
-- Everything else is handled by the default values
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ mobs:spawn({
|
|||||||
on_die = function(self)
|
on_die = function(self)
|
||||||
if self.cause_of_death.puncher ~= nil then
|
if self.cause_of_death.puncher ~= nil then
|
||||||
name = self.cause_of_death.puncher:get_player_name()
|
name = self.cause_of_death.puncher:get_player_name()
|
||||||
if minetest.get_modpath("awards") and name ~= nil then
|
if core.get_modpath("awards") and name ~= nil then
|
||||||
awards.unlock(name, "drwho_tardis:defeat_dalek")
|
awards.unlock(name, "drwho_tardis:defeat_dalek")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -233,7 +233,7 @@ mobs:spawn({
|
|||||||
},
|
},
|
||||||
active_object_count = 2, -- Can spawn up to 2 Daleks at a time
|
active_object_count = 2, -- Can spawn up to 2 Daleks at a time
|
||||||
interval = 60, -- checks to spawn once a minute
|
interval = 60, -- checks to spawn once a minute
|
||||||
chance = tonumber(minetest.settings:get("drwho_tardis.dalek_spawn_rate") or 60000), -- Should be at or above 60000, except when testing.
|
chance = tonumber(core.settings:get("drwho_tardis.dalek_spawn_rate") or 60000), -- Should be at or above 60000, except when testing.
|
||||||
-- Everything else is handled by the default values
|
-- Everything else is handled by the default values
|
||||||
})
|
})
|
||||||
|
|
||||||
|
72
recipes.lua
72
recipes.lua
@ -4,7 +4,7 @@
|
|||||||
-- All recipes that are not CRAFTITEMS or ARMOR
|
-- All recipes that are not CRAFTITEMS or ARMOR
|
||||||
|
|
||||||
-- Not used in this file.
|
-- Not used in this file.
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
|
|
||||||
local i = _drwho_tardis.items
|
local i = _drwho_tardis.items
|
||||||
-- i.block_steel returns the steel block depending on what gametype it is
|
-- i.block_steel returns the steel block depending on what gametype it is
|
||||||
@ -36,7 +36,7 @@ local function get_formspec_lab()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function lab_recipe(item,result,pos, player)
|
local function lab_recipe(item,result,pos, player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if inv:contains_item("fuel", item) == true and inv:is_empty("dest") then
|
if inv:contains_item("fuel", item) == true and inv:is_empty("dest") then
|
||||||
inv:remove_item("fuel",item)
|
inv:remove_item("fuel",item)
|
||||||
@ -57,12 +57,12 @@ local function lab_crafting(pos, player)
|
|||||||
lab_recipe(i.dirt, i.coal, pos, player)
|
lab_recipe(i.dirt, i.coal, pos, player)
|
||||||
lab_recipe(i.stone, d.grey_block, pos, player)
|
lab_recipe(i.stone, d.grey_block, pos, player)
|
||||||
end
|
end
|
||||||
minetest.register_node("drwho_tardis:lab", {
|
core.register_node("drwho_tardis:lab", {
|
||||||
description = S("Gallifreyan Lab"),
|
description = S("Gallifreyan Lab"),
|
||||||
tiles = {"tardis_lab.png"},
|
tiles = {"tardis_lab.png"},
|
||||||
groups = {cracky = 3},
|
groups = {cracky = 3},
|
||||||
on_construct = function(pos, node)
|
on_construct = function(pos, node)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("fuel", 2*1)
|
inv:set_size("fuel", 2*1)
|
||||||
inv:set_size("dest", 2*1)
|
inv:set_size("dest", 2*1)
|
||||||
@ -83,7 +83,7 @@ minetest.register_node("drwho_tardis:lab", {
|
|||||||
|
|
||||||
if _drwho_tardis.GAMETYPE == "rp" then
|
if _drwho_tardis.GAMETYPE == "rp" then
|
||||||
|
|
||||||
if minetest.settings:get('drwho_tardis.craftable_tardis') == true then
|
if core.settings:get('drwho_tardis.craftable_tardis') == true then
|
||||||
crafting.register_craft({
|
crafting.register_craft({
|
||||||
output = d.tardis,
|
output = d.tardis,
|
||||||
items = {
|
items = {
|
||||||
@ -306,8 +306,8 @@ else -- It's not Repixture, do normal crafting
|
|||||||
--Recipes--
|
--Recipes--
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
if minetest.settings:get('drwho_tardis.craftable_tardis') == true then
|
if core.settings:get('drwho_tardis.craftable_tardis') == true then
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.tardis,
|
output = d.tardis,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.block_steel, d.arton_crystal, i.block_steel},
|
{i.block_steel, d.arton_crystal, i.block_steel},
|
||||||
@ -316,7 +316,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.lab,
|
output = d.lab,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.block_tin, i.block_bronze, i.block_steel},
|
{i.block_tin, i.block_bronze, i.block_steel},
|
||||||
@ -324,7 +324,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.block_steel, i.block_gold, i.block_tin}
|
{i.block_steel, i.block_gold, i.block_tin}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.vortex_manipulator,
|
output = d.vortex_manipulator,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.stick, d.circuitry_board, i.stick},
|
{i.stick, d.circuitry_board, i.stick},
|
||||||
@ -332,7 +332,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{d.azbantium_shard, i.block_tin, d.azbantium_shard}
|
{d.azbantium_shard, i.block_tin, d.azbantium_shard}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.rassilon_gauntlet,
|
output = d.rassilon_gauntlet,
|
||||||
recipe = {
|
recipe = {
|
||||||
{d.arton_crystal, d.dalekanium_ingot, d.arton_crystal},
|
{d.arton_crystal, d.dalekanium_ingot, d.arton_crystal},
|
||||||
@ -340,7 +340,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{d.dalekanium_ingot, "", d.dalekanium_ingot}
|
{d.dalekanium_ingot, "", d.dalekanium_ingot}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.chest,
|
output = d.chest,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
||||||
@ -348,7 +348,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel}
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.circuitry_board.." 2",
|
output = d.circuitry_board.." 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_copper, i.diamond, i.ingot_tin},
|
{i.ingot_copper, i.diamond, i.ingot_tin},
|
||||||
@ -356,7 +356,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{"group:wood", "group:wood", "group:wood"}
|
{"group:wood", "group:wood", "group:wood"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.rotor,
|
output = d.rotor,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.block_steel, i.diamond, i.block_steel},
|
{i.block_steel, i.diamond, i.block_steel},
|
||||||
@ -364,7 +364,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.block_steel, d.circuitry_board, i.block_steel}
|
{i.block_steel, d.circuitry_board, i.block_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.console_y,
|
output = d.console_y,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
||||||
@ -372,7 +372,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.console_x,
|
output = d.console_x,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
||||||
@ -380,7 +380,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.console_z,
|
output = d.console_z,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
||||||
@ -388,7 +388,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.console_go,
|
output = d.console_go,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
||||||
@ -396,7 +396,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.console_c,
|
output = d.console_c,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
||||||
@ -404,7 +404,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.console_f,
|
output = d.console_f,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
||||||
@ -412,7 +412,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.console_o,
|
output = d.console_o,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
||||||
@ -420,7 +420,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.console_s,
|
output = d.console_s,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
||||||
@ -428,7 +428,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
{i.ingot_steel, d.circuitry_board, i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.monitor,
|
output = d.monitor,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel},
|
||||||
@ -436,7 +436,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel, i.ingot_steel, i.ingot_steel}
|
{i.ingot_steel, i.ingot_steel, i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.light.." 4",
|
output = d.light.." 4",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", i.ingot_steel, ""},
|
{"", i.ingot_steel, ""},
|
||||||
@ -444,27 +444,27 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{"", i.ingot_steel, ""}
|
{"", i.ingot_steel, ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.turquiose,
|
output = d.turquiose,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_tin},
|
{i.ingot_tin},
|
||||||
{i.stone}
|
{i.stone}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.azbantium,
|
output = d.azbantium,
|
||||||
recipe = {
|
recipe = {
|
||||||
{d.azbantium_shard, d.azbantium_shard},
|
{d.azbantium_shard, d.azbantium_shard},
|
||||||
{d.azbantium_shard, d.azbantium_shard}
|
{d.azbantium_shard, d.azbantium_shard}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = d.azbantium_shard.." 4",
|
output = d.azbantium_shard.." 4",
|
||||||
recipe = {d.azbantium}
|
recipe = {d.azbantium}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.dalekanium_ingot,
|
output = d.dalekanium_ingot,
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.obsidian, i.ingot_steel, i.obsidian},
|
{i.obsidian, i.ingot_steel, i.obsidian},
|
||||||
@ -472,7 +472,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.obsidian, i.ingot_steel, i.obsidian}
|
{i.obsidian, i.ingot_steel, i.obsidian}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "drwho_tardis:in_door",
|
output = "drwho_tardis:in_door",
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel, d.azbantium_shard, i.ingot_steel},
|
{i.ingot_steel, d.azbantium_shard, i.ingot_steel},
|
||||||
@ -480,17 +480,17 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel, d.azbantium_shard, i.ingot_steel}
|
{i.ingot_steel, d.azbantium_shard, i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "drwho_tardis:in_door_b",
|
output = "drwho_tardis:in_door_b",
|
||||||
recipe = {"drwho_tardis:in_door"}
|
recipe = {"drwho_tardis:in_door"}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "drwho_tardis:in_door",
|
output = "drwho_tardis:in_door",
|
||||||
recipe = {"drwho_tardis:in_door_b"}
|
recipe = {"drwho_tardis:in_door_b"}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.walls.wall.." 9",
|
output = d.walls.wall.." 9",
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel},
|
{i.ingot_steel},
|
||||||
@ -498,7 +498,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel}
|
{i.ingot_steel}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.walls.circles_16.." 9",
|
output = d.walls.circles_16.." 9",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"","",i.ingot_steel},
|
{"","",i.ingot_steel},
|
||||||
@ -506,7 +506,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel,"",""},
|
{i.ingot_steel,"",""},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.walls.circles_32.." 9",
|
output = d.walls.circles_32.." 9",
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel,"",""},
|
{i.ingot_steel,"",""},
|
||||||
@ -514,7 +514,7 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{"","",i.ingot_steel},
|
{"","",i.ingot_steel},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = d.walls.one_circle.." 9",
|
output = d.walls.one_circle.." 9",
|
||||||
recipe = {
|
recipe = {
|
||||||
{i.ingot_steel,"",""},
|
{i.ingot_steel,"",""},
|
||||||
@ -522,12 +522,12 @@ else -- It's not Repixture, do normal crafting
|
|||||||
{i.ingot_steel,"",""},
|
{i.ingot_steel,"",""},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = d.walls.one_circle_halfs,
|
output = d.walls.one_circle_halfs,
|
||||||
recipe = {d.walls.one_circle}
|
recipe = {d.walls.one_circle}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = d.walls.one_circle,
|
output = d.walls.one_circle,
|
||||||
recipe = {d.walls.one_circle_halfs}
|
recipe = {d.walls.one_circle_halfs}
|
||||||
|
82
sonic.lua
82
sonic.lua
@ -3,8 +3,8 @@
|
|||||||
-- generate_sonic_screwdriver()
|
-- generate_sonic_screwdriver()
|
||||||
-- Generic Sonic Screwdriver
|
-- Generic Sonic Screwdriver
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
local data = minetest.get_mod_storage()
|
local data = core.get_mod_storage()
|
||||||
|
|
||||||
local function get_formspec_digilines()
|
local function get_formspec_digilines()
|
||||||
return "size[10,10]"..
|
return "size[10,10]"..
|
||||||
@ -40,7 +40,7 @@ function drwho_tardis:register_sonic_device(def)
|
|||||||
if top > sonictypes then top = 1 end
|
if top > sonictypes then top = 1 end
|
||||||
if mid > sonictypes then mid = 1 end
|
if mid > sonictypes then mid = 1 end
|
||||||
if bottom > sonictypes then bottom = 1 end
|
if bottom > sonictypes then bottom = 1 end
|
||||||
minetest.chat_send_all(sonictypes.." top: "..top.." mid: "..mid.." bottom: "..bottom)
|
core.chat_send_all(sonictypes.." top: "..top.." mid: "..mid.." bottom: "..bottom)
|
||||||
|
|
||||||
|
|
||||||
if def.sonictype == nil then def.sonictype = "screwdriver" end -- Default to "screwdriver"
|
if def.sonictype == nil then def.sonictype = "screwdriver" end -- Default to "screwdriver"
|
||||||
@ -51,7 +51,7 @@ function drwho_tardis:register_sonic_device(def)
|
|||||||
else
|
else
|
||||||
item_name = ":drwho_tardis:sonic_"..def.sonictype.."_"..top.."_"..mid.."_"..bottom
|
item_name = ":drwho_tardis:sonic_"..def.sonictype.."_"..top.."_"..mid.."_"..bottom
|
||||||
end
|
end
|
||||||
minetest.chat_send_all(".")
|
core.chat_send_all(".")
|
||||||
-- if playername is not given, custom description must be given.
|
-- if playername is not given, custom description must be given.
|
||||||
--local item_description = def.customdescription or def.playername.."\'s Sonic Screwdriver"
|
--local item_description = def.customdescription or def.playername.."\'s Sonic Screwdriver"
|
||||||
local item_description = def.customdescription or S("Sonic Screwdriver (@1-@2-@3)", top, mid, bottom) -- (4-2-3)
|
local item_description = def.customdescription or S("Sonic Screwdriver (@1-@2-@3)", top, mid, bottom) -- (4-2-3)
|
||||||
@ -84,7 +84,7 @@ function drwho_tardis:register_sonic_device(def)
|
|||||||
def.sounds.sonic_use = def.sounds.sonic_use or {name="sonic_sound",max_hear_distance = 10}
|
def.sounds.sonic_use = def.sounds.sonic_use or {name="sonic_sound",max_hear_distance = 10}
|
||||||
|
|
||||||
|
|
||||||
minetest.register_tool(item_name, {
|
core.register_tool(item_name, {
|
||||||
description = item_description,
|
description = item_description,
|
||||||
inventory_image = inventoryimage,
|
inventory_image = inventoryimage,
|
||||||
stack_max=1,
|
stack_max=1,
|
||||||
@ -104,70 +104,70 @@ function drwho_tardis:register_sonic_device(def)
|
|||||||
local sonic_add_wear = true
|
local sonic_add_wear = true
|
||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
local controls = player:get_player_control()
|
local controls = player:get_player_control()
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = core.get_node(pointed_thing.under)
|
||||||
local meta = minetest.get_meta(pointed_thing.under)
|
local meta = core.get_meta(pointed_thing.under)
|
||||||
select_pos = pointed_thing.under
|
select_pos = pointed_thing.under
|
||||||
local drop = minetest.get_node_drops(node, nil)
|
local drop = core.get_node_drops(node, nil)
|
||||||
if controls.sneak then
|
if controls.sneak then
|
||||||
-- sneaking
|
-- sneaking
|
||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
if user.has_a_tardis == false then
|
if user.has_a_tardis == false then
|
||||||
minetest.chat_send_player(id, S("You do not have a Tardis!"))
|
core.chat_send_player(id, S("You do not have a Tardis!"))
|
||||||
elseif r_pos.x+50 > select_pos.x and r_pos.x-50 < select_pos.x and r_pos.z+50 > select_pos.z and r_pos.z-50 < select_pos.z and r_pos.y+50 > select_pos.y and r_pos.y-50 < select_pos.y then
|
elseif r_pos.x+50 > select_pos.x and r_pos.x-50 < select_pos.x and r_pos.z+50 > select_pos.z and r_pos.z-50 < select_pos.z and r_pos.y+50 > select_pos.y and r_pos.y-50 < select_pos.y then
|
||||||
minetest.chat_send_player(id, "Your Tardis can not be summoned here!")
|
core.chat_send_player(id, "Your Tardis can not be summoned here!")
|
||||||
else
|
else
|
||||||
if user.power < 3 then minetest.chat_send_player(id, "Not Enough Power In Tardis!") else
|
if user.power < 3 then core.chat_send_player(id, "Not Enough Power In Tardis!") else
|
||||||
local select_pos = pointed_thing.above
|
local select_pos = pointed_thing.above
|
||||||
local out_pos = user.out_pos
|
local out_pos = user.out_pos
|
||||||
minetest.set_node(out_pos, {name = "air"})
|
core.set_node(out_pos, {name = "air"})
|
||||||
out_pos.x = select_pos.x
|
out_pos.x = select_pos.x
|
||||||
out_pos.y = select_pos.y
|
out_pos.y = select_pos.y
|
||||||
out_pos.z = select_pos.z
|
out_pos.z = select_pos.z
|
||||||
|
|
||||||
out_pos.y = out_pos.y+1
|
out_pos.y = out_pos.y+1
|
||||||
minetest.set_node(out_pos, {name = "air"})
|
core.set_node(out_pos, {name = "air"})
|
||||||
out_pos.y = out_pos.y-1
|
out_pos.y = out_pos.y-1
|
||||||
|
|
||||||
minetest.set_node(out_pos, {name=user.exterior_skin})
|
core.set_node(out_pos, {name=user.exterior_skin})
|
||||||
local ometa = minetest.get_meta(out_pos)
|
local ometa = core.get_meta(out_pos)
|
||||||
ometa:set_string("id", id)
|
ometa:set_string("id", id)
|
||||||
user.out_pos = out_pos
|
user.out_pos = out_pos
|
||||||
user.power = user.power - 3
|
user.power = user.power - 3
|
||||||
local timer = minetest.get_node_timer(out_pos)
|
local timer = core.get_node_timer(out_pos)
|
||||||
timer:start(0.5)
|
timer:start(0.5)
|
||||||
minetest.chat_send_player(id, S("Tardis Summoned"))
|
core.chat_send_player(id, S("Tardis Summoned"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- not sneaking
|
-- not sneaking
|
||||||
if id == meta:get_string("id") then
|
if id == meta:get_string("id") then
|
||||||
if minetest.get_item_group(node.name, "tardis") == 1 then
|
if core.get_item_group(node.name, "tardis") == 1 then
|
||||||
minetest.set_node(select_pos, {name = user.exterior_skin.."_locked"})
|
core.set_node(select_pos, {name = user.exterior_skin.."_locked"})
|
||||||
local ometa = minetest.get_meta(select_pos)
|
local ometa = core.get_meta(select_pos)
|
||||||
ometa:set_string("id", id)
|
ometa:set_string("id", id)
|
||||||
minetest.chat_send_player(id, S("Tardis Locked"))
|
core.chat_send_player(id, S("Tardis Locked"))
|
||||||
end
|
end
|
||||||
if minetest.get_item_group(node.name, "tardis_locked") == 1 then
|
if core.get_item_group(node.name, "tardis_locked") == 1 then
|
||||||
minetest.set_node(select_pos, {name = user.exterior_skin})
|
core.set_node(select_pos, {name = user.exterior_skin})
|
||||||
local timer = minetest.get_node_timer(select_pos)
|
local timer = core.get_node_timer(select_pos)
|
||||||
timer:start(0.2)
|
timer:start(0.2)
|
||||||
local ometa = minetest.get_meta(select_pos)
|
local ometa = core.get_meta(select_pos)
|
||||||
ometa:set_string("id", id)
|
ometa:set_string("id", id)
|
||||||
minetest.chat_send_player(id, S("Tardis Unlocked"))
|
core.chat_send_player(id, S("Tardis Unlocked"))
|
||||||
end
|
end
|
||||||
elseif string.match(node.name,"doors:door_steel") then
|
elseif string.match(node.name,"doors:door_steel") then
|
||||||
doors.door_toggle(select_pos, nil, nil)
|
doors.door_toggle(select_pos, nil, nil)
|
||||||
elseif string.match(node.name,"doors:trapdoor_steel") then
|
elseif string.match(node.name,"doors:trapdoor_steel") then
|
||||||
doors.trapdoor_toggle(select_pos, nil, nil)
|
doors.trapdoor_toggle(select_pos, nil, nil)
|
||||||
elseif node.name == "default:glass" then
|
elseif node.name == "default:glass" then
|
||||||
minetest.set_node(select_pos, {name = "default:obsidian_glass"})
|
core.set_node(select_pos, {name = "default:obsidian_glass"})
|
||||||
elseif node.name == "default:dirt" then
|
elseif node.name == "default:dirt" then
|
||||||
minetest.set_node(select_pos, {name = "default:dirt_with_grass"})
|
core.set_node(select_pos, {name = "default:dirt_with_grass"})
|
||||||
elseif node.name == "default:sand" then
|
elseif node.name == "default:sand" then
|
||||||
minetest.set_node(select_pos, {name = "default:silver_sand"})
|
core.set_node(select_pos, {name = "default:silver_sand"})
|
||||||
elseif node.name == "default:obsidian" then
|
elseif node.name == "default:obsidian" then
|
||||||
minetest.set_node(select_pos, {name = "default:lava_source"} )
|
core.set_node(select_pos, {name = "default:lava_source"} )
|
||||||
elseif minetest.get_item_group(node.name, "mesecon_conductor_craftable") == 1 then
|
elseif core.get_item_group(node.name, "mesecon_conductor_craftable") == 1 then
|
||||||
if mesecon.is_conductor_on(node) then
|
if mesecon.is_conductor_on(node) then
|
||||||
mesecon.turnoff(select_pos, {0, 0, 0})
|
mesecon.turnoff(select_pos, {0, 0, 0})
|
||||||
else
|
else
|
||||||
@ -175,11 +175,11 @@ function drwho_tardis:register_sonic_device(def)
|
|||||||
end
|
end
|
||||||
elseif drop[1] == "digilines:wire_std_00000000" then
|
elseif drop[1] == "digilines:wire_std_00000000" then
|
||||||
local meta = player:get_meta()
|
local meta = player:get_meta()
|
||||||
meta:set_string("sonic_digiline", minetest.serialize(select_pos))
|
meta:set_string("sonic_digiline", core.serialize(select_pos))
|
||||||
minetest.show_formspec(player:get_player_name(), "drwho_tardis:digilines_formspec", get_formspec_digilines() )
|
core.show_formspec(player:get_player_name(), "drwho_tardis:digilines_formspec", get_formspec_digilines() )
|
||||||
else
|
else
|
||||||
sonic_add_wear = false -- don't reduce durability
|
sonic_add_wear = false -- don't reduce durability
|
||||||
--minetest.chat_send_player(id, "not reducing durability")
|
--core.chat_send_player(id, "not reducing durability")
|
||||||
return -- we can't do anything with this node
|
return -- we can't do anything with this node
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -196,19 +196,19 @@ function drwho_tardis:register_sonic_device(def)
|
|||||||
obj:add_velocity({ x = 5*(vpos.x - pos.x), y = 5*(vpos.y - pos.y), z = 5*(vpos.z - pos.z)})
|
obj:add_velocity({ x = 5*(vpos.x - pos.x), y = 5*(vpos.y - pos.y), z = 5*(vpos.z - pos.z)})
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(id, S("Scanned subject had @1 hearts", obj:get_hp()/2))
|
core.chat_send_player(id, S("Scanned subject had @1 hearts", obj:get_hp()/2))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
sonic_add_wear = false -- don't reduce durability
|
sonic_add_wear = false -- don't reduce durability
|
||||||
--minetest.chat_send_player(id, "not reducing durability")
|
--core.chat_send_player(id, "not reducing durability")
|
||||||
return -- not pointing to anything important, return
|
return -- not pointing to anything important, return
|
||||||
end
|
end
|
||||||
local sonic_sound = table.copy(def.sounds.sonic_use)
|
local sonic_sound = table.copy(def.sounds.sonic_use)
|
||||||
sonic_sound.pos = select_pos
|
sonic_sound.pos = select_pos
|
||||||
minetest.sound_play(sonic_sound.name, sonic_sound)
|
core.sound_play(sonic_sound.name, sonic_sound)
|
||||||
if sonic_add_wear == true then
|
if sonic_add_wear == true then
|
||||||
itemstack:add_wear(65535 / (sonicgc.uses * (3^(sonicgc.maxlevel-1) ) - 1 ))
|
itemstack:add_wear(65535 / (sonicgc.uses * (3^(sonicgc.maxlevel-1) ) - 1 ))
|
||||||
--minetest.chat_send_player(id, "durability added")
|
--core.chat_send_player(id, "durability added")
|
||||||
end
|
end
|
||||||
_drwho_tardis.save_user(id, user) -- save user data if anything was changed, e.g. if Tardis is summoned out_pos is changed
|
_drwho_tardis.save_user(id, user) -- save user data if anything was changed, e.g. if Tardis is summoned out_pos is changed
|
||||||
return itemstack
|
return itemstack
|
||||||
@ -221,11 +221,11 @@ function drwho_tardis:register_sonic_device(def)
|
|||||||
-- do nothing, it has already been set
|
-- do nothing, it has already been set
|
||||||
else -- if == "choose", == "random", or not specified
|
else -- if == "choose", == "random", or not specified
|
||||||
add_sonictypes_texture(item_name, top, mid, bottom) -- Add correct textures using ItemStack
|
add_sonictypes_texture(item_name, top, mid, bottom) -- Add correct textures using ItemStack
|
||||||
minetest.chat_send_all(S("Sonic Screwdriver registered with textures @1-@2-@3 and itemstring @4", top, mid, bottom, item_name))
|
core.chat_send_all(S("Sonic Screwdriver registered with textures @1-@2-@3 and itemstring @4", top, mid, bottom, item_name))
|
||||||
end
|
end
|
||||||
--]]
|
--]]
|
||||||
minetest.register_alias(item_name:match"^.-:(.+)", item_name) -- Just in case
|
core.register_alias(item_name:match"^.-:(.+)", item_name) -- Just in case
|
||||||
--minetest.register_alias(item_name, item_name:match"^.-:(.+)") -- Who knows?
|
--core.register_alias(item_name, item_name:match"^.-:(.+)") -- Who knows?
|
||||||
|
|
||||||
return item_name
|
return item_name
|
||||||
end
|
end
|
||||||
|
@ -6,10 +6,12 @@
|
|||||||
|
|
||||||
-- The definitions and formspecs can't be separated because they are local functions
|
-- The definitions and formspecs can't be separated because they are local functions
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
local data = minetest.get_mod_storage()
|
local data = core.get_mod_storage()
|
||||||
|
|
||||||
--formspecs
|
|
||||||
|
|
||||||
|
---------------------- Formspec getters --------------------------------
|
||||||
|
|
||||||
|
|
||||||
-- Travel Factor, X, Y, Z
|
-- Travel Factor, X, Y, Z
|
||||||
@ -31,7 +33,7 @@ local function get_formspec_fxyz(set)
|
|||||||
local dest = S("Destination: @1, @2, @3", addx, addy, addz)
|
local dest = S("Destination: @1, @2, @3", addx, addy, addz)
|
||||||
local cur = S("Current Position: @1, @2, @3", outx, outy, outz)
|
local cur = S("Current Position: @1, @2, @3", outx, outy, outz)
|
||||||
return "size[10,10]"..
|
return "size[10,10]"..
|
||||||
"label[1,1.25;"..minetest.formspec_escape(tfactor).."]".. -- Travel Factor:
|
"label[1,1.25;"..core.formspec_escape(tfactor).."]".. -- Travel Factor:
|
||||||
"image_button[4,1;1,1;switch_1.png;one; ;false;false;switch_2.png]"..
|
"image_button[4,1;1,1;switch_1.png;one; ;false;false;switch_2.png]"..
|
||||||
"image_button[5.2,1;1,1;switch_1.png;ten; ;false;false;switch_2.png]"..
|
"image_button[5.2,1;1,1;switch_1.png;ten; ;false;false;switch_2.png]"..
|
||||||
"image_button[6.4,1;1,1;switch_1.png;hundred; ;false;false;switch_2.png]"..
|
"image_button[6.4,1;1,1;switch_1.png;hundred; ;false;false;switch_2.png]"..
|
||||||
@ -41,8 +43,8 @@ local function get_formspec_fxyz(set)
|
|||||||
"tooltip[hundred;100]"..
|
"tooltip[hundred;100]"..
|
||||||
"tooltip[thousand;1000]"..
|
"tooltip[thousand;1000]"..
|
||||||
|
|
||||||
"label[1,3;"..minetest.formspec_escape(cur).."]".. -- Current Position: X, Y, Z
|
"label[1,3;"..core.formspec_escape(cur).."]".. -- Current Position: X, Y, Z
|
||||||
"label[1,5;"..minetest.formspec_escape(dest).."]".. -- Destination: X, Y, Z
|
"label[1,5;"..core.formspec_escape(dest).."]".. -- Destination: X, Y, Z
|
||||||
|
|
||||||
"image_button[0.5,7;2,2;handle_1.png;xposup; ;false;false;handle_2.png]".. -- Change X POS
|
"image_button[0.5,7;2,2;handle_1.png;xposup; ;false;false;handle_2.png]".. -- Change X POS
|
||||||
"image_button[1.5,7;2,2;handle_1.png;xposdown; ;false;false;handle_2.png]"..
|
"image_button[1.5,7;2,2;handle_1.png;xposdown; ;false;false;handle_2.png]"..
|
||||||
@ -66,12 +68,12 @@ local function get_formspec_w() -- GO Lever
|
|||||||
"image_button_exit[3,3;4,4;lever_1.png;go; ;false;false;lever_2.png]"
|
"image_button_exit[3,3;4,4;lever_1.png;go; ;false;false;lever_2.png]"
|
||||||
end
|
end
|
||||||
local function get_formspec_r(set) -- Power Left (Time Rotor)
|
local function get_formspec_r(set) -- Power Left (Time Rotor)
|
||||||
local max_power = tonumber(minetest.settings:get("drwho_tardis.max_power")) or 10
|
local max_power = tonumber(core.settings:get("drwho_tardis.max_power")) or 10
|
||||||
local power = S("Power Left: @1 out of @2", set, max_power)
|
local power = S("Power Left: @1 out of @2", set, max_power)
|
||||||
local info = S("1 power is generated every 15 seconds.")
|
local info = S("1 power is generated every 15 seconds.")
|
||||||
return "size[10,10]"..
|
return "size[10,10]"..
|
||||||
"label[1,1;"..minetest.formspec_escape(power).."]"..
|
"label[1,1;"..core.formspec_escape(power).."]"..
|
||||||
"label[1,2;"..minetest.formspec_escape(info).."]"
|
"label[1,2;"..core.formspec_escape(info).."]"
|
||||||
end
|
end
|
||||||
local function get_formspec_fb(set)
|
local function get_formspec_fb(set)
|
||||||
local id = set.id -- TARDIS ID Code, passed to formspec every time
|
local id = set.id -- TARDIS ID Code, passed to formspec every time
|
||||||
@ -105,22 +107,22 @@ local function get_formspec_fb(set)
|
|||||||
|
|
||||||
-- Create sidebar with buttons part
|
-- Create sidebar with buttons part
|
||||||
local biome = biomes[sid]
|
local biome = biomes[sid]
|
||||||
local sidebuttons = "label[0,0;"..minetest.formspec_escape(loc).."]"..
|
local sidebuttons = "label[0,0;"..core.formspec_escape(loc).."]"..
|
||||||
"label[0,1;"..minetest.formspec_escape(cur).."]"..
|
"label[0,1;"..core.formspec_escape(cur).."]"..
|
||||||
"label[0,1.5;"..minetest.formspec_escape(dest).."]"..
|
"label[0,1.5;"..core.formspec_escape(dest).."]"..
|
||||||
"label[0,2;"..minetest.formspec_escape(bpos).."]"..
|
"label[0,2;"..core.formspec_escape(bpos).."]"..
|
||||||
"label[0.1,2.75;"..minetest.formspec_escape(note).."]"
|
"label[0.1,2.75;"..core.formspec_escape(note).."]"
|
||||||
|
|
||||||
-- Write in the biome name field
|
-- Write in the biome name field
|
||||||
sidebuttons = sidebuttons.."field[0.25,4.5;4,1;setbiome;"..textf..";"..finding_biome.."]"
|
sidebuttons = sidebuttons.."field[0.25,4.5;4,1;setbiome;"..textf..";"..finding_biome.."]"
|
||||||
-- Find biome button
|
-- Find biome button
|
||||||
sidebuttons = sidebuttons.."image_button[0.5,6;2,2;handle_1.png;fbiome; ;false;false;handle_2.png]"..
|
sidebuttons = sidebuttons.."image_button[0.5,6;2,2;handle_1.png;fbiome; ;false;false;handle_2.png]"..
|
||||||
"tooltip[fbiome;"..minetest.formspec_escape(fbiome_tt).."]"
|
"tooltip[fbiome;"..core.formspec_escape(fbiome_tt).."]"
|
||||||
-- Set biome as destination button
|
-- Set biome as destination button
|
||||||
sidebuttons = sidebuttons.."image_button[2,6;2,2;handle_1.png;set; ;false;false;handle_2.png]"..
|
sidebuttons = sidebuttons.."image_button[2,6;2,2;handle_1.png;set; ;false;false;handle_2.png]"..
|
||||||
"tooltip[set;"..minetest.formspec_escape(set_tt).."]"
|
"tooltip[set;"..core.formspec_escape(set_tt).."]"
|
||||||
-- Create biome list formspec part
|
-- Create biome list formspec part
|
||||||
local biomeslistformspec = "label[6,0.5;"..minetest.formspec_escape(list).."]"..
|
local biomeslistformspec = "label[6,0.5;"..core.formspec_escape(list).."]"..
|
||||||
"textlist[5,1;5,9;consolefindbiome;"
|
"textlist[5,1;5,9;consolefindbiome;"
|
||||||
|
|
||||||
local first = true
|
local first = true
|
||||||
@ -129,7 +131,7 @@ local function get_formspec_fb(set)
|
|||||||
biomeslistformspec = biomeslistformspec .. ","
|
biomeslistformspec = biomeslistformspec .. ","
|
||||||
end
|
end
|
||||||
first = false
|
first = false
|
||||||
biomeslistformspec = biomeslistformspec .. minetest.formspec_escape(biomes[b])
|
biomeslistformspec = biomeslistformspec .. core.formspec_escape(biomes[b])
|
||||||
end
|
end
|
||||||
biomeslistformspec = biomeslistformspec .. ";]"
|
biomeslistformspec = biomeslistformspec .. ";]"
|
||||||
|
|
||||||
@ -151,7 +153,7 @@ local function get_formspec_s() -- Extra Functions
|
|||||||
local pick_tt = S("Create a Pickaxe")
|
local pick_tt = S("Create a Pickaxe")
|
||||||
local locate_fieldtext = S("type name here... ")
|
local locate_fieldtext = S("type name here... ")
|
||||||
return "size[10,10]"..
|
return "size[10,10]"..
|
||||||
"field[1,9;8,1;locate;;"..minetest.formspec_escape(locate_fieldtext).."]"..
|
"field[1,9;8,1;locate;;"..core.formspec_escape(locate_fieldtext).."]"..
|
||||||
"image_button[1,1;2,2;switch_1.png;pick; ;false;false;switch_2.png]"..
|
"image_button[1,1;2,2;switch_1.png;pick; ;false;false;switch_2.png]"..
|
||||||
"image_button[2.5,1;2,2;switch_1.png;heal; ;false;false;switch_2.png]"..
|
"image_button[2.5,1;2,2;switch_1.png;heal; ;false;false;switch_2.png]"..
|
||||||
"image_button[4,1;2,2;switch_1.png;axe; ;false;false;switch_2.png]"..
|
"image_button[4,1;2,2;switch_1.png;axe; ;false;false;switch_2.png]"..
|
||||||
@ -161,20 +163,20 @@ local function get_formspec_s() -- Extra Functions
|
|||||||
"image_button[6,1;4,4;handle_1.png;sonic; ;false;false;handle_2.png]"..
|
"image_button[6,1;4,4;handle_1.png;sonic; ;false;false;handle_2.png]"..
|
||||||
"image_button_exit[0.5,5.5;3,3;dial_1.png;submit; ;false;false;dial_2.png]"..
|
"image_button_exit[0.5,5.5;3,3;dial_1.png;submit; ;false;false;dial_2.png]"..
|
||||||
"image_button[3.5,5.5;3,3;dial_1.png;scan; ;false;false;dial_2.png]"..
|
"image_button[3.5,5.5;3,3;dial_1.png;scan; ;false;false;dial_2.png]"..
|
||||||
"tooltip[sonic;"..minetest.formspec_escape(sonic_tt).."]"..
|
"tooltip[sonic;"..core.formspec_escape(sonic_tt).."]"..
|
||||||
"tooltip[heal;"..minetest.formspec_escape(heal_tt).."]"..
|
"tooltip[heal;"..core.formspec_escape(heal_tt).."]"..
|
||||||
"tooltip[axe;"..minetest.formspec_escape(axe_tt).."]"..
|
"tooltip[axe;"..core.formspec_escape(axe_tt).."]"..
|
||||||
"tooltip[scan;"..minetest.formspec_escape(scan_tt).."]"..
|
"tooltip[scan;"..core.formspec_escape(scan_tt).."]"..
|
||||||
"tooltip[submit;"..minetest.formspec_escape(submit_tt).."]"..
|
"tooltip[submit;"..core.formspec_escape(submit_tt).."]"..
|
||||||
"tooltip[food;"..minetest.formspec_escape(food_tt).."]"..
|
"tooltip[food;"..core.formspec_escape(food_tt).."]"..
|
||||||
"tooltip[antigrav;"..minetest.formspec_escape(antigrav_tt).."]"..
|
"tooltip[antigrav;"..core.formspec_escape(antigrav_tt).."]"..
|
||||||
"tooltip[attack;"..minetest.formspec_escape(attack_tt).."]"..
|
"tooltip[attack;"..core.formspec_escape(attack_tt).."]"..
|
||||||
"tooltip[pick;"..minetest.formspec_escape(pick_tt).."]"
|
"tooltip[pick;"..core.formspec_escape(pick_tt).."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- set should be the `name` e.g. 'green'
|
-- set should be the `name` e.g. 'green'
|
||||||
local function get_formspec_ext(set) -- Change Exterior
|
local function get_formspec_ext(set) -- Change Exterior
|
||||||
local ext_list = minetest.deserialize(data:get_string("ext_list"))
|
local ext_list = core.deserialize(data:get_string("ext_list"))
|
||||||
local ext_text = S("Change Exterior Shell")
|
local ext_text = S("Change Exterior Shell")
|
||||||
local index = 1
|
local index = 1
|
||||||
local ext_name_table = {}
|
local ext_name_table = {}
|
||||||
@ -184,10 +186,10 @@ local function get_formspec_ext(set) -- Change Exterior
|
|||||||
if ext.name == set then index = i end -- get the index of the current ext so it is already selected
|
if ext.name == set then index = i end -- get the index of the current ext so it is already selected
|
||||||
end
|
end
|
||||||
local formspec = "size[10,10]"..
|
local formspec = "size[10,10]"..
|
||||||
"label[1,1;"..minetest.formspec_escape(ext_text).."]"..
|
"label[1,1;"..core.formspec_escape(ext_text).."]"..
|
||||||
'dropdown[1,2;4,8;ext_dropdown;'..table.concat(ext_name_table, ',')..';'..index..']'..
|
'dropdown[1,2;4,8;ext_dropdown;'..table.concat(ext_name_table, ',')..';'..index..']'..
|
||||||
"button_exit[7,7;2,1;close;Close]"..
|
"button_exit[7,7;2,1;close;Close]"..
|
||||||
"item_image[6,2;3,3;"..minetest.formspec_escape("drwho_tardis:tardis_"..set).."]"
|
"item_image[6,2;3,3;"..core.formspec_escape("drwho_tardis:tardis_"..set).."]"
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -217,30 +219,36 @@ local function get_formspec_o(set) -- Waypoints
|
|||||||
local use_three_tt = S("Use Waypoint 3")
|
local use_three_tt = S("Use Waypoint 3")
|
||||||
|
|
||||||
return "size[10,10]"..
|
return "size[10,10]"..
|
||||||
"label[4,1;"..minetest.formspec_escape(cur).."]".. -- Current Position: X, Y, Z
|
"label[4,1;"..core.formspec_escape(cur).."]".. -- Current Position: X, Y, Z
|
||||||
"label[4,1.5;"..minetest.formspec_escape(dest).."]".. -- Destination: X, Y, Z
|
"label[4,1.5;"..core.formspec_escape(dest).."]".. -- Destination: X, Y, Z
|
||||||
"label[4,3.5;"..minetest.formspec_escape(way_one).."]".. -- Waypoint One: X, Y, Z
|
"label[4,3.5;"..core.formspec_escape(way_one).."]".. -- Waypoint One: X, Y, Z
|
||||||
"label[4,4;"..minetest.formspec_escape(way_two).."]".. -- Waypoint Two: X, Y, Z
|
"label[4,4;"..core.formspec_escape(way_two).."]".. -- Waypoint Two: X, Y, Z
|
||||||
"label[4,4.5;"..minetest.formspec_escape(way_three).."]"..-- Waypoint Three: X, Y, Z
|
"label[4,4.5;"..core.formspec_escape(way_three).."]"..-- Waypoint Three: X, Y, Z
|
||||||
|
|
||||||
"image_button[1,1;2,2;dial_1.png;set_one; ;false;false;dial_2.png]"..
|
"image_button[1,1;2,2;dial_1.png;set_one; ;false;false;dial_2.png]"..
|
||||||
"image_button[1,4;2,2;dial_1.png;set_two; ;false;false;dial_2.png]"..
|
"image_button[1,4;2,2;dial_1.png;set_two; ;false;false;dial_2.png]"..
|
||||||
"image_button[1,7;2,2;dial_1.png;set_three; ;false;false;dial_2.png]"..
|
"image_button[1,7;2,2;dial_1.png;set_three; ;false;false;dial_2.png]"..
|
||||||
|
|
||||||
"label[5,6.5;"..minetest.formspec_escape(set_way).."]".. -- Use Waypoint as Destination?
|
"label[5,6.5;"..core.formspec_escape(set_way).."]".. -- Use Waypoint as Destination?
|
||||||
"image_button[4.5,7;2,2;switch_1.png;use_one; ;false;false;switch_2.png]"..
|
"image_button[4.5,7;2,2;switch_1.png;use_one; ;false;false;switch_2.png]"..
|
||||||
"image_button[6,7;2,2;switch_1.png;use_two; ;false;false;switch_2.png]"..
|
"image_button[6,7;2,2;switch_1.png;use_two; ;false;false;switch_2.png]"..
|
||||||
"image_button[7.5,7;2,2;switch_1.png;use_three; ;false;false;switch_2.png]"..
|
"image_button[7.5,7;2,2;switch_1.png;use_three; ;false;false;switch_2.png]"..
|
||||||
|
|
||||||
"tooltip[set_one;"..minetest.formspec_escape(set_one_tt).."]"..
|
"tooltip[set_one;"..core.formspec_escape(set_one_tt).."]"..
|
||||||
"tooltip[set_two;"..minetest.formspec_escape(set_two_tt).."]"..
|
"tooltip[set_two;"..core.formspec_escape(set_two_tt).."]"..
|
||||||
"tooltip[set_three;"..minetest.formspec_escape(set_three_tt).."]"..
|
"tooltip[set_three;"..core.formspec_escape(set_three_tt).."]"..
|
||||||
"tooltip[use_one;"..minetest.formspec_escape(use_one_tt).."]"..
|
"tooltip[use_one;"..core.formspec_escape(use_one_tt).."]"..
|
||||||
"tooltip[use_two;"..minetest.formspec_escape(use_two_tt).."]"..
|
"tooltip[use_two;"..core.formspec_escape(use_two_tt).."]"..
|
||||||
"tooltip[use_three;"..minetest.formspec_escape(use_three_tt).."]"
|
"tooltip[use_three;"..core.formspec_escape(use_three_tt).."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------ Functions -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
local function general_functions(pos, formname, fields, sender)
|
local function general_functions(pos, formname, fields, sender)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id) -- get user data
|
local user = _drwho_tardis.get_user(id) -- get user data
|
||||||
local name = sender:get_player_name()
|
local name = sender:get_player_name()
|
||||||
@ -304,19 +312,19 @@ local function general_functions(pos, formname, fields, sender)
|
|||||||
|
|
||||||
--extra functions
|
--extra functions
|
||||||
elseif fields.submit then -- Locate a player
|
elseif fields.submit then -- Locate a player
|
||||||
if user.power < 2 then minetest.chat_send_player(name, S("You Need 2 Power")) else
|
if user.power < 2 then core.chat_send_player(name, S("You Need 2 Power")) else
|
||||||
local victim = minetest.get_player_by_name(fields.locate)
|
local victim = core.get_player_by_name(fields.locate)
|
||||||
if not victim then minetest.chat_send_player(name, fields.locate .. S(" not found")) else
|
if not victim then core.chat_send_player(name, fields.locate .. S(" not found")) else
|
||||||
local vpos = victim:get_pos()
|
local vpos = victim:get_pos()
|
||||||
user.dest_pos.x = vpos.x
|
user.dest_pos.x = vpos.x
|
||||||
user.dest_pos.y = vpos.y + 1
|
user.dest_pos.y = vpos.y + 1
|
||||||
user.dest_pos.z = vpos.z
|
user.dest_pos.z = vpos.z
|
||||||
minetest.chat_send_player(name, S("Player Located and set destination to them."))
|
core.chat_send_player(name, S("Player Located and set destination to them."))
|
||||||
user.power = user.power - 2
|
user.power = user.power - 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif fields.sonic then -- Create a sonic screwdriver
|
elseif fields.sonic then -- Create a sonic screwdriver
|
||||||
if user.power < 5 then minetest.chat_send_player(name, S("You Need 5 Power")) else
|
if user.power < 5 then core.chat_send_player(name, S("You Need 5 Power")) else
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
local sonictypes = 4 --number of variants for end, middle, and top
|
local sonictypes = 4 --number of variants for end, middle, and top
|
||||||
local top = math.random(1,sonictypes)
|
local top = math.random(1,sonictypes)
|
||||||
@ -334,57 +342,57 @@ local function general_functions(pos, formname, fields, sender)
|
|||||||
bottom = bottom,
|
bottom = bottom,
|
||||||
})
|
})
|
||||||
--]]
|
--]]
|
||||||
minetest.add_item(pos, sonicname)
|
core.add_item(pos, sonicname)
|
||||||
user.power = user.power - 5
|
user.power = user.power - 5
|
||||||
if minetest.get_modpath("awards") and _drwho_tardis.GAMETYPE=="mtg" then
|
if core.get_modpath("awards") and _drwho_tardis.GAMETYPE=="mtg" then
|
||||||
awards.unlock(name, "drwho_tardis:get_sonic_screwdriver") -- Unlock award if awards are enabled
|
awards.unlock(name, "drwho_tardis:get_sonic_screwdriver") -- Unlock award if awards are enabled
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif fields.heal then -- Heal the pilot
|
elseif fields.heal then -- Heal the pilot
|
||||||
if user.power < 3 then minetest.chat_send_player(name, S("You Need 3 Power")) else
|
if user.power < 3 then core.chat_send_player(name, S("You Need 3 Power")) else
|
||||||
sender:set_hp(40)
|
sender:set_hp(40)
|
||||||
user.power = user.power - 3
|
user.power = user.power - 3
|
||||||
end
|
end
|
||||||
elseif fields.scan then -- Scan a player by name
|
elseif fields.scan then -- Scan a player by name
|
||||||
if user.power < 1 then minetest.chat_send_player(name, S("You Need 1 Power")) else
|
if user.power < 1 then core.chat_send_player(name, S("You Need 1 Power")) else
|
||||||
local victim = minetest.get_player_by_name(fields.locate)
|
local victim = core.get_player_by_name(fields.locate)
|
||||||
if not victim then minetest.chat_send_player(name, fields.locate .. S(" not found")) else
|
if not victim then core.chat_send_player(name, fields.locate .. S(" not found")) else
|
||||||
local item = victim:get_wielded_item()
|
local item = victim:get_wielded_item()
|
||||||
local item_name = item:get_name()
|
local item_name = item:get_name()
|
||||||
if item:get_name() == "" then item_name = "nothing" end
|
if item:get_name() == "" then item_name = "nothing" end
|
||||||
minetest.chat_send_player(name, S("@1 is holding @2 and has @3 hearts", fields.locate, item_name, victim:get_hp()/2))
|
core.chat_send_player(name, S("@1 is holding @2 and has @3 hearts", fields.locate, item_name, victim:get_hp()/2))
|
||||||
user.power = user.power - 1
|
user.power = user.power - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif fields.pick then -- Create a diamond pickaxe
|
elseif fields.pick then -- Create a diamond pickaxe
|
||||||
if user.power < 5 then minetest.chat_send_player(name, S("You Need 5 Power")) else
|
if user.power < 5 then core.chat_send_player(name, S("You Need 5 Power")) else
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
minetest.add_item(pos, "default:pick_diamond")
|
core.add_item(pos, "default:pick_diamond")
|
||||||
user.power = user.power - 5
|
user.power = user.power - 5
|
||||||
end
|
end
|
||||||
elseif fields.axe then -- Create a diamond axe
|
elseif fields.axe then -- Create a diamond axe
|
||||||
if user.power < 5 then minetest.chat_send_player(name, S("You Need 5 Power")) else
|
if user.power < 5 then core.chat_send_player(name, S("You Need 5 Power")) else
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
minetest.add_item(pos, "default:axe_diamond")
|
core.add_item(pos, "default:axe_diamond")
|
||||||
user.power = user.power - 5
|
user.power = user.power - 5
|
||||||
end
|
end
|
||||||
elseif fields.antigrav then -- Toggle antigrav mavity system
|
elseif fields.antigrav then -- Toggle antigrav mavity system
|
||||||
local success, status = _drwho_tardis.toggle_mavity(id)
|
local success, status = _drwho_tardis.toggle_mavity(id)
|
||||||
minetest.chat_send_player(name, S(status))
|
core.chat_send_player(name, S(status))
|
||||||
elseif fields.food then -- Create a tardis biscuit
|
elseif fields.food then -- Create a tardis biscuit
|
||||||
if user.power < 1 then minetest.chat_send_player(name, S("You Need 1 Power")) else
|
if user.power < 1 then core.chat_send_player(name, S("You Need 1 Power")) else
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
minetest.add_item(pos, "drwho_tardis:biscuit")
|
core.add_item(pos, "drwho_tardis:biscuit")
|
||||||
user.power = user.power - 1
|
user.power = user.power - 1
|
||||||
end
|
end
|
||||||
elseif fields.attack then -- Attack a nearby player down to 1 hp
|
elseif fields.attack then -- Attack a nearby player down to 1 hp
|
||||||
if user.power < 4 then minetest.chat_send_player(name, S("You Need 4 Power")) else
|
if user.power < 4 then core.chat_send_player(name, S("You Need 4 Power")) else
|
||||||
local objs = minetest.get_objects_inside_radius(out_pos, 20)
|
local objs = core.get_objects_inside_radius(out_pos, 20)
|
||||||
if objs[1] == nil then minetest.chat_send_player(name, S("No players in range of Tardis")) else
|
if objs[1] == nil then core.chat_send_player(name, S("No players in range of Tardis")) else
|
||||||
if objs[1]:get_player_name() ~= "" then
|
if objs[1]:get_player_name() ~= "" then
|
||||||
objs[1]:set_hp(1) --Set their HP to 1
|
objs[1]:set_hp(1) --Set their HP to 1
|
||||||
minetest.chat_send_player(name, objs[1]:get_player_name().." was attacked" )
|
core.chat_send_player(name, objs[1]:get_player_name().." was attacked" )
|
||||||
if minetest.get_modpath("awards") and _drwho_tardis.GAMETYPE=="mtg" then --check if awards are enabled
|
if core.get_modpath("awards") and _drwho_tardis.GAMETYPE=="mtg" then --check if awards are enabled
|
||||||
awards.unlock(name, "drwho_tardis:tardis_attack") --unlock 'Threat Nullified' award
|
awards.unlock(name, "drwho_tardis:tardis_attack") --unlock 'Threat Nullified' award
|
||||||
end
|
end
|
||||||
user.power = user.power - 4 -- reduce power by 4
|
user.power = user.power - 4 -- reduce power by 4
|
||||||
@ -401,8 +409,8 @@ end
|
|||||||
-- Called when the emerge stuff has completely finished
|
-- Called when the emerge stuff has completely finished
|
||||||
-- Saves the go_pos, unlocks the interior door, sends a status message in chat
|
-- Saves the go_pos, unlocks the interior door, sends a status message in chat
|
||||||
function _drwho_tardis.do_after_travel(go_pos, context)
|
function _drwho_tardis.do_after_travel(go_pos, context)
|
||||||
--minetest.chat_send_all("Function do_after_travel() called...") -- debug
|
--core.chat_send_all("Function do_after_travel() called...") -- debug
|
||||||
if minetest.get_node(go_pos).name ~= "air" then
|
if core.get_node(go_pos).name ~= "air" then
|
||||||
go_pos.y = go_pos.y + 1 -- Make the Tardis land properly, not be 1 block in the ground
|
go_pos.y = go_pos.y + 1 -- Make the Tardis land properly, not be 1 block in the ground
|
||||||
end
|
end
|
||||||
local name = context.name
|
local name = context.name
|
||||||
@ -411,7 +419,7 @@ function _drwho_tardis.do_after_travel(go_pos, context)
|
|||||||
local user = _drwho_tardis.get_user(id) -- Get user data
|
local user = _drwho_tardis.get_user(id) -- Get user data
|
||||||
local out_pos = table.copy(user.out_pos)
|
local out_pos = table.copy(user.out_pos)
|
||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
local rmeta = minetest.get_meta(r_pos)--
|
local rmeta = core.get_meta(r_pos)--
|
||||||
local style = rmeta:get_string("style")--
|
local style = rmeta:get_string("style")--
|
||||||
-- local pmeta = sender:get_meta() -- deprecated
|
-- local pmeta = sender:get_meta() -- deprecated
|
||||||
local mavity_type = user.respect_mavity
|
local mavity_type = user.respect_mavity
|
||||||
@ -420,14 +428,14 @@ function _drwho_tardis.do_after_travel(go_pos, context)
|
|||||||
|
|
||||||
-- ADJUST FOR MAVITY and AVOID BEING UNDERGROUND
|
-- ADJUST FOR MAVITY and AVOID BEING UNDERGROUND
|
||||||
--if mavity_type == "yes" or mavity_type == "sink" then -- the emerge_callback did it, send chat message
|
--if mavity_type == "yes" or mavity_type == "sink" then -- the emerge_callback did it, send chat message
|
||||||
--local old_go_pos = minetest.deserialize(data:get_string(name.."old_go_pos"))
|
--local old_go_pos = core.deserialize(data:get_string(name.."old_go_pos"))
|
||||||
--if old_go_pos == nil then old_go_pos = {x="??", y="??", z="??"} end -- just in case, we don't want error
|
--if old_go_pos == nil then old_go_pos = {x="??", y="??", z="??"} end -- just in case, we don't want error
|
||||||
--minetest.chat_send_player(name, S("Tardis was going to be travelling to Y-pos @1 but adjusted for mavity and changed it to Y-pos @2", old_go_pos.y, go_pos.y))
|
--core.chat_send_player(name, S("Tardis was going to be travelling to Y-pos @1 but adjusted for mavity and changed it to Y-pos @2", old_go_pos.y, go_pos.y))
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
if minetest.is_protected(go_pos, name) then
|
if core.is_protected(go_pos, name) then
|
||||||
minetest.chat_send_player(name, S("You don't have access to this area!"))
|
core.chat_send_player(name, S("You don't have access to this area!"))
|
||||||
minetest.sound_stop(effect)
|
core.sound_stop(effect)
|
||||||
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
|
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
|
||||||
_drwho_tardis.switch_time_rotor(name, "off") -- end rotor animation
|
_drwho_tardis.switch_time_rotor(name, "off") -- end rotor animation
|
||||||
else
|
else
|
||||||
@ -435,51 +443,51 @@ function _drwho_tardis.do_after_travel(go_pos, context)
|
|||||||
-- and for MineClone world borders
|
-- and for MineClone world borders
|
||||||
--stay away from console room!
|
--stay away from console room!
|
||||||
if r_pos.x+100 > go_pos.x and r_pos.x-100 < go_pos.x and r_pos.z+100 > go_pos.z and r_pos.z-100 < go_pos.z and r_pos.y+100 > go_pos.y and r_pos.y-100 < go_pos.y then
|
if r_pos.x+100 > go_pos.x and r_pos.x-100 < go_pos.x and r_pos.z+100 > go_pos.z and r_pos.z-100 < go_pos.z and r_pos.y+100 > go_pos.y and r_pos.y-100 < go_pos.y then
|
||||||
minetest.chat_send_player(name, "Your Tardis does not want to land at this location")
|
core.chat_send_player(name, "Your Tardis does not want to land at this location")
|
||||||
minetest.sound_stop(effect)
|
core.sound_stop(effect)
|
||||||
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
|
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
|
||||||
_drwho_tardis.switch_time_rotor(name, "off") -- end rotor animation
|
_drwho_tardis.switch_time_rotor(name, "off") -- end rotor animation
|
||||||
else
|
else
|
||||||
if 30900 > go_pos.x and -30900 < go_pos.x and 30900 > go_pos.z and -30900 < go_pos.z and 30900 > go_pos.z and -30900 < go_pos.z then --world limits , update them for MCL as that is different
|
if 30900 > go_pos.x and -30900 < go_pos.x and 30900 > go_pos.z and -30900 < go_pos.z and 30900 > go_pos.z and -30900 < go_pos.z then --world limits , update them for MCL as that is different
|
||||||
minetest.after(8, function(effect)
|
core.after(8, function(effect)
|
||||||
minetest.sound_stop(effect)
|
core.sound_stop(effect)
|
||||||
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
|
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
|
||||||
_drwho_tardis.switch_time_rotor(name, "off") -- end rotor animation
|
_drwho_tardis.switch_time_rotor(name, "off") -- end rotor animation
|
||||||
if minetest.get_modpath("awards") and _drwho_tardis.GAMETYPE == "mtg" then
|
if core.get_modpath("awards") and _drwho_tardis.GAMETYPE == "mtg" then
|
||||||
_drwho_tardis.update_one_value(name, 'times_travelled_in_tardis', user.times_travelled_in_tardis + 1)
|
_drwho_tardis.update_one_value(name, 'times_travelled_in_tardis', user.times_travelled_in_tardis + 1)
|
||||||
minetest.chat_send_player(name, S("Times travelled in TARDIS: @1", user.times_travelled_in_tardis))
|
core.chat_send_player(name, S("Times travelled in TARDIS: @1", user.times_travelled_in_tardis))
|
||||||
_drwho_tardis.check_drwho_awards(name) -- Will give times_travelled awards if nessasary
|
_drwho_tardis.check_drwho_awards(name) -- Will give times_travelled awards if nessasary
|
||||||
end
|
end
|
||||||
local ometa = minetest.get_meta(r_pos)
|
local ometa = core.get_meta(r_pos)
|
||||||
ometa:set_string("id", id)
|
ometa:set_string("id", id)
|
||||||
ometa:set_string("formspec", get_formspec_r(user.power))
|
ometa:set_string("formspec", get_formspec_r(user.power))
|
||||||
local otimer = minetest.get_node_timer(r_pos)
|
local otimer = core.get_node_timer(r_pos)
|
||||||
otimer:start(15)
|
otimer:start(15)
|
||||||
-- pmeta:set_string("vortex", "no") -- deprecated
|
-- pmeta:set_string("vortex", "no") -- deprecated
|
||||||
data:set_string(id.."vortex", "no")
|
data:set_string(id.."vortex", "no")
|
||||||
minetest.chat_send_player(name, S("Your Tardis has landed."))
|
core.chat_send_player(name, S("Your Tardis has landed."))
|
||||||
end, effect)
|
end, effect)
|
||||||
|
|
||||||
minetest.set_node(out_pos, {name = "air"})
|
core.set_node(out_pos, {name = "air"})
|
||||||
out_pos = go_pos
|
out_pos = go_pos
|
||||||
minetest.set_node(out_pos, {name = user.exterior_skin})
|
core.set_node(out_pos, {name = user.exterior_skin})
|
||||||
|
|
||||||
out_pos.y = out_pos.y+1
|
out_pos.y = out_pos.y+1
|
||||||
minetest.set_node(out_pos, {name = "air"})
|
core.set_node(out_pos, {name = "air"})
|
||||||
out_pos.y = out_pos.y-1
|
out_pos.y = out_pos.y-1
|
||||||
|
|
||||||
local ometa = minetest.get_meta(out_pos)
|
local ometa = core.get_meta(out_pos)
|
||||||
ometa:set_string("id", id)
|
ometa:set_string("id", id)
|
||||||
local user = _drwho_tardis.get_user(id) -- Get recent user data
|
local user = _drwho_tardis.get_user(id) -- Get recent user data
|
||||||
user.out_pos = out_pos
|
user.out_pos = out_pos
|
||||||
user.power = user.power - 1
|
user.power = user.power - 1
|
||||||
_drwho_tardis.save_user(id, user) -- Save user data
|
_drwho_tardis.save_user(id, user) -- Save user data
|
||||||
local timer = minetest.get_node_timer(out_pos)
|
local timer = core.get_node_timer(out_pos)
|
||||||
timer:start(0.2)
|
timer:start(0.2)
|
||||||
|
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("Your Tardis can not travel outside the world!"))
|
core.chat_send_player(name, S("Your Tardis can not travel outside the world!"))
|
||||||
minetest.sound_stop(effect)
|
core.sound_stop(effect)
|
||||||
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
|
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
|
||||||
_drwho_tardis.switch_time_rotor(name, "off") -- end rotor animation
|
_drwho_tardis.switch_time_rotor(name, "off") -- end rotor animation
|
||||||
end
|
end
|
||||||
@ -498,7 +506,7 @@ function _drwho_tardis.emerge_callback(pos, action, num_calls_remaining, context
|
|||||||
context.loaded_blocks = context.loaded_blocks + 1
|
context.loaded_blocks = context.loaded_blocks + 1
|
||||||
if context.total_blocks == context.loaded_blocks then
|
if context.total_blocks == context.loaded_blocks then
|
||||||
-- Ding! Now we can run our code to float up or down
|
-- Ding! Now we can run our code to float up or down
|
||||||
--minetest.chat_send_player(context.name, "Finished emerging section") -- debug
|
--core.chat_send_player(context.name, "Finished emerging section") -- debug
|
||||||
local user = _drwho_tardis.get_user(context.name) -- Get user data
|
local user = _drwho_tardis.get_user(context.name) -- Get user data
|
||||||
local mavity = user.respect_mavity
|
local mavity = user.respect_mavity
|
||||||
_drwho_tardis.do_float_fall(context.go_pos, context, mavity) -- Will float fall if mavity settings say so
|
_drwho_tardis.do_float_fall(context.go_pos, context, mavity) -- Will float fall if mavity settings say so
|
||||||
@ -518,21 +526,21 @@ function _drwho_tardis.do_float_fall(go_pos, context1, mavity)
|
|||||||
meta = context1.meta,
|
meta = context1.meta,
|
||||||
sound_effect = context1.sound_effect,
|
sound_effect = context1.sound_effect,
|
||||||
}
|
}
|
||||||
--minetest.chat_send_all("Function do_float_fall() called...") -- debug
|
--core.chat_send_all("Function do_float_fall() called...") -- debug
|
||||||
if mavity == "yes" then -- float fall
|
if mavity == "yes" then -- float fall
|
||||||
local nodedef = minetest.registered_nodes[minetest.get_node(go_pos).name] -- store def
|
local nodedef = core.registered_nodes[core.get_node(go_pos).name] -- store def
|
||||||
-- If we are in the air (or flattenable node)
|
-- If we are in the air (or flattenable node)
|
||||||
if minetest.get_node(go_pos).name == "air" or nodedef.buildable_to then
|
if core.get_node(go_pos).name == "air" or nodedef.buildable_to then
|
||||||
while minetest.get_node(go_pos).name == "air" or nodedef.buildable_to do
|
while core.get_node(go_pos).name == "air" or nodedef.buildable_to do
|
||||||
go_pos.y = go_pos.y - 1 -- Keep moving down until we hit a different node
|
go_pos.y = go_pos.y - 1 -- Keep moving down until we hit a different node
|
||||||
nodedef = minetest.registered_nodes[minetest.get_node(go_pos).name]
|
nodedef = core.registered_nodes[core.get_node(go_pos).name]
|
||||||
if minetest.get_node(go_pos).name == "ignore" then -- Check if we need to
|
if core.get_node(go_pos).name == "ignore" then -- Check if we need to
|
||||||
context.go_pos = go_pos -- save the current go_pos
|
context.go_pos = go_pos -- save the current go_pos
|
||||||
-- Load next area
|
-- Load next area
|
||||||
context.pos1.y = go_pos.y - 1000
|
context.pos1.y = go_pos.y - 1000
|
||||||
context.pos2.y = go_pos.y + 20
|
context.pos2.y = go_pos.y + 20
|
||||||
minetest.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
|
core.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
|
||||||
--minetest.chat_send_all("Starting to emerge the next section") -- debug
|
--core.chat_send_all("Starting to emerge the next section") -- debug
|
||||||
return -- end because this function is the callback after emerge is finished
|
return -- end because this function is the callback after emerge is finished
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -540,17 +548,17 @@ function _drwho_tardis.do_float_fall(go_pos, context1, mavity)
|
|||||||
return
|
return
|
||||||
else
|
else
|
||||||
-- It's not air (or flattenable node), we are underground or inside nodes
|
-- It's not air (or flattenable node), we are underground or inside nodes
|
||||||
while minetest.get_node(go_pos).name ~= "air" or not nodedef.buildable_to do
|
while core.get_node(go_pos).name ~= "air" or not nodedef.buildable_to do
|
||||||
go_pos.y = go_pos.y + 1 -- Keep moving up until we hit air
|
go_pos.y = go_pos.y + 1 -- Keep moving up until we hit air
|
||||||
--minetest.chat_send_player(context.name, "Tardis is computing go_pos, the Y level is "..go_pos.y)
|
--core.chat_send_player(context.name, "Tardis is computing go_pos, the Y level is "..go_pos.y)
|
||||||
nodedef = minetest.registered_nodes[minetest.get_node(go_pos).name]
|
nodedef = core.registered_nodes[core.get_node(go_pos).name]
|
||||||
if minetest.get_node(go_pos).name == "ignore" then -- Check if we need to
|
if core.get_node(go_pos).name == "ignore" then -- Check if we need to
|
||||||
context.go_pos = go_pos -- save the current go_pos
|
context.go_pos = go_pos -- save the current go_pos
|
||||||
-- Load next area
|
-- Load next area
|
||||||
context.pos1.y = go_pos.y + 1000
|
context.pos1.y = go_pos.y + 1000
|
||||||
context.pos2.y = go_pos.y - 20
|
context.pos2.y = go_pos.y - 20
|
||||||
minetest.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
|
core.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
|
||||||
--minetest.chat_send_all("Starting to emerge the next section")
|
--core.chat_send_all("Starting to emerge the next section")
|
||||||
return -- end because this function is the callback after emerge is finished
|
return -- end because this function is the callback after emerge is finished
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -558,21 +566,21 @@ function _drwho_tardis.do_float_fall(go_pos, context1, mavity)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
elseif mavity == "sink" then -- float fall but also sinks through liquids
|
elseif mavity == "sink" then -- float fall but also sinks through liquids
|
||||||
local nodedef = minetest.registered_nodes[minetest.get_node(go_pos).name] -- store def
|
local nodedef = core.registered_nodes[core.get_node(go_pos).name] -- store def
|
||||||
--nodedef.liquidtype ~= "none"
|
--nodedef.liquidtype ~= "none"
|
||||||
-- If we are in the air or liquid or flattenable
|
-- If we are in the air or liquid or flattenable
|
||||||
if minetest.get_node(go_pos).name == "air" or nodedef.liquidtype ~= "none" or nodedef.buildable_to then
|
if core.get_node(go_pos).name == "air" or nodedef.liquidtype ~= "none" or nodedef.buildable_to then
|
||||||
while minetest.get_node(go_pos).name == "air" or nodedef.liquidtype ~= "none" or nodedef.buildable_to do
|
while core.get_node(go_pos).name == "air" or nodedef.liquidtype ~= "none" or nodedef.buildable_to do
|
||||||
go_pos.y = go_pos.y - 1 -- Keep moving down until we hit a different node
|
go_pos.y = go_pos.y - 1 -- Keep moving down until we hit a different node
|
||||||
--minetest.chat_send_player(context.name, "Tardis is computing go_pos, the Y level is "..go_pos.y)
|
--core.chat_send_player(context.name, "Tardis is computing go_pos, the Y level is "..go_pos.y)
|
||||||
nodedef = minetest.registered_nodes[minetest.get_node(go_pos).name] -- update def for new node
|
nodedef = core.registered_nodes[core.get_node(go_pos).name] -- update def for new node
|
||||||
if minetest.get_node(go_pos).name == "ignore" then -- Check if we need to
|
if core.get_node(go_pos).name == "ignore" then -- Check if we need to
|
||||||
context.go_pos = go_pos -- save the current go_pos
|
context.go_pos = go_pos -- save the current go_pos
|
||||||
-- Load next area
|
-- Load next area
|
||||||
context.pos1.y = go_pos.y - 1000
|
context.pos1.y = go_pos.y - 1000
|
||||||
context.pos2.y = go_pos.y + 20
|
context.pos2.y = go_pos.y + 20
|
||||||
minetest.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
|
core.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
|
||||||
--minetest.chat_send_all("Starting to emerge the next section")
|
--core.chat_send_all("Starting to emerge the next section")
|
||||||
return -- end because this function is the callback after emerge is finished
|
return -- end because this function is the callback after emerge is finished
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -580,17 +588,17 @@ function _drwho_tardis.do_float_fall(go_pos, context1, mavity)
|
|||||||
return
|
return
|
||||||
else
|
else
|
||||||
-- It's not air, we are underground or inside nodes
|
-- It's not air, we are underground or inside nodes
|
||||||
while minetest.get_node(go_pos).name ~= "air" or nodedef.liquidtype == "none" or not nodedef.buildable_to do
|
while core.get_node(go_pos).name ~= "air" or nodedef.liquidtype == "none" or not nodedef.buildable_to do
|
||||||
go_pos.y = go_pos.y + 1 -- Keep moving up until we hit air
|
go_pos.y = go_pos.y + 1 -- Keep moving up until we hit air
|
||||||
--minetest.chat_send_player(context.name, "Tardis is computing go_pos, the Y level is "..go_pos.y)
|
--core.chat_send_player(context.name, "Tardis is computing go_pos, the Y level is "..go_pos.y)
|
||||||
nodedef = minetest.registered_nodes[minetest.get_node(go_pos).name] -- update def for new node
|
nodedef = core.registered_nodes[core.get_node(go_pos).name] -- update def for new node
|
||||||
if minetest.get_node(go_pos).name == "ignore" then -- Check if we need to
|
if core.get_node(go_pos).name == "ignore" then -- Check if we need to
|
||||||
context.go_pos = go_pos -- save the current go_pos
|
context.go_pos = go_pos -- save the current go_pos
|
||||||
-- Load next area
|
-- Load next area
|
||||||
context.pos1.y = go_pos.y + 1000
|
context.pos1.y = go_pos.y + 1000
|
||||||
context.pos2.y = go_pos.y - 20
|
context.pos2.y = go_pos.y - 20
|
||||||
minetest.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
|
core.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
|
||||||
--minetest.chat_send_all("Starting to emerge the next section")
|
--core.chat_send_all("Starting to emerge the next section")
|
||||||
return -- end because this function is the callback after emerge is finished
|
return -- end because this function is the callback after emerge is finished
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -605,21 +613,21 @@ end
|
|||||||
|
|
||||||
|
|
||||||
local function travel_to_location(pos, formname, fields, sender)
|
local function travel_to_location(pos, formname, fields, sender)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id)
|
local user = _drwho_tardis.get_user(id)
|
||||||
local out_pos = user.out_pos
|
local out_pos = user.out_pos
|
||||||
local look = user.exterior_skin
|
local look = user.exterior_skin
|
||||||
if _drwho_tardis.is_time_rotor(id) then
|
if _drwho_tardis.is_time_rotor(id) then
|
||||||
local rmeta = minetest.get_meta(user.r_pos)
|
local rmeta = core.get_meta(user.r_pos)
|
||||||
local style = rmeta:get_string("style")
|
local style = rmeta:get_string("style")
|
||||||
end
|
end
|
||||||
local go_pos = table.copy(user.dest_pos)
|
local go_pos = table.copy(user.dest_pos)
|
||||||
local pmeta = sender:get_meta()
|
local pmeta = sender:get_meta()
|
||||||
local name = sender:get_player_name()
|
local name = sender:get_player_name()
|
||||||
if fields.go then
|
if fields.go then
|
||||||
if not _drwho_tardis.is_time_rotor(id) then minetest.chat_send_player(name, S("You need to have a Time Rotor! If you already do, try break it and re-place it.")) else
|
if not _drwho_tardis.is_time_rotor(id) then core.chat_send_player(name, S("You need to have a Time Rotor! If you already do, try break it and re-place it.")) else
|
||||||
if user.power == 0 then minetest.chat_send_player(name, S("No Power Left!")) else --power?
|
if user.power == 0 then core.chat_send_player(name, S("No Power Left!")) else --power?
|
||||||
-- LOCK TARDIS DOOR
|
-- LOCK TARDIS DOOR
|
||||||
_drwho_tardis.toggle_int_door(id, "lock")
|
_drwho_tardis.toggle_int_door(id, "lock")
|
||||||
user.old_go_pos = user.go_pos
|
user.old_go_pos = user.go_pos
|
||||||
@ -634,11 +642,11 @@ local function travel_to_location(pos, formname, fields, sender)
|
|||||||
pos1 = pos1,
|
pos1 = pos1,
|
||||||
pos2 = pos2,
|
pos2 = pos2,
|
||||||
meta = meta, -- I think this is the metadata for warp lever
|
meta = meta, -- I think this is the metadata for warp lever
|
||||||
sound_effect = minetest.sound_play("tardis_sound", {pos = pos, max_hear_distance = 10}),
|
sound_effect = core.sound_play("tardis_sound", {pos = pos, max_hear_distance = 10}),
|
||||||
}
|
}
|
||||||
_drwho_tardis.switch_time_rotor(id, "on")
|
_drwho_tardis.switch_time_rotor(id, "on")
|
||||||
minetest.chat_send_player(name, S("Your Tardis is dematerialising, and is travelling through the time vortex. The exit door is locked until it lands."))
|
core.chat_send_player(name, S("Your Tardis is dematerialising, and is travelling through the time vortex. The exit door is locked until it lands."))
|
||||||
minetest.emerge_area(pos1, pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
|
core.emerge_area(pos1, pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
|
||||||
|
|
||||||
-- After the emerge_callback is finished and the Tardis lands somewhere,
|
-- After the emerge_callback is finished and the Tardis lands somewhere,
|
||||||
-- it runs more checks before actually landing there
|
-- it runs more checks before actually landing there
|
||||||
@ -649,7 +657,7 @@ local function travel_to_location(pos, formname, fields, sender)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function change_look(pos, formname, fields, sender)
|
local function change_look(pos, formname, fields, sender)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id)
|
local user = _drwho_tardis.get_user(id)
|
||||||
if fields.ext_dropdown then
|
if fields.ext_dropdown then
|
||||||
@ -662,7 +670,7 @@ local function change_look(pos, formname, fields, sender)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function find_biome_functions(pos, formname, fields, sender)
|
local function find_biome_functions(pos, formname, fields, sender)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id)
|
local user = _drwho_tardis.get_user(id)
|
||||||
local out_pos = user.out_pos
|
local out_pos = user.out_pos
|
||||||
@ -688,7 +696,7 @@ local function find_biome_functions(pos, formname, fields, sender)
|
|||||||
elseif fields.consolefindbiome then -- consolefindbiome
|
elseif fields.consolefindbiome then -- consolefindbiome
|
||||||
local success, biome_list = findbiome.list_biomes() -- get the biome list again
|
local success, biome_list = findbiome.list_biomes() -- get the biome list again
|
||||||
if success then
|
if success then
|
||||||
local event = minetest.explode_textlist_event(fields.consolefindbiome)
|
local event = core.explode_textlist_event(fields.consolefindbiome)
|
||||||
if event.type == "CHG" then -- something has been selected
|
if event.type == "CHG" then -- something has been selected
|
||||||
local cur_biome = biome_list[event.index] -- find the biome they would have selected
|
local cur_biome = biome_list[event.index] -- find the biome they would have selected
|
||||||
meta:set_string("formspec", get_formspec_fb({ -- Refresh formspec
|
meta:set_string("formspec", get_formspec_fb({ -- Refresh formspec
|
||||||
@ -701,7 +709,7 @@ local function find_biome_functions(pos, formname, fields, sender)
|
|||||||
end
|
end
|
||||||
elseif fields.fbiome then
|
elseif fields.fbiome then
|
||||||
local setbiome = fields.setbiome
|
local setbiome = fields.setbiome
|
||||||
minetest.chat_send_all(S("Tardis finding biome: @1", setbiome))
|
core.chat_send_all(S("Tardis finding biome: @1", setbiome))
|
||||||
user.finding_biome = setbiome
|
user.finding_biome = setbiome
|
||||||
|
|
||||||
local biome_pos = findbiome.find_biome(user.out_pos, {setbiome})
|
local biome_pos = findbiome.find_biome(user.out_pos, {setbiome})
|
||||||
@ -723,7 +731,7 @@ local function find_biome_functions(pos, formname, fields, sender)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function waypoint(pos, formname, fields, sender)
|
local function waypoint(pos, formname, fields, sender)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id) -- Get user data
|
local user = _drwho_tardis.get_user(id) -- Get user data
|
||||||
local out_pos = user.out_pos
|
local out_pos = user.out_pos
|
||||||
@ -775,9 +783,8 @@ local function waypoint(pos, formname, fields, sender)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--------------------
|
------------------ Node Definitions ----------------------
|
||||||
--NODE DEFINITIONS--
|
|
||||||
--------------------
|
|
||||||
_drwho_tardis.console_list = {
|
_drwho_tardis.console_list = {
|
||||||
"console_y",
|
"console_y",
|
||||||
"console_x",
|
"console_x",
|
||||||
@ -791,7 +798,7 @@ _drwho_tardis.console_list = {
|
|||||||
"rotor",
|
"rotor",
|
||||||
}
|
}
|
||||||
local function register_console_set(set, craftitem, side, ytexture, xtexture, ztexture, ftexture, stexture, wtexture, ctexture, otexture, rotortexture, altrotortexture, ltexture)
|
local function register_console_set(set, craftitem, side, ytexture, xtexture, ztexture, ftexture, stexture, wtexture, ctexture, otexture, rotortexture, altrotortexture, ltexture)
|
||||||
minetest.register_node("drwho_tardis:console_y"..set, {
|
core.register_node("drwho_tardis:console_y"..set, {
|
||||||
description = S("Axis Console Unit A"),
|
description = S("Axis Console Unit A"),
|
||||||
tiles = {ytexture, ytexture, side, side, side, side},
|
tiles = {ytexture, ytexture, side, side, side, side},
|
||||||
groups = {cracky = 3, tardis_console_y = 1},
|
groups = {cracky = 3, tardis_console_y = 1},
|
||||||
@ -803,13 +810,13 @@ minetest.register_node("drwho_tardis:console_y"..set, {
|
|||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
||||||
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
meta:set_string("formspec", get_formspec_fxyz({id = id}))
|
meta:set_string("formspec", get_formspec_fxyz({id = id}))
|
||||||
else minetest.dig_node(pos) minetest.chat_send_player(id, S("You must place it inside your Tardis")) end
|
else core.dig_node(pos) core.chat_send_player(id, S("You must place it inside your Tardis")) end
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id) -- Get user data
|
local user = _drwho_tardis.get_user(id) -- Get user data
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
@ -817,7 +824,7 @@ minetest.register_node("drwho_tardis:console_y"..set, {
|
|||||||
end,
|
end,
|
||||||
on_receive_fields = general_functions
|
on_receive_fields = general_functions
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:console_x"..set, {
|
core.register_node("drwho_tardis:console_x"..set, {
|
||||||
description = S("Axis Console Unit B"),
|
description = S("Axis Console Unit B"),
|
||||||
tiles = {xtexture, xtexture, side, side, side, side},
|
tiles = {xtexture, xtexture, side, side, side, side},
|
||||||
groups = {cracky = 3, tardis_console_x = 1},
|
groups = {cracky = 3, tardis_console_x = 1},
|
||||||
@ -829,14 +836,14 @@ minetest.register_node("drwho_tardis:console_x"..set, {
|
|||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
||||||
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local out_pos = user.out_pos
|
local out_pos = user.out_pos
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
meta:set_string("formspec", get_formspec_fxyz({id = id}))
|
meta:set_string("formspec", get_formspec_fxyz({id = id}))
|
||||||
else minetest.dig_node(pos) minetest.chat_send_player(id, S("You must place it inside your Tardis")) end
|
else core.dig_node(pos) core.chat_send_player(id, S("You must place it inside your Tardis")) end
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id) -- Get user data
|
local user = _drwho_tardis.get_user(id) -- Get user data
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
@ -844,7 +851,7 @@ minetest.register_node("drwho_tardis:console_x"..set, {
|
|||||||
end,
|
end,
|
||||||
on_receive_fields = general_functions
|
on_receive_fields = general_functions
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:console_z"..set, {
|
core.register_node("drwho_tardis:console_z"..set, {
|
||||||
description = S("Axis Console Unit C"),
|
description = S("Axis Console Unit C"),
|
||||||
tiles = {ztexture, ztexture, side, side, side, side},
|
tiles = {ztexture, ztexture, side, side, side, side},
|
||||||
groups = {cracky = 3, tardis_console_z = 1},
|
groups = {cracky = 3, tardis_console_z = 1},
|
||||||
@ -856,20 +863,20 @@ minetest.register_node("drwho_tardis:console_z"..set, {
|
|||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
||||||
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
meta:set_string("formspec", get_formspec_fxyz({id = id}))
|
meta:set_string("formspec", get_formspec_fxyz({id = id}))
|
||||||
else minetest.dig_node(pos) minetest.chat_send_player(id, S("You must place it inside your Tardis")) end
|
else core.dig_node(pos) core.chat_send_player(id, S("You must place it inside your Tardis")) end
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
meta:set_string("formspec", get_formspec_fxyz({id = id}))
|
meta:set_string("formspec", get_formspec_fxyz({id = id}))
|
||||||
end,
|
end,
|
||||||
on_receive_fields = general_functions
|
on_receive_fields = general_functions
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:console_f"..set, {
|
core.register_node("drwho_tardis:console_f"..set, {
|
||||||
description = S("Find Biome Console Unit"),
|
description = S("Find Biome Console Unit"),
|
||||||
tiles = {ftexture, ftexture, side, side, side, side},
|
tiles = {ftexture, ftexture, side, side, side, side},
|
||||||
groups = {cracky = 3, tardis_console_f = 1},
|
groups = {cracky = 3, tardis_console_f = 1},
|
||||||
@ -881,13 +888,13 @@ minetest.register_node("drwho_tardis:console_f"..set, {
|
|||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
||||||
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
meta:set_string("formspec", get_formspec_fb({id = id}))
|
meta:set_string("formspec", get_formspec_fb({id = id}))
|
||||||
else minetest.dig_node(pos) minetest.chat_send_player(id, S("You must place it inside your Tardis")) end
|
else core.dig_node(pos) core.chat_send_player(id, S("You must place it inside your Tardis")) end
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id) -- Get user data
|
local user = _drwho_tardis.get_user(id) -- Get user data
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
@ -898,7 +905,7 @@ minetest.register_node("drwho_tardis:console_f"..set, {
|
|||||||
end,
|
end,
|
||||||
on_receive_fields = find_biome_functions
|
on_receive_fields = find_biome_functions
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:console_s"..set, {
|
core.register_node("drwho_tardis:console_s"..set, {
|
||||||
description = S("Functions Console Unit"),
|
description = S("Functions Console Unit"),
|
||||||
tiles = {stexture, stexture, side, side, side, side},
|
tiles = {stexture, stexture, side, side, side, side},
|
||||||
groups = {cracky = 3, tardis_console_s = 1},
|
groups = {cracky = 3, tardis_console_s = 1},
|
||||||
@ -910,15 +917,15 @@ minetest.register_node("drwho_tardis:console_s"..set, {
|
|||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
||||||
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = pmeta:get_string("id")
|
local id = pmeta:get_string("id")
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
meta:set_string("formspec", get_formspec_s())
|
meta:set_string("formspec", get_formspec_s())
|
||||||
else minetest.dig_node(pos) minetest.chat_send_player(id, S("You must place it inside your Tardis")) end
|
else core.dig_node(pos) core.chat_send_player(id, S("You must place it inside your Tardis")) end
|
||||||
end,
|
end,
|
||||||
on_receive_fields = general_functions
|
on_receive_fields = general_functions
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:console_go"..set, {
|
core.register_node("drwho_tardis:console_go"..set, {
|
||||||
description = S("Warp Lever Console Unit"),
|
description = S("Warp Lever Console Unit"),
|
||||||
tiles = {wtexture, wtexture, side, side, side, side},
|
tiles = {wtexture, wtexture, side, side, side, side},
|
||||||
groups = {cracky = 3, tardis_console_go = 1},
|
groups = {cracky = 3, tardis_console_go = 1},
|
||||||
@ -930,14 +937,14 @@ minetest.register_node("drwho_tardis:console_go"..set, {
|
|||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
||||||
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
meta:set_string("formspec", get_formspec_w())
|
meta:set_string("formspec", get_formspec_w())
|
||||||
else minetest.dig_node(pos) minetest.chat_send_player(id, S("You must place it inside your Tardis")) end
|
else core.dig_node(pos) core.chat_send_player(id, S("You must place it inside your Tardis")) end
|
||||||
end,
|
end,
|
||||||
on_receive_fields = travel_to_location
|
on_receive_fields = travel_to_location
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:console_c"..set, {
|
core.register_node("drwho_tardis:console_c"..set, {
|
||||||
description = S("Exterior Console Unit"),
|
description = S("Exterior Console Unit"),
|
||||||
tiles = {ctexture, ctexture, side, side, side, side},
|
tiles = {ctexture, ctexture, side, side, side, side},
|
||||||
groups = {cracky = 3, tardis_console_c = 1},
|
groups = {cracky = 3, tardis_console_c = 1},
|
||||||
@ -949,16 +956,16 @@ minetest.register_node("drwho_tardis:console_c"..set, {
|
|||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
||||||
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
local exterior = user.exterior_skin
|
local exterior = user.exterior_skin
|
||||||
local ext_name = exterior:gsub("^" .. "drwho_tardis:tardis_", "") -- extract just the name part
|
local ext_name = exterior:gsub("^" .. "drwho_tardis:tardis_", "") -- extract just the name part
|
||||||
meta:set_string("formspec", get_formspec_ext(ext_name))
|
meta:set_string("formspec", get_formspec_ext(ext_name))
|
||||||
else minetest.dig_node(pos) minetest.chat_send_player(id, S("You must place it inside your Tardis")) end
|
else core.dig_node(pos) core.chat_send_player(id, S("You must place it inside your Tardis")) end
|
||||||
end,
|
end,
|
||||||
on_receive_fields = change_look
|
on_receive_fields = change_look
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:console_o"..set, {
|
core.register_node("drwho_tardis:console_o"..set, {
|
||||||
description = S("Waypoint Console Unit"),
|
description = S("Waypoint Console Unit"),
|
||||||
tiles = {otexture, otexture, side, side, side, side},
|
tiles = {otexture, otexture, side, side, side, side},
|
||||||
groups = {cracky = 3, tardis_console_o = 1},
|
groups = {cracky = 3, tardis_console_o = 1},
|
||||||
@ -970,13 +977,13 @@ minetest.register_node("drwho_tardis:console_o"..set, {
|
|||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
||||||
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
meta:set_string("formspec", get_formspec_o({id=id}))
|
meta:set_string("formspec", get_formspec_o({id=id}))
|
||||||
else minetest.dig_node(pos) minetest.chat_send_player(id, S("You must place it inside your Tardis")) end
|
else core.dig_node(pos) core.chat_send_player(id, S("You must place it inside your Tardis")) end
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id) -- Get user data
|
local user = _drwho_tardis.get_user(id) -- Get user data
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
@ -987,7 +994,7 @@ minetest.register_node("drwho_tardis:console_o"..set, {
|
|||||||
end,
|
end,
|
||||||
on_receive_fields = waypoint
|
on_receive_fields = waypoint
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:rotor"..set, {
|
core.register_node("drwho_tardis:rotor"..set, {
|
||||||
description = S("Time Rotor"),
|
description = S("Time Rotor"),
|
||||||
tiles = {rotortexture},
|
tiles = {rotortexture},
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
@ -1004,27 +1011,27 @@ minetest.register_node("drwho_tardis:rotor"..set, {
|
|||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
||||||
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
meta:set_string("formspec", get_formspec_r(user.power))
|
meta:set_string("formspec", get_formspec_r(user.power))
|
||||||
meta:set_string("style", set)
|
meta:set_string("style", set)
|
||||||
user.r_pos = pos
|
user.r_pos = pos
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = core.get_node_timer(pos)
|
||||||
timer:start(15) -- on_timer is run every 15 seconds
|
timer:start(15) -- on_timer is run every 15 seconds
|
||||||
_drwho_tardis.save_user(id, user) -- Save user data
|
_drwho_tardis.save_user(id, user) -- Save user data
|
||||||
else minetest.dig_node(pos) minetest.chat_send_player(id, S("You must place it inside your Tardis")) end
|
else core.dig_node(pos) core.chat_send_player(id, S("You must place it inside your Tardis")) end
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id) -- Get user data
|
local user = _drwho_tardis.get_user(id) -- Get user data
|
||||||
meta:set_string("formspec", get_formspec_r(user.power))
|
meta:set_string("formspec", get_formspec_r(user.power))
|
||||||
end,
|
end,
|
||||||
on_timer = function(pos)
|
on_timer = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id) -- Get user data
|
local user = _drwho_tardis.get_user(id) -- Get user data
|
||||||
local max_power = tonumber(minetest.settings:get('drwho_tardis.max_power')) or 10
|
local max_power = tonumber(core.settings:get('drwho_tardis.max_power')) or 10
|
||||||
if user.power < max_power then
|
if user.power < max_power then
|
||||||
user.power = user.power + 1
|
user.power = user.power + 1
|
||||||
_drwho_tardis.save_user(id, user)
|
_drwho_tardis.save_user(id, user)
|
||||||
@ -1033,7 +1040,7 @@ minetest.register_node("drwho_tardis:rotor"..set, {
|
|||||||
return (user.r_pos.x == pos.x and user.r_pos.y == pos.y and user.r_pos.z == pos.z)
|
return (user.r_pos.x == pos.x and user.r_pos.y == pos.y and user.r_pos.z == pos.z)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:rotor_active"..set, {
|
core.register_node("drwho_tardis:rotor_active"..set, {
|
||||||
description = S("Time Rotor (active)"),
|
description = S("Time Rotor (active)"),
|
||||||
tiles = { {name = altrotortexture, animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5}} },
|
tiles = { {name = altrotortexture, animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5}} },
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
@ -1044,14 +1051,14 @@ minetest.register_node("drwho_tardis:rotor_active"..set, {
|
|||||||
light_source = 12,
|
light_source = 12,
|
||||||
groups = {not_in_creative_inventory = 1, tardis_time_rotor_active = 1},
|
groups = {not_in_creative_inventory = 1, tardis_time_rotor_active = 1},
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:light"..set, {
|
core.register_node("drwho_tardis:light"..set, {
|
||||||
description = S("Tardis Light"),
|
description = S("Tardis Light"),
|
||||||
inventory_image = ltexture,
|
inventory_image = ltexture,
|
||||||
drawtype = "signlike",
|
drawtype = "signlike",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
walkable = false, -- Allow players to walk thru them (rather than blocking their movement)
|
walkable = false, -- Allow players to walk thru them (rather than blocking their movement)
|
||||||
light_source = minetest.LIGHT_MAX, -- VERY bright
|
light_source = core.LIGHT_MAX, -- VERY bright
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
selection_box = { type = "wallmounted" },
|
selection_box = { type = "wallmounted" },
|
||||||
tiles = {ltexture},
|
tiles = {ltexture},
|
||||||
@ -1075,7 +1082,7 @@ for _, item in ipairs(_drwho_tardis.console_list) do
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
else -- MTG or MCL, so do normal crafting
|
else -- MTG or MCL, so do normal crafting
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "drwho_tardis:"..item..set,
|
output = "drwho_tardis:"..item..set,
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -1103,14 +1110,14 @@ local function get_formspec_screen(power, pos, dest_pos, block, id)
|
|||||||
local block = block
|
local block = block
|
||||||
local id = S("Tardis Owner: @1", id) -- Tardis Owner: <name>
|
local id = S("Tardis Owner: @1", id) -- Tardis Owner: <name>
|
||||||
return "size[10,10]"..
|
return "size[10,10]"..
|
||||||
"label[1,1;"..minetest.formspec_escape(power).."]"..
|
"label[1,1;"..core.formspec_escape(power).."]"..
|
||||||
"label[1,2.5;"..minetest.formspec_escape(cur).."]"..
|
"label[1,2.5;"..core.formspec_escape(cur).."]"..
|
||||||
"label[1,4;"..minetest.formspec_escape(dest).."]"..
|
"label[1,4;"..core.formspec_escape(dest).."]"..
|
||||||
"label[1,5.5;"..minetest.formspec_escape(S("Block Tardis Is On: ")).."]"..
|
"label[1,5.5;"..core.formspec_escape(S("Block Tardis Is On: ")).."]"..
|
||||||
"item_image[3,5;2,2;"..minetest.formspec_escape(block).."]"..
|
"item_image[3,5;2,2;"..core.formspec_escape(block).."]"..
|
||||||
"label[1,7;"..minetest.formspec_escape(id).."]"
|
"label[1,7;"..core.formspec_escape(id).."]"
|
||||||
end
|
end
|
||||||
minetest.register_node("drwho_tardis:monitor", {
|
core.register_node("drwho_tardis:monitor", {
|
||||||
description = S("Tardis Monitor"),
|
description = S("Tardis Monitor"),
|
||||||
tiles = {"tardis_side_1.png", "tardis_side_1.png", "tardis_side_1.png", "tardis_side_1.png", "tardis_monitor_screen.png", "tardis_side_1.png"},
|
tiles = {"tardis_side_1.png", "tardis_side_1.png", "tardis_side_1.png", "tardis_side_1.png", "tardis_monitor_screen.png", "tardis_side_1.png"},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
@ -1130,32 +1137,32 @@ minetest.register_node("drwho_tardis:monitor", {
|
|||||||
local r_pos = user.r_pos
|
local r_pos = user.r_pos
|
||||||
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
if not r_pos or r_pos == "" then r_pos = placer:get_pos() end
|
||||||
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
if r_pos.x+50 > pos.x and r_pos.x-50 < pos.x and r_pos.z+50 > pos.z and r_pos.z-50 < pos.z and r_pos.y+50 > pos.y and r_pos.y-50 < pos.y then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local out_pos = user.out_pos
|
local out_pos = user.out_pos
|
||||||
meta:set_string("id", id)
|
meta:set_string("id", id)
|
||||||
|
|
||||||
out_pos.y = out_pos.y-1
|
out_pos.y = out_pos.y-1
|
||||||
local node = minetest.get_node(out_pos)
|
local node = core.get_node(out_pos)
|
||||||
if node.name == "ignore" then
|
if node.name == "ignore" then
|
||||||
minetest.get_voxel_manip():read_from_map(out_pos, out_pos)
|
core.get_voxel_manip():read_from_map(out_pos, out_pos)
|
||||||
local node = minetest.get_node(out_pos)
|
local node = core.get_node(out_pos)
|
||||||
end
|
end
|
||||||
out_pos.y = out_pos.y+1
|
out_pos.y = out_pos.y+1
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec_screen(user.power, out_pos, user.dest_pos, node.name, id ))
|
meta:set_string("formspec", get_formspec_screen(user.power, out_pos, user.dest_pos, node.name, id ))
|
||||||
else minetest.dig_node(pos) minetest.chat_send_player(id, S("You must place it inside your Tardis")) end
|
else core.dig_node(pos) core.chat_send_player(id, S("You must place it inside your Tardis")) end
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos)
|
on_rightclick = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id)
|
local user = _drwho_tardis.get_user(id)
|
||||||
local out_pos = user.out_pos
|
local out_pos = user.out_pos
|
||||||
|
|
||||||
out_pos.y = out_pos.y-1
|
out_pos.y = out_pos.y-1
|
||||||
local node = minetest.get_node(out_pos)
|
local node = core.get_node(out_pos)
|
||||||
if node.name == "ignore" then
|
if node.name == "ignore" then
|
||||||
minetest.get_voxel_manip():read_from_map(out_pos, out_pos)
|
core.get_voxel_manip():read_from_map(out_pos, out_pos)
|
||||||
local node = minetest.get_node(out_pos)
|
local node = core.get_node(out_pos)
|
||||||
end
|
end
|
||||||
out_pos.y = out_pos.y+1
|
out_pos.y = out_pos.y+1
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--DEFAULT EXTERIORS
|
--DEFAULT EXTERIORS
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
|
|
||||||
-- Normal mesh drawtypes
|
-- Normal mesh drawtypes
|
||||||
drwho_tardis:register_tardis_exterior({
|
drwho_tardis:register_tardis_exterior({
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
-- drwho_tardis:register_tardis_exterior() API
|
-- drwho_tardis:register_tardis_exterior() API
|
||||||
-- TARDIS Node Definitions (using API)
|
-- TARDIS Node Definitions (using API)
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
local data = minetest.get_mod_storage()
|
local data = core.get_mod_storage()
|
||||||
|
|
||||||
-- IMPORTANT:
|
-- IMPORTANT:
|
||||||
-- Old Tardises will not be affected by the changes in values.
|
-- Old Tardises will not be affected by the changes in values.
|
||||||
@ -14,38 +14,38 @@ local data = minetest.get_mod_storage()
|
|||||||
-- TARDIS EXTERIOR FUNCTIONS
|
-- TARDIS EXTERIOR FUNCTIONS
|
||||||
local function tardis_on_place(pos, placer, itemstack, pointed_thing)
|
local function tardis_on_place(pos, placer, itemstack, pointed_thing)
|
||||||
if placer:get_player_name() == "" then return else
|
if placer:get_player_name() == "" then return else
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local name = placer:get_player_name()
|
local name = placer:get_player_name()
|
||||||
local user = _drwho_tardis.get_user(name) -- This will be first run, and will create init all user data automatically
|
local user = _drwho_tardis.get_user(name) -- This will be first run, and will create init all user data automatically
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = core.get_node_timer(pos)
|
||||||
if user.has_a_tardis == false then
|
if user.has_a_tardis == false then
|
||||||
user.has_a_tardis = true
|
user.has_a_tardis = true
|
||||||
user.out_pos = pos -- set exterior position
|
user.out_pos = pos -- set exterior position
|
||||||
_drwho_tardis.save_user(name, user) -- save user data
|
_drwho_tardis.save_user(name, user) -- save user data
|
||||||
local room = minetest.settings:get('drwho_tardis.default_interior')
|
local room = core.settings:get('drwho_tardis.default_interior')
|
||||||
if _drwho_tardis.rooms[room] then room = room else room = "default" end
|
if _drwho_tardis.rooms[room] then room = room else room = "default" end
|
||||||
local _, msg, exit_door_pos = _drwho_tardis:place_tardis_interior(name, room, pos)
|
local _, msg, exit_door_pos = _drwho_tardis:place_tardis_interior(name, room, pos)
|
||||||
minetest.chat_send_player(name, S("After you walk inside your Tardis, if the cave generation has broken through it, you will have to run the chat command /rebuild_tardis. Make sure you are somewhere where you won't get blocked out of it though."))
|
core.chat_send_player(name, S("After you walk inside your Tardis, if the cave generation has broken through it, you will have to run the chat command /rebuild_tardis. Make sure you are somewhere where you won't get blocked out of it though."))
|
||||||
|
|
||||||
_drwho_tardis:init_interior_door(name, exit_door_pos)
|
_drwho_tardis:init_interior_door(name, exit_door_pos)
|
||||||
|
|
||||||
meta:set_string("id", name) -- set exterior id
|
meta:set_string("id", name) -- set exterior id
|
||||||
timer:start(0.2)
|
timer:start(0.2)
|
||||||
else -- they already have a tardis
|
else -- they already have a tardis
|
||||||
minetest.set_node(pos, {name = "air"})
|
core.set_node(pos, {name = "air"})
|
||||||
minetest.add_item(pos, "drwho_tardis:tardis_blue")
|
core.add_item(pos, "drwho_tardis:tardis_blue")
|
||||||
minetest.chat_send_player(name, S("You can only have one Tardis!"))
|
core.chat_send_player(name, S("You can only have one Tardis!"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check if there are any players or mobs entering a TARDIS and teleport them
|
-- Check if there are any players or mobs entering a TARDIS and teleport them
|
||||||
local function tardis_timer(pos)
|
local function tardis_timer(pos)
|
||||||
local objs = minetest.get_objects_inside_radius(pos, 0.9)
|
local objs = core.get_objects_inside_radius(pos, 0.9)
|
||||||
--for idx,obj in pairs(objs) do -- loop incase there are multiple objs there at once
|
--for idx,obj in pairs(objs) do -- loop incase there are multiple objs there at once
|
||||||
local obj = objs[1]
|
local obj = objs[1]
|
||||||
if obj == nil then return true else --only do code if there is something there
|
if obj == nil then return true else --only do code if there is something there
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id) -- get user data
|
local user = _drwho_tardis.get_user(id) -- get user data
|
||||||
local go_pos = table.copy(user.in_pos)
|
local go_pos = table.copy(user.in_pos)
|
||||||
@ -58,7 +58,7 @@ local function tardis_timer(pos)
|
|||||||
obj:set_look_horizontal( math.rad( 180 ))
|
obj:set_look_horizontal( math.rad( 180 ))
|
||||||
obj:set_look_vertical( math.rad( 0 ))
|
obj:set_look_vertical( math.rad( 0 ))
|
||||||
obj:set_pos(go_pos)
|
obj:set_pos(go_pos)
|
||||||
if minetest.get_modpath("awards") and _drwho_tardis.GAMETYPE=="mtg" then
|
if core.get_modpath("awards") and _drwho_tardis.GAMETYPE=="mtg" then
|
||||||
awards.unlock(name, "drwho_tardis:go_inside_tardis") -- unlock award
|
awards.unlock(name, "drwho_tardis:go_inside_tardis") -- unlock award
|
||||||
end
|
end
|
||||||
if not been_inside then
|
if not been_inside then
|
||||||
@ -94,7 +94,7 @@ function drwho_tardis:register_tardis_exterior(def)
|
|||||||
local groups = def.groups or {not_in_creative_inventory = 1, tardis = 1}
|
local groups = def.groups or {not_in_creative_inventory = 1, tardis = 1}
|
||||||
|
|
||||||
-- Register normal TARDIS
|
-- Register normal TARDIS
|
||||||
minetest.register_node("drwho_tardis:tardis"..name, {
|
core.register_node("drwho_tardis:tardis"..name, {
|
||||||
description = description,
|
description = description,
|
||||||
tiles = {texture},
|
tiles = {texture},
|
||||||
use_texture_alpha = "clip",
|
use_texture_alpha = "clip",
|
||||||
@ -110,7 +110,7 @@ function drwho_tardis:register_tardis_exterior(def)
|
|||||||
on_timer = tardis_timer
|
on_timer = tardis_timer
|
||||||
})
|
})
|
||||||
-- Register locked TARDIS
|
-- Register locked TARDIS
|
||||||
minetest.register_node("drwho_tardis:tardis"..name.."_locked", {
|
core.register_node("drwho_tardis:tardis"..name.."_locked", {
|
||||||
description = description.." (locked)",
|
description = description.." (locked)",
|
||||||
tiles = {texture},
|
tiles = {texture},
|
||||||
use_texture_alpha = "clip",
|
use_texture_alpha = "clip",
|
||||||
@ -125,7 +125,7 @@ function drwho_tardis:register_tardis_exterior(def)
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Add it to the exterior list
|
-- Add it to the exterior list
|
||||||
local ext_list = minetest.deserialize(data:get_string("ext_list")) or {}
|
local ext_list = core.deserialize(data:get_string("ext_list")) or {}
|
||||||
ext_list[#ext_list+1] = {
|
ext_list[#ext_list+1] = {
|
||||||
itemstring = "drwho_tardis:tardis"..name,
|
itemstring = "drwho_tardis:tardis"..name,
|
||||||
name = def.name,
|
name = def.name,
|
||||||
@ -134,5 +134,5 @@ function drwho_tardis:register_tardis_exterior(def)
|
|||||||
license = def.license or "CC BY-SA 4.0", -- defaults so we don't need to specify each time
|
license = def.license or "CC BY-SA 4.0", -- defaults so we don't need to specify each time
|
||||||
texture = texture
|
texture = texture
|
||||||
}
|
}
|
||||||
data:set_string("ext_list", minetest.serialize(ext_list))
|
data:set_string("ext_list", core.serialize(ext_list))
|
||||||
end
|
end
|
@ -7,10 +7,10 @@
|
|||||||
-- special stone
|
-- special stone
|
||||||
-- Gallifreyan Chest
|
-- Gallifreyan Chest
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
local data = minetest.get_mod_storage()
|
local data = core.get_mod_storage()
|
||||||
|
|
||||||
--data = minetest.get_mod_storage()
|
--data = core.get_mod_storage()
|
||||||
|
|
||||||
|
|
||||||
-- def needs:
|
-- def needs:
|
||||||
@ -26,7 +26,7 @@ function drwho_tardis:register_in_door_style(def)
|
|||||||
-- In the node metadata, there is the value 'type'. 'exit' if it is the door to leave the Tardis,
|
-- In the node metadata, there is the value 'type'. 'exit' if it is the door to leave the Tardis,
|
||||||
-- and there are two other possbible doors with values 'door_1' and 'door_2'. These will be able to go to
|
-- and there are two other possbible doors with values 'door_1' and 'door_2'. These will be able to go to
|
||||||
-- other rooms in future updates.
|
-- other rooms in future updates.
|
||||||
minetest.register_node(def.itemstring, {
|
core.register_node(def.itemstring, {
|
||||||
description = S(def.description),
|
description = S(def.description),
|
||||||
tiles = {def.texture},
|
tiles = {def.texture},
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
@ -52,16 +52,16 @@ function drwho_tardis:register_in_door_style(def)
|
|||||||
groups = {cracky=2, tardis_in_door=1},
|
groups = {cracky=2, tardis_in_door=1},
|
||||||
diggable = true,
|
diggable = true,
|
||||||
on_timer = function(pos)
|
on_timer = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local type = meta:get_string("type") or "exit"
|
local type = meta:get_string("type") or "exit"
|
||||||
local objs = minetest.get_objects_inside_radius(pos, 0.9)
|
local objs = core.get_objects_inside_radius(pos, 0.9)
|
||||||
if type == "exit" or type == nil or type == "" then
|
if type == "exit" or type == nil or type == "" then
|
||||||
if type == nil then meta:set_string("type", "exit") end -- Backwards compatability
|
if type == nil then meta:set_string("type", "exit") end -- Backwards compatability
|
||||||
if objs[1] == nil then return true else
|
if objs[1] == nil then return true else
|
||||||
if objs[1]:is_player() then
|
if objs[1]:is_player() then
|
||||||
|
|
||||||
local pmeta = objs[1]:get_meta()
|
local pmeta = objs[1]:get_meta()
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id)
|
local user = _drwho_tardis.get_user(id)
|
||||||
local go_pos = user.out_pos
|
local go_pos = user.out_pos
|
||||||
@ -77,19 +77,19 @@ function drwho_tardis:register_in_door_style(def)
|
|||||||
objs[1]:set_hp(0)
|
objs[1]:set_hp(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.after(1, function()
|
core.after(1, function()
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id)
|
local user = _drwho_tardis.get_user(id)
|
||||||
local go_pos = user.out_pos
|
local go_pos = user.out_pos
|
||||||
minetest.set_node(go_pos, {name=user.exterior_skin})
|
core.set_node(go_pos, {name=user.exterior_skin})
|
||||||
local ometa = minetest.get_meta(go_pos)
|
local ometa = core.get_meta(go_pos)
|
||||||
ometa:set_string("id", id)
|
ometa:set_string("id", id)
|
||||||
local timer = minetest.get_node_timer(go_pos)
|
local timer = core.get_node_timer(go_pos)
|
||||||
timer:start(0.2)
|
timer:start(0.2)
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local user = _drwho_tardis.get_user(id)
|
local user = _drwho_tardis.get_user(id)
|
||||||
local go_pos = user.out_pos
|
local go_pos = user.out_pos
|
||||||
@ -104,12 +104,12 @@ function drwho_tardis:register_in_door_style(def)
|
|||||||
if objs[1]:is_player() then
|
if objs[1]:is_player() then
|
||||||
|
|
||||||
local pmeta = objs[1]:get_meta()
|
local pmeta = objs[1]:get_meta()
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local id = meta:get_string("id")
|
local id = meta:get_string("id")
|
||||||
local name = objs[1]:get_player_name()
|
local name = objs[1]:get_player_name()
|
||||||
|
|
||||||
minetest.after(1, function()
|
core.after(1, function()
|
||||||
minetest.chat_send_player(name, S("Sorry! The idea for multiple doors and rooms was scrapped in favour of a large interior area which is all one room and can have corridors and room built in it. Feel free to break these doors and build your own rooms behind where they were."))
|
core.chat_send_player(name, S("Sorry! The idea for multiple doors and rooms was scrapped in favour of a large interior area which is all one room and can have corridors and room built in it. Feel free to break these doors and build your own rooms behind where they were."))
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ function drwho_tardis:register_in_door_style(def)
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(def.itemstring.."_locked", {
|
core.register_node(def.itemstring.."_locked", {
|
||||||
description = S("Locked @1", def.description),
|
description = S("Locked @1", def.description),
|
||||||
tiles = {def.texture},
|
tiles = {def.texture},
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
@ -161,32 +161,32 @@ drwho_tardis:register_in_door_style({
|
|||||||
-- Trigger translation for automated scripts
|
-- Trigger translation for automated scripts
|
||||||
local qwerty = S("Tardis Interior Door (style A)")
|
local qwerty = S("Tardis Interior Door (style A)")
|
||||||
|
|
||||||
minetest.register_node("drwho_tardis:wall", {
|
core.register_node("drwho_tardis:wall", {
|
||||||
description = S("Tardis Wall (non-craftable)"),
|
description = S("Tardis Wall (non-craftable)"),
|
||||||
tiles = {"tardis_wall.png"},
|
tiles = {"tardis_wall.png"},
|
||||||
diggable = false,
|
diggable = false,
|
||||||
groups = { not_in_creative_inventory = 1},
|
groups = { not_in_creative_inventory = 1},
|
||||||
light_source = 2,
|
light_source = 2,
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:wall_craftable", {
|
core.register_node("drwho_tardis:wall_craftable", {
|
||||||
description = S("Tardis Wall"),
|
description = S("Tardis Wall"),
|
||||||
tiles = {"tardis_wall.png"},
|
tiles = {"tardis_wall.png"},
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
light_source = 2,
|
light_source = 2,
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:wall_circles_16x16", { -- with 8x8 circles in 45* rotated square formation
|
core.register_node("drwho_tardis:wall_circles_16x16", { -- with 8x8 circles in 45* rotated square formation
|
||||||
description = S("Tardis Wall - Circles (16x16)"),
|
description = S("Tardis Wall - Circles (16x16)"),
|
||||||
tiles = {"drwho_tardis_wall_circles_16x16.png"},
|
tiles = {"drwho_tardis_wall_circles_16x16.png"},
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
light_source = 8,
|
light_source = 8,
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:wall_one_circle", {
|
core.register_node("drwho_tardis:wall_one_circle", {
|
||||||
description = S("Tardis Wall - Large Circle"),
|
description = S("Tardis Wall - Large Circle"),
|
||||||
tiles = {"drwho_tardis_wall_one_circle.png"},
|
tiles = {"drwho_tardis_wall_one_circle.png"},
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
light_source = 8,
|
light_source = 8,
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:wall_one_circle_halfs", {
|
core.register_node("drwho_tardis:wall_one_circle_halfs", {
|
||||||
description = S("Tardis Wall - Large Circle Halfs"),
|
description = S("Tardis Wall - Large Circle Halfs"),
|
||||||
tiles = {"drwho_tardis_wall_one_circle_halfs.png"},
|
tiles = {"drwho_tardis_wall_one_circle_halfs.png"},
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
@ -194,19 +194,19 @@ minetest.register_node("drwho_tardis:wall_one_circle_halfs", {
|
|||||||
})
|
})
|
||||||
local front = "drwho_tardis_wall_circles_32x32.png"
|
local front = "drwho_tardis_wall_circles_32x32.png"
|
||||||
local top = "drwho_tardis_wall_circles_32x32_top.png"
|
local top = "drwho_tardis_wall_circles_32x32_top.png"
|
||||||
minetest.register_node("drwho_tardis:wall_circles_32x32", { -- with 12x12 circles in hexagonal formation
|
core.register_node("drwho_tardis:wall_circles_32x32", { -- with 12x12 circles in hexagonal formation
|
||||||
description = S("Tardis Wall - Circles (32x32)"),
|
description = S("Tardis Wall - Circles (32x32)"),
|
||||||
tiles = {top, top, front, front, front, front},
|
tiles = {top, top, front, front, front, front},
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
light_source = 8,
|
light_source = 8,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("drwho_tardis:grey_block", {
|
core.register_node("drwho_tardis:grey_block", {
|
||||||
description = S("Light Grey Block"),
|
description = S("Light Grey Block"),
|
||||||
tiles = {"drwho_tardis_grey_block.png"},
|
tiles = {"drwho_tardis_grey_block.png"},
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:grey_block_slab", {
|
core.register_node("drwho_tardis:grey_block_slab", {
|
||||||
description = S("Light Grey Block Slab"),
|
description = S("Light Grey Block Slab"),
|
||||||
tiles = {"drwho_tardis_grey_block.png"},
|
tiles = {"drwho_tardis_grey_block.png"},
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
@ -216,7 +216,7 @@ minetest.register_node("drwho_tardis:grey_block_slab", {
|
|||||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:grey_block_h", {
|
core.register_node("drwho_tardis:grey_block_h", {
|
||||||
description = S("Light Grey Block"),
|
description = S("Light Grey Block"),
|
||||||
tiles = {"drwho_tardis_grey_block.png"},
|
tiles = {"drwho_tardis_grey_block.png"},
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
@ -235,12 +235,12 @@ minetest.register_node("drwho_tardis:grey_block_h", {
|
|||||||
},
|
},
|
||||||
sunlight_propagates = false,
|
sunlight_propagates = false,
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:turquiose_block", {
|
core.register_node("drwho_tardis:turquiose_block", {
|
||||||
description = S("Turquiose Block"),
|
description = S("Turquiose Block"),
|
||||||
tiles = {"tardis_side_4.png"},
|
tiles = {"tardis_side_4.png"},
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
})
|
})
|
||||||
minetest.register_node("drwho_tardis:turquiose_block_h", {
|
core.register_node("drwho_tardis:turquiose_block_h", {
|
||||||
description = S("Turquiose Block"),
|
description = S("Turquiose Block"),
|
||||||
tiles = {"tardis_side_4.png"},
|
tiles = {"tardis_side_4.png"},
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
@ -260,7 +260,7 @@ minetest.register_node("drwho_tardis:turquiose_block_h", {
|
|||||||
sunlight_propagates = false,
|
sunlight_propagates = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("drwho_tardis:stone", {
|
core.register_node("drwho_tardis:stone", {
|
||||||
description = S("Stone"),
|
description = S("Stone"),
|
||||||
tiles = {"default_stone.png"},
|
tiles = {"default_stone.png"},
|
||||||
diggable = false,
|
diggable = false,
|
||||||
@ -273,12 +273,12 @@ local function get_formspec_chest()
|
|||||||
"list[context;main;0,0.5;24,10;]"..
|
"list[context;main;0,0.5;24,10;]"..
|
||||||
"list[current_player;main;8,10.5;8,4;]"
|
"list[current_player;main;8,10.5;8,4;]"
|
||||||
end
|
end
|
||||||
minetest.register_node("drwho_tardis:chest", {
|
core.register_node("drwho_tardis:chest", {
|
||||||
description = S("Gallifreyan Chest"),
|
description = S("Gallifreyan Chest"),
|
||||||
tiles = {"tardis_chest_top.png", "tardis_chest_top.png", "tardis_chest_side.png", "tardis_chest_side.png", "tardis_chest_side.png", "tardis_chest_side.png"},
|
tiles = {"tardis_chest_top.png", "tardis_chest_top.png", "tardis_chest_side.png", "tardis_chest_side.png", "tardis_chest_side.png", "tardis_chest_side.png"},
|
||||||
groups = {cracky = 3},
|
groups = {cracky = 3},
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
meta:set_string("owner", placer:get_player_name())
|
meta:set_string("owner", placer:get_player_name())
|
||||||
meta:set_string("infotext", S("Chest owned by @1", placer:get_player_name()))
|
meta:set_string("infotext", S("Chest owned by @1", placer:get_player_name()))
|
||||||
@ -286,7 +286,7 @@ minetest.register_node("drwho_tardis:chest", {
|
|||||||
inv:set_size("main", 24*10) -- VERY large
|
inv:set_size("main", 24*10) -- VERY large
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
if clicker:get_player_name() == meta:get_string("owner") then meta:set_string("formspec", get_formspec_chest(pos)) else meta:set_string("formspec", "") end
|
if clicker:get_player_name() == meta:get_string("owner") then meta:set_string("formspec", get_formspec_chest(pos)) else meta:set_string("formspec", "") end
|
||||||
end -- gallifreyan chest
|
end -- gallifreyan chest
|
||||||
})
|
})
|
26
tools.lua
26
tools.lua
@ -5,13 +5,13 @@
|
|||||||
-- Gauntlet of Rassilon
|
-- Gauntlet of Rassilon
|
||||||
-- Vortex Manipulator
|
-- Vortex Manipulator
|
||||||
|
|
||||||
local S = minetest.get_translator("drwho_tardis")
|
local S = core.get_translator("drwho_tardis")
|
||||||
local i = _drwho_tardis.items
|
local i = _drwho_tardis.items
|
||||||
|
|
||||||
-- DALEKANIUM (dalek) TOOLS
|
-- DALEKANIUM (dalek) TOOLS
|
||||||
|
|
||||||
-- Pickaxe
|
-- Pickaxe
|
||||||
minetest.register_tool("drwho_tardis:pick_dalek", {
|
core.register_tool("drwho_tardis:pick_dalek", {
|
||||||
description = S("Dalekanium Pickaxe"),
|
description = S("Dalekanium Pickaxe"),
|
||||||
inventory_image = "dalek_pick.png",
|
inventory_image = "dalek_pick.png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
@ -36,7 +36,7 @@ if _drwho_tardis.GAMETYPE == "rp" then
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "drwho_tardis:pick_dalek",
|
output = "drwho_tardis:pick_dalek",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot"},
|
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot"},
|
||||||
@ -47,7 +47,7 @@ minetest.register_craft({
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Shovel
|
-- Shovel
|
||||||
minetest.register_tool("drwho_tardis:shovel_dalek", {
|
core.register_tool("drwho_tardis:shovel_dalek", {
|
||||||
description = S("Dalekanium Shovel"),
|
description = S("Dalekanium Shovel"),
|
||||||
inventory_image = "dalek_shovel.png",
|
inventory_image = "dalek_shovel.png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
@ -71,7 +71,7 @@ if _drwho_tardis.GAMETYPE == "rp" then
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "drwho_tardis:shovel_dalek",
|
output = "drwho_tardis:shovel_dalek",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"drwho_tardis:dalekanium_ingot"},
|
{"drwho_tardis:dalekanium_ingot"},
|
||||||
@ -82,7 +82,7 @@ minetest.register_craft({
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Axe
|
-- Axe
|
||||||
minetest.register_tool("drwho_tardis:axe_dalek", {
|
core.register_tool("drwho_tardis:axe_dalek", {
|
||||||
description = S("Dalekanium Axe"),
|
description = S("Dalekanium Axe"),
|
||||||
inventory_image = "dalek_axe.png",
|
inventory_image = "dalek_axe.png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
@ -106,7 +106,7 @@ if _drwho_tardis.GAMETYPE == "rp" then
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "drwho_tardis:axe_dalek",
|
output = "drwho_tardis:axe_dalek",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", ""},
|
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", ""},
|
||||||
@ -117,7 +117,7 @@ minetest.register_craft({
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Sword
|
-- Sword
|
||||||
minetest.register_tool("drwho_tardis:sword_dalek", {
|
core.register_tool("drwho_tardis:sword_dalek", {
|
||||||
description = S("Dalekanium Sword"),
|
description = S("Dalekanium Sword"),
|
||||||
inventory_image = "dalek_sword.png",
|
inventory_image = "dalek_sword.png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
@ -141,7 +141,7 @@ if _drwho_tardis.GAMETYPE == "rp" then
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "drwho_tardis:sword_dalek",
|
output = "drwho_tardis:sword_dalek",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"drwho_tardis:dalekanium_ingot"},
|
{"drwho_tardis:dalekanium_ingot"},
|
||||||
@ -152,7 +152,7 @@ minetest.register_craft({
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Toolranks support
|
-- Toolranks support
|
||||||
if minetest.get_modpath("toolranks") then
|
if core.get_modpath("toolranks") then
|
||||||
toolranks.add_tool("drwho_tardis:sword_dalek")
|
toolranks.add_tool("drwho_tardis:sword_dalek")
|
||||||
toolranks.add_tool("drwho_tardis:pick_dalek")
|
toolranks.add_tool("drwho_tardis:pick_dalek")
|
||||||
toolranks.add_tool("drwho_tardis:axe_dalek")
|
toolranks.add_tool("drwho_tardis:axe_dalek")
|
||||||
@ -164,7 +164,7 @@ end
|
|||||||
-- so we don't have to do anything extra
|
-- so we don't have to do anything extra
|
||||||
|
|
||||||
-- gauntlet of rassilon
|
-- gauntlet of rassilon
|
||||||
minetest.register_tool("drwho_tardis:rassilon_gauntlet", {
|
core.register_tool("drwho_tardis:rassilon_gauntlet", {
|
||||||
description = S("Gaunlet of Rassilon"),
|
description = S("Gaunlet of Rassilon"),
|
||||||
inventory_image = "gauntlet_rassilon.png",
|
inventory_image = "gauntlet_rassilon.png",
|
||||||
stack_max=1,
|
stack_max=1,
|
||||||
@ -186,12 +186,12 @@ local function get_formspec_vortex()
|
|||||||
"field[1,5;8,1;teleport_z;Z-Cord;0]"..
|
"field[1,5;8,1;teleport_z;Z-Cord;0]"..
|
||||||
"image_button_exit[1,6.5;3,3;dial_1.png;teleport; ;false;false;dial_2.png]"
|
"image_button_exit[1,6.5;3,3;dial_1.png;teleport; ;false;false;dial_2.png]"
|
||||||
end
|
end
|
||||||
minetest.register_tool("drwho_tardis:vortex_manipulator", {
|
core.register_tool("drwho_tardis:vortex_manipulator", {
|
||||||
description = S("Vortex Manipulator"),
|
description = S("Vortex Manipulator"),
|
||||||
inventory_image = "vortex_manipulator.png",
|
inventory_image = "vortex_manipulator.png",
|
||||||
stack_max=1,
|
stack_max=1,
|
||||||
on_use = function(itemstack, player, pointed_thing)
|
on_use = function(itemstack, player, pointed_thing)
|
||||||
minetest.show_formspec(player:get_player_name(), "drwho_tardis:vortex_formspec", get_formspec_vortex() )
|
core.show_formspec(player:get_player_name(), "drwho_tardis:vortex_formspec", get_formspec_vortex() )
|
||||||
itemstack:set_wear(itemstack:get_wear() + 3000) return itemstack
|
itemstack:set_wear(itemstack:get_wear() + 3000) return itemstack
|
||||||
end
|
end
|
||||||
})
|
})
|
Loading…
x
Reference in New Issue
Block a user