update: travelnet

This commit is contained in:
Sergei Mozhaisky 2020-05-22 12:31:01 +00:00
parent 5e4f772139
commit ffcca7d873
26 changed files with 604 additions and 96 deletions

24
travelnet/.luacheckrc Normal file
View File

@ -0,0 +1,24 @@
unused_args = false
globals = {
"travelnet"
}
read_globals = {
-- Stdlib
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
-- mod deps
"technic_cnc", "technic",
"loot", "mesecon", "skybox",
"xp_redo",
-- Minetest
"minetest",
"vector", "ItemStack",
"dump", "screwdriver",
-- Deps
"default", "creative", "locks", "intllib"
}

View File

@ -1,6 +1,8 @@
# TravelNet
How this works:
![](https://github.com/mt-mods/travelnet/workflows/luacheck/badge.svg)
How this works:
- craft it by filling the right and left row with glass; place in the middle row (from top to bottom): steel, mese, steel
- place the travelnet box somewhere

View File

@ -90,7 +90,7 @@ end
-- if you want to allow *everybody* to attach stations to all nets, let the
-- function always return true;
-- if the function returns false, players with the travelnet_attach priv
-- can still add stations to that network
-- can still add stations to that network
travelnet.allow_attach = function( player_name, owner_name, network_name )
if network_name == "TNet" then
@ -103,7 +103,7 @@ end
-- if this returns true, a player named player_name can remove a travelnet station
-- from network_name (owned by owner_name) even though he is neither the owner nor
-- has the travelnet_remove priv
travelnet.allow_dig = function( player_name, owner_name, network_name )
travelnet.allow_dig = function( player_name, owner_name, network_name, pos )
return false;
end
@ -116,7 +116,8 @@ end
-- usage of stations to players in the same fraction on PvP servers
travelnet.allow_travel = function( player_name, owner_name, network_name, station_name_start, station_name_target )
--minetest.chat_send_player( player_name, "Player "..tostring( player_name ).." tries to use station "..tostring( station_name_start )..
--minetest.chat_send_player( player_name, "Player "..tostring( player_name ).." tries to use station "..
-- tostring( station_name_start )..
-- " on network "..tostring( network_name ).." owned by "..tostring( owner_name ).." in order to travel to "..
-- tostring( station_name_target )..".");

View File

@ -90,7 +90,7 @@ end
-- if you want to allow *everybody* to attach stations to all nets, let the
-- function always return true;
-- if the function returns false, players with the travelnet_attach priv
-- can still add stations to that network
-- can still add stations to that network
travelnet.allow_attach = function( player_name, owner_name, network_name )
return false;
@ -100,7 +100,7 @@ end
-- if this returns true, a player named player_name can remove a travelnet station
-- from network_name (owned by owner_name) even though he is neither the owner nor
-- has the travelnet_remove priv
travelnet.allow_dig = function( player_name, owner_name, network_name )
travelnet.allow_dig = function( player_name, owner_name, network_name, pos )
return false;
end
@ -113,7 +113,8 @@ end
-- usage of stations to players in the same fraction on PvP servers
travelnet.allow_travel = function( player_name, owner_name, network_name, station_name_start, station_name_target )
--minetest.chat_send_player( player_name, "Player "..tostring( player_name ).." tries to use station "..tostring( station_name_start )..
--minetest.chat_send_player( player_name, "Player "..tostring( player_name ).." tries to use station "..
-- tostring( station_name_start )..
-- " on network "..tostring( network_name ).." owned by "..tostring( owner_name ).." in order to travel to "..
-- tostring( station_name_target )..".");

View File

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

View File

@ -16,7 +16,8 @@ travelnet.register_door = function( node_base_name, def_tiles, material )
is_ground_content = true,
-- only the closed variant is in creative inventory
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1},
-- larger than one node but slightly smaller than a half node so that wallmounted torches pose no problem
-- larger than one node but slightly smaller than a half node so
-- that wallmounted torches pose no problem
node_box = {
type = "fixed",
fixed = {
@ -93,7 +94,7 @@ end
-- actually register the doors
-- (but only if the materials for them exist)
if( minetest.registered_nodes["default:glass"]) then
if(minetest.get_modpath("default")) then
travelnet.register_door( "travelnet:elevator_door_steel", {"default_stone.png"}, "default:steel_ingot");
travelnet.register_door( "travelnet:elevator_door_glass", {"travelnet_elevator_door_glass.png"}, "default:glass");
travelnet.register_door( "travelnet:elevator_door_tin", {"default_clay.png"}, "default:tin_ingot");

View File

@ -31,7 +31,7 @@ travelnet.show_nearest_elevator = function( pos, owner_name, param2 )
local nearest_dist = 100000000;
local nearest_dist_x = 0;
local nearest_dist_z = 0;
for network_name, data in pairs( travelnet.targets[ owner_name ] ) do
for target_network_name, data in pairs( travelnet.targets[ owner_name ] ) do
local station_name = next( data, nil );
if( station_name and data[ station_name ][ "nr" ] and data[ station_name ].pos) then
local station_pos = data[ station_name ].pos;
@ -43,7 +43,7 @@ travelnet.show_nearest_elevator = function( pos, owner_name, param2 )
nearest_dist = dist;
nearest_dist_x = station_pos.x - pos.x;
nearest_dist_z = station_pos.z - pos.z;
nearest_name = network_name;
nearest_name = target_network_name;
end
end
end
@ -106,11 +106,11 @@ minetest.register_node("travelnet:elevator", {
fixed = {
{ 0.48, -0.5,-0.5, 0.5, 0.5, 0.5},
{-0.5 , -0.5, 0.48, 0.48, 0.5, 0.5},
{-0.5 , -0.5, 0.48, 0.48, 0.5, 0.5},
{-0.5, -0.5,-0.5 ,-0.48, 0.5, 0.5},
--groundplate to stand on
{ -0.5,-0.5,-0.5,0.5,-0.48, 0.5},
{ -0.5,-0.5,-0.5,0.5,-0.48, 0.5},
},
},
@ -128,19 +128,18 @@ minetest.register_node("travelnet:elevator", {
meta:set_string("station_network","");
meta:set_string("owner", placer:get_player_name() );
-- request initial data
meta:set_string("formspec",
meta:set_string("formspec",
"size[12,10]"..
"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,7.6;6,0.7;owner_name;(optional) owned by:;]"..
"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 p2 = minetest.dir_to_facedir(placer:get_look_dir())
minetest.add_node(p, {name="travelnet:elevator_top", paramtype2="facedir", param2=p2})
travelnet.show_nearest_elevator( pos, placer:get_player_name(), p2 );
local top_pos = {x=pos.x, y=pos.y+1, z=pos.z}
minetest.set_node(top_pos, {name="travelnet:hidden_top"})
travelnet.show_nearest_elevator( pos, placer:get_player_name(), minetest.dir_to_facedir(placer:get_look_dir()));
end,
on_receive_fields = travelnet.on_receive_fields,
on_punch = function(pos, node, puncher)
travelnet.update_formspec(pos, puncher:get_player_name())
@ -162,22 +161,24 @@ minetest.register_node("travelnet:elevator", {
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above;
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
if( node ~= nil and node.name ~= "air" and node.name ~= 'travelnet:elevator_top') then
minetest.chat_send_player( placer:get_player_name(), S('Not enough vertical space to place the travelnet box!'))
local def = minetest.registered_nodes[node.name]
-- leftover top nodes can be removed by placing a new elevator underneath
if (not def or not def.buildable_to) and node.name ~= "travelnet:hidden_top" then
minetest.chat_send_player(
placer:get_player_name(),
S('Not enough vertical space to place the travelnet box!')
)
return;
end
return minetest.item_place(itemstack, placer, pointed_thing);
end,
on_destruct = function(pos)
local p = {x=pos.x, y=pos.y+1, z=pos.z}
minetest.remove_node(p)
pos = {x=pos.x, y=pos.y+1, z=pos.z}
minetest.remove_node(pos)
end
})
minetest.register_alias("travelnet:elevator_top", "air")
--if( minetest.get_modpath("technic") ~= nil ) then
-- minetest.register_craft({
-- output = "travelnet:elevator",
@ -193,4 +194,3 @@ minetest.register_alias("travelnet:elevator_top", "air")
recipe = travelnet.elevator_recipe,
})
--end

View File

@ -59,7 +59,8 @@
05.08.13 - fixed possible crash when the node in front of the travelnet is unknown
26.06.13 - added inventory image for elevator (created by VanessaE)
21.06.13 - bugfix: wielding an elevator while digging a door caused the elevator_top to be placed
- leftover floating elevator_top nodes can be removed by placing a new travelnet:elevator underneath them and removing that afterwards
- leftover floating elevator_top nodes can be removed by placing a new
travelnet:elevator underneath them and removing that afterwards
- homedecor-doors are now opened and closed correctly as well
- removed nodes that are not intended for manual use from creative inventory
- improved naming of station levels for the elevator
@ -99,9 +100,15 @@ travelnet.path = minetest.get_modpath(minetest.get_current_modname())
local S = dofile(travelnet.path .. "/intllib.lua")
travelnet.S = 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_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});
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
dofile(travelnet.path.."/config.lua"); -- the normal, default travelnet
@ -123,7 +130,7 @@ end
travelnet.restore_data = function()
local file = io.open( travelnet.mod_data_path, "r" );
if( not file ) then
print(S("[Mod travelnet] Error: Savefile '%s' not found.")
@ -194,7 +201,7 @@ travelnet.show_current_formspec = function( pos, meta, player_name )
return;
end
-- we need to supply the position of the travelnet box
formspec = meta:get_string("formspec")..
local formspec = meta:get_string("formspec")..
"field[20,20;0.1,0.1;pos2str;Pos;".. minetest.pos_to_string( pos ).."]";
-- show the formspec manually
minetest.show_formspec(player_name, "travelnet:show", formspec);
@ -205,6 +212,10 @@ end
travelnet.form_input_handler = function( player, formname, fields)
if(formname == "travelnet:show" and fields and fields.pos2str) then
local pos = minetest.string_to_pos( fields.pos2str );
if not pos then
return
end
if( locks and (fields.locks_config or fields.locks_authorize)) then
return locks:lock_handle_input( pos, formname, fields, player )
end
@ -234,21 +245,20 @@ travelnet.reset_formspec = function( meta )
meta:set_string("owner", "");
-- some players seem to be confused with entering network names at first; provide them
-- with a default name
if( not( station_network ) or station_network == "" ) then
station_network = "net1";
end
local station_network = "net1";
-- request initinal data
meta:set_string("formspec",
"size[10,6.0]"..
"label[2.0,0.0;--> "..S("Configure this travelnet station").." <--]"..
"button_exit[8.0,0.0;2.2,0.7;station_dig;"..S("Remove station").."]"..
"field[0.3,1.2;9,0.9;station_name;"..S("Name of this station")..":;"..
minetest.formspec_escape(station_name or "").."]"..
"field[0.3,1.2;9,0.9;station_name;"..S("Name of this station")..":;]"..
"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;"..S("Assign to Network:")..";"..
minetest.formspec_escape(station_network or "").."]"..
"label[0.3,3.1;"..S("You can have more than one network. If unsure, use \"%s\""):format(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;"..S("Owned by:")..";]"..
"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;"..S("Help").."]"..
@ -336,13 +346,17 @@ travelnet.update_formspec = function( pos, puncher_name, fields )
trheight = "11.5";
end
local formspec = "size[12,"..trheight.."]"..
"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;"..S("Name of this station:").."]".."label[6.3,0.4;"..minetest.formspec_escape(station_name 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;"..S("Owned by:").."]" .."label[6.3,1.2;"..minetest.formspec_escape(owner_name or "?").."]"..
"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;"..S("Name of this station:").."]"..
"label[6.3,0.4;"..minetest.formspec_escape(station_name 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;"..S("Owned by:").."]"..
"label[6.3,1.2;"..minetest.formspec_escape(owner_name or "?").."]"..
"label[3.3,1.6;"..S("Click on target to travel there:").."]"..
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 y = 0;
local i = 0;
@ -381,8 +395,10 @@ travelnet.update_formspec = function( pos, puncher_name, fields )
else
-- sort the table according to the timestamp (=time the station was configured)
table.sort( stations, function(a,b) return travelnet.targets[ owner_name ][ station_network ][ a ].timestamp <
travelnet.targets[ owner_name ][ station_network ][ b ].timestamp end);
table.sort( stations, function(a,b)
return travelnet.targets[ owner_name ][ station_network ][ a ].timestamp <
travelnet.targets[ owner_name ][ station_network ][ b ].timestamp
end);
end
-- does the player want to move this station one position up in the list?
@ -403,7 +419,7 @@ travelnet.update_formspec = function( pos, puncher_name, fields )
end
end
local swap_with_pos = -1;
local swap_with_pos;
if( fields.move_up ) then
swap_with_pos = current_pos - 1;
else
@ -463,17 +479,13 @@ travelnet.update_formspec = function( pos, puncher_name, fields )
formspec = formspec .."button_exit["..(x)..","..(y+2.5)..";1,0.5;open_door;<>]"..
"label["..(x+0.9)..","..(y+2.35)..";"..tostring( k ).."]";
elseif( is_elevator ) then
formspec = formspec .."button_exit["..(x)..","..(y+2.5)..";1,0.5;target;"..tostring( travelnet.targets[ owner_name ][ station_network ][ k ].nr ).."]"..
"label["..(x+0.9)..","..(y+2.35)..";"..tostring( k ).."]";
formspec = formspec .."button_exit["..(x)..","..(y+2.5)..";1,0.5;target;"..
tostring( travelnet.targets[ owner_name ][ station_network ][ k ].nr ).."]"..
"label["..(x+0.9)..","..(y+2.35)..";"..tostring( k ).."]";
else
formspec = formspec .."button_exit["..(x)..","..(y+2.5)..";4,0.5;target;"..k.."]";
end
-- if( is_elevator ) then
-- formspec = formspec ..' ('..tostring( travelnet.targets[ owner_name ][ station_network ][ k ].pos.y )..'m)';
-- end
-- formspec = formspec .. ']';
y = y+1;
--x = x+4;
end
@ -595,8 +607,10 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m
meta:set_string("formspec",
"size[12,10]"..
"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;"..S("Network:")..";"..minetest.formspec_escape(meta:get_string("station_network")).."]" );
"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;"..S("Network:")..";"..
minetest.formspec_escape(meta:get_string("station_network")).."]" );
-- display a list of all stations that can be reached from here
travelnet.update_formspec( pos, player_name, nil );
@ -625,7 +639,11 @@ travelnet.open_close_door = function( pos, player, mode )
end
local door_node = minetest.get_node( pos2 );
if( door_node ~= nil and door_node.name ~= 'ignore' and door_node.name ~= 'air' and minetest.registered_nodes[ door_node.name ] ~= nil and minetest.registered_nodes[ door_node.name ].on_rightclick ~= nil) then
if door_node ~= nil and
door_node.name ~= 'ignore' and
door_node.name ~= 'air' and
minetest.registered_nodes[ door_node.name ] ~= nil and
minetest.registered_nodes[ door_node.name ].on_rightclick ~= nil then
-- at least for homedecor, same facedir would mean "door closed"
@ -690,9 +708,9 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
-- the player wants to remove the station
if( fields.station_dig ) then
local owner = meta:get_string( "owner" );
local network_name = meta:get_string("station_network")
local node = minetest.get_node(pos)
local description = "station"
local description
if( node and node.name and node.name == "travelnet:travelnet") then
description = "travelnet box"
elseif( node and node.name and node.name == "travelnet:elevator") then
@ -706,13 +724,18 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
-- players with travelnet_remove priv can dig the station
if( not(minetest.check_player_privs(name, {travelnet_remove=true}))
-- the function travelnet.allow_dig(..) may allow additional digging
and not(travelnet.allow_dig( name, owner, network_name ))
and not(travelnet.allow_dig( name, owner, network_name, pos ))
-- the owner can remove the station
and owner ~= name
-- stations without owner can be removed by anybody
and owner ~= "") then
minetest.chat_send_player(name, S("This %s belongs to %s. You can't remove it."):format(description, tostring( meta:get_string('owner'))));
return
minetest.chat_send_player(name,
S("This %s belongs to %s. You can't remove it."):format(
description,
tostring( meta:get_string('owner'))
)
);
return
end
local pinv = player:get_inventory()
@ -800,7 +823,7 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
local this_node = minetest.get_node( pos );
if( this_node ~= nil and this_node.name == 'travelnet:elevator' ) then
for k,v in pairs( travelnet.targets[ owner_name ][ station_network ] ) do
if( travelnet.targets[ owner_name ][ station_network ][ k ].nr --..' ('..tostring( travelnet.targets[ owner_name ][ station_network ][ k ].pos.y )..'m)'
if( travelnet.targets[ owner_name ][ station_network ][ k ].nr
== fields.target) then
fields.target = k;
end
@ -840,17 +863,37 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
travelnet.open_close_door( pos, player, 1 );
-- transport the player to the target location
local target_pos = travelnet.targets[ owner_name ][ station_network ][ fields.target ].pos;
player:moveto( target_pos, false);
if( travelnet.travelnet_effect_enabled ) then
minetest.add_entity( {x=target_pos.x,y=target_pos.y+0.5,z=target_pos.z}, "travelnet:effect"); -- it self-destructs after 20 turns
-- may be 0.0 for some versions of MT 5 player model
local player_model_bottom = tonumber(minetest.settings:get("player_model_bottom")) or -.5;
local player_model_vec = vector.new(0, player_model_bottom, 0);
local target_pos = travelnet.targets[ owner_name ][ station_network ][ fields.target ].pos;
local top_pos = {x=pos.x, y=pos.y+1, z=pos.z}
local top_node = minetest.get_node(top_pos)
if top_node.name ~= "travelnet:hidden_top" then
local def = minetest.registered_nodes[top_node.name]
if def and def.buildable_to then
minetest.set_node(top_pos, {name="travelnet:hidden_top"})
end
end
player:move_to( vector.add(target_pos, player_model_vec), false);
if( travelnet.enable_travelnet_effect ) then
-- it self-destructs after 20 turns
minetest.add_entity( {x=target_pos.x,y=target_pos.y+0.5,z=target_pos.z}, "travelnet:effect");
end
-- check if the box has at the other end has been removed.
local node2 = minetest.get_node_or_nil( target_pos );
if( node2 ~= nil and node2.name ~= 'ignore' and node2.name ~= 'travelnet:travelnet' and node2.name ~= 'travelnet:elevator' and node2.name ~= "locked_travelnet:travelnet" and node2.name ~= "travelnet:travelnet_private") then
if node2 ~= nil and
node2.name ~= 'ignore' and
node2.name ~= 'travelnet:travelnet' and
node2.name ~= 'travelnet:elevator' and
node2.name ~= "locked_travelnet:travelnet" and
node2.name ~= "travelnet:travelnet_private" then
-- provide information necessary to identify the removed box
local oldmetadata = { fields = { owner = owner_name,
@ -859,7 +902,7 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
travelnet.remove_box( target_pos, nil, oldmetadata, player );
-- send the player back as there's no receiving travelnet
player:moveto( pos, false );
player:move_to( pos, false );
else
travelnet.rotate_player( target_pos, player, 0 )
@ -974,23 +1017,47 @@ travelnet.can_dig_old = function( pos, player, description )
-- players with that priv can dig regardless of owner
if( minetest.check_player_privs(name, {travelnet_remove=true})
or travelnet.allow_dig( name, owner, network_name )) then
or travelnet.allow_dig( name, owner, network_name, pos )) then
return true;
end
if( not( meta ) or not( owner) or owner=='') then
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));
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;
elseif( owner ~= name ) then
minetest.chat_send_player(name, S("This %s belongs to %s. You can't remove it."):format(description, tostring( meta:get_string('owner'))));
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;
end
return true;
end
-- invisible node to place inside top of travelnet box and elevator
minetest.register_node("travelnet:hidden_top", {
drawtype = "nodebox",
paramtype = "light",
sunlight_propagates = true,
pointable = false,
diggable = false,
drop = "",
groups = {not_in_creative_inventory = 1},
tiles = {"travelnet_blank.png"},
node_box = {
type = "fixed",
fixed = { -0.5, 0.45,-0.5,0.5, 0.5, 0.5},
},
collision_box = {
type = "fixed",
fixed = { -0.5, 0.45,-0.5,0.5, 0.5, 0.5},
},
})
if( travelnet.travelnet_effect_enabled ) then
@ -1015,7 +1082,7 @@ if( travelnet.travelnet_effect_enabled ) then
on_step = function( self, dtime )
-- this is supposed to be more flickering than smooth animation
self.object:setyaw( self.object:getyaw()+1);
self.object:set_yaw( self.object:get_yaw()+1);
self.anz_rotations = self.anz_rotations + 1;
-- eventually self-destruct
if( self.anz_rotations > 15 ) then
@ -1033,11 +1100,13 @@ if( travelnet.elevator_enabled ) then
dofile(travelnet.path.."/elevator.lua"); -- allows up/down transfers only
end
if( travelnet.doors_enabled ) then
dofile(travelnet.path.."/doors.lua"); -- doors that open and close automaticly when the travelnet or elevator is used
-- doors that open and close automaticly when the travelnet or elevator is used
dofile(travelnet.path.."/doors.lua");
end
if( travelnet.abm_enabled ) then
dofile(travelnet.path.."/restore_network_via_abm.lua"); -- restore travelnet data when players pass by broken networks
if( travelnet.enable_abm ) then
-- restore travelnet data when players pass by broken networks
dofile(travelnet.path.."/restore_network_via_abm.lua");
end
-- upon server start, read the savefile

401
travelnet/locale/es.po Normal file
View File

@ -0,0 +1,401 @@
# Spanish translation for the travelnet mod.
# Copyright (C) 2018 Sokomine
# This file is distributed under the same license as the travelnet package.
#
msgid ""
msgstr ""
"Project-Id-Version: travelnet\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-05 14:34+0200\n"
"PO-Revision-Date: 2018-04-05 14:34+0200\n"
"Last-Translator: Diego Martínez <lkaezadl3@yahoo.com>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: doors.lua
msgid "elevator door (open)"
msgstr "puerta de elevador (abierta)"
#: doors.lua
msgid "elevator door (closed)"
msgstr "puerta de elevador (cerrada)"
#: elevator.lua
msgid ""
"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."
msgstr ""
"¡Felicidades! Éste es tu primer elevador. Puedes construir una red de "
"elevadores colocando más elevadores en algún lugar arriba o abajo de éste. "
"asegúrate de que las coordenadas X y Z sean las mismas."
#: elevator.lua
msgid ""
"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."
msgstr ""
"Éste elevador se conectará automáticamente a otros elevadores que hayas "
"colocado a diferentes alturas. Simplemente ingresa un nombre para la "
"estación y haz clic en \"Guardar\" para configurarlo, o golpéalo para usar "
"la altura como nombre."
#: elevator.lua
msgid "Your nearest elevator network is located"
msgstr "La red de elevadores más cercana se ubica"
#: elevator.lua
msgid "m behind this elevator and"
msgstr "m detrás de éste elevador y"
#: elevator.lua
msgid "m in front of this elevator and"
msgstr "m delante de éste elevador y"
#: elevator.lua
msgid " ERROR"
msgstr " ERROR"
#: elevator.lua
msgid "m to the left"
msgstr "m a la izquierda"
#: elevator.lua
msgid "m to the right"
msgstr "m a la derecha"
#: elevator.lua
msgid ", located at x"
msgstr ", ubicado en x"
#: elevator.lua
msgid "This elevator here will start a new shaft/network."
msgstr "Éste elevador comenzará una nueva red."
#: elevator.lua
msgid ""
"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."
msgstr ""
"Éste es tu primer elevador. Se diferencia de las cabinas de viaje en que "
"solamente permite movimiento vertical (arriba o abajo). Los elevadores que "
"coloque en las mismas coordenadas X,Z se conectarán a éste elevador."
#: elevator.lua
msgid "Elevator"
msgstr "Elevador"
#: elevator.lua
msgid "Elevator (unconfigured)"
msgstr "Elevador (sin configurar)"
#: elevator.lua init.lua
msgid "Name of this station:"
msgstr "Nombre de ésta estación:"
#: elevator.lua
msgid "Store"
msgstr "Guardar"
#: elevator.lua travelnet.lua
msgid "Not enough vertical space to place the travelnet box!"
msgstr ""
"¡No hay espacio vertical suficiente para colocar la cabina de viaje!"
#: init.lua
msgid "allows to attach travelnet boxes to travelnets of other players"
msgstr "permite adjuntar cajas de viaje a redes de otros jugadores"
#: init.lua
msgid "allows to dig travelnet boxes which belog to nets of other players"
msgstr ""
"permite cavar cabinas de viaje pertenecientes a redes de otros jugadores"
#: init.lua
#, lua-format
msgid "[Mod travelnet] Error: Savefile '%s' could not be written."
msgstr "[Mod travelnet] Error: No se pudo escribir '%s'."
#: init.lua
#, lua-format
msgid "[Mod travelnet] Error: Savefile '%s' not found."
msgstr "[Mod travelnet] Error: No se pudo encontrar '%s'."
#: init.lua
msgid "Back"
msgstr "Atras"
#: init.lua
msgid "Exit"
msgstr "Salir"
#: init.lua
msgid "Travelnet-box (unconfigured)"
msgstr "Cabina de viaje (sin configurar)"
#: init.lua
msgid "Configure this travelnet station"
msgstr "Configurar ésta estación"
#: init.lua
msgid "Name of this station"
msgstr "Nombre de ésta estación"
#: init.lua
msgid ""
"How do you call this place here? Example: \"my first house\", \"mine\", "
"\"shop\"..."
msgstr ""
"¿Cómo llamaras a éste lugar? Por ejemplo: \"mi casa\", \"mina\", "
"\"tienda\"..."
#: init.lua
msgid "Assign to Network:"
msgstr "Asignar a la red:"
#: init.lua
#, lua-format
msgid "You can have more than one network. If unsure, use \"%s\""
msgstr ""
"Puedes tener más de una red. Si no estás seguro, usa \"%s\""
#: init.lua
msgid "Owned by:"
msgstr "Propiedad de:"
#: init.lua
msgid "Unless you know what you are doing, leave this empty."
msgstr "Deja éste campo vacío a menos que sepas lo que haces."
#: init.lua
msgid "Help"
msgstr "Ayuda"
#: init.lua
msgid "Save"
msgstr "Guardar"
#: init.lua
msgid "Update failed! Resetting this box on the travelnet."
msgstr "¡Actualización fallida! Reiniciando ésta cabina de viaje."
#: init.lua
#, lua-format
msgid "Station '%s'"
msgstr "Estación '%s'"
#: init.lua
#, lua-format
msgid " has been reattached to the network '%s'."
msgstr " ha sido reacoplado a la red '%s'."
#: init.lua
msgid "Locked travelnet. Type /help for help:"
msgstr "Cabins de viaje bloqueada. Escriba /help para ver la ayuda:"
#: init.lua travelnet.lua
msgid "Travelnet-Box"
msgstr "Cabina de viaje"
#: init.lua
msgid "Punch box to update target list."
msgstr "Golpea la cabina para actualizar la lista de destinos."
#: init.lua
msgid "Assigned to Network:"
msgstr "Asignado a la red:"
#: init.lua
msgid "Click on target to travel there:"
msgstr "Has clic en un destino para viajar allí:"
#: init.lua
msgid "G"
msgstr "G"
#: init.lua
msgid "This station is already the first one on the list."
msgstr "Ésta estación ya es la primera en la lista."
#: init.lua
msgid "This station is already the last one on the list."
msgstr "Ésta estación ya es la última en la lista."
#: init.lua
msgid "Position in list:"
msgstr "Posición en la lista:"
#: init.lua
msgid "move up"
msgstr "subir"
#: init.lua
msgid "move down"
msgstr "bajar"
#: init.lua
#, lua-format
msgid "on travelnet '%s'"
msgstr "en la red '%s'"
#: init.lua
#, lua-format
msgid "(owned by %s)"
msgstr "(pertenece a %s)"
#: init.lua
msgid "ready for usage. Right-click to travel, punch to update."
msgstr ""
"listo para usar. Haz clic derecho para viajar, golpea para actualizar."
#: init.lua
#, lua-format
msgid "at %s m"
msgstr "a %s m"
#: init.lua
msgid "Error"
msgstr "Error"
#: init.lua
msgid "Please provide a name for this station."
msgstr ""
#: init.lua
msgid ""
"Please provide the name of the network this station ought to be connected to."
msgstr ""
"Por favor especifique el nombre de la red a la cual conectarse."
#: init.lua
#, lua-format
msgid "There is no player with interact privilege named '%s'. Aborting."
msgstr ""
"No hay un jugador llamado '%s' con privilegios de interacción. Abortando."
#: init.lua
msgid ""
"You do not have the travelnet_attach priv which is required to attach your "
"box to the network of someone else. Aborting."
msgstr ""
"No tienes el privilegio 'travelnet_attach' requerido para acoplar tu "
"cabina a la red de otros. Abortando."
#: init.lua
#, lua-format
msgid ""
"A station named '%s' already exists on this network. Please choose a "
"diffrent name!"
msgstr ""
"Yes existe una estación llamada '%s' en ésta red. Por favor, ¡elige un "
"nombre diferente!"
#: init.lua
#, lua-format
msgid "Network '%s',"
msgstr "La red '%s',"
#: init.lua
#, lua-format
msgid ""
"already contains the maximum number (=%s) of allowed stations per network. "
"Please choose a diffrent/new network name."
msgstr ""
"ya contiene la cantidad máxima (%s) de estaciones permitidas. Por favor "
"elige un nombre de red diferente/nuevo."
#: init.lua
#, lua-format
msgid "has been added to the network '%s'"
msgstr "ha sido añadida a la red '%s'"
#: init.lua
#, lua-format
msgid ", which now consists of %s station(s)."
msgstr ", la cual consta de %s estación(es)."
#: init.lua
msgid "Station:"
msgstr "Estación:"
#: init.lua
msgid "Network:"
msgstr "Red:"
#: init.lua
msgid "No help available yet."
msgstr "No hay ayuda disponible aún."
#: init.lua
msgid "Please click on the target you want to travel to."
msgstr "Por favor haz clic en el destino al cual quieres viajar."
#: init.lua
msgid "There is something wrong with the configuration of this station."
msgstr "Excuse algún error en la configuración de ésta estación."
#: init.lua
msgid "This travelnet is lacking data and/or improperly configured."
msgstr ""
"A ésta red le faltan datos y/o no ha sido configurada apropiadamente."
#: init.lua
msgid "does not exist (anymore?) on this network."
msgstr "ya no existe (mas?) en ésta red."
#: init.lua
#, lua-format
msgid "Initiating transfer to station '%s'."
msgstr "Iniciando transferencia a la estación '%s'."
#: init.lua
msgid "Could not find information about the station that is to be removed."
msgstr "No se encontró información acerca de la estación a quitar."
#: init.lua
msgid "Could not find the station that is to be removed."
msgstr "No se encontró la estación a quitar."
#: init.lua
#, lua-format
msgid "has been REMOVED from the network '%s'."
msgstr "ha sido QUITADA de la red '%s'."
#: init.lua
#, lua-format
msgid ""
"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."
msgstr ""
"Éste %s aún no ha sido configurado. Por favor configurarlo para "
"reclamarlo. Luego de hacerlo serás el dueño y podrás quitarlo."
#: init.lua
#, lua-format
msgid "This %s belongs to %s. You can't remove it."
msgstr "Éste %s pertenece a %s. No lo puedes quitar."
#: init.lua
#, lua-format
msgid "Remove station"
msgstr "Quitar estación"
#: init.lua
#, lua-format
msgid "You do not have enough room in your inventory."
msgstr "No tienes suficiente espacio en el inventario."
#: init.lua
#, lua-format
msgid ""
"[Mod travelnet] Error: Savefile '%s' is damaged. Saved the backup as '%s'."
msgstr ""
"[Mod travelnet] Error: El fichero '%s' está dañado. Guardando copia de "
"respaldo en '%s'."

View File

@ -1,5 +1 @@
name = travelnet
description = Network of teleporter-boxes that allow easy travelling to other boxes on the same network.
release = 1158
author = Sokomine
title = Travelnet

View File

@ -10,15 +10,15 @@ minetest.register_abm({
local station_name = meta:get_string( "station_name" );
local station_network = meta:get_string( "station_network" );
if( owner_name and station_name and station_network
if( owner_name and station_name and station_network
and ( not( travelnet.targets )
or not( travelnet.targets[ owner_name ] )
or not( travelnet.targets[ owner_name ][ station_network ] )
or not( travelnet.targets[ owner_name ][ station_network ][ station_name ] ))) then
travelnet.add_target( station_name, station_network, pos, owner_name, meta, owner_name );
print( 'TRAVELNET: re-adding '..tostring( station_name )..' to '..tostring( station_network )..' owned by '..tostring( owner_name ));
print( 'TRAVELNET: re-adding '..tostring( station_name )..' to '..
tostring( station_network )..' owned by '..tostring( owner_name ));
end
end
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 827 B

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 936 B

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 477 B

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 686 B

After

Width:  |  Height:  |  Size: 904 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

After

Width:  |  Height:  |  Size: 731 B

View File

@ -1,6 +1,7 @@
-- contains the node definition for a general travelnet that can be used by anyone
-- further travelnets can only be installed by the owner or by people with the travelnet_attach priv
-- 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)
-- Author: Sokomine
local S = travelnet.S;
@ -25,13 +26,13 @@ minetest.register_node("travelnet:travelnet", {
fixed = {
{ 0.45, -0.5,-0.5, 0.5, 1.45, 0.5},
{-0.5 , -0.5, 0.45, 0.45, 1.45, 0.5},
{-0.5 , -0.5, 0.45, 0.45, 1.45, 0.5},
{-0.5, -0.5,-0.5 ,-0.45, 1.45, 0.5},
--groundplate to stand on
{ -0.5,-0.5,-0.5,0.5,-0.45, 0.5},
{ -0.5,-0.5,-0.5,0.5,-0.45, 0.5},
--roof
{ -0.5, 1.45,-0.5,0.5, 1.5, 0.5},
{ -0.5, 1.45,-0.5,0.5, 1.5, 0.5},
-- control panel
-- { -0.2, 0.6, 0.3, 0.2, 1.1, 0.5},
@ -48,11 +49,14 @@ minetest.register_node("travelnet:travelnet", {
light_source = 10,
after_place_node = function(pos, placer, itemstack)
local meta = minetest.get_meta(pos);
travelnet.reset_formspec( meta );
meta:set_string("owner", placer:get_player_name() );
local meta = minetest.get_meta(pos);
travelnet.reset_formspec( meta );
meta:set_string("owner", placer:get_player_name() );
local top_pos = {x=pos.x, y=pos.y+1, z=pos.z}
minetest.set_node(top_pos, {name="travelnet:hidden_top"})
end,
on_receive_fields = travelnet.on_receive_fields,
on_punch = function(pos, node, puncher)
travelnet.update_formspec(pos, puncher:get_player_name(), nil)
@ -74,16 +78,24 @@ minetest.register_node("travelnet:travelnet", {
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above;
local def = minetest.registered_nodes[
minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name]
if not def or not def.buildable_to then
local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
local def = minetest.registered_nodes[node.name]
-- leftover top nodes can be removed by placing a new travelnet underneath
if (not def or not def.buildable_to) and node.name ~= "travelnet:hidden_top" then
minetest.chat_send_player( placer:get_player_name(), S('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;
end
return minetest.item_place(itemstack, placer, pointed_thing);
end,
on_destruct = function(pos)
pos = {x=pos.x, y=pos.y+1, z=pos.z}
minetest.remove_node(pos)
end
})
--[