Skip to content

Commit

Permalink
Merge branch 'release/5.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Cooldude2606 committed Jun 7, 2019
2 parents 8f5c687 + 754dfd5 commit 79c98c3
Show file tree
Hide file tree
Showing 30 changed files with 1,246 additions and 152 deletions.
3 changes: 3 additions & 0 deletions config/_file_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ return {
'modules.commands.spawn',
'modules.commands.warnings',
'modules.commands.find',
'modules.commands.bonus',
-- QoL Addons
'modules.addons.chat-popups',
'modules.addons.damage-popups',
Expand All @@ -33,9 +34,11 @@ return {
'modules.addons.scorched-earth',
'modules.addons.pollution-grading',
'modules.addons.random-player-colours',
'modules.addons.discord-alerts',
-- GUI
'modules.gui.rocket-info',
'modules.gui.science-info',
'modules.gui.warp-list',
'modules.gui.task-list',
'modules.gui.player-list',
'modules.commands.debug',
Expand Down
9 changes: 9 additions & 0 deletions config/bonuses.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--- Lists all bonuses which can be used, name followed by min max
return {
character_mining_speed_modifier={0,3},
character_crafting_speed_modifier={0,3},
character_running_speed_modifier={0,3},
character_build_distance_bonus={0,20},
character_reach_distance_bonus={0,20},
character_inventory_slots_bonus={0,200}
}
20 changes: 20 additions & 0 deletions config/discord_alerts.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- Config file used to enable and disable different push messages for discord
return {
player_reports=true,
player_warnings=true,
player_bans=true,
player_mutes=true,
player_kicks=true,
player_promotes=false,
config=true,
purge=true,
c=true,
command=true,
['silent-command']=true,
['measured-command']=true,
['banlist']=true,
['permissions']=true,
['editor']=true,
['cheat']=true,
['open']=false,
}
7 changes: 3 additions & 4 deletions config/permission_groups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ Permission_Groups.new_group('Standard')
'change_programmable_speaker_alert_parameters', -- standard
'drop_item',
'reset_assembling_machine',
'set_auto_launch_rocket',
'cancel_research'
'set_auto_launch_rocket'
}

Permission_Groups.new_group('Guest')
Expand All @@ -84,7 +83,6 @@ Permission_Groups.new_group('Guest')
'drop_item',
'reset_assembling_machine',
'set_auto_launch_rocket',
'cancel_research',
'change_programmable_speaker_parameters', -- guest
'change_train_stop_station',
'deconstruct',
Expand All @@ -93,7 +91,8 @@ Permission_Groups.new_group('Guest')
'reset_assembling_machine',
'rotate_entity',
'use_artillery_remote',
'launch_rocket'
'launch_rocket',
'cancel_research'
}

Permission_Groups.new_group('Restricted')
Expand Down
13 changes: 12 additions & 1 deletion config/roles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ Roles.new_role('System','SYS')
:set_flag('is_admin')
:set_flag('is_spectator')
:set_flag('report-immune')
:set_flag('instance-respawn')
:set_allow_all()

Roles.new_role('Senior Administrator','SAdmin')
:set_permission_group('Admin')
:set_flag('is_admin')
:set_flag('is_spectator')
:set_flag('report-immune')
:set_flag('instance-respawn')
:set_parent('Administrator')
:allow{
'command/interface',
Expand All @@ -54,8 +56,10 @@ Roles.new_role('Administrator','Admin')
:set_flag('is_admin')
:set_flag('is_spectator')
:set_flag('report-immune')
:set_flag('instance-respawn')
:set_parent('Moderator')
:allow{
'gui/warp-list/no-limit',
}

Roles.new_role('Moderator','Mod')
Expand All @@ -64,6 +68,7 @@ Roles.new_role('Moderator','Mod')
:set_flag('is_admin')
:set_flag('is_spectator')
:set_flag('report-immune')
:set_flag('instance-respawn')
:set_parent('Trainee')
:allow{
'command/assign-role',
Expand All @@ -76,6 +81,7 @@ Roles.new_role('Moderator','Mod')
'command/clear-warnings',
'command/clear-temp-ban',
'command/clear-inventory',
'command/bonus',
'gui/rocket-info/toggle-active',
'gui/rocket-info/remote_launch',
}
Expand Down Expand Up @@ -106,6 +112,7 @@ Roles.new_role('Sponsor','Spon')
:set_custom_color{r=247,g=246,b=54}
:set_flag('is_spectator')
:set_flag('report-immune')
:set_flag('instance-respawn')
:set_parent('Pay to Win')
:allow{
}
Expand All @@ -115,10 +122,12 @@ Roles.new_role('Pay to Win','P2W')
:set_custom_color{r=238,g=172,b=44}
:set_flag('is_spectator')
:set_flag('report-immune')
:set_flag('instance-respawn')
:set_parent('Donator')
:allow{
'gui/rocket-info/toggle-active',
'gui/rocket-info/remote_launch',
'command/bonus',
}

Roles.new_role('Donator','Don')
Expand Down Expand Up @@ -159,7 +168,8 @@ Roles.new_role('Member','Mem')
:set_custom_color{r=24,g=172,b=188}
:set_parent('Regular')
:allow{
'gui/task-list/edit'
'gui/task-list/edit',
'gui/warp-list/edit'
}

Roles.new_role('Regular','Reg')
Expand Down Expand Up @@ -193,6 +203,7 @@ local default = Roles.new_role('Guest','')
'gui/rocket-info',
'gui/science-info',
'gui/task-list',
'gui/warp-list',
}

--- Jail role
Expand Down
24 changes: 24 additions & 0 deletions config/warps.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--- This file contains all the different settings for the warp system and gui
return {
recharge_time = 60, -- The amount of time in seconds that the player must wait between warps, acts as a balance
update_smothing = 10, -- Higher is better, the amount of smothing applied to recharge timer and other gui updates, max is 60
minimum_distance = 100, -- The minimum distance that must be between warp points, creating new ones is blocked when too close
activation_range = 4, -- The distance the player must be to a warp in order to use the warp gui, gui can still be viewd but not used
spawn_activation_range = 20, -- A second activation range which is used for the forces spawn point
default_icon = 'discharge-defense-equipment', -- The deafult icon which is used by warps; must be an item name
user_can_edit_own_warps = false, -- When true the user can always edit warps which they created regaudless of other settings
any_user_can_add_new_warp = false, -- When true any user is able to create new warps, however editing may still be restricted
only_admins_can_edit = false, -- When true only admins can edit warps
edit_warps_role_permision = 'gui/warp-list/edit', -- Role permission used by the role system to allow editing warps
bypass_warp_limits_permision = 'gui/warp-list/no-limit', -- Role permission used by the role system to allow bypassing the time and distance restrctions
entities = { -- The entites which are created for warps
{'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', -- The tile which is used for the warps
tiles = { -- The tiles which are created for warps
{-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}
}
}
13 changes: 9 additions & 4 deletions expcore/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ end

--- Adds a new param to the command this will be displayed in the help and used to parse the input
-- @tparam string name the name of the new param that is being added to the command
-- @tparam[opt=true] boolean optional is this param required for this command, these must be after all required params
-- @tparam[opt=false] boolean optional is this param required for this command, these must be after all required params
-- @tparam[opt=pass function through] ?string|function parse this function will take the input and return a new (or same) value
-- @param[opt] ... extra args you want to pass to the parse function; for example if the parse is general use
-- parse param - input: string - the input given by the user for this param
Expand All @@ -436,12 +436,17 @@ end
-- parse return - the value that will be passed to the command callback, must not be nil and if reject then command is not run
-- @treturn Commands._prototype pass through to allow more functions to be called
function Commands._prototype:add_param(name,optional,parse,...)
if optional ~= false then optional = true end
local parse_args = {...}
if type(optional) ~= 'boolean' then
parse_args = {parse,...}
parse = optional
optional = false
end
parse = parse or function(string) return string end
self.params[name] = {
optional=optional,
parse=parse,
parse_args={...}
parse_args=parse_args
}
self.max_param_count = self.max_param_count+1
if not optional then
Expand Down Expand Up @@ -617,7 +622,7 @@ function Commands.run_command(command_event)
-- splits the arguments
local input_string = command_event.parameter or ''
local quote_params = {} -- stores any " " params
input_string = input_string:gsub('"[^"]-"',function(w)
input_string = input_string:gsub(' "[^"]-"',function(w)
-- finds all " " params are removes spaces for the next part
local no_spaces = w:gsub('%s','_')
local no_quotes = w:sub(2,-2)
Expand Down
83 changes: 67 additions & 16 deletions expcore/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -510,26 +510,77 @@ function Common.auto_complete(options,input,use_key,rtn_key)
return rtn[1]
end

--- Returns all the keys of a table
-- @tparam table tbl table the to get the keys of
-- @treturn table an array of the table keys
function Common.table_keys(tbl)
local rtn = {}
for key,_ in pairs(tbl) do
table.insert(rtn,key)
--- Default table comparator sort function.
-- @local
-- @param x one comparator operand
-- @param y the other comparator operand
-- @return true if x logically comes before y in a list, false otherwise
local function sortFunc(x, y) --sorts tables with mixed index types.
local tx = type(x)
local ty = type(y)
if tx == ty then
if type(x) == 'string' then
return string.lower(x) < string.lower(y)
else
return x < y
end
elseif tx == 'number' then
return true --only x is a number and goes first
else
return false --only y is a number and goes first
end
return rtn
end

--- Returns all the values of a table
-- @tparam table tbl table the to get the values of
-- @treturn table an array of the table values
function Common.table_values(tbl)
local rtn = {}
for _,value in pairs(tbl) do
table.insert(rtn,value)
--- Returns a copy of all of the values in the table.
-- @tparam table table tbl the to copy the keys from, or an empty table if tbl is nil
-- @tparam[opt] boolean sorted whether to sort the keys (slower) or keep the random order from pairs()
-- @tparam[opt] boolean as_string whether to try and parse the values as strings, or leave them as their existing type
-- @treturn array an array with a copy of all the values in the table
function Common.table_values(tbl, sorted, as_string)
if not tbl then return {} end
local valueset = {}
local n = 0
if as_string then --checking as_string /before/ looping is faster
for _, v in pairs(tbl) do
n = n + 1
valueset[n] = tostring(v)
end
else
for _, v in pairs(tbl) do
n = n + 1
valueset[n] = v
end
end
return rtn
if sorted then
table.sort(valueset,sortFunc)
end
return valueset
end

--- Returns a copy of all of the keys in the table.
-- @tparam table table tbl the to copy the keys from, or an empty table if tbl is nil
-- @tparam[opt] boolean sorted whether to sort the keys (slower) or keep the random order from pairs()
-- @tparam[opt] boolean as_string whether to try and parse the keys as strings, or leave them as their existing type
-- @treturn array an array with a copy of all the keys in the table
function Common.table_keys(tbl, sorted, as_string)
if not tbl then return {} end
local keyset = {}
local n = 0
if as_string then --checking as_string /before/ looping is faster
for k, _ in pairs(tbl) do
n = n + 1
keyset[n] = tostring(k)
end
else
for k, _ in pairs(tbl) do
n = n + 1
keyset[n] = k
end
end
if sorted then
table.sort(keyset,sortFunc)
end
return keyset
end

--- Returns the list is a sorted way that would be expected by people (this is by key)
Expand Down
6 changes: 4 additions & 2 deletions expcore/gui/progress-bar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,18 @@ local function change_value_prototype(self,amount,category,filter)
local maximum = self.default_maximum or 1
local new_value = value + (amount/maximum)

self:set_store(category,new_value)

if self.count_down and new_value <= 0
or not self.count_down and new_value >= 1 then
self:clear_store(category)

if self.events.on_store_complete then
self.events.on_store_complete(category,reset_store)
end
end

self:set_store(category,new_value)
return
end

return
end
Expand Down
9 changes: 7 additions & 2 deletions expcore/store.lua
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,13 @@ Event.add(Store.on_value_update,function(event)
Store.callbacks[event.location](event.value,event.child)
end

if not event.from_sync then
write_json('log/store.log',event)
if not event.from_sync and Store.synced[event.location] then
write_json('log/store.log',{
tick=event.tick,
location=event.location,
child=event.child,
value=event.value,
})
end
end)

Expand Down
19 changes: 18 additions & 1 deletion locale/en/gui.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,21 @@ confirm-tooltip=Save changes
cancel-tooltip=Discard changes
edit-tooltip=Currently being edited by: __1__
edit-tooltip-none=Currently being edited by: Nobody
discord-tooltip=Remove task
discard-tooltip=Remove task

[warp-list]
main-caption=Warp List
main-tooltip=Warp list, must be within __1__ tiles to use
sub-tooltip=Warps can only be used every __1__ seconds and when within __2__ tiles
too-close=Cant make warp; too close to warp: __1__
last-edit=Last edited by __1__ at __2__
add-tooltip=Add new warp
confirm-tooltip=Save changes
cancel-tooltip=Discard changes
edit-tooltip=Currently being edited by: __1__
edit-tooltip-none=Currently being edited by: Nobody
discard-tooltip=Remove warp
timer-tooltip=Warp charge, charge time __1__ seconds
goto-tooltip=Go to x __1__ y __2__
goto-disabled=You must be on a warp point and have a full charge to warp
goto-edit=Edit warp icon
Loading

0 comments on commit 79c98c3

Please sign in to comment.