Added Config

This commit is contained in:
Cooldude2606
2019-03-14 18:30:50 +00:00
parent 7c40d82cb2
commit 2d634303a9
3 changed files with 102 additions and 1 deletions

View File

@@ -1 +1,95 @@
local Permission_Groups = require 'expcore.permission_groups' local Permission_Groups = require 'expcore.permission_groups'
Permission_Groups.new_group('admin')
:allow_all()
:disallow{
'add_permission_group', -- admin
'delete_permission_group',
'edit_permission_group',
'import_permissions_string',
'map_editor_action',
'toggle_map_editor',
'change_multiplayer_config',
'set_heat_interface_mode',
'set_heat_interface_temperature',
'set_infinity_container_filter_item',
'set_infinity_container_remove_unfiltered_items',
'set_infinity_pipe_filter'
}
Permission_Groups.new_group('trusted')
:allow_all()
:disallow{
'add_permission_group', -- admin
'delete_permission_group',
'edit_permission_group',
'import_permissions_string',
'map_editor_action',
'toggle_map_editor',
'change_multiplayer_config',
'set_heat_interface_mode',
'set_heat_interface_temperature',
'set_infinity_container_filter_item',
'set_infinity_container_remove_unfiltered_items',
'set_infinity_pipe_filter',
'admin_action' -- trusted
}
Permission_Groups.new_group('standard')
:allow_all()
:disallow{
'add_permission_group', -- admin
'delete_permission_group',
'edit_permission_group',
'import_permissions_string',
'map_editor_action',
'toggle_map_editor',
'change_multiplayer_config',
'set_heat_interface_mode',
'set_heat_interface_temperature',
'set_infinity_container_filter_item',
'set_infinity_container_remove_unfiltered_items',
'set_infinity_pipe_filter',
'admin_action', -- trusted
'change_programmable_speaker_alert_parameters', -- standard
'drop_item',
'reset_assembling_machine',
'set_auto_launch_rocket',
'cancel_research'
}
Permission_Groups.new_group('guest')
:allow_all()
:disallow{
'add_permission_group', -- admin
'delete_permission_group',
'edit_permission_group',
'import_permissions_string',
'map_editor_action',
'toggle_map_editor',
'change_multiplayer_config',
'set_heat_interface_mode',
'set_heat_interface_temperature',
'set_infinity_container_filter_item',
'set_infinity_container_remove_unfiltered_items',
'set_infinity_pipe_filter',
'admin_action', -- trusted
'change_programmable_speaker_alert_parameters', -- standard
'drop_item',
'reset_assembling_machine',
'set_auto_launch_rocket',
'cancel_research',
'change_programmable_speaker_parameters', -- guest
'change_train_stop_station',
'deconstruct',
'remove_cables',
'remove_train_station',
'reset_assembling_machine',
'rotate_entity',
'use_artillery_remote',
'launch_rocket'
}
Permission_Groups.new_group('restricted')
:disallow_all()
:allow('write_to_console')

View File

@@ -24,6 +24,7 @@ local files = {
'modules.commands.cheat-mode', 'modules.commands.cheat-mode',
'modules.commands.interface', 'modules.commands.interface',
'modules.commands.help', 'modules.commands.help',
'config.permission_groups'
} }
-- Loads all files in array above and logs progress -- Loads all files in array above and logs progress

View File

@@ -63,6 +63,9 @@ function Permissions_Groups.set_player_group(player,group)
end end
function Permissions_Groups._prototype:set_action(action,state) function Permissions_Groups._prototype:set_action(action,state)
if type(action) == 'string' then
action = defines.input_action[action]
end
self.actions[action] = state self.actions[action] = state
return self return self
end end
@@ -98,6 +101,9 @@ function Permissions_Groups._prototype:disallow_all()
end end
function Permissions_Groups._prototype:is_allowed(action) function Permissions_Groups._prototype:is_allowed(action)
if type(action) == 'string' then
action = defines.input_action[action]
end
local state = self.actions[action] local state = self.actions[action]
if state == nil then if state == nil then
state = self.allow_all_actions state = self.allow_all_actions