From 40dd03e328ff0ae36338615114cb38879752756e Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Mon, 4 Sep 2017 22:08:59 +0200 Subject: Implement minetest.register_can_bypass_userlimit (#6369) * Implement minetest.register_on_userlimit_check This new callback permits to bypass the max_users parameter with new mods condition, based on player name or IP Only one mod needs to permit it. Move core part for builtin privileges checks to builtin --- builtin/game/privileges.lua | 5 +++++ builtin/game/register.lua | 1 + 2 files changed, 6 insertions(+) (limited to 'builtin/game') diff --git a/builtin/game/privileges.lua b/builtin/game/privileges.lua index fb53423eb..e9b2df54c 100644 --- a/builtin/game/privileges.lua +++ b/builtin/game/privileges.lua @@ -86,3 +86,8 @@ core.register_privilege("debug", { description = "Allows enabling various debug options that may affect gameplay", give_to_singleplayer = false, }) + +core.register_can_bypass_userlimit(function(name, ip) + local privs = core.get_player_privs(name) + return privs["server"] or privs["ban"] or privs["privs"] or privs["password"] +end) diff --git a/builtin/game/register.lua b/builtin/game/register.lua index 1f355c7e5..e0073fc03 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -581,6 +581,7 @@ core.registered_on_item_eats, core.register_on_item_eat = make_registration() core.registered_on_punchplayers, core.register_on_punchplayer = make_registration() core.registered_on_priv_grant, core.register_on_priv_grant = make_registration() core.registered_on_priv_revoke, core.register_on_priv_revoke = make_registration() +core.registered_can_bypass_userlimit, core.register_can_bypass_userlimit = make_registration() -- -- Compatibility for on_mapgen_init() -- cgit v1.2.3