From 677d75a15eeb268359cc411fba167f94b27febfb Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 24 Apr 2021 22:00:41 +0100 Subject: [PATCH] Fixed jail not working with regular #192 --- expcore/roles.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/expcore/roles.lua b/expcore/roles.lua index edcc989e..2028cd23 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -1012,9 +1012,14 @@ local function auto_assign(event) local roles = Roles.config.players[player.name] or {} local lookup = {} - for _, role in ipairs(roles) do lookup[role] = true end + -- Create a lookup table for existing roles, and check for block auto assign + for _, role in ipairs(roles) do + if role.block_auto_assign then return end + lookup[role] = true + end local assigns, ctn = {}, 0 + -- Check roles with auto assign conditions and run the handler for role, condition in pairs(Roles.config.auto_assign) do if not lookup[role] then local success, rtn = pcall(condition, player) @@ -1027,6 +1032,7 @@ local function auto_assign(event) end end + -- Assign new roles if any were passed if ctn > 0 then Roles.assign_player(player, assigns) end end