From 4202b7d10ef30fe5637728ae548e8c8bdf25f2d5 Mon Sep 17 00:00:00 2001 From: Maik Wild Date: Wed, 15 Aug 2018 14:15:03 +0200 Subject: [PATCH] moved show report into custom commands --- custom_commands.lua | 9 +++++++++ report.lua | 14 +++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/custom_commands.lua b/custom_commands.lua index a79e62bc..fc53b5ed 100644 --- a/custom_commands.lua +++ b/custom_commands.lua @@ -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 +) diff --git a/report.lua b/report.lua index 4dafc3fc..fbae19d6 100644 --- a/report.lua +++ b/report.lua @@ -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