1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

moved show report into custom commands

This commit is contained in:
Maik Wild 2018-08-15 14:15:03 +02:00
parent 58ee4a6535
commit 4202b7d10e
2 changed files with 12 additions and 11 deletions

View File

@ -695,3 +695,12 @@ commands.add_command(
unjail_player
)
commands.add_command('a', 'Admin chat. Messages all other admins (Admins only)', admin_chat)
local Report = require('report')
commands.add_command('showreports', 'Shows user reports (Admins only)',
function(event)
if game.player and game.player.admin then
Report.show_reports(game.players[event.player_index])
end
end
)

View File

@ -36,7 +36,7 @@ local function draw_report(parent, report_id)
parent.add {type="label", caption="Reported by: " .. reporting_player_name}
end
local function show_reports(player)
Module.show_reports = function(player)
local reports = global.reports or {}
local center = player.gui.center
@ -74,14 +74,14 @@ local function report(reporting_player, reported_player, message)
local notified = false
for _,p in pairs(game.players) do
if p.admin and p.connected then
show_reports(p)
Module.show_reports(p)
if p.afk_time < 3600 then notified = true end
end
end
if not notified then
for _,p in pairs(game.players) do
if p.admin then
show_reports(p)
Module.show_reports(p)
end
end
end
@ -180,12 +180,4 @@ Gui.on_click(
end
)
commands.add_command('showreports', 'Shows user reports (Admins only)',
function(event)
if game.player and game.player.admin then
show_reports(game.players[event.player_index])
end
end
)
return Module