Skip to content

Commit

Permalink
Merge branch 'release/5.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Cooldude2606 committed Oct 18, 2019
2 parents 64bac53 + 3a04e72 commit a2737e2
Show file tree
Hide file tree
Showing 135 changed files with 10,173 additions and 4,665 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,20 @@ Explosive Gaming (often ExpGaming) is a server hosting community with a strong f

## Contributing

All are welcome to make pull requests and issues for this scenario, if you are in any doubt please ask someone in our [discord]. If you do not know lua and don't feel like learning you can always make a [feature request]. Please keep in mind while making code changes:
All are welcome to make pull requests and issues for this scenario, if you are in any doubt please ask someone in our [discord]. If you do not know lua and don't feel like learning you can always make a [feature request]. All our docs can be found [here][docs]. Please keep in mind while making code changes:

* New features should have the branch names: `feature/feature-name`
* New features are merged into `dev` after it has been completed.
* After a number of features have been added a release branch is made: `release/X.Y.0`; this branch should have no new features and only bug fixes or localization.
* A release is merged into `master` on the following friday in time for the the weekly reset.
* Patches may be named `patch/X.Y.Z` and fill be merged into `master` and `dev` when appropriate.
* New features are merged into `dev` after it has been completed, this can be done through a pull request.
* After a number of features have been added a release branch is made: `release/X.Y.0`
* Bug fixes and localization can be made to the release branch with a pull request rather than into dev.
* A release is merged into `master` on the following friday after it is considered stable.
* Patches may be named `patch/X.Y.Z` and will be merged into `dev` and then `master` when appropriate.

## Releases

| Scenario Version* | Version Name | Factorio Version** |
|---|---|---|
| [v5.10][s5.10] | Data Store Rewrite | [v0.17.71][f0.17.71] |
| [v5.9][s5.9] | Control Modules and Documentation | [v0.17.63][f0.17.63] |
| [v5.8][s5.8] | Home and Chat Bot | [v0.17.47][f0.17.49] |
| [v5.7][s5.7] | Warp System | [v0.17.47][f0.17.47] |
Expand All @@ -76,6 +78,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i

\*\* Factorio versions show the version they were made for, often the minimum requirement.

[s5.10]: https://github.com/explosivegaming/scenario/releases/tag/5.10.0
[s5.9]: https://github.com/explosivegaming/scenario/releases/tag/5.9.0
[s5.8]: https://github.com/explosivegaming/scenario/releases/tag/5.8.0
[s5.7]: https://github.com/explosivegaming/scenario/releases/tag/5.7.0
Expand All @@ -92,6 +95,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i
[s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0
[s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1

[f0.17.71]: https://wiki.factorio.com/Version_history/0.17.0#0.17.71
[f0.17.63]: https://wiki.factorio.com/Version_history/0.17.0#0.17.63
[f0.17.49]: https://wiki.factorio.com/Version_history/0.17.0#0.17.49
[f0.17.47]: https://wiki.factorio.com/Version_history/0.17.0#0.17.47
Expand All @@ -111,6 +115,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i

The Explosive Gaming codebase is licensed under the [GNU General Public License v3.0](LICENSE)

[docs]: https://explosivegaming.github.io/scenario/
[issues]: https://github.com/explosivegaming/scenario/issues/new/choose
[website]: https://explosivegaming.nl
[discord]: https://discord.explosivegaming.nl
Expand Down
209 changes: 108 additions & 101 deletions config/action_buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ local Jail = require 'modules.control.jail' --- @dep modules.control.jail
local Colors = require 'resources.color_presets' --- @dep resources.color_presets
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') --- @dep expcore.common

local action_player_store = 'gui.left.player-list.action-player'
local action_name_store = 'gui.left.player-list.action-name'
local selected_player_store = ''
local selected_action_store = ''
local function set_store_uids(player,action)
selected_player_store = player
selected_action_store = action
end

-- common style used by all action buttons
local function tool_button_style(style)
Expand All @@ -26,20 +30,20 @@ local function tool_button_style(style)
end

-- auth that will only allow when on player's of lower roles
local function auth_lower_role(player,action_player_name)
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(action_player_name)
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 action_player_name = Store.get(action_player_store,player.name)
local action_player = Game.get_player_from_any(action_player_name)
local action_player_name_color = format_chat_player_name(action_player)
return action_player,action_player_name_color
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
Expand All @@ -60,12 +64,12 @@ Gui.new_button()
:set_tooltip{'player-list.goto-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local action_player_name = get_action_player_name(player)
local action_player = Game.get_player_from_any(action_player_name)
if not player.character or not action_player.character then
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,action_player)
teleport(player,selected_player)
end
end)

Expand All @@ -77,12 +81,12 @@ Gui.new_button()
:set_tooltip{'player-list.bring-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local action_player_name = get_action_player_name(player)
local action_player = Game.get_player_from_any(action_player_name)
if not player.character or not action_player.character then
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(action_player,player)
teleport(selected_player,player)
end
end)

Expand All @@ -94,10 +98,10 @@ Gui.new_button()
:set_tooltip{'player-list.kill-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local action_player_name = get_action_player_name(player)
local action_player = Game.get_player_from_any(action_player_name)
if action_player.character then
action_player.character.die()
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
Expand All @@ -111,20 +115,20 @@ Gui.new_button()
:set_tooltip{'player-list.report-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local action_player_name = get_action_player_name(player)
if Reports.is_reported(action_player_name,player.name) then
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(action_name_store,player.name,'command/report')
Store.set(selected_action_store,player,'command/report')
end
end)

local function report_player_callback(player,reason)
local action_player_name,action_player_name_color = get_action_player_name(player)
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',action_player_name_color,reason}
Roles.print_to_roles_higher('Trainee',{'expcom-report.admin',action_player_name_color,by_player_name_color,reason})
Reports.report_player(action_player_name,player.name,reason)
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
Expand All @@ -135,14 +139,14 @@ Gui.new_button()
:set_tooltip{'player-list.warn-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
Store.set(action_name_store,player.name,'command/give-warning')
Store.set(selected_action_store,player,'command/give-warning')
end)

local function warn_player_callback(player,reason)
local action_player_name,action_player_name_color = get_action_player_name(player)
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',action_player_name_color,by_player_name_color,reason}
Warnings.add_warning(action_player_name,player.name,reason)
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
Expand All @@ -153,19 +157,19 @@ Gui.new_button()
:set_tooltip{'player-list.jail-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local action_player_name,action_player_name_color = get_action_player_name(player)
if Jail.is_jailed(action_player_name) then
player.print({'expcom-jail.already-jailed',action_player_name_color},Colors.orange_red)
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(action_name_store,player.name,'command/jail')
Store.set(selected_action_store,player,'command/jail')
end
end)

local function jail_player_callback(player,reason)
local action_player_name,action_player_name_color = get_action_player_name(player)
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',action_player_name_color,by_player_name_color,reason}
Jail.jail_player(action_player_name,player.name,reason)
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
Expand All @@ -176,19 +180,19 @@ Gui.new_button()
:set_tooltip{'player-list.temp-ban-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
local action_player_name,action_player_name_color = get_action_player_name(player)
if Jail.is_jailed(action_player_name) then
player.print({'expcom-jail.already-banned',action_player_name_color},Colors.orange_red)
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(action_name_store,player.name,'command/temp-ban')
Store.set(selected_action_store,player,'command/temp-ban')
end
end)

local function temp_ban_player_callback(player,reason)
local action_player,action_player_name_color = get_action_player_name(player)
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',action_player_name_color,by_player_name_color,reason}
Jail.temp_ban_player(action_player,player.name,reason)
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
Expand All @@ -199,12 +203,12 @@ Gui.new_button()
:set_tooltip{'player-list.kick-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
Store.set(action_name_store,player.name,'command/kick')
Store.set(selected_action_store,player,'command/kick')
end)

local function kick_player_callback(player,reason)
local action_player = get_action_player_name(player)
game.kick_player(action_player,reason)
local selected_player = get_action_player_name(player)
game.kick_player(selected_player,reason)
end

--- Bans the action player, requires a reason
Expand All @@ -215,64 +219,67 @@ Gui.new_button()
:set_tooltip{'player-list.ban-player'}
:set_style('tool_button',tool_button_style)
:on_click(function(player,element)
Store.set(action_name_store,player.name,'command/ban')
Store.set(selected_action_store,player,'command/ban')
end)

local function ban_player_callback(player,reason)
local action_player = get_action_player_name(player)
game.ban_player(action_player,reason)
local selected_player = get_action_player_name(player)
game.ban_player(selected_player,reason)
end

return {
['command/teleport'] = {
auth=function(player,action_player)
return player.name ~= action_player.name
end, -- cant teleport to your self
goto_player,
bring_player
},
['command/kill'] = {
auth=function(player,action_player)
if player.name == action_player.name then
return true
elseif Roles.player_allowed(player,'command/kill/always') then
return auth_lower_role(player,action_player)
end
end, -- player must be lower role, or your self
kill_player
},
['command/report'] = {
auth=function(player,action_player)
if not Roles.player_allowed(player,'command/give-warning') then
return not Roles.player_has_flag(action_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
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
}
}
}
6 changes: 3 additions & 3 deletions config/advanced_start.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ return {
['electronic-circuit']=scale_amount_made(1000,0,6),
['iron-gear-wheel']=scale_amount_made(1000,0,6),
-- Starting Items
['burner-mining-drill']=cutoff_time(5*minutes,4,0),
['stone-furnace']=cutoff_time(5*minutes,4,0),
['burner-mining-drill']=cutoff_time(10*minutes,4,0),
['stone-furnace']=cutoff_time(10*minutes,4,0),
-- Armor
['light-armor']=cutoff_amount_made_unless(5,0,1,'heavy-armor',5),
['heavy-armor']=cutoff_amount_made(5,0,1),
Expand All @@ -91,4 +91,4 @@ return {
['firearm-magazine']=cutoff_amount_made_unless(100,10,0,'piercing-rounds-magazine',100),
['piercing-rounds-magazine']=cutoff_amount_made(100,0,10),
}
}
}
Loading

0 comments on commit a2737e2

Please sign in to comment.