From 1dfada4c666acfdff80a4f532c524564c5368518 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Mon, 30 Jul 2018 16:46:05 +0200 Subject: [PATCH] improved password check and repaired pipeworks --- init.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 2a35b02..73f4585 100644 --- a/init.lua +++ b/init.lua @@ -212,8 +212,8 @@ function locks:lock_allow_use( pos, player ) local meta = minetest.env:get_meta(pos); -- pipeworks sends a special username - if( name == ':pipeworks' or (player.is_fake_player and player.is_fake_player==":pipeworks")) then - if( meta:get_int( 'allow_pipeworks' ) == 1 ) then + if( player.is_fake_player) then + if( locks:lock_allow_dig( pos, player ) and meta:get_int( 'allow_pipeworks' ) == 1 ) then return true; else return false; @@ -356,8 +356,11 @@ function locks:lock_handle_input( pos, formname, fields, player ) end + local password = meta:get_string("password"); -- other players can only try to input the correct password - if( name ~= meta:get_string( "owner" )) then + if( name ~= meta:get_string( "owner" ) + or (password and password ~= "" and password==fields.locks_sent_lock_command) + or (name==meta:get_string("pw_user"))) then -- no need to bother with trying other PWs if none is set... if( meta:get_string("password")=="" ) then