mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-14 10:13:13 +02:00
moved show report into custom commands
This commit is contained in:
parent
58ee4a6535
commit
4202b7d10e
@ -695,3 +695,12 @@ commands.add_command(
|
|||||||
unjail_player
|
unjail_player
|
||||||
)
|
)
|
||||||
commands.add_command('a', 'Admin chat. Messages all other admins (Admins only)', admin_chat)
|
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
|
||||||
|
)
|
||||||
|
14
report.lua
14
report.lua
@ -36,7 +36,7 @@ local function draw_report(parent, report_id)
|
|||||||
parent.add {type="label", caption="Reported by: " .. reporting_player_name}
|
parent.add {type="label", caption="Reported by: " .. reporting_player_name}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function show_reports(player)
|
Module.show_reports = function(player)
|
||||||
local reports = global.reports or {}
|
local reports = global.reports or {}
|
||||||
|
|
||||||
local center = player.gui.center
|
local center = player.gui.center
|
||||||
@ -74,14 +74,14 @@ local function report(reporting_player, reported_player, message)
|
|||||||
local notified = false
|
local notified = false
|
||||||
for _,p in pairs(game.players) do
|
for _,p in pairs(game.players) do
|
||||||
if p.admin and p.connected then
|
if p.admin and p.connected then
|
||||||
show_reports(p)
|
Module.show_reports(p)
|
||||||
if p.afk_time < 3600 then notified = true end
|
if p.afk_time < 3600 then notified = true end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not notified then
|
if not notified then
|
||||||
for _,p in pairs(game.players) do
|
for _,p in pairs(game.players) do
|
||||||
if p.admin then
|
if p.admin then
|
||||||
show_reports(p)
|
Module.show_reports(p)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -180,12 +180,4 @@ Gui.on_click(
|
|||||||
end
|
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
|
return Module
|
||||||
|
Loading…
Reference in New Issue
Block a user