Replace minetest with core following engine name change to Luanti

This commit is contained in:
Skivling 2024-10-27 08:13:25 +13:00
parent c65226113a
commit 3f1eb8caf5
16 changed files with 567 additions and 560 deletions

52
api.lua
View File

@ -20,8 +20,8 @@
-- Power
-- and more
local data = minetest.get_mod_storage()
local S = minetest.get_translator("drwho_tardis")
local data = core.get_mod_storage()
local S = core.get_translator("drwho_tardis")
drwho_tardis.get = {}
-- 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
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
end
@ -86,7 +86,7 @@ function _drwho_tardis:place_tardis_interior(id, type, pos)
local exit_door_offset = {x=0,y=0,z=0}
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}
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
@ -105,8 +105,8 @@ end
-- id is the username of the player who owns the Tardis
function _drwho_tardis:init_interior_door(id, exit_door_pos)
local d_meta = minetest.get_meta(exit_door_pos)
local d_timer = minetest.get_node_timer(exit_door_pos)
local d_meta = core.get_meta(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_meta:set_string("id", id) --set door id
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 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
local rmeta = minetest.get_meta(r_pos)
local rotor_node = minetest.get_node(r_pos)
local rmeta = core.get_meta(r_pos)
local rotor_node = core.get_node(r_pos)
if minetest.get_item_group(rotor_node.name, 'tardis_time_rotor') == 1 or
minetest.get_item_group(rotor_node.name, 'tardis_time_rotor_active') == 1 then
if core.get_item_group(rotor_node.name, 'tardis_time_rotor') == 1 or
core.get_item_group(rotor_node.name, 'tardis_time_rotor_active') == 1 then
return true, "rotor is there", r_pos
else
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)
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 rotor_node = minetest.get_node(r_pos)
local rotor_node = core.get_node(r_pos)
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
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
end
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
end
end
@ -198,32 +198,32 @@ function _drwho_tardis.toggle_int_door(id, on_off)
local in_pos = table.copy(user.in_pos)
if on_off == "lock" then
minetest.set_node(in_pos, { name = "drwho_tardis:in_door_locked" })
local dmeta = minetest.get_meta(in_pos)
core.set_node(in_pos, { name = "drwho_tardis:in_door_locked" })
local dmeta = core.get_meta(in_pos)
dmeta:set_string("id", id) -- set door id
dmeta:set_string("type", "exit") -- set door type
return true, "Interior door locked"
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
local dtimer = minetest.get_node_timer(in_pos)
local dmeta = minetest.get_meta(in_pos)
local dtimer = core.get_node_timer(in_pos)
local dmeta = core.get_meta(in_pos)
dmeta:set_string("id", id) -- set door id
dmeta:set_string("type", "exit") -- set door type
dtimer:start(0.2) -- start door timer (in case it doesn't start on construct)
return true, "Interior door unlocked"
else -- on_off is not given, toggle door
if minetest.get_node(in_pos).name == "drwho_tardis:in_door" then
minetest.set_node(in_pos, { name = "drwho_tardis:in_door_locked" })
local dmeta = minetest.get_meta(in_pos)
if core.get_node(in_pos).name == "drwho_tardis:in_door" then
core.set_node(in_pos, { name = "drwho_tardis:in_door_locked" })
local dmeta = core.get_meta(in_pos)
dmeta:set_string("id", id) -- set door id
dmeta:set_string("type", "exit") -- set door type
return true, "Interior door locked"
else
minetest.set_node(in_pos, { name = "drwho_tardis:in_door" })
core.set_node(in_pos, { name = "drwho_tardis:in_door" })
-- Start door timer
local dtimer = minetest.get_node_timer(in_pos)
local dmeta = minetest.get_meta(in_pos)
local dtimer = core.get_node_timer(in_pos)
local dmeta = core.get_meta(in_pos)
dmeta:set_string("id", id) -- set door id
dmeta:set_string("type", "exit") -- set door type
dtimer:start(0.2) -- start door timer (in case it doesn't start on construct)

View File

@ -2,10 +2,10 @@
-- Dalekanium Armor + Shield - definitions + crafting
-- 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 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
-- Armor Values similar to nether armor
@ -18,7 +18,7 @@ armor:register_armor("drwho_tardis:helmet_dalek", {
armor_groups = {fleshy=18},
damage_groups = {cracky=3, snappy=2, level=3},
})
minetest.register_craft({
core.register_craft({
output = "drwho_tardis:helmet_dalek",
recipe = {
{"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},
damage_groups = {cracky=3, snappy=2, level=3},
})
minetest.register_craft({
core.register_craft({
output = "drwho_tardis:chestplate_dalek",
recipe = {
{"drwho_tardis:dalekanium_ingot", "", "drwho_tardis:dalekanium_ingot"},
@ -54,7 +54,7 @@ armor:register_armor("drwho_tardis:leggings_dalek", {
armor_groups = {fleshy=25},
damage_groups = {cracky=3, snappy=2, level=3},
})
minetest.register_craft({
core.register_craft({
output = "drwho_tardis:leggings_dalek",
recipe = {
{"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},
damage_groups = {cracky=3, snappy=2, level=3},
})
minetest.register_craft({
core.register_craft({
output = "drwho_tardis:boots_dalek",
recipe = {
{"drwho_tardis:dalekanium_ingot", "", "drwho_tardis:dalekanium_ingot"},
@ -85,7 +85,7 @@ minetest.register_craft({
-- values from Mithril
-- 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", {
description = (S("Dalekanium Shield")),
@ -102,7 +102,7 @@ if minetest.get_modpath("shields") then
--end,
})
minetest.register_craft({
core.register_craft({
output = "drwho_tardis:shield_dalek",
recipe = {
{"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.
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
--[[
armor.register_armor_set("drwho_tardis", "dalek", {

View File

@ -1,10 +1,10 @@
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
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)
local user = _drwho_tardis.get_user(name)
@ -158,11 +158,11 @@ end -- MTG awards
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
end
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
end

View File

@ -3,41 +3,41 @@
-- Only the CRAFTitems, none of the actual items in-game
-- Includes the TARDIS biscuit
local S = minetest.get_translator("drwho_tardis")
local S = core.get_translator("drwho_tardis")
-- ALL CRAFTITEMS
minetest.register_craftitem("drwho_tardis:arton_crystal", {
core.register_craftitem("drwho_tardis:arton_crystal", {
description = S("Arton Crystal"),
inventory_image = "arton_crystal.png",
groups = {}
})
minetest.register_node("drwho_tardis:spacetime", {
core.register_node("drwho_tardis:spacetime", {
description = S("Compressed Spacetime"),
tiles = {"tardis_spacetime.png"},
groups = {cracky = 1}
})
minetest.register_craftitem("drwho_tardis:circuitry_board", {
core.register_craftitem("drwho_tardis:circuitry_board", {
description = S("Tardis Circuitry"),
inventory_image = "tardis_circuit_board.png",
groups = {}
})
minetest.register_craftitem("drwho_tardis:biscuit", {
core.register_craftitem("drwho_tardis:biscuit", {
description = S("Biscuit"),
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_sat = 14, -- `rp_hunger`
})
minetest.register_craftitem("drwho_tardis:azbantium_shard", {
core.register_craftitem("drwho_tardis:azbantium_shard", {
description = S("Azbantium Shard"),
inventory_image = "azbantium_shard.png",
})
minetest.register_craftitem("drwho_tardis:dalekanium_ingot", {
core.register_craftitem("drwho_tardis:dalekanium_ingot", {
description = S("Dalekanium Ingot"),
inventory_image = "dalekanium_ingot.png",
})
minetest.register_node("drwho_tardis:azbantium", {
core.register_node("drwho_tardis:azbantium", {
description = S("Azbantium"),
light_source = 4,
tiles = {"azbantium.png"},

116
init.lua
View File

@ -3,21 +3,21 @@
-- Chat Commands
-- 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
VERSION = "1.3.0-dev"
}
_drwho_tardis = { -- Private API + storage
data = minetest.get_mod_storage(),
data = core.get_mod_storage(),
}
--
-- 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 .. "/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)
-- 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
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
else dofile(MP .. "/mobs/cybermen.lua") end -- Cybermen
@ -48,7 +48,7 @@ dofile(MP .. "/migration.lua")
-- 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('Shortened_Dalek_Voice', S('"You will be exterminated!"'))
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
-- This is going to be reworked in v1.3.0
local data = minetest.get_mod_storage()
local data = core.get_mod_storage()
--
-- CHAT COMMANDS
--
-- Print the detected gametype, for devs
minetest.register_chatcommand("tardis_gametype", {
core.register_chatcommand("tardis_gametype", {
params = "",
description = S("Prints the type of game (mtg, mcl, rp)"),
privs = {debug = true},
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
})
-- TEMPORARY - for devs
minetest.register_chatcommand("ext_list", {
core.register_chatcommand("ext_list", {
params = "",
description = S("DEV COMMAND: temporary"),
privs = {debug = true},
func = function(name)
local ext_list = drwho_tardis.get:exterior_list()
for i, ext in ipairs(ext_list) do
minetest.chat_send_player(name, minetest.serialize(ext))
minetest.chat_send_player(name, minetest.serialize(ext.itemstring))
core.chat_send_player(name, core.serialize(ext))
core.chat_send_player(name, core.serialize(ext.itemstring))
if i >= 20 then
break
end
@ -92,7 +92,7 @@ minetest.register_chatcommand("ext_list", {
})
-- Fix interior doors
minetest.register_chatcommand("reset_door", {
core.register_chatcommand("reset_door", {
params = "",
description = S("Resets your Tardis interior console door and fixes it's timer"),
privs = {},
@ -105,12 +105,12 @@ minetest.register_chatcommand("reset_door", {
end
_drwho_tardis.save_user(name, user) -- save user data
_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
})
minetest.register_chatcommand("tardis_int", {
core.register_chatcommand("tardis_int", {
params = "<type>",
description = S("Change your Tardis interior type. Afterwards, remove everything from your Tardis and run /rebuild_tardis."),
privs = {},
@ -118,29 +118,29 @@ minetest.register_chatcommand("tardis_int", {
local Params = string.split(param, ' ')
local user = _drwho_tardis.get_user(name)
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
user.exterior_skin = Params[1]
_drwho_tardis.save_user(name, user) -- save user data
minetest.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, "Set interior type to "..Params[1])
core.chat_send_player(name, "Now, remove everything from your Tardis and run /rebuild_tardis. Make sure to be outside it though!")
end
end
})
-- Toggle 'respect_mavity'
minetest.register_chatcommand("tardis_mavity", {
core.register_chatcommand("tardis_mavity", {
params = "",
description = S("Toggles your Tardis's system for landing on ground instead of in the air or underground"),
privs = {},
func = function(name)
local success, status = _drwho_tardis.toggle_mavity(name)
minetest.chat_send_player(name, S(status))
core.chat_send_player(name, S(status))
end
})
-- Summon TARDIS command
minetest.register_chatcommand("summon_tardis", {
core.register_chatcommand("summon_tardis", {
params = "",
description = S("Summons your Tardis to your location"),
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.in_pos == "" then return false, S("Tardis not found") else
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()
if not r_pos then
minetest.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
if user.power < 3 then minetest.chat_send_player(name, "Not Enough Power In Tardis!") else
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 core.chat_send_player(name, "Your Tardis can not be summoned here!") else
if user.power < 3 then core.chat_send_player(name, "Not Enough Power In Tardis!") else
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.y = math.ceil(select_pos.y)
out_pos.z = math.ceil(select_pos.z)
minetest.set_node(out_pos, {name=user.exterior_skin})
local ometa = minetest.get_meta(out_pos)
core.set_node(out_pos, {name=user.exterior_skin})
local ometa = core.get_meta(out_pos)
ometa:set_string("id", name)
user.out_pos = out_pos
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)
minetest.chat_send_player(name, S("Tardis Summoned"))
core.chat_send_player(name, S("Tardis Summoned"))
end
end
_drwho_tardis.save_user(name, user) -- save user data
--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")
end
end
@ -181,7 +181,7 @@ minetest.register_chatcommand("summon_tardis", {
})
-- Rebuild TARDIS command
minetest.register_chatcommand("rebuild_tardis", {
core.register_chatcommand("rebuild_tardis", {
params = "",
description = S("Rebuilds your Tardis interior. Do this when OUTSIDE of it. This will REMOVE anything else inside it!"),
privs = {},
@ -195,19 +195,19 @@ minetest.register_chatcommand("rebuild_tardis", {
_drwho_tardis.save_user(name, user) -- save user data
if success then
minetest.chat_send_player(name, S("Tardis interior rebuilt!"))
minetest.chat_send_player(name, S("type: @1", user.console_room.type))
minetest.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))
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))
else minetest.chat_send_player(name, S("Error message: @1", errmsg)) end
core.chat_send_player(name, S("Tardis interior rebuilt!"))
core.chat_send_player(name, S("type: @1", user.console_room.type))
core.chat_send_player(name, S("owner: @1", name))
core.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("interior exit door location: @1, @2, @3 [X,Y,Z]", in_pos.x, in_pos.y, in_pos.z))
else core.chat_send_player(name, S("Error message: @1", errmsg)) end
end
})
-- Locate tardis command
-- This uses the public API function
-- Need to add a message if a player doesn't exist
minetest.register_chatcommand("locate_tardis", {
core.register_chatcommand("locate_tardis", {
params = "[<name>]",
description = S("Locate your Tardis's exterior. Admins (server priv) can locate other player's Tardises."),
privs = {},
@ -216,63 +216,63 @@ minetest.register_chatcommand("locate_tardis", {
if Params[1] == nil or Params[1] == '' then
local success, _, pos = drwho_tardis.get:tardis_ext_position(name)
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))
else minetest.chat_send_player(name, S("You do not have a Tardis!")) end
core.chat_send_player(name, S("Your Tardis is at: @1, @2, @3 [X,Y,Z]", pos.x, pos.y, pos.z))
else core.chat_send_player(name, S("You do not have a Tardis!")) end
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])
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
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
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
})
minetest.register_on_player_receive_fields(function(player, formname, fields)
core.register_on_player_receive_fields(function(player, formname, fields)
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_hp(2)
end
if fields.sonic_send then
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)
end
end)
--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 id = pmeta:get_string("id")
local user = _drwho_tardis.get_user(id) -- get user data
pmeta:set_string("vortex", "no")
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")
_drwho_tardis.switch_time_rotor(player, "off")
end
end)
--fix timers
minetest.register_lbm({
core.register_lbm({
name = "drwho_tardis:fix_timers",
nodenames = {"group:tardis_in_door", "group:tardis_in_door_locked"},
action = function(pos, node)
local timer = minetest.get_node_timer(pos)
local timer = core.get_node_timer(pos)
timer:start(0.2)
end
})
--aliases
minetest.register_alias("drwho_tardis:dalek_ingot", "drwho_tardis:dalekanium_ingot")
minetest.register_alias("drwho_tardis:tardis_blue", "drwho_tardis:tardis")
minetest.register_alias("drwho_tardis:tardis_empty", "drwho_tardis:tardis_invisible")
minetest.register_alias("drwho_tardis:tardis_leave", "drwho_tardis:tardis_leaves")
minetest.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:dalek_ingot", "drwho_tardis:dalekanium_ingot")
core.register_alias("drwho_tardis:tardis_blue", "drwho_tardis:tardis")
core.register_alias("drwho_tardis:tardis_empty", "drwho_tardis:tardis_invisible")
core.register_alias("drwho_tardis:tardis_leave", "drwho_tardis:tardis_leaves")
core.register_alias("drwho_tardis:tardis_cool", "drwho_tardis:tardis_classic")
core.register_alias("drwho_tardis:in_door_a", "drwho_tardis:in_door")

View File

@ -5,16 +5,16 @@
-- Store itemstrings of our items
-- ** In the future, function to initiate userdata
local data = minetest.get_mod_storage()
local S = minetest.get_translator("drwho_tardis")
local data = core.get_mod_storage()
local S = core.get_translator("drwho_tardis")
-- DETECT GAME TYPE (MTG, MCL, RP)
_drwho_tardis.GAMETYPE = "???"
if minetest.get_modpath("default") then
if core.get_modpath("default") then
_drwho_tardis.GAMETYPE = "mtg"
elseif minetest.get_modpath("mcl_core") then
elseif core.get_modpath("mcl_core") then
_drwho_tardis.GAMETYPE = "mcl"
elseif minetest.get_modpath("rp_default") then
elseif core.get_modpath("rp_default") then
_drwho_tardis.GAMETYPE = "rp"
else
_drwho_tardis.GAMETYPE = "other"
@ -23,7 +23,7 @@ end
-- Reset exterior list
-- if this is not done, every time the server is restarted it will add them again
-- eventually overcrowding the list and looking bad
data:set_string("ext_list", minetest.serialize({}))
data:set_string("ext_list", core.serialize({}))
-- Interior depth
_drwho_tardis.interiorDepth = -300 -- default value
@ -42,20 +42,20 @@ end
_drwho_tardis.rooms = {
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},
requires = {"drwho_tardis"},
},
default = {
type = "default",
-- 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},
requires = {"drwho_tardis"},
},
--[[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},
requires = {"drwho_tardis", "scifi_nodes"},
},--]]
@ -84,29 +84,29 @@ function _drwho_tardis.get_user(user_name)
local user = data:get_string(user_name)
if user == nil or user == "" or user == {} then
minetest.log("[drwho_tardis] Didn't find a user by name '"..user_name.."', creation occured")
minetest.log(user)
core.log("[drwho_tardis] Didn't find a user by name '"..user_name.."', creation occured")
core.log(user)
user = _drwho_tardis.init_new_user(user_name, {})
if _drwho_tardis.do_we_need_to_migrate_data(user_name) then
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
else
--minetest.log("[drwho_tardis] Found '"..user_name.."' with '"..user.."' data")
minetest.log("[drwho_tardis] Retrieved user data")
user = minetest.deserialize(user)
--minetest.log(minetest.serialize(user))
--core.log("[drwho_tardis] Found '"..user_name.."' with '"..user.."' data")
core.log("[drwho_tardis] Retrieved user data")
user = core.deserialize(user)
--core.log(core.serialize(user))
end
--minetest.log("[drwho_tardis] Returning '"..minetest.serialize(user).."'")
--core.log("[drwho_tardis] Returning '"..core.serialize(user).."'")
return user
end
-- Saves the user's data
function _drwho_tardis.save_user(user_name, user_data)
data:set_string(user_name, minetest.serialize(user_data))
minetest.log("[drwho_tardis] Saved user data")
data:set_string(user_name, core.serialize(user_data))
core.log("[drwho_tardis] Saved user data")
end
-- for convenience' sake
@ -115,7 +115,7 @@ end
function _drwho_tardis.update_one_value(user_name, key, value)
local user = _drwho_tardis.get_user(user_name)
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)
end
@ -124,7 +124,7 @@ end
-- Must be given the user data when run otherwise Stack Overflow
function _drwho_tardis.init_new_user(user_name, user)
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
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
-- where we placed the schematic (anchor_pos)
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_offset = "",
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
if user == "" or user == nil then user = {} end
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
user.version = drwho_tardis.VERSION
@ -186,28 +186,28 @@ function _drwho_tardis.migrate_user_data(user_name, user)
user.been_inside_tardis = true
user.times_travelled_in_tardis = 0
user.waypoints = {
way1 = minetest.deserialize(data:get_string(id.."way1")),
way2 = minetest.deserialize(data:get_string(id.."way2")),
way3 = minetest.deserialize(data:get_string(id.."way3")),
way1 = core.deserialize(data:get_string(id.."way1")),
way2 = core.deserialize(data:get_string(id.."way2")),
way3 = core.deserialize(data:get_string(id.."way3")),
}
-- Navigation related values
user.in_pos = minetest.deserialize(data:get_string(id.."in_pos"))
user.out_pos = minetest.deserialize(data:get_string(id.."out_pos"))
user.prev_out_pos = minetest.deserialize(data:get_string(id.."out_pos"))
user.in_pos = core.deserialize(data:get_string(id.."in_pos"))
user.out_pos = core.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.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.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.exterior_skin = data:get_string(id.."look")
user.console_room = {
type = data:get_string(id.."type"),
exit_door_pos = minetest.deserialize(data:get_string(id.."door_pos_table")).door_0,
exit_door_offset = minetest.deserialize(data:get_string(id.."door_offset_table")).door_0,
anchor_pos = minetest.deserialize(data:get_string(id.."console_place_pos")),
exit_door_pos = core.deserialize(data:get_string(id.."door_pos_table")).door_0,
exit_door_offset = core.deserialize(data:get_string(id.."door_offset_table")).door_0,
anchor_pos = core.deserialize(data:get_string(id.."console_place_pos")),
},
-- Remember that their data has been migrated

View File

@ -2,15 +2,15 @@
-- 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 .
--[[
for name, _ in pairs(minetest.registered_nodes) do
for name, _ in pairs(core.registered_nodes) do
local split_name = {}
--split name in modname:name
for str in (string.gmatch(name, "([^:]+)")) do
table.insert(split_name, str)
end
if split_name[1] == "drwho_tardis" then
minetest.log("registered alias for " .. name)
minetest.register_alias(name, "tardis_new:" .. split_name[2])
core.log("registered alias for " .. name)
core.register_alias(name, "tardis_new:" .. split_name[2])
end
end
--]]
@ -19,95 +19,95 @@ end
-- Hard-Coded Aliases
-- Console Units
minetest.register_alias("tardis_new:consle_y", "drwho_tardis:console_y")
minetest.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")
minetest.register_alias("tardis_new:consle_x", "drwho_tardis:console_x")
minetest.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")
minetest.register_alias("tardis_new:consle_z", "drwho_tardis:console_z")
minetest.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")
minetest.register_alias("tardis_new:consle_f", "drwho_tardis:console_f")
minetest.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")
minetest.register_alias("tardis_new:consle_s", "drwho_tardis:console_s")
minetest.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")
minetest.register_alias("tardis_new:consle_go", "drwho_tardis:console_go")
minetest.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")
minetest.register_alias("tardis_new:consle_c", "drwho_tardis:console_c")
minetest.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")
minetest.register_alias("tardis_new:consle_o", "drwho_tardis:console_o")
minetest.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_y", "drwho_tardis:console_y")
core.register_alias("tardis_new:consle_y_2", "drwho_tardis:console_y_2")
core.register_alias("tardis_new:consle_y_3", "drwho_tardis:console_y_3")
core.register_alias("tardis_new:consle_x", "drwho_tardis:console_x")
core.register_alias("tardis_new:consle_x_2", "drwho_tardis:console_x_2")
core.register_alias("tardis_new:consle_x_3", "drwho_tardis:console_x_3")
core.register_alias("tardis_new:consle_z", "drwho_tardis:console_z")
core.register_alias("tardis_new:consle_z_2", "drwho_tardis:console_z_2")
core.register_alias("tardis_new:consle_z_3", "drwho_tardis:console_z_3")
core.register_alias("tardis_new:consle_f", "drwho_tardis:console_f")
core.register_alias("tardis_new:consle_f_2", "drwho_tardis:console_f_2")
core.register_alias("tardis_new:consle_f_3", "drwho_tardis:console_f_3")
core.register_alias("tardis_new:consle_s", "drwho_tardis:console_s")
core.register_alias("tardis_new:consle_s_2", "drwho_tardis:console_s_2")
core.register_alias("tardis_new:consle_s_3", "drwho_tardis:console_s_3")
core.register_alias("tardis_new:consle_go", "drwho_tardis:console_go")
core.register_alias("tardis_new:consle_go_2", "drwho_tardis:console_go_2")
core.register_alias("tardis_new:consle_go_3", "drwho_tardis:console_go_3")
core.register_alias("tardis_new:consle_c", "drwho_tardis:console_c")
core.register_alias("tardis_new:consle_c_2", "drwho_tardis:console_c_2")
core.register_alias("tardis_new:consle_c_3", "drwho_tardis:console_c_3")
core.register_alias("tardis_new:consle_o", "drwho_tardis:console_o")
core.register_alias("tardis_new:consle_o_2", "drwho_tardis:console_o_2")
core.register_alias("tardis_new:consle_o_3", "drwho_tardis:console_o_3")
-- TARDIS Monitor Screen
minetest.register_alias("tardis_new:screen", "drwho_tardis:monitor")
core.register_alias("tardis_new:screen", "drwho_tardis:monitor")
-- Time Rotors
minetest.register_alias("tardis_new:rotor", "drwho_tardis:rotor")
minetest.register_alias("tardis_new:rotor_2", "drwho_tardis:rotor_2")
minetest.register_alias("tardis_new:rotor_3", "drwho_tardis:rotor_3")
minetest.register_alias("tardis_new:rotor_active", "drwho_tardis:rotor_active")
minetest.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", "drwho_tardis:rotor")
core.register_alias("tardis_new:rotor_2", "drwho_tardis:rotor_2")
core.register_alias("tardis_new:rotor_3", "drwho_tardis:rotor_3")
core.register_alias("tardis_new:rotor_active", "drwho_tardis:rotor_active")
core.register_alias("tardis_new:rotor_active_2", "drwho_tardis:rotor_active_2")
core.register_alias("tardis_new:rotor_active_3", "drwho_tardis:rotor_active_3")
-- TARDIS Lights
minetest.register_alias("tardis_new:light", "drwho_tardis:light")
minetest.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", "drwho_tardis:light")
core.register_alias("tardis_new:light_2", "drwho_tardis:light_2")
core.register_alias("tardis_new:light_3", "drwho_tardis:light_3")
-- TARDIS Exterior Nodes
minetest.register_alias("tardis_new:tardis", "drwho_tardis:tardis")
minetest.register_alias("tardis_new:tardis_locked", "drwho_tardis:tardis_locked")
minetest.register_alias("tardis_new:tardis_pink", "drwho_tardis:tardis_pink")
minetest.register_alias("tardis_new:tardis_pink_locked", "drwho_tardis:tardis_pink_locked")
minetest.register_alias("tardis_new:tardis_yellow", "drwho_tardis:tardis_yellow")
minetest.register_alias("tardis_new:tardis_yellow_locked", "drwho_tardis:tardis_yellow_locked")
minetest.register_alias("tardis_new:tardis_old", "drwho_tardis:tardis_old")
minetest.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
minetest.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")
minetest.register_alias("tardis_new:tardis_stone_locked", "drwho_tardis:tardis_stone_locked")
minetest.register_alias("tardis_new:tardis_empty", "drwho_tardis:tardis_empty")
minetest.register_alias("tardis_new:tardis_empty_locked", "drwho_tardis:tardis_empty_locked")
minetest.register_alias("tardis_new:tardis_cool", "drwho_tardis:tardis_cool")
minetest.register_alias("tardis_new:tardis_cool_locked", "drwho_tardis:tardis_cool_locked")
minetest.register_alias("tardis_new:tardis_leave", "drwho_tardis:tardis_leave")
minetest.register_alias("tardis_new:tardis_leave_locked", "drwho_tardis:tardis_leave_locked")
minetest.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", "drwho_tardis:tardis")
core.register_alias("tardis_new:tardis_locked", "drwho_tardis:tardis_locked")
core.register_alias("tardis_new:tardis_pink", "drwho_tardis:tardis_pink")
core.register_alias("tardis_new:tardis_pink_locked", "drwho_tardis:tardis_pink_locked")
core.register_alias("tardis_new:tardis_yellow", "drwho_tardis:tardis_yellow")
core.register_alias("tardis_new:tardis_yellow_locked", "drwho_tardis:tardis_yellow_locked")
core.register_alias("tardis_new:tardis_old", "drwho_tardis:tardis_old")
core.register_alias("tardis_new:tardis_old_locked", "drwho_tardis:tardis_old_locked")
core.register_alias("tardis_new:tardis_soda", "drwho_tardis:tardis_old") -- Make old soda become gray
core.register_alias("tardis_new:tardis_soda_locked", "drwho_tardis:tardis_old_locked") -- Make old soda become gray
core.register_alias("tardis_new:tardis_stone", "drwho_tardis:tardis_stone")
core.register_alias("tardis_new:tardis_stone_locked", "drwho_tardis:tardis_stone_locked")
core.register_alias("tardis_new:tardis_empty", "drwho_tardis:tardis_empty")
core.register_alias("tardis_new:tardis_empty_locked", "drwho_tardis:tardis_empty_locked")
core.register_alias("tardis_new:tardis_cool", "drwho_tardis:tardis_cool")
core.register_alias("tardis_new:tardis_cool_locked", "drwho_tardis:tardis_cool_locked")
core.register_alias("tardis_new:tardis_leave", "drwho_tardis:tardis_leave")
core.register_alias("tardis_new:tardis_leave_locked", "drwho_tardis:tardis_leave_locked")
core.register_alias("tardis_new:tardis_funky", "drwho_tardis:tardis_funky")
core.register_alias("tardis_new:tardis_funky_locked", "drwho_tardis:tardis_funky_locked")
-- TARDIS Interior Nodes
minetest.register_alias("tardis_new:wall", "drwho_tardis:wall")
minetest.register_alias("tardis_new:wall_craftable", "drwho_tardis:wall_craftable")
minetest.register_alias("tardis_new:stone", "drwho_tardis:stone")
minetest.register_alias("tardis_new:in_door", "drwho_tardis:in_door")
core.register_alias("tardis_new:wall", "drwho_tardis:wall")
core.register_alias("tardis_new:wall_craftable", "drwho_tardis:wall_craftable")
core.register_alias("tardis_new:stone", "drwho_tardis:stone")
core.register_alias("tardis_new:in_door", "drwho_tardis:in_door")
-- Craftitems
minetest.register_alias("tardis_new:arton", "drwho_tardis:arton_crystal")
minetest.register_alias("tardis_new:biscut", "drwho_tardis:biscuit")
minetest.register_alias("tardis_new:shard", "drwho_tardis:azbantium_shard")
minetest.register_alias("tardis_new:azbantium", "drwho_tardis:azbantium")
minetest.register_alias("tardis_new:spacetime", "drwho_tardis:spacetime")
minetest.register_alias("tardis_new:board", "drwho_tardis:circuitry_board")
minetest.register_alias("tardis_new:bar", "drwho_tardis:dalekanium_ingot")
core.register_alias("tardis_new:arton", "drwho_tardis:arton_crystal")
core.register_alias("tardis_new:biscut", "drwho_tardis:biscuit")
core.register_alias("tardis_new:shard", "drwho_tardis:azbantium_shard")
core.register_alias("tardis_new:azbantium", "drwho_tardis:azbantium")
core.register_alias("tardis_new:spacetime", "drwho_tardis:spacetime")
core.register_alias("tardis_new:board", "drwho_tardis:circuitry_board")
core.register_alias("tardis_new:bar", "drwho_tardis:dalekanium_ingot")
-- Dalekanium Tools
minetest.register_alias("tardis_new:pick_dalek", "drwho_tardis:pick_dalek")
minetest.register_alias("tardis_new:shovel_dalek", "drwho_tardis:shovel_dalek")
minetest.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:pick_dalek", "drwho_tardis:pick_dalek")
core.register_alias("tardis_new:shovel_dalek", "drwho_tardis:shovel_dalek")
core.register_alias("tardis_new:axe_dalek", "drwho_tardis:axe_dalek")
core.register_alias("tardis_new:sword_dalek", "drwho_tardis:sword_dalek")
-- Other tools + weapons
minetest.register_alias("tardis_new:gaunlet", "drwho_tardis:rassilon_gauntlet")
minetest.register_alias("tardis_new:vortex", "drwho_tardis:vortex_manipulator")
minetest.register_alias("tardis_new:sonic", "drwho_tardis:sonic_screwdriver")
core.register_alias("tardis_new:gaunlet", "drwho_tardis:rassilon_gauntlet")
core.register_alias("tardis_new:vortex", "drwho_tardis:vortex_manipulator")
core.register_alias("tardis_new:sonic", "drwho_tardis:sonic_screwdriver")
-- Gallifreyan Lab + Chest
minetest.register_alias("tardis_new:lab", "drwho_tardis:lab")
minetest.register_alias("tardis_new:chest", "drwho_tardis:chest")
core.register_alias("tardis_new:lab", "drwho_tardis:lab")
core.register_alias("tardis_new:chest", "drwho_tardis:chest")

View File

@ -2,10 +2,10 @@
-- Cyberman
-- Melee Cyberman
local S = minetest.get_translator("drwho_tardis")
local S = core.get_translator("drwho_tardis")
if _drwho_tardis.GAMETYPE == "mtg" then
if minetest.get_modpath("mobs") then
if core.get_modpath("mobs") then
mobs:register_mob("drwho_tardis:cyberman", {
type = "monster",
@ -91,7 +91,7 @@ mobs:register_mob("drwho_tardis:cyberman", {
on_die = function(self)
if self.cause_of_death.puncher ~= nil then
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")
end
end
@ -179,7 +179,7 @@ mobs:register_mob("drwho_tardis:cyberman_melee", {
on_die = function(self)
if self.cause_of_death.puncher ~= nil then
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")
end
end
@ -201,7 +201,7 @@ mobs:spawn({
},
active_object_count = 4, -- Can spawn up to 4 Cybermen at a time
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
})
@ -219,7 +219,7 @@ mobs:spawn({
},
active_object_count = 4, -- Can spawn up to 4 Cybermen at a time
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
})

View File

@ -2,10 +2,10 @@
-- [8] Brown Dalek (new who) (can 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 minetest.get_modpath("mobs") then
if core.get_modpath("mobs") then
-- Brown New Who Dalek
mobs:register_mob("drwho_tardis:dalek", {
@ -97,7 +97,7 @@ mobs:register_mob("drwho_tardis:dalek", {
on_die = function(self)
if self.cause_of_death.puncher ~= nil then
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")
end
end
@ -119,7 +119,7 @@ mobs:spawn({
},
active_object_count = 2, -- Can spawn up to 2 Daleks at a time
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
})
@ -211,7 +211,7 @@ mobs:spawn({
on_die = function(self)
if self.cause_of_death.puncher ~= nil then
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")
end
end
@ -233,7 +233,7 @@ mobs:spawn({
},
active_object_count = 2, -- Can spawn up to 2 Daleks at a time
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
})

View File

@ -4,7 +4,7 @@
-- All recipes that are not CRAFTITEMS or ARMOR
-- Not used in this file.
local S = minetest.get_translator("drwho_tardis")
local S = core.get_translator("drwho_tardis")
local i = _drwho_tardis.items
-- i.block_steel returns the steel block depending on what gametype it is
@ -36,7 +36,7 @@ local function get_formspec_lab()
end
end
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()
if inv:contains_item("fuel", item) == true and inv:is_empty("dest") then
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.stone, d.grey_block, pos, player)
end
minetest.register_node("drwho_tardis:lab", {
core.register_node("drwho_tardis:lab", {
description = S("Gallifreyan Lab"),
tiles = {"tardis_lab.png"},
groups = {cracky = 3},
on_construct = function(pos, node)
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("fuel", 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 minetest.settings:get('drwho_tardis.craftable_tardis') == true then
if core.settings:get('drwho_tardis.craftable_tardis') == true then
crafting.register_craft({
output = d.tardis,
items = {
@ -306,8 +306,8 @@ else -- It's not Repixture, do normal crafting
--Recipes--
-----------
if minetest.settings:get('drwho_tardis.craftable_tardis') == true then
minetest.register_craft({
if core.settings:get('drwho_tardis.craftable_tardis') == true then
core.register_craft({
output = d.tardis,
recipe = {
{i.block_steel, d.arton_crystal, i.block_steel},
@ -316,7 +316,7 @@ else -- It's not Repixture, do normal crafting
}
})
end
minetest.register_craft({
core.register_craft({
output = d.lab,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.vortex_manipulator,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.rassilon_gauntlet,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.chest,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.circuitry_board.." 2",
recipe = {
{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"}
}
})
minetest.register_craft({
core.register_craft({
output = d.rotor,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.console_y,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.console_x,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.console_z,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.console_go,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.console_c,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.console_f,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.console_o,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.console_s,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.monitor,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = d.light.." 4",
recipe = {
{"", i.ingot_steel, ""},
@ -444,27 +444,27 @@ else -- It's not Repixture, do normal crafting
{"", i.ingot_steel, ""}
}
})
minetest.register_craft({
core.register_craft({
output = d.turquiose,
recipe = {
{i.ingot_tin},
{i.stone}
}
})
minetest.register_craft({
core.register_craft({
output = d.azbantium,
recipe = {
{d.azbantium_shard, d.azbantium_shard},
{d.azbantium_shard, d.azbantium_shard}
}
})
minetest.register_craft({
core.register_craft({
type = "shapeless",
output = d.azbantium_shard.." 4",
recipe = {d.azbantium}
})
minetest.register_craft({
core.register_craft({
output = d.dalekanium_ingot,
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
output = "drwho_tardis:in_door",
recipe = {
{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}
}
})
minetest.register_craft({
core.register_craft({
type = "shapeless",
output = "drwho_tardis:in_door_b",
recipe = {"drwho_tardis:in_door"}
})
minetest.register_craft({
core.register_craft({
type = "shapeless",
output = "drwho_tardis:in_door",
recipe = {"drwho_tardis:in_door_b"}
})
minetest.register_craft({
core.register_craft({
output = d.walls.wall.." 9",
recipe = {
{i.ingot_steel},
@ -498,7 +498,7 @@ else -- It's not Repixture, do normal crafting
{i.ingot_steel}
}
})
minetest.register_craft({
core.register_craft({
output = d.walls.circles_16.." 9",
recipe = {
{"","",i.ingot_steel},
@ -506,7 +506,7 @@ else -- It's not Repixture, do normal crafting
{i.ingot_steel,"",""},
}
})
minetest.register_craft({
core.register_craft({
output = d.walls.circles_32.." 9",
recipe = {
{i.ingot_steel,"",""},
@ -514,7 +514,7 @@ else -- It's not Repixture, do normal crafting
{"","",i.ingot_steel},
}
})
minetest.register_craft({
core.register_craft({
output = d.walls.one_circle.." 9",
recipe = {
{i.ingot_steel,"",""},
@ -522,12 +522,12 @@ else -- It's not Repixture, do normal crafting
{i.ingot_steel,"",""},
}
})
minetest.register_craft({
core.register_craft({
type = "shapeless",
output = d.walls.one_circle_halfs,
recipe = {d.walls.one_circle}
})
minetest.register_craft({
core.register_craft({
type = "shapeless",
output = d.walls.one_circle,
recipe = {d.walls.one_circle_halfs}

View File

@ -3,8 +3,8 @@
-- generate_sonic_screwdriver()
-- Generic Sonic Screwdriver
local S = minetest.get_translator("drwho_tardis")
local data = minetest.get_mod_storage()
local S = core.get_translator("drwho_tardis")
local data = core.get_mod_storage()
local function get_formspec_digilines()
return "size[10,10]"..
@ -40,7 +40,7 @@ function drwho_tardis:register_sonic_device(def)
if top > sonictypes then top = 1 end
if mid > sonictypes then mid = 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"
@ -51,7 +51,7 @@ function drwho_tardis:register_sonic_device(def)
else
item_name = ":drwho_tardis:sonic_"..def.sonictype.."_"..top.."_"..mid.."_"..bottom
end
minetest.chat_send_all(".")
core.chat_send_all(".")
-- 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 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}
minetest.register_tool(item_name, {
core.register_tool(item_name, {
description = item_description,
inventory_image = inventoryimage,
stack_max=1,
@ -104,70 +104,70 @@ function drwho_tardis:register_sonic_device(def)
local sonic_add_wear = true
if pointed_thing.type == "node" then
local controls = player:get_player_control()
local node = minetest.get_node(pointed_thing.under)
local meta = minetest.get_meta(pointed_thing.under)
local node = core.get_node(pointed_thing.under)
local meta = core.get_meta(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
-- sneaking
local r_pos = user.r_pos
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
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
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 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.y = select_pos.y
out_pos.z = select_pos.z
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
minetest.set_node(out_pos, {name=user.exterior_skin})
local ometa = minetest.get_meta(out_pos)
core.set_node(out_pos, {name=user.exterior_skin})
local ometa = core.get_meta(out_pos)
ometa:set_string("id", id)
user.out_pos = out_pos
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)
minetest.chat_send_player(id, S("Tardis Summoned"))
core.chat_send_player(id, S("Tardis Summoned"))
end
end
else
-- not sneaking
if id == meta:get_string("id") then
if minetest.get_item_group(node.name, "tardis") == 1 then
minetest.set_node(select_pos, {name = user.exterior_skin.."_locked"})
local ometa = minetest.get_meta(select_pos)
if core.get_item_group(node.name, "tardis") == 1 then
core.set_node(select_pos, {name = user.exterior_skin.."_locked"})
local ometa = core.get_meta(select_pos)
ometa:set_string("id", id)
minetest.chat_send_player(id, S("Tardis Locked"))
core.chat_send_player(id, S("Tardis Locked"))
end
if minetest.get_item_group(node.name, "tardis_locked") == 1 then
minetest.set_node(select_pos, {name = user.exterior_skin})
local timer = minetest.get_node_timer(select_pos)
if core.get_item_group(node.name, "tardis_locked") == 1 then
core.set_node(select_pos, {name = user.exterior_skin})
local timer = core.get_node_timer(select_pos)
timer:start(0.2)
local ometa = minetest.get_meta(select_pos)
local ometa = core.get_meta(select_pos)
ometa:set_string("id", id)
minetest.chat_send_player(id, S("Tardis Unlocked"))
core.chat_send_player(id, S("Tardis Unlocked"))
end
elseif string.match(node.name,"doors:door_steel") then
doors.door_toggle(select_pos, nil, nil)
elseif string.match(node.name,"doors:trapdoor_steel") then
doors.trapdoor_toggle(select_pos, nil, nil)
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
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
minetest.set_node(select_pos, {name = "default:silver_sand"})
core.set_node(select_pos, {name = "default:silver_sand"})
elseif node.name == "default:obsidian" then
minetest.set_node(select_pos, {name = "default:lava_source"} )
elseif minetest.get_item_group(node.name, "mesecon_conductor_craftable") == 1 then
core.set_node(select_pos, {name = "default:lava_source"} )
elseif core.get_item_group(node.name, "mesecon_conductor_craftable") == 1 then
if mesecon.is_conductor_on(node) then
mesecon.turnoff(select_pos, {0, 0, 0})
else
@ -175,11 +175,11 @@ function drwho_tardis:register_sonic_device(def)
end
elseif drop[1] == "digilines:wire_std_00000000" then
local meta = player:get_meta()
meta:set_string("sonic_digiline", minetest.serialize(select_pos))
minetest.show_formspec(player:get_player_name(), "drwho_tardis:digilines_formspec", get_formspec_digilines() )
meta:set_string("sonic_digiline", core.serialize(select_pos))
core.show_formspec(player:get_player_name(), "drwho_tardis:digilines_formspec", get_formspec_digilines() )
else
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
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)})
end
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
else
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
end
local sonic_sound = table.copy(def.sounds.sonic_use)
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
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
_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
@ -221,11 +221,11 @@ function drwho_tardis:register_sonic_device(def)
-- do nothing, it has already been set
else -- if == "choose", == "random", or not specified
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
--]]
minetest.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:match"^.-:(.+)", item_name) -- Just in case
--core.register_alias(item_name, item_name:match"^.-:(.+)") -- Who knows?
return item_name
end

View File

@ -6,10 +6,12 @@
-- The definitions and formspecs can't be separated because they are local functions
local S = minetest.get_translator("drwho_tardis")
local data = minetest.get_mod_storage()
local S = core.get_translator("drwho_tardis")
local data = core.get_mod_storage()
--formspecs
---------------------- Formspec getters --------------------------------
-- 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 cur = S("Current Position: @1, @2, @3", outx, outy, outz)
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[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]"..
@ -41,8 +43,8 @@ local function get_formspec_fxyz(set)
"tooltip[hundred;100]"..
"tooltip[thousand;1000]"..
"label[1,3;"..minetest.formspec_escape(cur).."]".. -- Current Position: X, Y, Z
"label[1,5;"..minetest.formspec_escape(dest).."]".. -- Destination: X, Y, Z
"label[1,3;"..core.formspec_escape(cur).."]".. -- Current Position: 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[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]"
end
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 info = S("1 power is generated every 15 seconds.")
return "size[10,10]"..
"label[1,1;"..minetest.formspec_escape(power).."]"..
"label[1,2;"..minetest.formspec_escape(info).."]"
"label[1,1;"..core.formspec_escape(power).."]"..
"label[1,2;"..core.formspec_escape(info).."]"
end
local function get_formspec_fb(set)
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
local biome = biomes[sid]
local sidebuttons = "label[0,0;"..minetest.formspec_escape(loc).."]"..
"label[0,1;"..minetest.formspec_escape(cur).."]"..
"label[0,1.5;"..minetest.formspec_escape(dest).."]"..
"label[0,2;"..minetest.formspec_escape(bpos).."]"..
"label[0.1,2.75;"..minetest.formspec_escape(note).."]"
local sidebuttons = "label[0,0;"..core.formspec_escape(loc).."]"..
"label[0,1;"..core.formspec_escape(cur).."]"..
"label[0,1.5;"..core.formspec_escape(dest).."]"..
"label[0,2;"..core.formspec_escape(bpos).."]"..
"label[0.1,2.75;"..core.formspec_escape(note).."]"
-- Write in the biome name field
sidebuttons = sidebuttons.."field[0.25,4.5;4,1;setbiome;"..textf..";"..finding_biome.."]"
-- Find biome button
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
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
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;"
local first = true
@ -129,7 +131,7 @@ local function get_formspec_fb(set)
biomeslistformspec = biomeslistformspec .. ","
end
first = false
biomeslistformspec = biomeslistformspec .. minetest.formspec_escape(biomes[b])
biomeslistformspec = biomeslistformspec .. core.formspec_escape(biomes[b])
end
biomeslistformspec = biomeslistformspec .. ";]"
@ -151,7 +153,7 @@ local function get_formspec_s() -- Extra Functions
local pick_tt = S("Create a Pickaxe")
local locate_fieldtext = S("type name here... ")
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[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]"..
@ -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_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]"..
"tooltip[sonic;"..minetest.formspec_escape(sonic_tt).."]"..
"tooltip[heal;"..minetest.formspec_escape(heal_tt).."]"..
"tooltip[axe;"..minetest.formspec_escape(axe_tt).."]"..
"tooltip[scan;"..minetest.formspec_escape(scan_tt).."]"..
"tooltip[submit;"..minetest.formspec_escape(submit_tt).."]"..
"tooltip[food;"..minetest.formspec_escape(food_tt).."]"..
"tooltip[antigrav;"..minetest.formspec_escape(antigrav_tt).."]"..
"tooltip[attack;"..minetest.formspec_escape(attack_tt).."]"..
"tooltip[pick;"..minetest.formspec_escape(pick_tt).."]"
"tooltip[sonic;"..core.formspec_escape(sonic_tt).."]"..
"tooltip[heal;"..core.formspec_escape(heal_tt).."]"..
"tooltip[axe;"..core.formspec_escape(axe_tt).."]"..
"tooltip[scan;"..core.formspec_escape(scan_tt).."]"..
"tooltip[submit;"..core.formspec_escape(submit_tt).."]"..
"tooltip[food;"..core.formspec_escape(food_tt).."]"..
"tooltip[antigrav;"..core.formspec_escape(antigrav_tt).."]"..
"tooltip[attack;"..core.formspec_escape(attack_tt).."]"..
"tooltip[pick;"..core.formspec_escape(pick_tt).."]"
end
-- set should be the `name` e.g. 'green'
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 index = 1
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
end
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..']'..
"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
end
@ -217,30 +219,36 @@ local function get_formspec_o(set) -- Waypoints
local use_three_tt = S("Use Waypoint 3")
return "size[10,10]"..
"label[4,1;"..minetest.formspec_escape(cur).."]".. -- Current Position: X, Y, Z
"label[4,1.5;"..minetest.formspec_escape(dest).."]".. -- Destination: X, Y, Z
"label[4,3.5;"..minetest.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.5;"..minetest.formspec_escape(way_three).."]"..-- Waypoint Three: X, Y, Z
"label[4,1;"..core.formspec_escape(cur).."]".. -- Current Position: X, Y, Z
"label[4,1.5;"..core.formspec_escape(dest).."]".. -- Destination: X, Y, Z
"label[4,3.5;"..core.formspec_escape(way_one).."]".. -- Waypoint One: X, Y, Z
"label[4,4;"..core.formspec_escape(way_two).."]".. -- Waypoint Two: 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,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]"..
"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[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]"..
"tooltip[set_one;"..minetest.formspec_escape(set_one_tt).."]"..
"tooltip[set_two;"..minetest.formspec_escape(set_two_tt).."]"..
"tooltip[set_three;"..minetest.formspec_escape(set_three_tt).."]"..
"tooltip[use_one;"..minetest.formspec_escape(use_one_tt).."]"..
"tooltip[use_two;"..minetest.formspec_escape(use_two_tt).."]"..
"tooltip[use_three;"..minetest.formspec_escape(use_three_tt).."]"
"tooltip[set_one;"..core.formspec_escape(set_one_tt).."]"..
"tooltip[set_two;"..core.formspec_escape(set_two_tt).."]"..
"tooltip[set_three;"..core.formspec_escape(set_three_tt).."]"..
"tooltip[use_one;"..core.formspec_escape(use_one_tt).."]"..
"tooltip[use_two;"..core.formspec_escape(use_two_tt).."]"..
"tooltip[use_three;"..core.formspec_escape(use_three_tt).."]"
end
------------------------ Functions -----------------------------------
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 user = _drwho_tardis.get_user(id) -- get user data
local name = sender:get_player_name()
@ -304,19 +312,19 @@ local function general_functions(pos, formname, fields, sender)
--extra functions
elseif fields.submit then -- Locate a player
if user.power < 2 then minetest.chat_send_player(name, S("You Need 2 Power")) else
local victim = minetest.get_player_by_name(fields.locate)
if not victim then minetest.chat_send_player(name, fields.locate .. S(" not found")) else
if user.power < 2 then core.chat_send_player(name, S("You Need 2 Power")) else
local victim = core.get_player_by_name(fields.locate)
if not victim then core.chat_send_player(name, fields.locate .. S(" not found")) else
local vpos = victim:get_pos()
user.dest_pos.x = vpos.x
user.dest_pos.y = vpos.y + 1
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
end
end
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
local sonictypes = 4 --number of variants for end, middle, and top
local top = math.random(1,sonictypes)
@ -334,57 +342,57 @@ local function general_functions(pos, formname, fields, sender)
bottom = bottom,
})
--]]
minetest.add_item(pos, sonicname)
core.add_item(pos, sonicname)
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
end
end
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)
user.power = user.power - 3
end
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
local victim = minetest.get_player_by_name(fields.locate)
if not victim then minetest.chat_send_player(name, fields.locate .. S(" not found")) else
if user.power < 1 then core.chat_send_player(name, S("You Need 1 Power")) else
local victim = core.get_player_by_name(fields.locate)
if not victim then core.chat_send_player(name, fields.locate .. S(" not found")) else
local item = victim:get_wielded_item()
local item_name = item:get_name()
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
end
end
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
minetest.add_item(pos, "default:pick_diamond")
core.add_item(pos, "default:pick_diamond")
user.power = user.power - 5
end
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
minetest.add_item(pos, "default:axe_diamond")
core.add_item(pos, "default:axe_diamond")
user.power = user.power - 5
end
elseif fields.antigrav then -- Toggle antigrav mavity system
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
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
minetest.add_item(pos, "drwho_tardis:biscuit")
core.add_item(pos, "drwho_tardis:biscuit")
user.power = user.power - 1
end
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
local objs = minetest.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 user.power < 4 then core.chat_send_player(name, S("You Need 4 Power")) else
local objs = core.get_objects_inside_radius(out_pos, 20)
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
objs[1]:set_hp(1) --Set their HP to 1
minetest.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
core.chat_send_player(name, objs[1]:get_player_name().." was attacked" )
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
end
user.power = user.power - 4 -- reduce power by 4
@ -401,8 +409,8 @@ end
-- Called when the emerge stuff has completely finished
-- Saves the go_pos, unlocks the interior door, sends a status message in chat
function _drwho_tardis.do_after_travel(go_pos, context)
--minetest.chat_send_all("Function do_after_travel() called...") -- debug
if minetest.get_node(go_pos).name ~= "air" then
--core.chat_send_all("Function do_after_travel() called...") -- debug
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
end
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 out_pos = table.copy(user.out_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 pmeta = sender:get_meta() -- deprecated
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
--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
--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
if minetest.is_protected(go_pos, name) then
minetest.chat_send_player(name, S("You don't have access to this area!"))
minetest.sound_stop(effect)
if core.is_protected(go_pos, name) then
core.chat_send_player(name, S("You don't have access to this area!"))
core.sound_stop(effect)
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
_drwho_tardis.switch_time_rotor(name, "off") -- end rotor animation
else
@ -435,51 +443,51 @@ function _drwho_tardis.do_after_travel(go_pos, context)
-- and for MineClone world borders
--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
minetest.chat_send_player(name, "Your Tardis does not want to land at this location")
minetest.sound_stop(effect)
core.chat_send_player(name, "Your Tardis does not want to land at this location")
core.sound_stop(effect)
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
_drwho_tardis.switch_time_rotor(name, "off") -- end rotor animation
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
minetest.after(8, function(effect)
minetest.sound_stop(effect)
core.after(8, function(effect)
core.sound_stop(effect)
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
_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)
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
end
local ometa = minetest.get_meta(r_pos)
local ometa = core.get_meta(r_pos)
ometa:set_string("id", id)
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)
-- pmeta:set_string("vortex", "no") -- deprecated
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)
minetest.set_node(out_pos, {name = "air"})
core.set_node(out_pos, {name = "air"})
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
minetest.set_node(out_pos, {name = "air"})
core.set_node(out_pos, {name = "air"})
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)
local user = _drwho_tardis.get_user(id) -- Get recent user data
user.out_pos = out_pos
user.power = user.power - 1
_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)
else
minetest.chat_send_player(name, S("Your Tardis can not travel outside the world!"))
minetest.sound_stop(effect)
core.chat_send_player(name, S("Your Tardis can not travel outside the world!"))
core.sound_stop(effect)
_drwho_tardis.toggle_int_door(name, "unlock") -- Unlock interior door
_drwho_tardis.switch_time_rotor(name, "off") -- end rotor animation
end
@ -498,7 +506,7 @@ function _drwho_tardis.emerge_callback(pos, action, num_calls_remaining, context
context.loaded_blocks = context.loaded_blocks + 1
if context.total_blocks == context.loaded_blocks then
-- 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 mavity = user.respect_mavity
_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,
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
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 minetest.get_node(go_pos).name == "air" or nodedef.buildable_to then
while minetest.get_node(go_pos).name == "air" or nodedef.buildable_to do
if core.get_node(go_pos).name == "air" or nodedef.buildable_to then
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
nodedef = minetest.registered_nodes[minetest.get_node(go_pos).name]
if minetest.get_node(go_pos).name == "ignore" then -- Check if we need to
nodedef = core.registered_nodes[core.get_node(go_pos).name]
if core.get_node(go_pos).name == "ignore" then -- Check if we need to
context.go_pos = go_pos -- save the current go_pos
-- Load next area
context.pos1.y = go_pos.y - 1000
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
--minetest.chat_send_all("Starting to emerge the next section") -- debug
core.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
--core.chat_send_all("Starting to emerge the next section") -- debug
return -- end because this function is the callback after emerge is finished
end
end
@ -540,17 +548,17 @@ function _drwho_tardis.do_float_fall(go_pos, context1, mavity)
return
else
-- 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
--minetest.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]
if minetest.get_node(go_pos).name == "ignore" then -- Check if we need to
--core.chat_send_player(context.name, "Tardis is computing go_pos, the Y level is "..go_pos.y)
nodedef = core.registered_nodes[core.get_node(go_pos).name]
if core.get_node(go_pos).name == "ignore" then -- Check if we need to
context.go_pos = go_pos -- save the current go_pos
-- Load next area
context.pos1.y = go_pos.y + 1000
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
--minetest.chat_send_all("Starting to emerge the next section")
core.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
--core.chat_send_all("Starting to emerge the next section")
return -- end because this function is the callback after emerge is finished
end
end
@ -558,21 +566,21 @@ function _drwho_tardis.do_float_fall(go_pos, context1, mavity)
return
end
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"
-- 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
while minetest.get_node(go_pos).name == "air" or nodedef.liquidtype ~= "none" or nodedef.buildable_to do
if core.get_node(go_pos).name == "air" or nodedef.liquidtype ~= "none" or nodedef.buildable_to then
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
--minetest.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
if minetest.get_node(go_pos).name == "ignore" then -- Check if we need to
--core.chat_send_player(context.name, "Tardis is computing go_pos, the Y level is "..go_pos.y)
nodedef = core.registered_nodes[core.get_node(go_pos).name] -- update def for new node
if core.get_node(go_pos).name == "ignore" then -- Check if we need to
context.go_pos = go_pos -- save the current go_pos
-- Load next area
context.pos1.y = go_pos.y - 1000
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
--minetest.chat_send_all("Starting to emerge the next section")
core.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
--core.chat_send_all("Starting to emerge the next section")
return -- end because this function is the callback after emerge is finished
end
end
@ -580,17 +588,17 @@ function _drwho_tardis.do_float_fall(go_pos, context1, mavity)
return
else
-- 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
--minetest.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
if minetest.get_node(go_pos).name == "ignore" then -- Check if we need to
--core.chat_send_player(context.name, "Tardis is computing go_pos, the Y level is "..go_pos.y)
nodedef = core.registered_nodes[core.get_node(go_pos).name] -- update def for new node
if core.get_node(go_pos).name == "ignore" then -- Check if we need to
context.go_pos = go_pos -- save the current go_pos
-- Load next area
context.pos1.y = go_pos.y + 1000
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
--minetest.chat_send_all("Starting to emerge the next section")
core.emerge_area(context.pos1, context.pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
--core.chat_send_all("Starting to emerge the next section")
return -- end because this function is the callback after emerge is finished
end
end
@ -605,21 +613,21 @@ end
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 user = _drwho_tardis.get_user(id)
local out_pos = user.out_pos
local look = user.exterior_skin
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")
end
local go_pos = table.copy(user.dest_pos)
local pmeta = sender:get_meta()
local name = sender:get_player_name()
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 user.power == 0 then minetest.chat_send_player(name, S("No Power Left!")) else --power?
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 core.chat_send_player(name, S("No Power Left!")) else --power?
-- LOCK TARDIS DOOR
_drwho_tardis.toggle_int_door(id, "lock")
user.old_go_pos = user.go_pos
@ -634,11 +642,11 @@ local function travel_to_location(pos, formname, fields, sender)
pos1 = pos1,
pos2 = pos2,
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")
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."))
minetest.emerge_area(pos1, pos2, _drwho_tardis.emerge_callback, context) -- Load all nodes between pos1 and pos2
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."))
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,
-- it runs more checks before actually landing there
@ -649,7 +657,7 @@ local function travel_to_location(pos, formname, fields, sender)
end
end
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 user = _drwho_tardis.get_user(id)
if fields.ext_dropdown then
@ -662,7 +670,7 @@ local function change_look(pos, formname, fields, sender)
end
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 user = _drwho_tardis.get_user(id)
local out_pos = user.out_pos
@ -688,7 +696,7 @@ local function find_biome_functions(pos, formname, fields, sender)
elseif fields.consolefindbiome then -- consolefindbiome
local success, biome_list = findbiome.list_biomes() -- get the biome list again
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
local cur_biome = biome_list[event.index] -- find the biome they would have selected
meta:set_string("formspec", get_formspec_fb({ -- Refresh formspec
@ -701,7 +709,7 @@ local function find_biome_functions(pos, formname, fields, sender)
end
elseif fields.fbiome then
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
local biome_pos = findbiome.find_biome(user.out_pos, {setbiome})
@ -723,7 +731,7 @@ local function find_biome_functions(pos, formname, fields, sender)
end
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 user = _drwho_tardis.get_user(id) -- Get user data
local out_pos = user.out_pos
@ -775,9 +783,8 @@ local function waypoint(pos, formname, fields, sender)
end
--------------------
--NODE DEFINITIONS--
--------------------
------------------ Node Definitions ----------------------
_drwho_tardis.console_list = {
"console_y",
"console_x",
@ -791,7 +798,7 @@ _drwho_tardis.console_list = {
"rotor",
}
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"),
tiles = {ytexture, ytexture, side, side, side, side},
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
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
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
meta:set_string("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,
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 user = _drwho_tardis.get_user(id) -- Get user data
meta:set_string("id", id)
@ -817,7 +824,7 @@ minetest.register_node("drwho_tardis:console_y"..set, {
end,
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"),
tiles = {xtexture, xtexture, side, side, side, side},
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
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
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
local out_pos = user.out_pos
meta:set_string("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,
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 user = _drwho_tardis.get_user(id) -- Get user data
meta:set_string("id", id)
@ -844,7 +851,7 @@ minetest.register_node("drwho_tardis:console_x"..set, {
end,
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"),
tiles = {ztexture, ztexture, side, side, side, side},
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
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
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
meta:set_string("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,
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")
meta:set_string("id", id)
meta:set_string("formspec", get_formspec_fxyz({id = id}))
end,
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"),
tiles = {ftexture, ftexture, side, side, side, side},
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
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
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
meta:set_string("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,
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 user = _drwho_tardis.get_user(id) -- Get user data
meta:set_string("id", id)
@ -898,7 +905,7 @@ minetest.register_node("drwho_tardis:console_f"..set, {
end,
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"),
tiles = {stexture, stexture, side, side, side, side},
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
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
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
local id = pmeta:get_string("id")
meta:set_string("id", id)
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,
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"),
tiles = {wtexture, wtexture, side, side, side, side},
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
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
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
meta:set_string("id", id)
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,
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"),
tiles = {ctexture, ctexture, side, side, side, side},
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
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
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
meta:set_string("id", id)
local exterior = user.exterior_skin
local ext_name = exterior:gsub("^" .. "drwho_tardis:tardis_", "") -- extract just the name part
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,
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"),
tiles = {otexture, otexture, side, side, side, side},
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
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
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
meta:set_string("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,
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 user = _drwho_tardis.get_user(id) -- Get user data
meta:set_string("id", id)
@ -987,7 +994,7 @@ minetest.register_node("drwho_tardis:console_o"..set, {
end,
on_receive_fields = waypoint
})
minetest.register_node("drwho_tardis:rotor"..set, {
core.register_node("drwho_tardis:rotor"..set, {
description = S("Time Rotor"),
tiles = {rotortexture},
drawtype = "mesh",
@ -1004,27 +1011,27 @@ minetest.register_node("drwho_tardis:rotor"..set, {
local r_pos = user.r_pos
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
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
meta:set_string("id", id)
meta:set_string("formspec", get_formspec_r(user.power))
meta:set_string("style", set)
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
_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,
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 user = _drwho_tardis.get_user(id) -- Get user data
meta:set_string("formspec", get_formspec_r(user.power))
end,
on_timer = function(pos)
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
local id = meta:get_string("id")
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
user.power = user.power + 1
_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)
end
})
minetest.register_node("drwho_tardis:rotor_active"..set, {
core.register_node("drwho_tardis:rotor_active"..set, {
description = S("Time Rotor (active)"),
tiles = { {name = altrotortexture, animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5}} },
drawtype = "mesh",
@ -1044,14 +1051,14 @@ minetest.register_node("drwho_tardis:rotor_active"..set, {
light_source = 12,
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"),
inventory_image = ltexture,
drawtype = "signlike",
paramtype = "light",
sunlight_propagates = true,
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",
selection_box = { type = "wallmounted" },
tiles = {ltexture},
@ -1075,7 +1082,7 @@ for _, item in ipairs(_drwho_tardis.console_list) do
}
})
else -- MTG or MCL, so do normal crafting
minetest.register_craft({
core.register_craft({
type = "shapeless",
output = "drwho_tardis:"..item..set,
recipe = {
@ -1103,14 +1110,14 @@ local function get_formspec_screen(power, pos, dest_pos, block, id)
local block = block
local id = S("Tardis Owner: @1", id) -- Tardis Owner: <name>
return "size[10,10]"..
"label[1,1;"..minetest.formspec_escape(power).."]"..
"label[1,2.5;"..minetest.formspec_escape(cur).."]"..
"label[1,4;"..minetest.formspec_escape(dest).."]"..
"label[1,5.5;"..minetest.formspec_escape(S("Block Tardis Is On: ")).."]"..
"item_image[3,5;2,2;"..minetest.formspec_escape(block).."]"..
"label[1,7;"..minetest.formspec_escape(id).."]"
"label[1,1;"..core.formspec_escape(power).."]"..
"label[1,2.5;"..core.formspec_escape(cur).."]"..
"label[1,4;"..core.formspec_escape(dest).."]"..
"label[1,5.5;"..core.formspec_escape(S("Block Tardis Is On: ")).."]"..
"item_image[3,5;2,2;"..core.formspec_escape(block).."]"..
"label[1,7;"..core.formspec_escape(id).."]"
end
minetest.register_node("drwho_tardis:monitor", {
core.register_node("drwho_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"},
drawtype = "nodebox",
@ -1130,32 +1137,32 @@ minetest.register_node("drwho_tardis:monitor", {
local r_pos = user.r_pos
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
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
local out_pos = user.out_pos
meta:set_string("id", id)
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
minetest.get_voxel_manip():read_from_map(out_pos, out_pos)
local node = minetest.get_node(out_pos)
core.get_voxel_manip():read_from_map(out_pos, out_pos)
local node = core.get_node(out_pos)
end
out_pos.y = out_pos.y+1
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,
on_rightclick = function(pos)
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
local id = meta:get_string("id")
local user = _drwho_tardis.get_user(id)
local out_pos = user.out_pos
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
minetest.get_voxel_manip():read_from_map(out_pos, out_pos)
local node = minetest.get_node(out_pos)
core.get_voxel_manip():read_from_map(out_pos, out_pos)
local node = core.get_node(out_pos)
end
out_pos.y = out_pos.y+1

View File

@ -1,6 +1,6 @@
--DEFAULT EXTERIORS
local S = minetest.get_translator("drwho_tardis")
local S = core.get_translator("drwho_tardis")
-- Normal mesh drawtypes
drwho_tardis:register_tardis_exterior({

View File

@ -3,8 +3,8 @@
-- drwho_tardis:register_tardis_exterior() API
-- TARDIS Node Definitions (using API)
local S = minetest.get_translator("drwho_tardis")
local data = minetest.get_mod_storage()
local S = core.get_translator("drwho_tardis")
local data = core.get_mod_storage()
-- IMPORTANT:
-- Old Tardises will not be affected by the changes in values.
@ -14,38 +14,38 @@ local data = minetest.get_mod_storage()
-- TARDIS EXTERIOR FUNCTIONS
local function tardis_on_place(pos, placer, itemstack, pointed_thing)
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 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
user.has_a_tardis = true
user.out_pos = pos -- set exterior position
_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
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)
meta:set_string("id", name) -- set exterior id
timer:start(0.2)
else -- they already have a tardis
minetest.set_node(pos, {name = "air"})
minetest.add_item(pos, "drwho_tardis:tardis_blue")
minetest.chat_send_player(name, S("You can only have one Tardis!"))
core.set_node(pos, {name = "air"})
core.add_item(pos, "drwho_tardis:tardis_blue")
core.chat_send_player(name, S("You can only have one Tardis!"))
end
end
end
-- Check if there are any players or mobs entering a TARDIS and teleport them
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
local obj = objs[1]
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 user = _drwho_tardis.get_user(id) -- get user data
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_vertical( math.rad( 0 ))
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
end
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}
-- Register normal TARDIS
minetest.register_node("drwho_tardis:tardis"..name, {
core.register_node("drwho_tardis:tardis"..name, {
description = description,
tiles = {texture},
use_texture_alpha = "clip",
@ -110,7 +110,7 @@ function drwho_tardis:register_tardis_exterior(def)
on_timer = tardis_timer
})
-- Register locked TARDIS
minetest.register_node("drwho_tardis:tardis"..name.."_locked", {
core.register_node("drwho_tardis:tardis"..name.."_locked", {
description = description.." (locked)",
tiles = {texture},
use_texture_alpha = "clip",
@ -125,7 +125,7 @@ function drwho_tardis:register_tardis_exterior(def)
})
-- 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] = {
itemstring = "drwho_tardis:tardis"..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
texture = texture
}
data:set_string("ext_list", minetest.serialize(ext_list))
data:set_string("ext_list", core.serialize(ext_list))
end

View File

@ -7,10 +7,10 @@
-- special stone
-- Gallifreyan Chest
local S = minetest.get_translator("drwho_tardis")
local data = minetest.get_mod_storage()
local S = core.get_translator("drwho_tardis")
local data = core.get_mod_storage()
--data = minetest.get_mod_storage()
--data = core.get_mod_storage()
-- 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,
-- 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.
minetest.register_node(def.itemstring, {
core.register_node(def.itemstring, {
description = S(def.description),
tiles = {def.texture},
drawtype = "mesh",
@ -52,16 +52,16 @@ function drwho_tardis:register_in_door_style(def)
groups = {cracky=2, tardis_in_door=1},
diggable = true,
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 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 == nil then meta:set_string("type", "exit") end -- Backwards compatability
if objs[1] == nil then return true else
if objs[1]:is_player() then
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 user = _drwho_tardis.get_user(id)
local go_pos = user.out_pos
@ -77,19 +77,19 @@ function drwho_tardis:register_in_door_style(def)
objs[1]:set_hp(0)
end
minetest.after(1, function()
local meta = minetest.get_meta(pos)
core.after(1, function()
local meta = core.get_meta(pos)
local id = meta:get_string("id")
local user = _drwho_tardis.get_user(id)
local go_pos = user.out_pos
minetest.set_node(go_pos, {name=user.exterior_skin})
local ometa = minetest.get_meta(go_pos)
core.set_node(go_pos, {name=user.exterior_skin})
local ometa = core.get_meta(go_pos)
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)
end)
else
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
local id = meta:get_string("id")
local user = _drwho_tardis.get_user(id)
local go_pos = user.out_pos
@ -104,12 +104,12 @@ function drwho_tardis:register_in_door_style(def)
if objs[1]:is_player() then
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 name = objs[1]:get_player_name()
minetest.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.after(1, function()
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)
else
@ -121,7 +121,7 @@ function drwho_tardis:register_in_door_style(def)
end
})
minetest.register_node(def.itemstring.."_locked", {
core.register_node(def.itemstring.."_locked", {
description = S("Locked @1", def.description),
tiles = {def.texture},
drawtype = "mesh",
@ -161,32 +161,32 @@ drwho_tardis:register_in_door_style({
-- Trigger translation for automated scripts
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)"),
tiles = {"tardis_wall.png"},
diggable = false,
groups = { not_in_creative_inventory = 1},
light_source = 2,
})
minetest.register_node("drwho_tardis:wall_craftable", {
core.register_node("drwho_tardis:wall_craftable", {
description = S("Tardis Wall"),
tiles = {"tardis_wall.png"},
groups = {cracky = 1},
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)"),
tiles = {"drwho_tardis_wall_circles_16x16.png"},
groups = {cracky = 1},
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"),
tiles = {"drwho_tardis_wall_one_circle.png"},
groups = {cracky = 1},
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"),
tiles = {"drwho_tardis_wall_one_circle_halfs.png"},
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 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)"),
tiles = {top, top, front, front, front, front},
groups = {cracky = 1},
light_source = 8,
})
minetest.register_node("drwho_tardis:grey_block", {
core.register_node("drwho_tardis:grey_block", {
description = S("Light Grey Block"),
tiles = {"drwho_tardis_grey_block.png"},
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"),
tiles = {"drwho_tardis_grey_block.png"},
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},
},
})
minetest.register_node("drwho_tardis:grey_block_h", {
core.register_node("drwho_tardis:grey_block_h", {
description = S("Light Grey Block"),
tiles = {"drwho_tardis_grey_block.png"},
groups = {cracky = 1},
@ -235,12 +235,12 @@ minetest.register_node("drwho_tardis:grey_block_h", {
},
sunlight_propagates = false,
})
minetest.register_node("drwho_tardis:turquiose_block", {
core.register_node("drwho_tardis:turquiose_block", {
description = S("Turquiose Block"),
tiles = {"tardis_side_4.png"},
groups = {cracky = 1},
})
minetest.register_node("drwho_tardis:turquiose_block_h", {
core.register_node("drwho_tardis:turquiose_block_h", {
description = S("Turquiose Block"),
tiles = {"tardis_side_4.png"},
groups = {cracky = 1},
@ -260,7 +260,7 @@ minetest.register_node("drwho_tardis:turquiose_block_h", {
sunlight_propagates = false,
})
minetest.register_node("drwho_tardis:stone", {
core.register_node("drwho_tardis:stone", {
description = S("Stone"),
tiles = {"default_stone.png"},
diggable = false,
@ -273,12 +273,12 @@ local function get_formspec_chest()
"list[context;main;0,0.5;24,10;]"..
"list[current_player;main;8,10.5;8,4;]"
end
minetest.register_node("drwho_tardis:chest", {
core.register_node("drwho_tardis: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"},
groups = {cracky = 3},
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()
meta:set_string("owner", 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
end,
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
end -- gallifreyan chest
})

View File

@ -5,13 +5,13 @@
-- Gauntlet of Rassilon
-- Vortex Manipulator
local S = minetest.get_translator("drwho_tardis")
local S = core.get_translator("drwho_tardis")
local i = _drwho_tardis.items
-- DALEKANIUM (dalek) TOOLS
-- Pickaxe
minetest.register_tool("drwho_tardis:pick_dalek", {
core.register_tool("drwho_tardis:pick_dalek", {
description = S("Dalekanium Pickaxe"),
inventory_image = "dalek_pick.png",
tool_capabilities = {
@ -36,7 +36,7 @@ if _drwho_tardis.GAMETYPE == "rp" then
}
})
else
minetest.register_craft({
core.register_craft({
output = "drwho_tardis:pick_dalek",
recipe = {
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot"},
@ -47,7 +47,7 @@ minetest.register_craft({
end
-- Shovel
minetest.register_tool("drwho_tardis:shovel_dalek", {
core.register_tool("drwho_tardis:shovel_dalek", {
description = S("Dalekanium Shovel"),
inventory_image = "dalek_shovel.png",
tool_capabilities = {
@ -71,7 +71,7 @@ if _drwho_tardis.GAMETYPE == "rp" then
}
})
else
minetest.register_craft({
core.register_craft({
output = "drwho_tardis:shovel_dalek",
recipe = {
{"drwho_tardis:dalekanium_ingot"},
@ -82,7 +82,7 @@ minetest.register_craft({
end
-- Axe
minetest.register_tool("drwho_tardis:axe_dalek", {
core.register_tool("drwho_tardis:axe_dalek", {
description = S("Dalekanium Axe"),
inventory_image = "dalek_axe.png",
tool_capabilities = {
@ -106,7 +106,7 @@ if _drwho_tardis.GAMETYPE == "rp" then
}
})
else
minetest.register_craft({
core.register_craft({
output = "drwho_tardis:axe_dalek",
recipe = {
{"drwho_tardis:dalekanium_ingot", "drwho_tardis:dalekanium_ingot", ""},
@ -117,7 +117,7 @@ minetest.register_craft({
end
-- Sword
minetest.register_tool("drwho_tardis:sword_dalek", {
core.register_tool("drwho_tardis:sword_dalek", {
description = S("Dalekanium Sword"),
inventory_image = "dalek_sword.png",
tool_capabilities = {
@ -141,7 +141,7 @@ if _drwho_tardis.GAMETYPE == "rp" then
}
})
else
minetest.register_craft({
core.register_craft({
output = "drwho_tardis:sword_dalek",
recipe = {
{"drwho_tardis:dalekanium_ingot"},
@ -152,7 +152,7 @@ minetest.register_craft({
end
-- 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:pick_dalek")
toolranks.add_tool("drwho_tardis:axe_dalek")
@ -164,7 +164,7 @@ end
-- so we don't have to do anything extra
-- gauntlet of rassilon
minetest.register_tool("drwho_tardis:rassilon_gauntlet", {
core.register_tool("drwho_tardis:rassilon_gauntlet", {
description = S("Gaunlet of Rassilon"),
inventory_image = "gauntlet_rassilon.png",
stack_max=1,
@ -186,12 +186,12 @@ local function get_formspec_vortex()
"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]"
end
minetest.register_tool("drwho_tardis:vortex_manipulator", {
core.register_tool("drwho_tardis:vortex_manipulator", {
description = S("Vortex Manipulator"),
inventory_image = "vortex_manipulator.png",
stack_max=1,
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
end
})