From 4066361b915eb9cec7222714d29bc417767cd4e9 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Sat, 22 Sep 2018 02:23:02 +0200 Subject: [PATCH] creative mode: update on punch, dig with diamond pick --- init.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/init.lua b/init.lua index 7b86731..c72238a 100644 --- a/init.lua +++ b/init.lua @@ -22,6 +22,8 @@ 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. @@ -138,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"]) @@ -845,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