mirror of
https://github.com/Sokomine/travelnet.git
synced 2024-08-19 21:14:18 +02:00
added error message to prevent a crash if something went wrong with a newly setup box
This commit is contained in:
parent
900b4354dd
commit
4779487156
13
init.lua
13
init.lua
@ -483,6 +483,19 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
|
||||
end
|
||||
end
|
||||
|
||||
if( not( owner_name )
|
||||
or not( station_network )
|
||||
or not( travelnet.targets )
|
||||
or not( travelnet.targets[ owner_name ] )
|
||||
or not( travelnet.targets[ owner_name ][ station_network ] )) then
|
||||
minetest.chat_send_player(name, "Error: This travelnet is lacking data and/or improperly configured.");
|
||||
print( "ERROR: The travelnet at "..minetest.pos_to_string( pos ).." has a problem: "..
|
||||
" DATA: owner: "..( owner_name or "?")..
|
||||
" station_name: "..(station_name or "?")..
|
||||
" station_network: "..(station_network or "?")..".");
|
||||
return;
|
||||
end
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user