Cleaned Config

This commit is contained in:
Cooldude2606
2020-03-29 23:39:24 +01:00
parent 5dbc7a5e5c
commit 95af6cfc34
45 changed files with 49 additions and 79 deletions

View File

@@ -0,0 +1,255 @@
--- Config for the different action buttons that show on the player list;
-- each button has the button define(s) given along side an auth function, and optional reason callback;
-- if a reason callback is used then Store.set(action_name_store,player.name,'BUTTON_NAME') should be called during on_click;
-- buttons can be removed from the gui by commenting them out of the config at the bottom of this file;
-- the key used for the name of the button is the permission name used by the role system;
-- @config Player-List
local Gui = require 'expcore.gui' --- @dep expcore.gui
local Roles = require 'expcore.roles' --- @dep expcore.roles
local Store = require 'expcore.store' --- @dep expcore.store
local Game = require 'utils.game' --- @dep utils.game
local Reports = require 'modules.control.reports' --- @dep modules.control.reports
local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings
local Jail = require 'modules.control.jail' --- @dep modules.control.jail
local Colors = require 'utils.color_presets' --- @dep utils.color_presets
local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common
local selected_player_store = ''
local selected_action_store = ''
local function set_store_uids(player,action)
selected_player_store = player
selected_action_store = action
end
-- auth that will only allow when on player's of lower roles
local function auth_lower_role(player,selected_player_name)
local player_highest = Roles.get_player_highest_role(player)
local action_player_highest = Roles.get_player_highest_role(selected_player_name)
if player_highest.index < action_player_highest.index then
return true
end
end
-- gets the action player and a coloured name for the action to be used on
local function get_action_player_name(player)
local selected_player_name = Store.get(selected_player_store,player)
local selected_player = Game.get_player_from_any(selected_player_name)
local selected_player_color = format_chat_player_name(selected_player)
return selected_player_name, selected_player_color
end
-- telports one player to another
local function teleport(from_player,to_player)
local surface = to_player.surface
local position = surface.find_non_colliding_position('character',to_player.position,32,1)
if not position then return false end -- return false if no new position
if from_player.driving then from_player.driving = false end -- kicks a player out a vehicle if in one
from_player.teleport(position,surface)
return true
end
local function new_button(sprite,tooltip)
return Gui.element{
type = 'sprite-button',
style = 'tool_button',
sprite = sprite,
tooltip = tooltip
}:style{
padding = -1,
height = 28,
width = 28
}
end
--- Teleports the user to the action player
-- @element goto_player
local goto_player = new_button('utility/export',{'player-list.goto-player'})
:on_click(function(player)
local selected_player_name = get_action_player_name(player)
local selected_player = Game.get_player_from_any(selected_player_name)
if not player.character or not selected_player.character then
player.print({'expcore-commands.reject-player-alive'},Colors.orange_red)
else
teleport(player,selected_player)
end
end)
--- Teleports the action player to the user
-- @element bring_player
local bring_player = new_button('utility/import',{'player-list.bring-player'})
:on_click(function(player)
local selected_player_name = get_action_player_name(player)
local selected_player = Game.get_player_from_any(selected_player_name)
if not player.character or not selected_player.character then
player.print({'expcore-commands.reject-player-alive'},Colors.orange_red)
else
teleport(selected_player,player)
end
end)
--- Kills the action player, if there are alive
-- @element kill_player
local kill_player = new_button('utility/too_far',{'player-list.kill-player'})
:on_click(function(player)
local selected_player_name = get_action_player_name(player)
local selected_player = Game.get_player_from_any(selected_player_name)
if selected_player.character then
selected_player.character.die()
else
player.print({'expcom-kill.already-dead'},Colors.orange_red)
end
end)
--- Reports the action player, requires a reason to be given
-- @element report_player
local report_player = new_button('utility/spawn_flag',{'player-list.report-player'})
:on_click(function(player)
local selected_player_name = get_action_player_name(player)
if Reports.is_reported(selected_player_name,player.name) then
player.print({'expcom-report.already-reported'},Colors.orange_red)
else
Store.set(selected_action_store,player,'command/report')
end
end)
local function report_player_callback(player,reason)
local selected_player_name, selected_player_color = get_action_player_name(player)
local by_player_name_color = format_chat_player_name(player)
game.print{'expcom-report.non-admin', selected_player_color,reason}
Roles.print_to_roles_higher('Trainee',{'expcom-report.admin', selected_player_color,by_player_name_color,reason})
Reports.report_player(selected_player_name,player.name,reason)
end
--- Gives the action player a warning, requires a reason
-- @element warn_player
local warn_player = new_button('utility/spawn_flag',{'player-list.warn-player'})
:on_click(function(player)
Store.set(selected_action_store,player,'command/give-warning')
end)
local function warn_player_callback(player,reason)
local selected_player_name, selected_player_color = get_action_player_name(player)
local by_player_name_color = format_chat_player_name(player)
game.print{'expcom-warnings.received', selected_player_color,by_player_name_color,reason}
Warnings.add_warning(selected_player_name,player.name,reason)
end
--- Jails the action player, requires a reason
-- @element jail_player
local jail_player = new_button('utility/multiplayer_waiting_icon',{'player-list.jail-player'})
:on_click(function(player)
local selected_player_name, selected_player_color = get_action_player_name(player)
if Jail.is_jailed(selected_player_name) then
player.print({'expcom-jail.already-jailed', selected_player_color},Colors.orange_red)
else
Store.set(selected_action_store,player,'command/jail')
end
end)
local function jail_player_callback(player,reason)
local selected_player_name, selected_player_color = get_action_player_name(player)
local by_player_name_color = format_chat_player_name(player)
game.print{'expcom-jail.give', selected_player_color,by_player_name_color,reason}
Jail.jail_player(selected_player_name,player.name,reason)
end
--- Temp bans the action player, requires a reason
-- @element temp_ban_player
local temp_ban_player = new_button('utility/warning_white',{'player-list.temp-ban-player'})
:on_click(function(player)
local selected_player_name, selected_player_color = get_action_player_name(player)
if Jail.is_jailed(selected_player_name) then
player.print({'expcom-jail.already-banned', selected_player_color},Colors.orange_red)
else
Store.set(selected_action_store,player,'command/temp-ban')
end
end)
local function temp_ban_player_callback(player,reason)
local selected_player, selected_player_color = get_action_player_name(player)
local by_player_name_color = format_chat_player_name(player)
game.print{'expcom-jail.temp-ban', selected_player_color,by_player_name_color,reason}
Jail.temp_ban_player(selected_player,player.name,reason)
end
--- Kicks the action player, requires a reason
-- @element kick_player
local kick_player = new_button('utility/warning_icon',{'player-list.kick-player'})
:on_click(function(player)
Store.set(selected_action_store,player,'command/kick')
end)
local function kick_player_callback(player,reason)
local selected_player = get_action_player_name(player)
game.kick_player(selected_player,reason)
end
--- Bans the action player, requires a reason
-- @element ban_player
local ban_player = new_button('utility/danger_icon',{'player-list.ban-player'})
:on_click(function(player)
Store.set(selected_action_store,player,'command/ban')
end)
local function ban_player_callback(player,reason)
local selected_player = get_action_player_name(player)
game.ban_player(selected_player,reason)
end
return {
set_store_uids = set_store_uids,
buttons = {
['command/teleport'] = {
auth=function(player,selected_player)
return player.name ~= selected_player.name
end, -- cant teleport to your self
goto_player,
bring_player
},
['command/kill'] = {
auth=function(player,selected_player)
if player.name == selected_player.name then
return true
elseif Roles.player_allowed(player,'command/kill/always') then
return auth_lower_role(player,selected_player)
end
end, -- player must be lower role, or your self
kill_player
},
['command/report'] = {
auth=function(player,selected_player)
if not Roles.player_allowed(player,'command/give-warning') then
return not Roles.player_has_flag(selected_player,'report-immune')
end
end, -- can report any player that isn't immune and you aren't able to give warnings
reason_callback=report_player_callback,
report_player
},
['command/give-warning'] = {
auth=auth_lower_role, -- warn a lower user, replaces report
reason_callback=warn_player_callback,
warn_player
},
['command/jail'] = {
auth=auth_lower_role,
reason_callback=jail_player_callback,
jail_player
},
['command/temp-ban'] = {
auth=auth_lower_role,
reason_callback=temp_ban_player_callback,
temp_ban_player
},
['command/kick'] = {
auth=auth_lower_role,
reason_callback=kick_player_callback,
kick_player
},
['command/ban'] = {
auth=auth_lower_role,
reason_callback=ban_player_callback,
ban_player
}
}
}

35
config/gui/rockets.lua Normal file
View File

@@ -0,0 +1,35 @@
--- This file controls what will show in each section of the rocket info gui
-- @config Rockets
return {
stats = { --- @setting stats The data that will show in the stats section
show_stats=true, --- @setting show_stats false will hide this section all together
show_first_rocket = true, --- @setting show_first_rocket false will not show when the first rocket was launched
show_last_rocket = true, --- @setting show_last_rocket false will not show when the last rocket was launched
show_fastest_rocket = true, --- @setting show_fastest_rocket false will not show the time taken for the fastest rocket
show_total_rockets = true, --- @setting show_total_rockets false will not show the total number of rockets launched
show_game_avg = true, --- @setting show_game_avg false will hide the avg across the entire map time
rolling_avg = { --- @setting rolling_avg each number will be one statistic; 5 means the avg time taken for the last 5 rockets
5,10,25
}
},
milestones = { --- @setting milestones each number will be one statistic; 5 means the time that the 5th rocket was launched
show_milestones=true, --- @setting show_milestones false will hide this section all together
1,2,5,
10,20,50,
100,200,500,
1000,1500,2000,2500,
3000,3500,4000,4500,
5000
},
progress = { --- @setting progress The data and buttons in the build progress section
show_progress = true, --- @setting show_progress false will hide this section altogether
allow_zoom_to_map = true, --- @setting allow_zoom_to_map false will disable the zoom to map feature
allow_remote_launch = true, --- @setting allow_remote_launch false removes the remote launch button for all players
remote_launch_admins_only = false, --- @setting remote_launch_admins_only true will remove the remote launch button for all non (game) admins
remote_launch_role_permission = 'gui/rocket-info/remote_launch', --- @setting remote_launch_role_permission value used by custom permission system to allow or disallow the button
allow_toggle_active = true, --- @setting allow_toggle_active false removes the remote toggle auto launch button for all players
toggle_active_admins_only = false, --- @setting toggle_active_admins_only true will remove the toggle auto launch button for all non (game) admins
toggle_active_role_permission = 'gui/rocket-info/toggle-active' --- @setting toggle_active_role_permission value used by custom permission system to allow or disallow the button
}
}

15
config/gui/science.lua Normal file
View File

@@ -0,0 +1,15 @@
--- Config file for the science info gui
-- @config Science
return { -- list of all science packs to be shown in the gui
show_eta=true, --- @setting show_eta when true the eta for research completion will be shown
color_clamp=5, --- @setting color_clamp the amount required for the text to show as green or red
color_flux=0.1, --- @setting color_flux the ammount of flucuation allowed in production before icon change
'automation-science-pack',
'logistic-science-pack',
'military-science-pack',
'chemical-science-pack',
'production-science-pack',
'utility-science-pack',
'space-science-pack',
}

13
config/gui/tasks.lua Normal file
View File

@@ -0,0 +1,13 @@
--- Config file for the tasks gui
-- @config Tasks
return {
-- Adding tasks
allow_add_task = 'all', --- @setting allow_add_task dictates who is allowed to add new tasks; values: all, admin, expcore.roles, none
expcore_roles_allow_add_task = 'gui/task-list/add', --- @setting expcore_roles_allow_add_task if expcore.roles is used then this is the required permission
-- Editing tasks
allow_edit_task = 'expcore.roles', --- @setting allow_edit_task dictates who is allowed to edit existing tasks; values: all, admin, expcore.roles, none
expcore_roles_allow_edit_task = 'gui/task-list/edit', --- @setting expcore_roles_allow_edit_task if expcore.roles is used then this is the required permission
user_can_edit_own_tasks = true --- @settings if true then the user who made the task can edit it regardless of the allow_edit_task setting
}

41
config/gui/warps.lua Normal file
View File

@@ -0,0 +1,41 @@
--- This file contains all the different settings for the warp system and gui
-- @config Warps
return {
-- General config
update_smoothing = 10, --- @setting update_smoothing the amount of smoothing applied to updates to the cooldown timer, higher is better, max is 60
minimum_distance = 100, --- @setting minimum_distance the minimum distance that is allowed between warps on the same force
default_icon = 'discharge-defense-equipment', --- @setting default_icon the default icon that will be used for warps
-- Warp cooldowns
bypass_warp_cooldown = 'expcore.roles', --- @setting bypass_warp_cooldown dictates who the warp cooldown is applied to; values: all, admin, expcore.roles, none
expcore_roles_bypass_warp_cooldown = 'gui/warp-list/bypass-cooldown', --- @setting expcore_roles_bypass_warp_cooldown if expcore.roles is used then this is the required permission
cooldown_duraction = 60, --- @setting cooldown_duraction the duration of the warp cooldown in seconds
-- Warp proximity
bypass_warp_proximity = 'expcore.roles', --- @setting bypass_warp_proximity dictates who the warp proximity is applied to; values: all, admin, expcore.roles, none
expcore_roles_bypass_warp_proximity = 'gui/warp-list/bypass-proximity', --- @setting expcore_roles_bypass_warp_proximity if expcore.roles is used then this is the required permission
standard_proximity_radius = 4, --- @setting standard_proximity_radius the minimum distance a player is allowed to be to a warp in order to use it
spawn_proximity_radius = 20, --- @setting spawn_proximity_radius the minimum distance a player is allowed to be from they spawn point to use warps
-- Adding warps
allow_add_warp = 'expcore.roles', --- @setting allow_add_warp dictates who is allowed to add warps; values: all, admin, expcore.roles, none
expcore_roles_allow_add_warp = 'gui/warp-list/add', --- @setting expcore_roles_allow_add_warp if expcore.roles is used then this is the required permission
-- Editing warps
allow_edit_warp = 'expcore.roles', --- @setting allow_edit_warp dictates who is allowed to edit warps; values: all, admin, expcore.roles, none
expcore_roles_allow_edit_warp = 'gui/warp-list/edit', --- @setting expcore_roles_allow_edit_warp if expcore.roles is used then this is the required permission
user_can_edit_own_warps = false, --- @settings user_can_edit_own_warps if true then the user who made the warp can edit it regardless of the allow_edit_warp setting
-- Warp area generation
entities = { --- @setting entities The entities which are created for warp areas
{'small-lamp',-3,-2},{'small-lamp',-3,2},{'small-lamp',3,-2},{'small-lamp',3,2},
{'small-lamp',-2,-3},{'small-lamp',2,-3},{'small-lamp',-2,3},{'small-lamp',2,3},
{'small-electric-pole',-3,-3},{'small-electric-pole',3,3},{'small-electric-pole',-3,3},{'small-electric-pole',3,-3}
},
base_tile = 'tutorial-grid', --- @setting base_tile The tile which is used for the warp areas
tiles = { --- @setting tiles The tiles which are created for warp areas
{-3,-2},{-3,-1},{-3,0},{-3,1},{-3,2},{3,-2},{3,-1},{3,0},{3,1},{3,2},
{-2,-3},{-1,-3},{0,-3},{1,-3},{2,-3},{-2,3},{-1,3},{0,3},{1,3},{2,3}
}
}