Update functions.lua

This commit is contained in:
Panquesito7 2019-08-20 17:54:27 -05:00 committed by GitHub
parent e2848144e1
commit 654b6d1197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -349,3 +349,26 @@ function core.send_leave_message(player_name, timed_out)
end end
core.chat_send_all(announcement) core.chat_send_all(announcement)
end end
-- Override "core.register_privilege"
function core.register_privilege(name, param)
local function fill_defaults(def)
if def.give_to_singleplayer == nil then
def.give_to_singleplayer = true
end
if def.give_to_admin == nil then
def.give_to_admin = def.give_to_singleplayer
end
if def.description == nil then
def.description = S("(no description)") -- This makes the difference! :)
end
end
local def = {}
if type(param) == "table" then
def = param
else
def = {description = param}
end
fill_defaults(def)
core.registered_privileges[name] = def
end