1
0
mirror of https://github.com/Sokomine/locks.git synced 2025-09-08 11:05:33 +02:00

7 Commits

Author SHA1 Message Date
bd6909326c Fix warning on undeclared global variable 2020-07-21 17:43:32 +02:00
ca94c8d43e Corrige la texture de la porte vérouillé 2019-04-26 23:37:22 +02:00
63a2a54be2 Merge branch 'master' into nalc-1.1 2019-04-26 23:30:55 +02:00
Sokomine
ed0db28add renamed obsolete functions to new name 2019-03-11 23:50:39 +01:00
Sokomine
c79e8fe19e password field is marked as private 2019-03-10 16:53:25 +01:00
Sokomine
bfce8b29eb config buttons can now be placed at fractions of coordinates 2019-03-10 16:25:28 +01:00
sys4-fr
09385b7da5 Ajoute message de chargement du mod dans le journal "action" 2018-12-26 21:02:33 +01:00
2 changed files with 11 additions and 7 deletions

View File

@@ -46,7 +46,7 @@ minetest.register_privilege("diglocks", { description = "allows to open/use and
locks.config_button = [[
image_button[%d,%d;1,1;locks_lock16.png;locks_config;Config
image_button[%s,%s;1,1;locks_lock16.png;locks_config;Config
Locks]
tooltip[locks_config;Configure the players or set the password to grant access to other players.]
]]
@@ -56,7 +56,7 @@ function locks.get_config_button(x,y)
end
locks.authorize_button = [[
image_button[%d,%d;1,1;locks_key16.png;locks_authorize;Autho-
image_button[%s,%s;1,1;locks_key16.png;locks_authorize;Autho-
rize]
tooltip[locks_authorize;Opens a password prompt to grant you access to this object.]
]]
@@ -181,6 +181,7 @@ function locks:lock_init( pos, default_formspec )
meta:set_string("allowed_users","");
-- objects can be unlocked by passwords as well (if it is set)
meta:set_string("password","");
meta:mark_as_private("password")
-- the last player who entered the right password (to save space this is not a list)
meta:set_string("pw_user","");
-- this formspec is presented on right-click for every user
@@ -228,6 +229,7 @@ function locks:set_lockdata( pos, data )
meta:set_string("owner", (data.owner or ""));
meta:set_string("allowed_users",(data.allowed_users or ""));
meta:set_string("password", (data.password or ""));
meta:mark_as_private("password")
meta:set_string("pw_user", (data.pw_user or ""));
meta:set_string("formspec", (data.formspec or ""));
end
@@ -598,6 +600,7 @@ function locks:lock_handle_input( pos, formname, fields, player )
meta:set_string( "password", help[2]);
meta:mark_as_private("password")
-- reset the list of users who typed the right password
meta:set_string("pw_users","");
@@ -798,3 +801,5 @@ dofile(minetest.get_modpath("locks").."/shared_locked_chest.lua");
dofile(minetest.get_modpath("locks").."/shared_locked_sign_wall.lua");
dofile(minetest.get_modpath("locks").."/shared_locked_xdoors2.lua");
dofile(minetest.get_modpath("locks").."/shared_locked_furnace.lua");
minetest.log("action", "[locks] loaded.")

View File

@@ -138,7 +138,7 @@ minetest.register_node("locks:door", {
description = "Shared locked Wooden Door",
node_placement_prediction = "",
inventory_image = 'locks_xdoors2_door.png',
wield_image = 'xdoors2_door.png',
wield_image = 'locks_xdoors2_door.png',
stack_max = 1,
sunlight_propogates = true,
on_place = function(itemstack, placer, pointed_thing)
@@ -155,14 +155,13 @@ minetest.register_node("locks:door", {
end
local fdir = 0
local placer_pos = placer:getpos()
local placer_pos = placer:get_pos()
if placer_pos then
dir = {
fdir = minetest.dir_to_facedir({
x = above.x - placer_pos.x,
y = above.y - placer_pos.y,
z = above.z - placer_pos.z
}
fdir = minetest.dir_to_facedir(dir)
})
end
local t = 1