Builtin: Add basic_privs setting
This commit is contained in:
parent
0939c871cf
commit
50d7bee97d
|
@ -181,8 +181,10 @@ core.register_chatcommand("grant", {
|
||||||
end
|
end
|
||||||
local privs = core.get_player_privs(grantname)
|
local privs = core.get_player_privs(grantname)
|
||||||
local privs_unknown = ""
|
local privs_unknown = ""
|
||||||
|
local basic_privs =
|
||||||
|
core.string_to_privs(core.setting_get("basic_privs") or "interact,shout")
|
||||||
for priv, _ in pairs(grantprivs) do
|
for priv, _ in pairs(grantprivs) do
|
||||||
if priv ~= "interact" and priv ~= "shout" and
|
if not basic_privs[priv] and
|
||||||
not core.check_player_privs(name, {privs=true}) then
|
not core.check_player_privs(name, {privs=true}) then
|
||||||
return false, "Your privileges are insufficient."
|
return false, "Your privileges are insufficient."
|
||||||
end
|
end
|
||||||
|
@ -223,8 +225,10 @@ core.register_chatcommand("revoke", {
|
||||||
end
|
end
|
||||||
local revoke_privs = core.string_to_privs(revoke_priv_str)
|
local revoke_privs = core.string_to_privs(revoke_priv_str)
|
||||||
local privs = core.get_player_privs(revoke_name)
|
local privs = core.get_player_privs(revoke_name)
|
||||||
|
local basic_privs =
|
||||||
|
core.string_to_privs(core.setting_get("basic_privs") or "interact,shout")
|
||||||
for priv, _ in pairs(revoke_privs) do
|
for priv, _ in pairs(revoke_privs) do
|
||||||
if priv ~= "interact" and priv ~= "shout" and
|
if not basic_privs[priv] and
|
||||||
not core.check_player_privs(name, {privs=true}) then
|
not core.check_player_privs(name, {privs=true}) then
|
||||||
return false, "Your privileges are insufficient."
|
return false, "Your privileges are insufficient."
|
||||||
end
|
end
|
||||||
|
|
|
@ -691,6 +691,9 @@ default_password (Default password) string
|
||||||
# See /privs in game for a full list on your server and mod configuration.
|
# See /privs in game for a full list on your server and mod configuration.
|
||||||
default_privs (Default privileges) string interact, shout
|
default_privs (Default privileges) string interact, shout
|
||||||
|
|
||||||
|
# Privileges that players with basic_privs can grant
|
||||||
|
basic_privs (Basic Privileges) string interact, shout
|
||||||
|
|
||||||
# Whether players are shown to clients without any range limit.
|
# Whether players are shown to clients without any range limit.
|
||||||
# Deprecated, use the setting player_transfer_distance instead.
|
# Deprecated, use the setting player_transfer_distance instead.
|
||||||
unlimited_player_transfer_distance (Unlimited player transfer distance) bool true
|
unlimited_player_transfer_distance (Unlimited player transfer distance) bool true
|
||||||
|
|
Loading…
Reference in New Issue