local Gui = require 'utils.gui' local Utils = require 'utils.core' local Game = require 'utils.game' local Global = require 'utils.global' local Event = require 'utils.event' local Token = require 'utils.token' local Popup = require 'features.gui.popup' local Color = require 'resources.color_presets' local format = string.format local report_frame_name = Gui.uid_name() local report_close_button_name = Gui.uid_name() local report_tab_button_name = Gui.uid_name() local jail_offender_button_name = Gui.uid_name() local report_body_name = Gui.uid_name() local jail_name = 'Jail' local jail_force = 'jailed' local default_group = 'Default' local prefix = '------------------NOTICE-------------------' local prefix_e = '--------------------------------------------' local Module = {} -- Global registered locals local report_data = {} local jail_data = {} local primitives = { on_chat_registered = nil } Global.register( { report_data = report_data, jail_data = jail_data }, function(tbl) report_data = tbl.report_data jail_data = tbl.jail_data end ) --- If a player in jail chats to their force, let the admins know local on_chat = Token.register( function(event) local index = event.player_index local player = Game.get_player_by_index(index) local message if jail_data[index] then message = 'From jail: ' .. event.message Utils.print_admins(message, player.name) elseif player.admin then message = 'From admin: ' .. event.message game.forces[jail_force].print(message) end end ) local function draw_report(parent, report_id) local report = report_data[report_id] if report_id == 0 or not report then parent.add {type = 'label', caption = 'No reports yet.'} return end local reported_player_name = Game.get_player_by_index(report.reported_player_index).name local reporting_player_name = '