2012-11-07 01:03:59 +01:00
|
|
|
|
2016-02-25 10:06:53 +01:00
|
|
|
-- 25.02.16 Added new Locks config Buttons.
|
2013-12-17 03:08:09 +01:00
|
|
|
-- allow aborting with ESC in newer Versions of MT again
|
|
|
|
|
2012-11-07 01:03:59 +01:00
|
|
|
-- a sign
|
|
|
|
minetest.register_node("locks:shared_locked_sign_wall", {
|
|
|
|
description = "Shared locked sign",
|
|
|
|
drawtype = "signlike",
|
2016-09-09 21:21:45 +02:00
|
|
|
tiles = {"locks_lock16.png^default_sign_wood.png"},
|
|
|
|
inventory_image = "locks_lock16.png^default_sign_wood.png",
|
|
|
|
wield_image = "locks_lock16.png^default_sign_wood.png",
|
2012-11-07 01:03:59 +01:00
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "wallmounted",
|
|
|
|
--wall_top = <default>
|
|
|
|
--wall_bottom = <default>
|
|
|
|
--wall_side = <default>
|
|
|
|
},
|
|
|
|
groups = {choppy=2,dig_immediate=2},
|
|
|
|
legacy_wallmounted = true,
|
|
|
|
|
|
|
|
|
|
|
|
on_construct = function(pos)
|
2018-07-30 19:08:02 +02:00
|
|
|
local meta = minetest.get_meta(pos)
|
2012-11-07 01:03:59 +01:00
|
|
|
-- prepare the lock of the sign
|
|
|
|
locks:lock_init( pos,
|
|
|
|
"size[8,4]"..
|
2014-08-16 18:39:58 +02:00
|
|
|
"field[0.3,0.6;6,0.7;text;Text:;${text}]"..
|
2018-07-30 22:00:54 +02:00
|
|
|
-- "field[0.3,3.6;6,0.7;locks_sent_lock_command;Locked sign. Type /help for help:;]"..
|
2016-09-09 21:21:45 +02:00
|
|
|
-- "background[-0.5,-0.5;9,5;bg_shared_locked_sign.jpg]" );
|
2014-07-14 20:36:57 +02:00
|
|
|
"button_exit[6.3,3.2;1.7,0.7;locks_sent_input;Proceed]"..
|
2016-02-25 10:06:53 +01:00
|
|
|
locks.uniform_background );
|
2012-11-07 01:03:59 +01:00
|
|
|
end,
|
|
|
|
|
|
|
|
after_place_node = function(pos, placer)
|
|
|
|
locks:lock_set_owner( pos, placer, "Shared locked sign" );
|
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
|
|
can_dig = function(pos,player)
|
|
|
|
return locks:lock_allow_dig( pos, player );
|
|
|
|
end,
|
|
|
|
|
|
|
|
on_receive_fields = function(pos, formname, fields, sender)
|
2013-12-17 03:08:09 +01:00
|
|
|
|
2016-02-25 10:06:53 +01:00
|
|
|
-- 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
|
2012-11-07 01:03:59 +01:00
|
|
|
and locks:lock_allow_use( pos, sender )) then
|
|
|
|
|
|
|
|
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
2018-07-30 19:08:02 +02:00
|
|
|
local meta = minetest.get_meta(pos)
|
2012-11-07 01:03:59 +01:00
|
|
|
fields.text = fields.text or "";
|
|
|
|
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
|
|
|
"\" to sign at "..minetest.pos_to_string(pos));
|
2014-08-16 18:39:58 +02:00
|
|
|
meta:set_string("text", fields.text);
|
2012-11-07 01:03:59 +01:00
|
|
|
meta:set_string("infotext", '"'..fields.text..'"'.." ["..sender:get_player_name().."]");
|
2016-02-25 10:06:53 +01:00
|
|
|
end
|
|
|
|
end
|
2012-11-07 01:03:59 +01:00
|
|
|
|
|
|
|
end,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = 'locks:shared_locked_sign_wall',
|
|
|
|
recipe = {
|
|
|
|
{ 'default:sign_wall', 'locks:lock', '' },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
print( "[Mod] locks: loading locks:shared_locked_sign_wall");
|