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
|
-- 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
|
-- Sounds
|
||||||
--
|
--
|
||||||
|
|
|
@ -714,10 +714,10 @@ minetest.register_node("default:chest", {
|
||||||
})
|
})
|
||||||
|
|
||||||
local function has_locked_chest_privilege(meta, player)
|
local function has_locked_chest_privilege(meta, player)
|
||||||
if player:get_player_name() ~= meta:get_string("owner") then
|
if (player:get_player_name() == meta:get_string("owner")) or (minetest.check_player_privs(player:get_player_name(), {diglocks=true})) then
|
||||||
return false
|
return true
|
||||||
end
|
end
|
||||||
return true
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("default:chest_locked", {
|
minetest.register_node("default:chest_locked", {
|
||||||
|
|
|
@ -15,6 +15,7 @@ doors = {}
|
||||||
-- selection_box_top
|
-- selection_box_top
|
||||||
-- only_placer_can_open: if true only the player who placed the door can
|
-- only_placer_can_open: if true only the player who placed the door can
|
||||||
-- open it
|
-- open it
|
||||||
|
|
||||||
function doors:register_door(name, def)
|
function doors:register_door(name, def)
|
||||||
def.groups.not_in_creative_inventory = 1
|
def.groups.not_in_creative_inventory = 1
|
||||||
|
|
||||||
|
@ -131,7 +132,7 @@ function doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local pn = player:get_player_name()
|
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
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_b_1", {
|
minetest.register_node(name.."_b_1", {
|
||||||
|
|
Loading…
Add table
Reference in a new issue