diff options
Diffstat (limited to 'travelnet')
-rw-r--r-- | travelnet/init.lua | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/travelnet/init.lua b/travelnet/init.lua index 5be6cac..c72238a 100644 --- a/travelnet/init.lua +++ b/travelnet/init.lua @@ -22,8 +22,11 @@ Please configure this mod in config.lua Changelog: + 22.09.18 - If in creative mode, wield a diamond pick to dig the station. This avoids + conflicts with too fast punches. 24.12.17 - Added support for localization through intllib. Added localization for German (de). + Door opening/closing can now handle more general doors. 17.07.17 - Added more detailled licence information. TNT and DungeonMasters ought to leave travelnets and elevators untouched now. Added function to register elevator doors. @@ -137,6 +140,13 @@ travelnet.check_if_trying_to_dig = function( puncher, node ) if( not( puncher) or not( puncher:get_wielded_item())) then return false; end + -- show menu when in creative mode + if( creative + and creative.is_enabled_for(puncher:get_player_name()) + and (not(puncher:get_wielded_item()) + or puncher:get_wielded_item():get_name()~="default:pick_diamond")) then + return false; + end local tool_capabilities = puncher:get_wielded_item():get_tool_capabilities(); if( not( tool_capabilities ) or not( tool_capabilities["groupcaps"]) @@ -593,8 +603,7 @@ travelnet.open_close_door = function( pos, player, mode ) -- at least for homedecor, same facedir would mean "door closed" -- do not close the elevator door if it is already closed - if( mode==1 and ( door_node.name == 'travelnet:elevator_door_glass_closed' - or door_node.name == 'travelnet:elevator_door_steel_closed' + if( mode==1 and ( string.sub( door_node.name, -7 ) == '_closed' -- handle doors that change their facedir or ( door_node.param2 == this_node.param2 and door_node.name ~= 'travelnet:elevator_door_glass_open' @@ -602,8 +611,7 @@ travelnet.open_close_door = function( pos, player, mode ) return; end -- do not open the doors if they are already open (works only on elevator-doors; not on doors in general) - if( mode==2 and ( door_node.name == 'travelnet:elevator_door_glass_open' - or door_node.name == 'travelnet:elevator_door_steel_open' + if( mode==2 and ( string.sub( door_node.name, -5 ) == '_open' -- handle doors that change their facedir or ( door_node.param2 ~= this_node.param2 and door_node.name ~= 'travelnet:elevator_door_glass_closed' @@ -846,6 +854,15 @@ travelnet.can_dig = function( pos, player, description ) local owner = meta:get_string('owner'); local network_name = meta:get_string( "station_network" ); + -- in creative mode, accidental digging could happen too easily when trying to update the net + if(creative and creative.is_enabled_for(player:get_player_name())) then + -- only a diamond pick can dig the travelnet + if( not(player:get_wielded_item()) + or player:get_wielded_item():get_name()~="default:pick_diamond") then + return false; + end + end + -- 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 |