From 0c0dba384b904a27d948348a13884b8080ed991c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 6 May 2021 00:28:52 +0100 Subject: [PATCH] Fixed issues in expcore --- config/expcore/roles.lua | 2 +- expcore/permission_groups.lua | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 8200287d..95b797bd 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -20,7 +20,7 @@ end) --- Admin Roles Roles.new_role('System','SYS') -:set_permission_group('Admin') +:set_permission_group('Default', true) :set_flag('is_admin') :set_flag('is_spectator') :set_flag('report-immune') diff --git a/expcore/permission_groups.lua b/expcore/permission_groups.lua index 30ac6039..0eca5f75 100644 --- a/expcore/permission_groups.lua +++ b/expcore/permission_groups.lua @@ -142,15 +142,15 @@ end @tparam boolean state the state that you want to set it to, true = allow, false = disallow @treturn Permissions_Groups._prototype returns self so function can be chained -@usage-- Set an action to be disalowed +@usage-- Set an action to be disallowed group:set_action('toggle_map_editor', false) ]] function Permissions_Groups._prototype:set_action(action, state) - if type(action) == 'string' then - action = defines.input_action[action] - end - self.actions[action] = state + local input_action = defines.input_action[action] + if input_action == nil then input_action = action end + assert(type(input_action) == 'number', tostring(action)..' is not a valid input action') + self.actions[input_action] = state return self end