From 2c45c0a42b0ffe002f58a81b3d36c02ef4d0198e Mon Sep 17 00:00:00 2001 From: MewMew Date: Sun, 1 Sep 2019 06:01:48 +0200 Subject: [PATCH] remember permissions --- maps/biter_battles_v2/team_manager.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/maps/biter_battles_v2/team_manager.lua b/maps/biter_battles_v2/team_manager.lua index c20ef6ad..f4a8a6a5 100644 --- a/maps/biter_battles_v2/team_manager.lua +++ b/maps/biter_battles_v2/team_manager.lua @@ -12,8 +12,10 @@ end local function freeze_players() if not global.freeze_players then return end - local p = game.permissions.get_group("Default") + global.team_manager_default_permissions = {} + local p = game.permissions.get_group("Default") for action_name, _ in pairs(defines.input_action) do + global.team_manager_default_permissions[action_name] = p.allows_action(defines.input_action[action_name]) p.set_allows_action(defines.input_action[action_name], false) end local defs = { @@ -30,9 +32,11 @@ local function freeze_players() end local function unfreeze_players() - local p = game.permissions.get_group("Default") + local p = game.permissions.get_group("Default") for action_name, _ in pairs(defines.input_action) do - p.set_allows_action(defines.input_action[action_name], true) + if global.team_manager_default_permissions[action_name] then + p.set_allows_action(defines.input_action[action_name], true) + end end end