Skip to content

Commit 79c98c3

Browse files
committed
Merge branch 'release/5.7.0'
2 parents 8f5c687 + 754dfd5 commit 79c98c3

File tree

30 files changed

+1246
-152
lines changed

30 files changed

+1246
-152
lines changed

config/_file_loader.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ return {
2323
'modules.commands.spawn',
2424
'modules.commands.warnings',
2525
'modules.commands.find',
26+
'modules.commands.bonus',
2627
-- QoL Addons
2728
'modules.addons.chat-popups',
2829
'modules.addons.damage-popups',
@@ -33,9 +34,11 @@ return {
3334
'modules.addons.scorched-earth',
3435
'modules.addons.pollution-grading',
3536
'modules.addons.random-player-colours',
37+
'modules.addons.discord-alerts',
3638
-- GUI
3739
'modules.gui.rocket-info',
3840
'modules.gui.science-info',
41+
'modules.gui.warp-list',
3942
'modules.gui.task-list',
4043
'modules.gui.player-list',
4144
'modules.commands.debug',

config/bonuses.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--- Lists all bonuses which can be used, name followed by min max
2+
return {
3+
character_mining_speed_modifier={0,3},
4+
character_crafting_speed_modifier={0,3},
5+
character_running_speed_modifier={0,3},
6+
character_build_distance_bonus={0,20},
7+
character_reach_distance_bonus={0,20},
8+
character_inventory_slots_bonus={0,200}
9+
}

config/discord_alerts.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- Config file used to enable and disable different push messages for discord
2+
return {
3+
player_reports=true,
4+
player_warnings=true,
5+
player_bans=true,
6+
player_mutes=true,
7+
player_kicks=true,
8+
player_promotes=false,
9+
config=true,
10+
purge=true,
11+
c=true,
12+
command=true,
13+
['silent-command']=true,
14+
['measured-command']=true,
15+
['banlist']=true,
16+
['permissions']=true,
17+
['editor']=true,
18+
['cheat']=true,
19+
['open']=false,
20+
}

config/permission_groups.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ Permission_Groups.new_group('Standard')
6060
'change_programmable_speaker_alert_parameters', -- standard
6161
'drop_item',
6262
'reset_assembling_machine',
63-
'set_auto_launch_rocket',
64-
'cancel_research'
63+
'set_auto_launch_rocket'
6564
}
6665

6766
Permission_Groups.new_group('Guest')
@@ -84,7 +83,6 @@ Permission_Groups.new_group('Guest')
8483
'drop_item',
8584
'reset_assembling_machine',
8685
'set_auto_launch_rocket',
87-
'cancel_research',
8886
'change_programmable_speaker_parameters', -- guest
8987
'change_train_stop_station',
9088
'deconstruct',
@@ -93,7 +91,8 @@ Permission_Groups.new_group('Guest')
9391
'reset_assembling_machine',
9492
'rotate_entity',
9593
'use_artillery_remote',
96-
'launch_rocket'
94+
'launch_rocket',
95+
'cancel_research'
9796
}
9897

9998
Permission_Groups.new_group('Restricted')

config/roles.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ Roles.new_role('System','SYS')
3434
:set_flag('is_admin')
3535
:set_flag('is_spectator')
3636
:set_flag('report-immune')
37+
:set_flag('instance-respawn')
3738
:set_allow_all()
3839

3940
Roles.new_role('Senior Administrator','SAdmin')
4041
:set_permission_group('Admin')
4142
:set_flag('is_admin')
4243
:set_flag('is_spectator')
4344
:set_flag('report-immune')
45+
:set_flag('instance-respawn')
4446
:set_parent('Administrator')
4547
:allow{
4648
'command/interface',
@@ -54,8 +56,10 @@ Roles.new_role('Administrator','Admin')
5456
:set_flag('is_admin')
5557
:set_flag('is_spectator')
5658
:set_flag('report-immune')
59+
:set_flag('instance-respawn')
5760
:set_parent('Moderator')
5861
:allow{
62+
'gui/warp-list/no-limit',
5963
}
6064

6165
Roles.new_role('Moderator','Mod')
@@ -64,6 +68,7 @@ Roles.new_role('Moderator','Mod')
6468
:set_flag('is_admin')
6569
:set_flag('is_spectator')
6670
:set_flag('report-immune')
71+
:set_flag('instance-respawn')
6772
:set_parent('Trainee')
6873
:allow{
6974
'command/assign-role',
@@ -76,6 +81,7 @@ Roles.new_role('Moderator','Mod')
7681
'command/clear-warnings',
7782
'command/clear-temp-ban',
7883
'command/clear-inventory',
84+
'command/bonus',
7985
'gui/rocket-info/toggle-active',
8086
'gui/rocket-info/remote_launch',
8187
}
@@ -106,6 +112,7 @@ Roles.new_role('Sponsor','Spon')
106112
:set_custom_color{r=247,g=246,b=54}
107113
:set_flag('is_spectator')
108114
:set_flag('report-immune')
115+
:set_flag('instance-respawn')
109116
:set_parent('Pay to Win')
110117
:allow{
111118
}
@@ -115,10 +122,12 @@ Roles.new_role('Pay to Win','P2W')
115122
:set_custom_color{r=238,g=172,b=44}
116123
:set_flag('is_spectator')
117124
:set_flag('report-immune')
125+
:set_flag('instance-respawn')
118126
:set_parent('Donator')
119127
:allow{
120128
'gui/rocket-info/toggle-active',
121129
'gui/rocket-info/remote_launch',
130+
'command/bonus',
122131
}
123132

124133
Roles.new_role('Donator','Don')
@@ -159,7 +168,8 @@ Roles.new_role('Member','Mem')
159168
:set_custom_color{r=24,g=172,b=188}
160169
:set_parent('Regular')
161170
:allow{
162-
'gui/task-list/edit'
171+
'gui/task-list/edit',
172+
'gui/warp-list/edit'
163173
}
164174

165175
Roles.new_role('Regular','Reg')
@@ -193,6 +203,7 @@ local default = Roles.new_role('Guest','')
193203
'gui/rocket-info',
194204
'gui/science-info',
195205
'gui/task-list',
206+
'gui/warp-list',
196207
}
197208

198209
--- Jail role

config/warps.lua

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--- This file contains all the different settings for the warp system and gui
2+
return {
3+
recharge_time = 60, -- The amount of time in seconds that the player must wait between warps, acts as a balance
4+
update_smothing = 10, -- Higher is better, the amount of smothing applied to recharge timer and other gui updates, max is 60
5+
minimum_distance = 100, -- The minimum distance that must be between warp points, creating new ones is blocked when too close
6+
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
7+
spawn_activation_range = 20, -- A second activation range which is used for the forces spawn point
8+
default_icon = 'discharge-defense-equipment', -- The deafult icon which is used by warps; must be an item name
9+
user_can_edit_own_warps = false, -- When true the user can always edit warps which they created regaudless of other settings
10+
any_user_can_add_new_warp = false, -- When true any user is able to create new warps, however editing may still be restricted
11+
only_admins_can_edit = false, -- When true only admins can edit warps
12+
edit_warps_role_permision = 'gui/warp-list/edit', -- Role permission used by the role system to allow editing warps
13+
bypass_warp_limits_permision = 'gui/warp-list/no-limit', -- Role permission used by the role system to allow bypassing the time and distance restrctions
14+
entities = { -- The entites which are created for warps
15+
{'small-lamp',-3,-2},{'small-lamp',-3,2},{'small-lamp',3,-2},{'small-lamp',3,2},
16+
{'small-lamp',-2,-3},{'small-lamp',2,-3},{'small-lamp',-2,3},{'small-lamp',2,3},
17+
{'small-electric-pole',-3,-3},{'small-electric-pole',3,3},{'small-electric-pole',-3,3},{'small-electric-pole',3,-3}
18+
},
19+
base_tile = 'tutorial-grid', -- The tile which is used for the warps
20+
tiles = { -- The tiles which are created for warps
21+
{-3,-2},{-3,-1},{-3,0},{-3,1},{-3,2},{3,-2},{3,-1},{3,0},{3,1},{3,2},
22+
{-2,-3},{-1,-3},{0,-3},{1,-3},{2,-3},{-2,3},{-1,3},{0,3},{1,3},{2,3}
23+
}
24+
}

expcore/commands.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ end
427427

428428
--- Adds a new param to the command this will be displayed in the help and used to parse the input
429429
-- @tparam string name the name of the new param that is being added to the command
430-
-- @tparam[opt=true] boolean optional is this param required for this command, these must be after all required params
430+
-- @tparam[opt=false] boolean optional is this param required for this command, these must be after all required params
431431
-- @tparam[opt=pass function through] ?string|function parse this function will take the input and return a new (or same) value
432432
-- @param[opt] ... extra args you want to pass to the parse function; for example if the parse is general use
433433
-- parse param - input: string - the input given by the user for this param
@@ -436,12 +436,17 @@ end
436436
-- parse return - the value that will be passed to the command callback, must not be nil and if reject then command is not run
437437
-- @treturn Commands._prototype pass through to allow more functions to be called
438438
function Commands._prototype:add_param(name,optional,parse,...)
439-
if optional ~= false then optional = true end
439+
local parse_args = {...}
440+
if type(optional) ~= 'boolean' then
441+
parse_args = {parse,...}
442+
parse = optional
443+
optional = false
444+
end
440445
parse = parse or function(string) return string end
441446
self.params[name] = {
442447
optional=optional,
443448
parse=parse,
444-
parse_args={...}
449+
parse_args=parse_args
445450
}
446451
self.max_param_count = self.max_param_count+1
447452
if not optional then
@@ -617,7 +622,7 @@ function Commands.run_command(command_event)
617622
-- splits the arguments
618623
local input_string = command_event.parameter or ''
619624
local quote_params = {} -- stores any " " params
620-
input_string = input_string:gsub('"[^"]-"',function(w)
625+
input_string = input_string:gsub(' "[^"]-"',function(w)
621626
-- finds all " " params are removes spaces for the next part
622627
local no_spaces = w:gsub('%s','_')
623628
local no_quotes = w:sub(2,-2)

expcore/common.lua

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -510,26 +510,77 @@ function Common.auto_complete(options,input,use_key,rtn_key)
510510
return rtn[1]
511511
end
512512

513-
--- Returns all the keys of a table
514-
-- @tparam table tbl table the to get the keys of
515-
-- @treturn table an array of the table keys
516-
function Common.table_keys(tbl)
517-
local rtn = {}
518-
for key,_ in pairs(tbl) do
519-
table.insert(rtn,key)
513+
--- Default table comparator sort function.
514+
-- @local
515+
-- @param x one comparator operand
516+
-- @param y the other comparator operand
517+
-- @return true if x logically comes before y in a list, false otherwise
518+
local function sortFunc(x, y) --sorts tables with mixed index types.
519+
local tx = type(x)
520+
local ty = type(y)
521+
if tx == ty then
522+
if type(x) == 'string' then
523+
return string.lower(x) < string.lower(y)
524+
else
525+
return x < y
526+
end
527+
elseif tx == 'number' then
528+
return true --only x is a number and goes first
529+
else
530+
return false --only y is a number and goes first
520531
end
521-
return rtn
522532
end
523533

524-
--- Returns all the values of a table
525-
-- @tparam table tbl table the to get the values of
526-
-- @treturn table an array of the table values
527-
function Common.table_values(tbl)
528-
local rtn = {}
529-
for _,value in pairs(tbl) do
530-
table.insert(rtn,value)
534+
--- Returns a copy of all of the values in the table.
535+
-- @tparam table table tbl the to copy the keys from, or an empty table if tbl is nil
536+
-- @tparam[opt] boolean sorted whether to sort the keys (slower) or keep the random order from pairs()
537+
-- @tparam[opt] boolean as_string whether to try and parse the values as strings, or leave them as their existing type
538+
-- @treturn array an array with a copy of all the values in the table
539+
function Common.table_values(tbl, sorted, as_string)
540+
if not tbl then return {} end
541+
local valueset = {}
542+
local n = 0
543+
if as_string then --checking as_string /before/ looping is faster
544+
for _, v in pairs(tbl) do
545+
n = n + 1
546+
valueset[n] = tostring(v)
547+
end
548+
else
549+
for _, v in pairs(tbl) do
550+
n = n + 1
551+
valueset[n] = v
552+
end
531553
end
532-
return rtn
554+
if sorted then
555+
table.sort(valueset,sortFunc)
556+
end
557+
return valueset
558+
end
559+
560+
--- Returns a copy of all of the keys in the table.
561+
-- @tparam table table tbl the to copy the keys from, or an empty table if tbl is nil
562+
-- @tparam[opt] boolean sorted whether to sort the keys (slower) or keep the random order from pairs()
563+
-- @tparam[opt] boolean as_string whether to try and parse the keys as strings, or leave them as their existing type
564+
-- @treturn array an array with a copy of all the keys in the table
565+
function Common.table_keys(tbl, sorted, as_string)
566+
if not tbl then return {} end
567+
local keyset = {}
568+
local n = 0
569+
if as_string then --checking as_string /before/ looping is faster
570+
for k, _ in pairs(tbl) do
571+
n = n + 1
572+
keyset[n] = tostring(k)
573+
end
574+
else
575+
for k, _ in pairs(tbl) do
576+
n = n + 1
577+
keyset[n] = k
578+
end
579+
end
580+
if sorted then
581+
table.sort(keyset,sortFunc)
582+
end
583+
return keyset
533584
end
534585

535586
--- Returns the list is a sorted way that would be expected by people (this is by key)

expcore/gui/progress-bar.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,18 @@ local function change_value_prototype(self,amount,category,filter)
258258
local maximum = self.default_maximum or 1
259259
local new_value = value + (amount/maximum)
260260

261+
self:set_store(category,new_value)
262+
261263
if self.count_down and new_value <= 0
262264
or not self.count_down and new_value >= 1 then
263265
self:clear_store(category)
264266

265267
if self.events.on_store_complete then
266268
self.events.on_store_complete(category,reset_store)
267269
end
268-
end
269270

270-
self:set_store(category,new_value)
271+
return
272+
end
271273

272274
return
273275
end

expcore/store.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,13 @@ Event.add(Store.on_value_update,function(event)
240240
Store.callbacks[event.location](event.value,event.child)
241241
end
242242

243-
if not event.from_sync then
244-
write_json('log/store.log',event)
243+
if not event.from_sync and Store.synced[event.location] then
244+
write_json('log/store.log',{
245+
tick=event.tick,
246+
location=event.location,
247+
child=event.child,
248+
value=event.value,
249+
})
245250
end
246251
end)
247252

0 commit comments

Comments
 (0)