mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-20 22:33:16 -04:00
Added the "diglocks" priv, which allows people to use/dig others' locked stuff.
This commit is contained in:
parent
a5dcf123e0
commit
3bd44e85a1
3 changed files with 8 additions and 5 deletions
|
@ -1,5 +1,7 @@
|
|||
-- mods/default/functions.lua
|
||||
|
||||
if not minetest.get_modpath("locks") then
|
||||
minetest.register_privilege("diglocks", { description = "allows to open/use and dig up all locked objects", give_to_singleplayer = false});
|
||||
end
|
||||
--
|
||||
-- Sounds
|
||||
--
|
||||
|
|
|
@ -714,10 +714,10 @@ minetest.register_node("default:chest", {
|
|||
})
|
||||
|
||||
local function has_locked_chest_privilege(meta, player)
|
||||
if player:get_player_name() ~= meta:get_string("owner") then
|
||||
return false
|
||||
end
|
||||
if (player:get_player_name() == meta:get_string("owner")) or (minetest.check_player_privs(player:get_player_name(), {diglocks=true})) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.register_node("default:chest_locked", {
|
||||
|
|
|
@ -15,6 +15,7 @@ doors = {}
|
|||
-- selection_box_top
|
||||
-- only_placer_can_open: if true only the player who placed the door can
|
||||
-- open it
|
||||
|
||||
function doors:register_door(name, def)
|
||||
def.groups.not_in_creative_inventory = 1
|
||||
|
||||
|
@ -131,7 +132,7 @@ function doors:register_door(name, def)
|
|||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
local pn = player:get_player_name()
|
||||
return meta:get_string("doors_owner") == pn
|
||||
return (meta:get_string("doors_owner") == pn) or (minetest.check_player_privs(player:get_player_name(), {diglocks=true}))
|
||||
end
|
||||
|
||||
minetest.register_node(name.."_b_1", {
|
||||
|
|
Loading…
Add table
Reference in a new issue