added localization (inttlib); added german

This commit is contained in:
Sokomine 2017-12-25 02:08:06 +01:00
parent 0dbcda24c1
commit 661919aaaf
7 changed files with 305 additions and 95 deletions

@ -1 +1,2 @@
mesecons? mesecons?
intllib?

@ -2,11 +2,12 @@
-- All doors (not only these here) in front of a travelnet or elevator are opened automaticly when a player arrives -- All doors (not only these here) in front of a travelnet or elevator are opened automaticly when a player arrives
-- and are closed when a player departs from the travelnet or elevator. -- and are closed when a player departs from the travelnet or elevator.
-- Autor: Sokomine -- Autor: Sokomine
local S = travelnet.S;
travelnet.register_door = function( node_base_name, def_tiles, material ) travelnet.register_door = function( node_base_name, def_tiles, material )
minetest.register_node( node_base_name.."_open", { minetest.register_node( node_base_name.."_open", {
description = "elevator door (open)", description = S("elevator door (open)"),
drawtype = "nodebox", drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer -- top, bottom, side1, side2, inner, outer
tiles = def_tiles, tiles = def_tiles,
@ -36,7 +37,7 @@ travelnet.register_door = function( node_base_name, def_tiles, material )
}) })
minetest.register_node(node_base_name.."_closed", { minetest.register_node(node_base_name.."_closed", {
description = "elevator door (closed)", description = S("elevator door (closed)"),
drawtype = "nodebox", drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer -- top, bottom, side1, side2, inner, outer
tiles = def_tiles, tiles = def_tiles,

@ -1,6 +1,7 @@
-- This version of the travelnet box allows to move up or down only. -- This version of the travelnet box allows to move up or down only.
-- The network name is determined automaticly from the position (x/z coordinates). -- The network name is determined automaticly from the position (x/z coordinates).
-- >utor: Sokomine -- >utor: Sokomine
local S = travelnet.S;
travelnet.show_nearest_elevator = function( pos, owner_name, param2 ) travelnet.show_nearest_elevator = function( pos, owner_name, param2 )
if( not( pos ) or not(pos.x) or not(pos.z) or not( owner_name )) then if( not( pos ) or not(pos.x) or not(pos.z) or not( owner_name )) then
@ -8,9 +9,9 @@ travelnet.show_nearest_elevator = function( pos, owner_name, param2 )
end end
if( not( travelnet.targets[ owner_name ] )) then if( not( travelnet.targets[ owner_name ] )) then
minetest.chat_send_player( owner_name, "Congratulations! This is your first elevator.".. minetest.chat_send_player( owner_name, S("Congratulations! This is your first elevator."..
"You can build an elevator network by placing further elevators somewhere above ".. "You can build an elevator network by placing further elevators somewhere above "..
"or below this one. Just make sure that the x and z coordinate are the same."); "or below this one. Just make sure that the x and z coordinate are the same."));
return; return;
end end
@ -19,10 +20,10 @@ travelnet.show_nearest_elevator = function( pos, owner_name, param2 )
if( travelnet.targets[ owner_name ][ network_name ] if( travelnet.targets[ owner_name ][ network_name ]
-- does the network have any members at all? -- does the network have any members at all?
and next( travelnet.targets[ owner_name ][ network_name ], nil )) then and next( travelnet.targets[ owner_name ][ network_name ], nil )) then
minetest.chat_send_player( owner_name, "This elevator will automaticly connect to the ".. minetest.chat_send_player( owner_name, S("This elevator will automaticly connect to the "..
"other elevators you have placed at diffrent heights. Just enter a station name ".. "other elevators you have placed at diffrent heights. Just enter a station name "..
"and click on \"store\" to set it up. Or just punch it to set the height as station ".. "and click on \"store\" to set it up. Or just punch it to set the height as station "..
"name."); "name."));
return; return;
end end
@ -47,46 +48,47 @@ travelnet.show_nearest_elevator = function( pos, owner_name, param2 )
end end
end end
if( nearest_name ~= "" ) then if( nearest_name ~= "" ) then
local text = "Your nearest elevator network is located "; local text = S("Your nearest elevator network is located").." ";
-- in front of/behind -- in front of/behind
if( (param2==0 and nearest_dist_z>=0)or (param2==2 and nearest_dist_z<=0)) then if( (param2==0 and nearest_dist_z>=0)or (param2==2 and nearest_dist_z<=0)) then
text = text..tostring( math.abs(nearest_dist_z )).." m behind this elevator and "; text = text..tostring( math.abs(nearest_dist_z )).." "..S("m behind this elevator and");
elseif((param2==1 and nearest_dist_x>=0)or (param2==3 and nearest_dist_x<=0)) then elseif((param2==1 and nearest_dist_x>=0)or (param2==3 and nearest_dist_x<=0)) then
text = text..tostring( math.abs(nearest_dist_x )).." m behind this elevator and "; text = text..tostring( math.abs(nearest_dist_x )).." "..S("m behind this elevator and");
elseif((param2==0 and nearest_dist_z< 0)or (param2==2 and nearest_dist_z> 0)) then elseif((param2==0 and nearest_dist_z< 0)or (param2==2 and nearest_dist_z> 0)) then
text = text..tostring( math.abs(nearest_dist_z )).." m in front of this elevator and "; text = text..tostring( math.abs(nearest_dist_z )).." "..S("m in front of this elevator and");
elseif((param2==1 and nearest_dist_x< 0)or (param2==3 and nearest_dist_x> 0)) then elseif((param2==1 and nearest_dist_x< 0)or (param2==3 and nearest_dist_x> 0)) then
text = text..tostring( math.abs(nearest_dist_x )).." m in front of this elevator and "; text = text..tostring( math.abs(nearest_dist_x )).." "..S("m in front of this elevator and");
else text = text.." ERROR "; else text = text..S(" ERROR");
end end
text = text.." ";
-- right/left -- right/left
if( (param2==0 and nearest_dist_x< 0)or (param2==2 and nearest_dist_x> 0)) then if( (param2==0 and nearest_dist_x< 0)or (param2==2 and nearest_dist_x> 0)) then
text = text..tostring( math.abs(nearest_dist_x )).." m to the left"; text = text..tostring( math.abs(nearest_dist_x )).." "..S("m to the left");
elseif((param2==1 and nearest_dist_z>=0)or (param2==3 and nearest_dist_z<=0)) then elseif((param2==1 and nearest_dist_z>=0)or (param2==3 and nearest_dist_z<=0)) then
text = text..tostring( math.abs(nearest_dist_z )).." m to the left"; text = text..tostring( math.abs(nearest_dist_z )).." "..S("m to the left");
elseif((param2==0 and nearest_dist_x>=0)or (param2==2 and nearest_dist_x<=0)) then elseif((param2==0 and nearest_dist_x>=0)or (param2==2 and nearest_dist_x<=0)) then
text = text..tostring( math.abs(nearest_dist_x )).." m to the right"; text = text..tostring( math.abs(nearest_dist_x )).." "..S("m to the right");
elseif((param2==1 and nearest_dist_z< 0)or (param2==3 and nearest_dist_z> 0)) then elseif((param2==1 and nearest_dist_z< 0)or (param2==3 and nearest_dist_z> 0)) then
text = text..tostring( math.abs(nearest_dist_z )).." m to the right"; text = text..tostring( math.abs(nearest_dist_z )).." "..S("m to the right");
else text = text.." ERROR "; else text = text..S(" ERROR");
end end
minetest.chat_send_player( owner_name, text.. minetest.chat_send_player( owner_name, text..
", located at x="..tostring( pos.x+nearest_dist_x).. S(", located at x").."="..tostring( pos.x+nearest_dist_x)..
", z="..tostring( pos.z+nearest_dist_z).. ", z="..tostring( pos.z+nearest_dist_z)..
" This elevator here will start a new shaft/network." ); ". "..S("This elevator here will start a new shaft/network."));
else else
minetest.chat_send_player( owner_name, "This is your first elevator. It differs from ".. minetest.chat_send_player( owner_name, S("This is your first elevator. It differs from "..
"travelnet networks by only allowing movement in vertical direction (up or down). ".. "travelnet networks by only allowing movement in vertical direction (up or down). "..
"All further elevators which you will place at the same x,z coordinates at differnt ".. "All further elevators which you will place at the same x,z coordinates at differnt "..
"heights will be able to connect to this elevator."); "heights will be able to connect to this elevator."));
end end
end end
minetest.register_node("travelnet:elevator", { minetest.register_node("travelnet:elevator", {
description = "Elevator", description = S("Elevator"),
drawtype = "mesh", drawtype = "mesh",
mesh = "travelnet_elevator.obj", mesh = "travelnet_elevator.obj",
sunlight_propagates = true, sunlight_propagates = true,
@ -127,17 +129,17 @@ minetest.register_node("travelnet:elevator", {
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
meta:set_string("infotext", "Elevator (unconfigured)"); meta:set_string("infotext", S("Elevator (unconfigured)"));
meta:set_string("station_name", ""); meta:set_string("station_name", "");
meta:set_string("station_network",""); meta:set_string("station_network","");
meta:set_string("owner", placer:get_player_name() ); meta:set_string("owner", placer:get_player_name() );
-- request initial data -- request initial data
meta:set_string("formspec", meta:set_string("formspec",
"size[12,10]".. "size[12,10]"..
"field[0.3,5.6;6,0.7;station_name;Name of this station:;]".. "field[0.3,5.6;6,0.7;station_name;"..S("Name of this station:")..";]"..
-- "field[0.3,6.6;6,0.7;station_network;Assign to Network:;]".. -- "field[0.3,6.6;6,0.7;station_network;Assign to Network:;]"..
-- "field[0.3,7.6;6,0.7;owner_name;(optional) owned by:;]".. -- "field[0.3,7.6;6,0.7;owner_name;(optional) owned by:;]"..
"button_exit[6.3,6.2;1.7,0.7;station_set;Store]" ); "button_exit[6.3,6.2;1.7,0.7;station_set;"..S("Store").."]" );
local p = {x=pos.x, y=pos.y+1, z=pos.z} local p = {x=pos.x, y=pos.y+1, z=pos.z}
local p2 = minetest.dir_to_facedir(placer:get_look_dir()) local p2 = minetest.dir_to_facedir(placer:get_look_dir())
@ -170,7 +172,7 @@ minetest.register_node("travelnet:elevator", {
local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}); local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z});
-- leftover elevator_top nodes can be removed by placing a new elevator underneath -- leftover elevator_top nodes can be removed by placing a new elevator underneath
if( node ~= nil and node.name ~= "air" and node.name ~= 'travelnet:elevator_top') then if( node ~= nil and node.name ~= "air" and node.name ~= 'travelnet:elevator_top') then
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place the travelnet box!' ) minetest.chat_send_player( placer:get_player_name(), S('Not enough vertical space to place the travelnet box!'))
return; return;
end end
return minetest.item_place(itemstack, placer, pointed_thing); return minetest.item_place(itemstack, placer, pointed_thing);

154
init.lua

@ -22,6 +22,8 @@
Please configure this mod in config.lua Please configure this mod in config.lua
Changelog: Changelog:
24.12.17 - Added support for localization through intllib.
Added localization for German (de).
17.07.17 - Added more detailled licence information. 17.07.17 - Added more detailled licence information.
TNT and DungeonMasters ought to leave travelnets and elevators untouched now. TNT and DungeonMasters ought to leave travelnets and elevators untouched now.
Added function to register elevator doors. Added function to register elevator doors.
@ -73,13 +75,21 @@
--]] --]]
minetest.register_privilege("travelnet_attach", { description = "allows to attach travelnet boxes to travelnets of other players", give_to_singleplayer = false});
minetest.register_privilege("travelnet_remove", { description = "allows to dig travelnet boxes which belog to nets of other players", give_to_singleplayer = false});
travelnet = {}; travelnet = {};
travelnet.targets = {}; travelnet.targets = {};
-- Boilerplate to support localized strings if intllib mod is installed.
if minetest.get_modpath( "intllib" ) and intllib then
travelnet.S = intllib.Getter()
else
travelnet.S = function(s) return s end
end
local S = travelnet.S;
minetest.register_privilege("travelnet_attach", { description = S("allows to attach travelnet boxes to travelnets of other players"), give_to_singleplayer = false});
minetest.register_privilege("travelnet_remove", { description = S("allows to dig travelnet boxes which belog to nets of other players"), give_to_singleplayer = false});
-- read the configuration -- read the configuration
dofile(minetest.get_modpath("travelnet").."/config.lua"); -- the normal, default travelnet dofile(minetest.get_modpath("travelnet").."/config.lua"); -- the normal, default travelnet
@ -98,7 +108,7 @@ travelnet.save_data = function()
file:write( data ); file:write( data );
file:close(); file:close();
else else
print("[Mod travelnet] Error: Savefile '"..tostring( path ).."' could not be written."); print(S("[Mod travelnet] Error: Savefile '%s' could not be written."):format(tostring(path)));
end end
end end
@ -113,7 +123,7 @@ travelnet.restore_data = function()
travelnet.targets = minetest.deserialize( data ); travelnet.targets = minetest.deserialize( data );
file:close(); file:close();
else else
print("[Mod travelnet] Error: Savefile '"..tostring( path ).."' not found."); print(S("[Mod travelnet] Error: Savefile '%s' not found."):format(tostring(path)));
end end
end end
@ -145,8 +155,8 @@ travelnet.show_message = function( pos, player_name, title, message )
local formspec = "size[8,3]".. local formspec = "size[8,3]"..
"label[3,0;"..minetest.formspec_escape( title or "Error").."]".. "label[3,0;"..minetest.formspec_escape( title or "Error").."]"..
"textlist[0,0.5;8,1.5;;"..minetest.formspec_escape( message or "- nothing -")..";]".. "textlist[0,0.5;8,1.5;;"..minetest.formspec_escape( message or "- nothing -")..";]"..
"button_exit[3.5,2.5;1.0,0.5;back;Back]".. "button_exit[3.5,2.5;1.0,0.5;back;"..S("Back").."]"..
"button_exit[6.8,2.5;1.0,0.5;station_exit;Exit]".. "button_exit[6.8,2.5;1.0,0.5;station_exit;"..S("Exit").."]"..
"field[20,20;0.1,0.1;pos2str;Pos;".. minetest.pos_to_string( pos ).."]"; "field[20,20;0.1,0.1;pos2str;Pos;".. minetest.pos_to_string( pos ).."]";
minetest.show_formspec(player_name, "travelnet:show", formspec); minetest.show_formspec(player_name, "travelnet:show", formspec);
end end
@ -189,7 +199,7 @@ travelnet.reset_formspec = function( meta )
if( not( meta )) then if( not( meta )) then
return; return;
end end
meta:set_string("infotext", "Travelnet-box (unconfigured)"); meta:set_string("infotext", S("Travelnet-box (unconfigured)"));
meta:set_string("station_name", ""); meta:set_string("station_name", "");
meta:set_string("station_network",""); meta:set_string("station_network","");
meta:set_string("owner", ""); meta:set_string("owner", "");
@ -201,19 +211,19 @@ travelnet.reset_formspec = function( meta )
-- request initinal data -- request initinal data
meta:set_string("formspec", meta:set_string("formspec",
"size[10,6.0]".. "size[10,6.0]"..
"label[2.0,0.0;--> Configure this travelnet station <--]".. "label[2.0,0.0;--> "..S("Configure this travelnet station").." <--]"..
"field[0.3,1.2;9,0.9;station_name;Name of this station:;".. "field[0.3,1.2;9,0.9;station_name;"..S("Name of this station")..":;"..
minetest.formspec_escape(station_name or "").."]".. minetest.formspec_escape(station_name or "").."]"..
"label[0.3,1.5;How do you call this place here? Example: \"my first house\", \"mine\", \"shop\"...]".. "label[0.3,1.5;"..S("How do you call this place here? Example: \"my first house\", \"mine\", \"shop\"...").."]"..
"field[0.3,2.8;9,0.9;station_network;Assign to Network:;".. "field[0.3,2.8;9,0.9;station_network;"..S("Assign to Network:")..";"..
minetest.formspec_escape(station_network or "").."]".. minetest.formspec_escape(station_network or "").."]"..
"label[0.3,3.1;You can have more than one network. If unsure, use \""..tostring(station_network).."\".]".. "label[0.3,3.1;"..S("You can have more than one network. If unsure, use \"%s\""):format(tostring(station_network)).."\".]"..
"field[0.3,4.4;9,0.9;owner;Owned by:;]".. "field[0.3,4.4;9,0.9;owner;"..S("Owned by:")..";]"..
"label[0.3,4.7;Unless you know what you are doing, leave this empty.]".. "label[0.3,4.7;"..S("Unless you know what you are doing, leave this empty.").."]"..
"button_exit[1.3,5.3;1.7,0.7;station_help_setup;Help]".. "button_exit[1.3,5.3;1.7,0.7;station_help_setup;"..S("Help").."]"..
"button_exit[3.8,5.3;1.7,0.7;station_set;Save]".. "button_exit[3.8,5.3;1.7,0.7;station_set;"..S("Save").."]"..
"button_exit[6.3,5.3;1.7,0.7;station_exit;Exit]"); "button_exit[6.3,5.3;1.7,0.7;station_exit;"..S("Exit").."]");
end end
@ -252,7 +262,7 @@ travelnet.update_formspec = function( pos, puncher_name, fields )
travelnet.reset_formspec( meta ); travelnet.reset_formspec( meta );
travelnet.show_message( pos, puncher_name, "Error", "Update failed! Resetting this box on the travelnet." ); travelnet.show_message( pos, puncher_name, "Error", S("Update failed! Resetting this box on the travelnet."));
return; return;
end end
@ -280,7 +290,8 @@ travelnet.update_formspec = function( pos, puncher_name, fields )
-- add this station -- add this station
travelnet.targets[ owner_name ][ station_network ][ station_name ] = {pos=pos, timestamp=zeit }; travelnet.targets[ owner_name ][ station_network ][ station_name ] = {pos=pos, timestamp=zeit };
minetest.chat_send_player(owner_name, "Station '"..station_name.."' has been reattached to the network '"..station_network.."'."); minetest.chat_send_player(owner_name, S("Station '%s'"):format(station_name).." "..
S(" has been reattached to the network '%s'."):format(station_network));
travelnet.save_data(); travelnet.save_data();
end end
@ -289,15 +300,15 @@ travelnet.update_formspec = function( pos, puncher_name, fields )
local zusatzstr = ""; local zusatzstr = "";
local trheight = "10"; local trheight = "10";
if( this_node and this_node.name=="locked_travelnet:travelnet" ) then if( this_node and this_node.name=="locked_travelnet:travelnet" ) then
zusatzstr = "field[0.3,11;6,0.7;locks_sent_lock_command;Locked travelnet. Type /help for help:;]"; zusatzstr = "field[0.3,11;6,0.7;locks_sent_lock_command;"..S("Locked travelnet. Type /help for help:")..";]";
trheight = "11.5"; trheight = "11.5";
end end
local formspec = "size[12,"..trheight.."]".. local formspec = "size[12,"..trheight.."]"..
"label[3.3,0.0;Travelnet-Box:]".."label[6.3,0.0;Punch box to update target list.]".. "label[3.3,0.0;"..S("Travelnet-Box")..":]".."label[6.3,0.0;"..S("Punch box to update target list.").."]"..
"label[0.3,0.4;Name of this station:]".."label[6.3,0.4;"..minetest.formspec_escape(station_name or "?").."]".. "label[0.3,0.4;"..S("Name of this station:").."]".."label[6.3,0.4;"..minetest.formspec_escape(station_name or "?").."]"..
"label[0.3,0.8;Assigned to Network:]" .."label[6.3,0.8;"..minetest.formspec_escape(station_network or "?").."]".. "label[0.3,0.8;"..S("Assigned to Network:").."]" .."label[6.3,0.8;"..minetest.formspec_escape(station_network or "?").."]"..
"label[0.3,1.2;Owned by:]" .."label[6.3,1.2;"..minetest.formspec_escape(owner_name or "?").."]".. "label[0.3,1.2;"..S("Owned by:").."]" .."label[6.3,1.2;"..minetest.formspec_escape(owner_name or "?").."]"..
"label[3.3,1.6;Click on target to travel there:]".. "label[3.3,1.6;"..S("Click on target to travel there:").."]"..
zusatzstr; zusatzstr;
-- "button_exit[5.3,0.3;8,0.8;do_update;Punch box to update destination list. Click on target to travel there.]".. -- "button_exit[5.3,0.3;8,0.8;do_update;Punch box to update destination list. Click on target to travel there.]"..
local x = 0; local x = 0;
@ -330,7 +341,7 @@ travelnet.update_formspec = function( pos, puncher_name, fields )
end end
for index,k in ipairs( stations ) do for index,k in ipairs( stations ) do
if( index == ground_level ) then if( index == ground_level ) then
travelnet.targets[ owner_name ][ station_network ][ k ].nr = 'G'; travelnet.targets[ owner_name ][ station_network ][ k ].nr = S('G');
else else
travelnet.targets[ owner_name ][ station_network ][ k ].nr = tostring( ground_level - index ); travelnet.targets[ owner_name ][ station_network ][ k ].nr = tostring( ground_level - index );
end end
@ -368,10 +379,10 @@ travelnet.update_formspec = function( pos, puncher_name, fields )
end end
-- handle errors -- handle errors
if( swap_with_pos < 1) then if( swap_with_pos < 1) then
travelnet.show_message( pos, puncher_name, "Info", "This station is already the first one on the list."); travelnet.show_message( pos, puncher_name, "Info", S("This station is already the first one on the list."));
return; return;
elseif( swap_with_pos > #stations ) then elseif( swap_with_pos > #stations ) then
travelnet.show_message( pos, puncher_name, "Info", "This station is already the last one on the list."); travelnet.show_message( pos, puncher_name, "Info", S("This station is already the last one on the list."));
return; return;
else else
-- swap the actual data by which the stations are sorted -- swap the actual data by which the stations are sorted
@ -436,15 +447,17 @@ travelnet.update_formspec = function( pos, puncher_name, fields )
end end
end end
formspec = formspec.. formspec = formspec..
"label[8.0,1.6;Position in list:]".. "label[8.0,1.6;"..S("Position in list:").."]"..
"button_exit[11.3,0.0;1.0,0.5;station_exit;Exit]".. "button_exit[11.3,0.0;1.0,0.5;station_exit;"..S("Exit").."]"..
"button_exit[9.6,1.6;1.4,0.5;move_up;move up]".. "button_exit[9.6,1.6;1.4,0.5;move_up;"..S("move up").."]"..
"button_exit[10.9,1.6;1.4,0.5;move_down;move down]"; "button_exit[10.9,1.6;1.4,0.5;move_down;"..S("move down").."]";
meta:set_string( "formspec", formspec ); meta:set_string( "formspec", formspec );
meta:set_string( "infotext", "Station '"..tostring( station_name ).."' on travelnet '"..tostring( station_network ).. meta:set_string( "infotext", S("Station '%s'"):format(tostring( station_name )).." "..
"' (owned by "..tostring( owner_name )..") ready for usage. Right-click to travel, punch to update."); S("on travelnet '%s'"):format(tostring( station_network )).." "..
S("(owned by %s)"):format(tostring( owner_name )).." "..
S("ready for usage. Right-click to travel, punch to update."));
-- show the player the updated formspec -- show the player the updated formspec
travelnet.show_current_formspec( pos, meta, puncher_name ); travelnet.show_current_formspec( pos, meta, puncher_name );
@ -464,18 +477,18 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m
is_elevator = true; is_elevator = true;
network_name = tostring( pos.x )..','..tostring( pos.z ); network_name = tostring( pos.x )..','..tostring( pos.z );
if( not( station_name ) or station_name == '' ) then if( not( station_name ) or station_name == '' ) then
station_name = 'at '..tostring( pos.y )..'m'; station_name = S('at %s m'):format(tostring( pos.y ));
end end
end end
if( station_name == "" or not(station_name )) then if( station_name == "" or not(station_name )) then
travelnet.show_message( pos, player_name, "Error", "Please provide a name for this station." ); travelnet.show_message( pos, player_name, S("Error"), S("Please provide a name for this station." ));
return; return;
end end
if( network_name == "" or not( network_name )) then if( network_name == "" or not( network_name )) then
travelnet.show_message( pos, player_name, "Error", travelnet.show_message( pos, player_name, S("Error"),
"Please provide the name of the network this station ought to be connected to." ); S("Please provide the name of the network this station ought to be connected to."));
return; return;
end end
@ -487,16 +500,16 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m
elseif( not( minetest.check_player_privs(player_name, {interact=true}))) then elseif( not( minetest.check_player_privs(player_name, {interact=true}))) then
travelnet.show_message( pos, player_name, "Error", travelnet.show_message( pos, player_name, S("Error"),
"There is no player with interact privilege named '"..tostring( player_name ).."'. Aborting."); S("There is no player with interact privilege named '%s'. Aborting."):format(tostring( player_name )));
return; return;
elseif( not( minetest.check_player_privs(player_name, {travelnet_attach=true})) elseif( not( minetest.check_player_privs(player_name, {travelnet_attach=true}))
and not( travelnet.allow_attach( player_name, owner_name, network_name ))) then and not( travelnet.allow_attach( player_name, owner_name, network_name ))) then
travelnet.show_message( pos, player_name, "Error", travelnet.show_message( pos, player_name, S("Error"),
"You do not have the travelnet_attach priv which is required to attach your box to ".. S("You do not have the travelnet_attach priv which is required to attach your box to "..
"the network of someone else. Aborting."); "the network of someone else. Aborting."));
return; return;
end end
@ -515,8 +528,8 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m
for k,v in pairs( travelnet.targets[ owner_name ][ network_name ] ) do for k,v in pairs( travelnet.targets[ owner_name ][ network_name ] ) do
if( k == station_name ) then if( k == station_name ) then
travelnet.show_message( pos, player_name, "Error", travelnet.show_message( pos, player_name, S("Error"),
"A station named '"..station_name.."' already exists on this network. Please choose a diffrent name!"); S("A station named '%s' already exists on this network. Please choose a diffrent name!"):format(station_name));
return; return;
end end
@ -525,10 +538,10 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m
-- we don't want too many stations in the same network because that would get confusing when displaying the targets -- we don't want too many stations in the same network because that would get confusing when displaying the targets
if( anz+1 > travelnet.MAX_STATIONS_PER_NETWORK ) then if( anz+1 > travelnet.MAX_STATIONS_PER_NETWORK ) then
travelnet.show_message( pos, player_name, "Error", travelnet.show_message( pos, player_name, S("Error"),
"Network '"..network_name.."' already contains the maximum number (=".. S("Network '%s',"):format(network_name).." "..
(travelnet.MAX_STATIONS_PER_NETWORK)..") of allowed stations per network. ".. S("already contains the maximum number (=%s) of allowed stations per network. "..
"Please choose a diffrent/new network name."); "Please choose a diffrent/new network name."):format(travelnet.MAX_STATIONS_PER_NETWORK));
return; return;
end end
@ -538,8 +551,9 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m
-- do we have a new node to set up? (and are not just reading from a safefile?) -- do we have a new node to set up? (and are not just reading from a safefile?)
if( meta ) then if( meta ) then
minetest.chat_send_player(player_name, "Station '"..station_name.."' has been added to the network '" minetest.chat_send_player(player_name, S("Station '%s'"):format(station_name).." "..
..network_name.."', which now consists of "..( anz+1 ).." station(s)."); S("has been added to the network '%s'"):format(network_name)..
S(", which now consists of %s station(s)."):format(anz+1));
meta:set_string( "station_name", station_name ); meta:set_string( "station_name", station_name );
meta:set_string( "station_network", network_name ); meta:set_string( "station_network", network_name );
@ -548,8 +562,8 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m
meta:set_string("formspec", meta:set_string("formspec",
"size[12,10]".. "size[12,10]"..
"field[0.3,0.6;6,0.7;station_name;Station:;".. minetest.formspec_escape(meta:get_string("station_name")).."]".. "field[0.3,0.6;6,0.7;station_name;"..S("Station:")..";".. minetest.formspec_escape(meta:get_string("station_name")).."]"..
"field[0.3,3.6;6,0.7;station_network;Network:;"..minetest.formspec_escape(meta:get_string("station_network")).."]" ); "field[0.3,3.6;6,0.7;station_network;"..S("Network:")..";"..minetest.formspec_escape(meta:get_string("station_network")).."]" );
-- display a list of all stations that can be reached from here -- display a list of all stations that can be reached from here
travelnet.update_formspec( pos, player_name, nil ); travelnet.update_formspec( pos, player_name, nil );
@ -626,7 +640,7 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
if( node and node.name and minetest.registered_nodes[ node.name ] ) then if( node and node.name and minetest.registered_nodes[ node.name ] ) then
travelnet.show_message( pos, name, "--> Help <--", travelnet.show_message( pos, name, "--> Help <--",
-- TODO: actually add help page -- TODO: actually add help page
"If only there would be any help for "..tostring( node.name )..".."); S("No help available yet."));
end end
return; return;
end end
@ -650,7 +664,7 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
end end
if( not( fields.target )) then if( not( fields.target )) then
minetest.chat_send_player(name, "Please click on the target you want to travel to."); minetest.chat_send_player(name, S("Please click on the target you want to travel to."));
return; return;
end end
@ -672,7 +686,8 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
and station_network ) then and station_network ) then
travelnet.add_target( station_name, station_network, pos, owner_name, meta, owner_name ); travelnet.add_target( station_name, station_network, pos, owner_name, meta, owner_name );
else else
minetest.chat_send_player(name, "Error: There is something wrong with the configuration of this station. ".. minetest.chat_send_player(name, S("Error")..": "..
S("There is something wrong with the configuration of this station.")..
" DEBUG DATA: owner: "..( owner_name or "?").. " DEBUG DATA: owner: "..( owner_name or "?")..
" station_name: "..(station_name or "?").. " station_name: "..(station_name or "?")..
" station_network: "..(station_network or "?").."."); " station_network: "..(station_network or "?")..".");
@ -685,7 +700,8 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
or not( travelnet.targets ) or not( travelnet.targets )
or not( travelnet.targets[ owner_name ] ) or not( travelnet.targets[ owner_name ] )
or not( travelnet.targets[ owner_name ][ station_network ] )) then or not( travelnet.targets[ owner_name ][ station_network ] )) then
minetest.chat_send_player(name, "Error: This travelnet is lacking data and/or improperly configured."); minetest.chat_send_player(name, S("Error")..": "..
S("This travelnet is lacking data and/or improperly configured."));
print( "ERROR: The travelnet at "..minetest.pos_to_string( pos ).." has a problem: ".. print( "ERROR: The travelnet at "..minetest.pos_to_string( pos ).." has a problem: "..
" DATA: owner: "..( owner_name or "?").. " DATA: owner: "..( owner_name or "?")..
" station_name: "..(station_name or "?").. " station_name: "..(station_name or "?")..
@ -707,7 +723,8 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
-- if the target station is gone -- if the target station is gone
if( not( travelnet.targets[ owner_name ][ station_network ][ fields.target ] )) then if( not( travelnet.targets[ owner_name ][ station_network ][ fields.target ] )) then
minetest.chat_send_player(name, "Station '"..( fields.target or "?").." does not exist (anymore?) on this network."); minetest.chat_send_player(name, S("Station '%s'"):format( fields.target or "?").." "..
S("does not exist (anymore?) on this network."));
travelnet.update_formspec( pos, name, nil ); travelnet.update_formspec( pos, name, nil );
return; return;
end end
@ -716,7 +733,7 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
if( not( travelnet.allow_travel( name, owner_name, station_network, station_name, fields.target ))) then if( not( travelnet.allow_travel( name, owner_name, station_network, station_name, fields.target ))) then
return; return;
end end
minetest.chat_send_player(name, "Initiating transfer to station '"..( fields.target or "?").."'.'"); minetest.chat_send_player(name, S("Initiating transfer to station '%s'."):format( fields.target or "?"));
@ -782,7 +799,8 @@ end
travelnet.remove_box = function( pos, oldnode, oldmetadata, digger ) travelnet.remove_box = function( pos, oldnode, oldmetadata, digger )
if( not( oldmetadata ) or oldmetadata=="nil" or not(oldmetadata.fields)) then if( not( oldmetadata ) or oldmetadata=="nil" or not(oldmetadata.fields)) then
minetest.chat_send_player( digger:get_player_name(), "Error: Could not find information about the station that is to be removed."); minetest.chat_send_player( digger:get_player_name(), S("Error")..": "..
S("Could not find information about the station that is to be removed."));
return; return;
end end
@ -797,16 +815,19 @@ travelnet.remove_box = function( pos, oldnode, oldmetadata, digger )
or not( travelnet.targets[ owner_name ] ) or not( travelnet.targets[ owner_name ] )
or not( travelnet.targets[ owner_name ][ station_network ] )) then or not( travelnet.targets[ owner_name ][ station_network ] )) then
minetest.chat_send_player( digger:get_player_name(), "Error: Could not find the station that is to be removed."); minetest.chat_send_player( digger:get_player_name(), S("Error")..": "..
S("Could not find the station that is to be removed."));
return; return;
end end
travelnet.targets[ owner_name ][ station_network ][ station_name ] = nil; travelnet.targets[ owner_name ][ station_network ][ station_name ] = nil;
-- inform the owner -- inform the owner
minetest.chat_send_player( owner_name, "Station '"..station_name.."' has been REMOVED from the network '"..station_network.."'."); minetest.chat_send_player( owner_name, S("Station '%s'"):format(station_name ).." "..
S("has been REMOVED from the network '%s'."):format(station_network));
if( digger ~= nil and owner_name ~= digger:get_player_name() ) then if( digger ~= nil and owner_name ~= digger:get_player_name() ) then
minetest.chat_send_player( digger:get_player_name(), "Station '"..station_name.."' has been REMOVED from the network '"..station_network.."'."); minetest.chat_send_player( digger:get_player_name(), S("Station '%s'"):format(station_name)..
S("has been REMOVED from the network '%s'."):format(station_network));
end end
-- save the updated network data in a savefile over server restart -- save the updated network data in a savefile over server restart
@ -832,11 +853,11 @@ travelnet.can_dig = function( pos, player, description )
end end
if( not( meta ) or not( owner) or owner=='') then if( not( meta ) or not( owner) or owner=='') then
minetest.chat_send_player(name, "This "..description.." has not been configured yet. Please set it up first to claim it. Afterwards you can remove it because you are then the owner."); minetest.chat_send_player(name, S("This %s has not been configured yet. Please set it up first to claim it. Afterwards you can remove it because you are then the owner."):format(description));
return false; return false;
elseif( owner ~= name ) then elseif( owner ~= name ) then
minetest.chat_send_player(name, "This "..description.." belongs to "..tostring( meta:get_string('owner'))..". You can't remove it."); minetest.chat_send_player(name, S("This %s belongs to %s. You can't remove it."):format(description, tostring( meta:get_string('owner'))));
return false; return false;
end end
return true; return true;
@ -895,4 +916,3 @@ end
-- upon server start, read the savefile -- upon server start, read the savefile
travelnet.restore_data(); travelnet.restore_data();

92
locale/de.txt Normal file

@ -0,0 +1,92 @@
# Template
### config.lua ###
### init.lua ###
allows to attach travelnet boxes to travelnets of other players = erlaubt es, Stationen zu den Reisenetzwerken anderer Spieler hinzuzufügen
allows to dig travelnet boxes which belog to nets of other players = erlaubt es, die Reisenetz-Stationen anderer Spieler zu entfernen
[Mod travelnet] Error: Savefile '%s' could not be written. = [Mod travelnet] Fehler: Sicherungsdatei '%s' konnte nicht geschrieben werden.
[Mod travelnet] Error: Savefile '%s' not found. = [Mod travelnet] Fehler: Sicherungsdatei '%s' nicht gefunden.
Back = Zurück
Exit = Ende
Travelnet-box (unconfigured) = Reisenetz-Box (nicht konfiguriert)
Configure this travelnet station = Konfiguration dieser Reisenetz-Box
Name of this station = Name dieser Reisenetz-Box
How do you call this place here? Example: \"my first house\", \"mine\", \"shop\"... = Wie willst du diesen Ort nennen? Beispiel: \"mein erstes Haus\", \"Mine\", \"Laden\"...
Assign to Network: = Station dem folgendem Netzwerk zuweisen:
You can have more than one network. If unsure, use \"%s\" = Du kannst mehrere Netzwerke anlegen. Falls du nicht weißt, was du tun sollst, wähle \"%s\"
Owned by: = Besitzer:
Unless you know what you are doing, leave this empty. = Wenn du nicht weißt, wozu dieses Feld dient, laß es leer.
Help = Hilfe
Save = Speichern
Update failed! Resetting this box on the travelnet. = Aktualisierung gescheitert. Konfiguration der Reisenetz-Box wird zurückgesetzt.
Station '%s' = Station '%s'
has been reattached to the network '%s'. = wurde dem Netzwerk '%s' wieder hinzugefügt.
Locked travelnet. Type /help for help: = Abgeschlossene Reisenetz-Box. Tippe /help für Hilfe:
Punch box to update target list. = Reisenetz-Box mit Linksklick aktualisieren.
Travelnet-Box = Reisenetz-Box
Name of this station: = Name dieser Station:
Assigned to Network: = Zugehöriges Netzwerk:
Click on target to travel there: = Klicke auf das Ziel um dorthin zu reisen:
G = E
This station is already the first one on the list. = Diese Reisenetz-Box ist bereits die erste auf der Liste.
This station is already the last one on the list. = Diese Reisenetz-Box ist bereits die letzte auf der Liste.
Position in list: = Listenposition:
move up = hoch
move down = runter
on travelnet '%s' = im Reisenetzwerk '%s'
owned by %s = Eigentum von %s
ready for usage. Right-click to travel, punch to update. = bereit für die Nutzung. Rechtsklick um zu Reisen, Linksklick für Update.
at %s m = in %s m Höhe
Error = Fehler
Please provide a name for this station. = Bitte gib einen Namen für diese Reisenetz-Box an.
Please provide the name of the network this station ought to be connected to. = Bitte gib einen Namen für das Netzwerk an zu dem diese Reisenetz-Box gehören soll.
There is no player with interact privilege named '%s'. Aborting. = Es gibt keinen Spieler mit interact-Recht names '%s'. Abbruch.
You do not have the travelnet_attach priv which is required to attach your box to the network of someone else. Aborting. = Dir fehlt das travelnet_attach-Recht, welches für das Hinzufügen von Reisenetz-Boxen zu Netzwerken nötig ist, die anderen Spielern gehören. Abbruch.
A station named '%s' already exists on this network. Please choose a diffrent name! = Eine Reisenetz-Box namens '%s' existiert bereits in diesem Netzwerk. Abbruch.
Network '%s' = Netzwerk '%s'
already contains the maximum number (=%s) of allowed stations per network. Please choose a diffrent/new network name. = enthält bereits die maixmale Anzahl (=%s) erlaubert Stationen pro Netzwerk. Bitte wähle ein anderes bzw. neues Netzwerk.
has been added to the network '%s' = wurde an das Netzwerk '%s' angeschlossen.
, which now consists of %s station(s). = , das nun aus %s Station(en) besteht.
Station: = Station:
Network: = Netzwerk:
No help available yet. = Noch keine Hilfe eingebaut.
Please click on the target you want to travel to. = Bitte klicke auf das Ziel zu dem du reisen willst.
There is something wrong with the configuration of this station. = Die Konfiguration dieser Reisenetz-Box ist fehlerhaft.
This travelnet is lacking data and/or improperly configured. = Diese Reisenetz-Box ist fehlerhaft oder unvollständig konfiguriert.
does not exist (anymore?) on this network. = gibt es nicht (mehr?) in diesem Netzwerk.
Initiating transfer to station '%s'. = leite Reise zur Station '%s' ein.
Could not find information about the station that is to be removed. = Konnte keine Informationen über die zu entfernende Station finden.
Could not find the station that is to be removed. = Konnte die zu entfernende Station nicht finden.
has been REMOVED from the network '%s'. = wurde vom Netzwerk '%s' ENTFERNT.
This %s has not been configured yet. Please set it up first to claim it. Afterwards you can remove it because you are then the owner. = Diese Reisenetz-Box wurde noch nicht konfiguriert. Bitte konfiguriere sie um sie in Besitz zu nehmen. Anschließend kannst du sie auch wieder entfernen da du dann der Besitzer bist.
This %s belongs to %s. You can't remove it. = Diese Reisenetz-Box gehört %s. Du kannst sie nicht entfernen.
### travelnet.lua ###
Not enough vertical space to place the travelnet box! = Nicht genug Platz (vertikal) um die Reisenetz-Box zu setzen!
### elevator.lua ###
Congratulations! This is your first elevator. You can build an elevator network by placing further elevators somewhere above or below this one. Just make sure that the x and z coordinate are the same. =
This elevator will automaticly connect to the other elevators you have placed at diffrent heights. Just enter a station name and click on \"store\" to set it up. Or just punch it to set the height as station name. = Dieser Aufzug wird sich automatisch mit anderen Aufzügen verbinden die du auf unterschiedlichen Höhen positioniert hast. Gib einfach einen Namen für diese Station hier ein und klicke auf \"Speichern\" um die Station einzurichten. Oder mache einen Linksklick um die Höhe als Stationsname zu setzen.
Your nearest elevator network is located = Dein nächstgelegenes Aufzugs-Netzwerk befindet sich
m behind this elevator and = m hinter diesem Aufzug und
m in front of this elevator and = m vor diesem Aufzug und
m to the left = m links
m to the right = m rechts
, located at x = , an Position x
This elevator here will start a new shaft/network. = Dieser Aufzug hier wird einen neuen Schaft bzw. ein neues Netzwerk erstellen.
This is your first elevator. It differs from travelnet networks by only allowing movement in vertical direction (up or down). All further elevators which you will place at the same x,z coordinates at differnt heights will be able to connect to this elevator. = Dies ist dein erster Aufzug. Der Aufzug unterscheidet sich von Reisenetz-Boxen insofern als daß er nur Reisen in vertikaler Richtung (hoch und runter) erlaubt. Alle folgenden Aufzüge, die du an die selben x,z Koordinaten auf verschiedenen Höhenpositionen setzen wirst, werden sich automatisch mit diesem Aufzug verbinden.
Elevator = Aufzug
Elevator (unconfigured) = Aufzug (nicht konfiguriert)
### doors.lua ###
elevator door (open) = Aufzugstür (offen)
elevator door (closed) = Aufzugstür (geschlossen)

92
locale/template.txt Normal file

@ -0,0 +1,92 @@
# Template
### config.lua ###
### init.lua ###
allows to attach travelnet boxes to travelnets of other players =
allows to dig travelnet boxes which belog to nets of other players =
[Mod travelnet] Error: Savefile '%s' could not be written. =
[Mod travelnet] Error: Savefile '%s' not found. =
Back =
Exit =
Travelnet-box (unconfigured) =
Configure this travelnet station =
Name of this station =
How do you call this place here? Example: \"my first house\", \"mine\", \"shop\"... =
Assign to Network: =
You can have more than one network. If unsure, use \"%s\" =
Owned by: =
Unless you know what you are doing, leave this empty. =
Help =
Save =
Update failed! Resetting this box on the travelnet. =
Station '%s' =
has been reattached to the network '%s'. =
Locked travelnet. Type /help for help: =
Punch box to update target list. =
Travelnet-Box =
Name of this station: =
Assigned to Network: =
Click on target to travel there: =
G =
This station is already the first one on the list. =
This station is already the last one on the list. =
Position in list: =
move up =
move down =
on travelnet '%s' =
owned by %s =
ready for usage. Right-click to travel, punch to update. =
at %s m =
Error =
Please provide a name for this station. =
Please provide the name of the network this station ought to be connected to. =
There is no player with interact privilege named '%s'. Aborting. =
You do not have the travelnet_attach priv which is required to attach your box to the network of someone else. Aborting. =
A station named '%s' already exists on this network. Please choose a diffrent name! =
Network '%s' =
already contains the maximum number (=%s) of allowed stations per network. Please choose a diffrent/new network name. =
has been added to the network '%s' =
, which now consists of %s station(s). =
Station: =
Network: =
No help available yet. =
Please click on the target you want to travel to. =
There is something wrong with the configuration of this station. =
This travelnet is lacking data and/or improperly configured. =
does not exist (anymore?) on this network. =
Initiating transfer to station '%s'. =
Could not find information about the station that is to be removed. =
Could not find the station that is to be removed. =
has been REMOVED from the network '%s'. =
This %s has not been configured yet. Please set it up first to claim it. Afterwards you can remove it because you are then the owner. =
This %s belongs to %s. You can't remove it. =
### travelnet.lua ###
Not enough vertical space to place the travelnet box! =
### elevator.lua ###
Congratulations! This is your first elevator. You can build an elevator network by placing further elevators somewhere above or below this one. Just make sure that the x and z coordinate are the same. =
This elevator will automaticly connect to the other elevators you have placed at diffrent heights. Just enter a station name and click on \"store\" to set it up. Or just punch it to set the height as station name. =
Your nearest elevator network is located =
m behind this elevator and =
m in front of this elevator and =
m to the left =
m to the right =
, located at x =
This elevator here will start a new shaft/network. =
This is your first elevator. It differs from travelnet networks by only allowing movement in vertical direction (up or down). All further elevators which you will place at the same x,z coordinates at differnt heights will be able to connect to this elevator. =
Elevator =
Elevator (unconfigured) =
### doors.lua ###
elevator door (open) =
elevator door (closed) =

@ -3,9 +3,11 @@
-- digging of such a travelnet is limited to the owner and to people with the travelnet_remove priv (useful for admins to clean up) -- digging of such a travelnet is limited to the owner and to people with the travelnet_remove priv (useful for admins to clean up)
-- (this can be overrided in config.lua) -- (this can be overrided in config.lua)
-- Author: Sokomine -- Author: Sokomine
local S = travelnet.S;
minetest.register_node("travelnet:travelnet", { minetest.register_node("travelnet:travelnet", {
description = "Travelnet box", description = S("Travelnet-Box"),
drawtype = "mesh", drawtype = "mesh",
mesh = "travelnet.obj", mesh = "travelnet.obj",
@ -81,7 +83,7 @@ minetest.register_node("travelnet:travelnet", {
local pos = pointed_thing.above; local pos = pointed_thing.above;
if( minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" ) then if( minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" ) then
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place the travelnet box!' ) minetest.chat_send_player( placer:get_player_name(), S('Not enough vertical space to place the travelnet box!'))
return; return;
end end
return minetest.item_place(itemstack, placer, pointed_thing); return minetest.item_place(itemstack, placer, pointed_thing);