1
0
mirror of https://github.com/Sokomine/locks.git synced 2025-07-01 06:20:21 +02:00

New and easier to use locks configuration screen.

This commit is contained in:
adrido
2016-02-25 10:06:53 +01:00
parent f1b404fb13
commit 618c7abbc8
5 changed files with 208 additions and 37 deletions

View File

@ -1,4 +1,5 @@
-- 25.02.16 Added new Locks config Buttons.
-- allow aborting with ESC in newer Versions of MT again
-- a sign
@ -28,9 +29,8 @@ minetest.register_node("locks:shared_locked_sign_wall", {
locks:lock_init( pos,
"size[8,4]"..
"field[0.3,0.6;6,0.7;text;Text:;${text}]"..
"field[0.3,3.6;6,0.7;locks_sent_lock_command;Locked sign. Type /help for help:;]"..
"button_exit[6.3,3.2;1.7,0.7;locks_sent_input;Proceed]"..
"background[-0.5,-0.5;9,5;bg_shared_locked_sign.jpg]" );
locks.uniform_background );
end,
after_place_node = function(pos, placer)
@ -44,10 +44,12 @@ minetest.register_node("locks:shared_locked_sign_wall", {
on_receive_fields = function(pos, formname, fields, sender)
-- if the user already has the right to use this and did input text
if( fields.text
and ( not(fields.locks_sent_lock_command)
or fields.locks_sent_lock_command=="")
-- if locks can not handle the input
if not locks:lock_handle_input( pos, formname, fields, sender ) then
--then handle compatibility stuff or insert text
if( fields.text
and ( not(fields.locks_sent_lock_command) --compatibility
or fields.locks_sent_lock_command=="") --compatibility
and locks:lock_allow_use( pos, sender )) then
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
@ -57,11 +59,8 @@ minetest.register_node("locks:shared_locked_sign_wall", {
"\" to sign at "..minetest.pos_to_string(pos));
meta:set_string("text", fields.text);
meta:set_string("infotext", '"'..fields.text..'"'.." ["..sender:get_player_name().."]");
-- a command for the lock?
else
locks:lock_handle_input( pos, formname, fields, sender );
end
end
end
end,
});