1- --- Config for the different action buttons that show on the player list
2- -- each button has the button define(s) given along side an auth function, and optional reason callback
3- -- if a reason callback is used then Store.set(action_name_store,player.name,'BUTTON_NAME') should be called during on_click
4- -- buttons can be removed from the gui by commenting them out of the config at the bottom of this file
5- -- the key used for the name of the button is the permision name used by the role system
6- local Gui = require ' expcore.gui'
7- local Roles = require ' expcore.roles'
8- local Store = require ' expcore.store'
9- local Game = require ' utils.game'
10- local Reports = require ' modules.addons.reports-control'
11- local Warnings = require ' modules.addons.warnings-control'
12- local Jail = require ' modules.addons.jail-control'
13- local Colors = require ' resources.color_presets'
14- local format_chat_player_name = ext_require (' expcore.common' ,' format_chat_player_name' )
1+ --- Config for the different action buttons that show on the player list;
2+ -- each button has the button define(s) given along side an auth function, and optional reason callback;
3+ -- if a reason callback is used then Store.set(action_name_store,player.name,'BUTTON_NAME') should be called during on_click;
4+ -- buttons can be removed from the gui by commenting them out of the config at the bottom of this file;
5+ -- the key used for the name of the button is the permission name used by the role system;
6+ -- @config Player-List
7+
8+ local Gui = require ' expcore.gui' --- @dep expcore.gui
9+ local Roles = require ' expcore.roles' --- @dep expcore.roles
10+ local Store = require ' expcore.store' --- @dep expcore.store
11+ local Game = require ' utils.game' --- @dep utils.game
12+ local Reports = require ' modules.control.reports' --- @dep modules.control.reports
13+ local Warnings = require ' modules.control.warnings' --- @dep modules.control.warnings
14+ local Jail = require ' modules.control.jail' --- @dep modules.control.jail
15+ local Colors = require ' resources.color_presets' --- @dep resources.color_presets
16+ local format_chat_player_name = ext_require (' expcore.common' ,' format_chat_player_name' ) --- @dep expcore.common
1517
1618local action_player_store = ' gui.left.player-list.action-player'
1719local action_name_store = ' gui.left.player-list.action-name'
@@ -50,7 +52,8 @@ local function teleport(from_player,to_player)
5052 return true
5153end
5254
53- -- teleports the user to the action player
55+ --- Teleports the user to the action player
56+ -- @element goto_player
5457local goto_player =
5558Gui .new_button ()
5659:set_sprites (' utility/export' )
@@ -66,7 +69,8 @@ Gui.new_button()
6669 end
6770end )
6871
69- -- teleports the action player to the user
72+ --- Teleports the action player to the user
73+ -- @element bring_player
7074local bring_player =
7175Gui .new_button ()
7276:set_sprites (' utility/import' )
@@ -82,7 +86,8 @@ Gui.new_button()
8286 end
8387end )
8488
85- -- kills the action player, if there are alive
89+ --- Kills the action player, if there are alive
90+ -- @element kill_player
8691local kill_player =
8792Gui .new_button ()
8893:set_sprites (' utility/too_far' )
@@ -98,15 +103,16 @@ Gui.new_button()
98103 end
99104end )
100105
101- -- reports the action player, requires a reason to be given
106+ --- Reports the action player, requires a reason to be given
107+ -- @element report_player
102108local report_player =
103109Gui .new_button ()
104110:set_sprites (' utility/spawn_flag' )
105111:set_tooltip {' player-list.report-player' }
106112:set_style (' tool_button' ,tool_button_style )
107113:on_click (function (player ,element )
108114 local action_player_name = get_action_player_name (player )
109- if Reports .player_is_reported_by (action_player_name ,player .name ) then
115+ if Reports .is_reported (action_player_name ,player .name ) then
110116 player .print ({' expcom-report.already-reported' },Colors .orange_red )
111117 else
112118 Store .set (action_name_store ,player .name ,' command/report' )
@@ -118,10 +124,11 @@ local function report_player_callback(player,reason)
118124 local by_player_name_color = format_chat_player_name (player )
119125 game .print {' expcom-report.non-admin' ,action_player_name_color ,reason }
120126 Roles .print_to_roles_higher (' Trainee' ,{' expcom-report.admin' ,action_player_name_color ,by_player_name_color ,reason })
121- Reports .report_player (action_player_name ,reason , player .name )
127+ Reports .report_player (action_player_name ,player .name , reason )
122128end
123129
124- -- gives the action player a warning, requires a reason
130+ --- Gives the action player a warning, requires a reason
131+ -- @element warn_player
125132local warn_player =
126133Gui .new_button ()
127134:set_sprites (' utility/spawn_flag' )
@@ -135,18 +142,19 @@ local function warn_player_callback(player,reason)
135142 local action_player_name ,action_player_name_color = get_action_player_name (player )
136143 local by_player_name_color = format_chat_player_name (player )
137144 game .print {' expcom-warnings.received' ,action_player_name_color ,by_player_name_color ,reason }
138- Warnings .add_warnings (action_player_name ,player .name )
145+ Warnings .add_warning (action_player_name ,player .name , reason )
139146end
140147
141- -- jails the action player, requires a reason
148+ --- Jails the action player, requires a reason
149+ -- @element jail_player
142150local jail_player =
143151Gui .new_button ()
144152:set_sprites (' utility/item_editor_icon' )
145153:set_tooltip {' player-list.jail-player' }
146154:set_style (' tool_button' ,tool_button_style )
147155:on_click (function (player ,element )
148156 local action_player_name ,action_player_name_color = get_action_player_name (player )
149- if Roles . player_has_role (action_player_name , ' Jail ' ) then
157+ if Jail . is_jailed (action_player_name ) then
150158 player .print ({' expcom-jail.already-jailed' ,action_player_name_color },Colors .orange_red )
151159 else
152160 Store .set (action_name_store ,player .name ,' command/jail' )
@@ -157,18 +165,19 @@ local function jail_player_callback(player,reason)
157165 local action_player_name ,action_player_name_color = get_action_player_name (player )
158166 local by_player_name_color = format_chat_player_name (player )
159167 game .print {' expcom-jail.give' ,action_player_name_color ,by_player_name_color ,reason }
160- Jail .jail_player (action_player_name ,player .name )
168+ Jail .jail_player (action_player_name ,player .name , reason )
161169end
162170
163- -- temp bans the action player, requires a reason
171+ --- Temp bans the action player, requires a reason
172+ -- @element temp_ban_player
164173local temp_ban_player =
165174Gui .new_button ()
166175:set_sprites (' utility/clock' )
167176:set_tooltip {' player-list.temp-ban-player' }
168177:set_style (' tool_button' ,tool_button_style )
169178:on_click (function (player ,element )
170179 local action_player_name ,action_player_name_color = get_action_player_name (player )
171- if Roles . player_has_role (action_player_name , ' Jail ' ) then
180+ if Jail . is_jailed (action_player_name ) then
172181 player .print ({' expcom-jail.already-banned' ,action_player_name_color },Colors .orange_red )
173182 else
174183 Store .set (action_name_store ,player .name ,' command/temp-ban' )
@@ -182,7 +191,8 @@ local function temp_ban_player_callback(player,reason)
182191 Jail .temp_ban_player (action_player ,player .name ,reason )
183192end
184193
185- -- kicks the action player, requires a reason
194+ --- Kicks the action player, requires a reason
195+ -- @element kick_player
186196local kick_player =
187197Gui .new_button ()
188198:set_sprites (' utility/warning_icon' )
@@ -197,7 +207,8 @@ local function kick_player_callback(player,reason)
197207 game .kick_player (action_player ,reason )
198208end
199209
200- -- bans the action player, requires a reason
210+ --- Bans the action player, requires a reason
211+ -- @element ban_player
201212local ban_player =
202213Gui .new_button ()
203214:set_sprites (' utility/danger_icon' )
@@ -235,7 +246,7 @@ return {
235246 if not Roles .player_allowed (player ,' command/give-warning' ) then
236247 return not Roles .player_has_flag (action_player ,' report-immune' )
237248 end
238- end , -- can report any player that isnt immune and you arnt able to give warnings
249+ end , -- can report any player that isn't immune and you aren't able to give warnings
239250 reason_callback = report_player_callback ,
240251 report_player
241252 },
0 commit comments