1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-14 10:13:13 +02:00
RedMew/features/report.lua

263 lines
9.8 KiB
Lua
Raw Normal View History

2018-08-13 17:36:21 +02:00
local Module = {}
2018-08-13 17:04:02 +02:00
local Gui = require("utils.gui")
local Utils = require("utils.utils");
2018-09-23 00:25:13 +02:00
local Game = require 'utils.game'
Catching up (#2) (#3) * Add creep spread mechanic * Added bot ore islands, use bool flag to turn on. * Added a noise based chest spawning system for artefacts * Added coin loot from biters and mining * Track artefacts launched into space * Add Creepy map preset * Update donators.lua * Add scenario info for crashsite (#291) * Split colors resources from colors code & catchup on donators (#288) * Split colors resources from colors code * Switch back to colors * Added jail button Moved parts of the jail command to report.lua Made jailing possible from a users report. closes #215 * Added sound for new reports Admins now get a sound when a new report is created. Useful for admins that doesn't have Factorio as active window. Currently set the sound_path as utility/tutorial_notice * Split chat triggers from control * Move cheat tracking outside of control.lua * Remove player-specific code * Split donator/on_join messages out of control * Move features into features folder * Indentation fix I aimed to fix the troublesome indentation. * Added a single indent * Make sure biter modifiers are accessible for mods * Consistency change regarding table access * Added NightTime.lua Split the time assignment into a new file NightTime.lua allowing for it to be disabled. (Restore normal day/night cycle) Also added a popup when a player places a solar panel informing that they are purely cosmetic Removed the recipe for portable solar panels because they are useless, but the technology is needed. * Fixed debug print grid value to show non-rounded value * added support for hidden tiles * Add newline to eof * Fixed no newline, indentation and scope of research * crash_site outposts set hidden tile to 'grass-1' * Log items spawned by crafting in cheat mode * Newline to eof * Put responses into table * Use trigger as table key * Change name of lattice to diagonal lattice (#297) * Add Diagonal Ribbon to map presets (#294) * Reorganize control (#312) * Check for config before disabling fish market (#311) * Force diggy biters to spawn, even if there's no space (#308) * Fixed some small things from feedback and issues (#313) * Update fractal_balls.lua * Add ALo's message and color (#314) * Add join message for ALo * Add ALo's color * Typo in donators.lua * fixed tile corruption issus closes #310 (#317) * Update player_list.lua * Update diagonal_ribbon.lua (#322) * Regulars: remove duplicates and sort alphabetically (#320)
2018-11-12 21:23:25 +02:00
2018-08-13 17:04:02 +02:00
local report_frame_name = Gui.uid_name()
local report_close_button_name = Gui.uid_name()
local report_tab_button_name = Gui.uid_name()
Catching up (#2) (#3) * Add creep spread mechanic * Added bot ore islands, use bool flag to turn on. * Added a noise based chest spawning system for artefacts * Added coin loot from biters and mining * Track artefacts launched into space * Add Creepy map preset * Update donators.lua * Add scenario info for crashsite (#291) * Split colors resources from colors code & catchup on donators (#288) * Split colors resources from colors code * Switch back to colors * Added jail button Moved parts of the jail command to report.lua Made jailing possible from a users report. closes #215 * Added sound for new reports Admins now get a sound when a new report is created. Useful for admins that doesn't have Factorio as active window. Currently set the sound_path as utility/tutorial_notice * Split chat triggers from control * Move cheat tracking outside of control.lua * Remove player-specific code * Split donator/on_join messages out of control * Move features into features folder * Indentation fix I aimed to fix the troublesome indentation. * Added a single indent * Make sure biter modifiers are accessible for mods * Consistency change regarding table access * Added NightTime.lua Split the time assignment into a new file NightTime.lua allowing for it to be disabled. (Restore normal day/night cycle) Also added a popup when a player places a solar panel informing that they are purely cosmetic Removed the recipe for portable solar panels because they are useless, but the technology is needed. * Fixed debug print grid value to show non-rounded value * added support for hidden tiles * Add newline to eof * Fixed no newline, indentation and scope of research * crash_site outposts set hidden tile to 'grass-1' * Log items spawned by crafting in cheat mode * Newline to eof * Put responses into table * Use trigger as table key * Change name of lattice to diagonal lattice (#297) * Add Diagonal Ribbon to map presets (#294) * Reorganize control (#312) * Check for config before disabling fish market (#311) * Force diggy biters to spawn, even if there's no space (#308) * Fixed some small things from feedback and issues (#313) * Update fractal_balls.lua * Add ALo's message and color (#314) * Add join message for ALo * Add ALo's color * Typo in donators.lua * fixed tile corruption issus closes #310 (#317) * Update player_list.lua * Update diagonal_ribbon.lua (#322) * Regulars: remove duplicates and sort alphabetically (#320)
2018-11-12 21:23:25 +02:00
local jail_offender_button_name = Gui.uid_name()
2018-08-13 17:04:02 +02:00
local report_body_name = Gui.uid_name()
2018-08-13 19:52:21 +02:00
2018-08-13 17:04:02 +02:00
global.reports = {}
global.player_report_data = {}
local function draw_report(parent, report_id)
local report = global.reports[report_id]
if report_id == 0 or not report then
parent.add {type = "label", caption="No reports yet."}
return
end
Catching up (#2) (#3) * Add creep spread mechanic * Added bot ore islands, use bool flag to turn on. * Added a noise based chest spawning system for artefacts * Added coin loot from biters and mining * Track artefacts launched into space * Add Creepy map preset * Update donators.lua * Add scenario info for crashsite (#291) * Split colors resources from colors code & catchup on donators (#288) * Split colors resources from colors code * Switch back to colors * Added jail button Moved parts of the jail command to report.lua Made jailing possible from a users report. closes #215 * Added sound for new reports Admins now get a sound when a new report is created. Useful for admins that doesn't have Factorio as active window. Currently set the sound_path as utility/tutorial_notice * Split chat triggers from control * Move cheat tracking outside of control.lua * Remove player-specific code * Split donator/on_join messages out of control * Move features into features folder * Indentation fix I aimed to fix the troublesome indentation. * Added a single indent * Make sure biter modifiers are accessible for mods * Consistency change regarding table access * Added NightTime.lua Split the time assignment into a new file NightTime.lua allowing for it to be disabled. (Restore normal day/night cycle) Also added a popup when a player places a solar panel informing that they are purely cosmetic Removed the recipe for portable solar panels because they are useless, but the technology is needed. * Fixed debug print grid value to show non-rounded value * added support for hidden tiles * Add newline to eof * Fixed no newline, indentation and scope of research * crash_site outposts set hidden tile to 'grass-1' * Log items spawned by crafting in cheat mode * Newline to eof * Put responses into table * Use trigger as table key * Change name of lattice to diagonal lattice (#297) * Add Diagonal Ribbon to map presets (#294) * Reorganize control (#312) * Check for config before disabling fish market (#311) * Force diggy biters to spawn, even if there's no space (#308) * Fixed some small things from feedback and issues (#313) * Update fractal_balls.lua * Add ALo's message and color (#314) * Add join message for ALo * Add ALo's color * Typo in donators.lua * fixed tile corruption issus closes #310 (#317) * Update player_list.lua * Update diagonal_ribbon.lua (#322) * Regulars: remove duplicates and sort alphabetically (#320)
2018-11-12 21:23:25 +02:00
local reported_player_name = Game.get_player_by_index(report.reported_player_index).name
local reporting_player_name = Game.get_player_by_index(report.reporting_player_index).name
2018-08-13 17:04:02 +02:00
local time = Utils.format_time(report.tick)
Catching up (#2) (#3) * Add creep spread mechanic * Added bot ore islands, use bool flag to turn on. * Added a noise based chest spawning system for artefacts * Added coin loot from biters and mining * Track artefacts launched into space * Add Creepy map preset * Update donators.lua * Add scenario info for crashsite (#291) * Split colors resources from colors code & catchup on donators (#288) * Split colors resources from colors code * Switch back to colors * Added jail button Moved parts of the jail command to report.lua Made jailing possible from a users report. closes #215 * Added sound for new reports Admins now get a sound when a new report is created. Useful for admins that doesn't have Factorio as active window. Currently set the sound_path as utility/tutorial_notice * Split chat triggers from control * Move cheat tracking outside of control.lua * Remove player-specific code * Split donator/on_join messages out of control * Move features into features folder * Indentation fix I aimed to fix the troublesome indentation. * Added a single indent * Make sure biter modifiers are accessible for mods * Consistency change regarding table access * Added NightTime.lua Split the time assignment into a new file NightTime.lua allowing for it to be disabled. (Restore normal day/night cycle) Also added a popup when a player places a solar panel informing that they are purely cosmetic Removed the recipe for portable solar panels because they are useless, but the technology is needed. * Fixed debug print grid value to show non-rounded value * added support for hidden tiles * Add newline to eof * Fixed no newline, indentation and scope of research * crash_site outposts set hidden tile to 'grass-1' * Log items spawned by crafting in cheat mode * Newline to eof * Put responses into table * Use trigger as table key * Change name of lattice to diagonal lattice (#297) * Add Diagonal Ribbon to map presets (#294) * Reorganize control (#312) * Check for config before disabling fish market (#311) * Force diggy biters to spawn, even if there's no space (#308) * Fixed some small things from feedback and issues (#313) * Update fractal_balls.lua * Add ALo's message and color (#314) * Add join message for ALo * Add ALo's color * Typo in donators.lua * fixed tile corruption issus closes #310 (#317) * Update player_list.lua * Update diagonal_ribbon.lua (#322) * Regulars: remove duplicates and sort alphabetically (#320)
2018-11-12 21:23:25 +02:00
local time_ago = Utils.format_time(game.tick - report.tick)
2018-08-13 17:04:02 +02:00
local message = report.message
2018-08-15 01:24:24 +02:00
Gui.clear(parent)
Catching up (#2) (#3) * Add creep spread mechanic * Added bot ore islands, use bool flag to turn on. * Added a noise based chest spawning system for artefacts * Added coin loot from biters and mining * Track artefacts launched into space * Add Creepy map preset * Update donators.lua * Add scenario info for crashsite (#291) * Split colors resources from colors code & catchup on donators (#288) * Split colors resources from colors code * Switch back to colors * Added jail button Moved parts of the jail command to report.lua Made jailing possible from a users report. closes #215 * Added sound for new reports Admins now get a sound when a new report is created. Useful for admins that doesn't have Factorio as active window. Currently set the sound_path as utility/tutorial_notice * Split chat triggers from control * Move cheat tracking outside of control.lua * Remove player-specific code * Split donator/on_join messages out of control * Move features into features folder * Indentation fix I aimed to fix the troublesome indentation. * Added a single indent * Make sure biter modifiers are accessible for mods * Consistency change regarding table access * Added NightTime.lua Split the time assignment into a new file NightTime.lua allowing for it to be disabled. (Restore normal day/night cycle) Also added a popup when a player places a solar panel informing that they are purely cosmetic Removed the recipe for portable solar panels because they are useless, but the technology is needed. * Fixed debug print grid value to show non-rounded value * added support for hidden tiles * Add newline to eof * Fixed no newline, indentation and scope of research * crash_site outposts set hidden tile to 'grass-1' * Log items spawned by crafting in cheat mode * Newline to eof * Put responses into table * Use trigger as table key * Change name of lattice to diagonal lattice (#297) * Add Diagonal Ribbon to map presets (#294) * Reorganize control (#312) * Check for config before disabling fish market (#311) * Force diggy biters to spawn, even if there's no space (#308) * Fixed some small things from feedback and issues (#313) * Update fractal_balls.lua * Add ALo's message and color (#314) * Add join message for ALo * Add ALo's color * Typo in donators.lua * fixed tile corruption issus closes #310 (#317) * Update player_list.lua * Update diagonal_ribbon.lua (#322) * Regulars: remove duplicates and sort alphabetically (#320)
2018-11-12 21:23:25 +02:00
2018-08-13 17:04:02 +02:00
parent.add {type="label", caption="Offender: " .. reported_player_name}
2018-08-13 20:53:23 +02:00
local msg_label_pane = parent.add {type="scroll-pane", vertical_scroll_policy = "auto-and-reserve-space", horizontal_scroll_policy="never"}
msg_label_pane.style.maximal_height = 400
local msg_label = msg_label_pane.add {type="label", caption="Message: " .. message}
Catching up (#2) (#3) * Add creep spread mechanic * Added bot ore islands, use bool flag to turn on. * Added a noise based chest spawning system for artefacts * Added coin loot from biters and mining * Track artefacts launched into space * Add Creepy map preset * Update donators.lua * Add scenario info for crashsite (#291) * Split colors resources from colors code & catchup on donators (#288) * Split colors resources from colors code * Switch back to colors * Added jail button Moved parts of the jail command to report.lua Made jailing possible from a users report. closes #215 * Added sound for new reports Admins now get a sound when a new report is created. Useful for admins that doesn't have Factorio as active window. Currently set the sound_path as utility/tutorial_notice * Split chat triggers from control * Move cheat tracking outside of control.lua * Remove player-specific code * Split donator/on_join messages out of control * Move features into features folder * Indentation fix I aimed to fix the troublesome indentation. * Added a single indent * Make sure biter modifiers are accessible for mods * Consistency change regarding table access * Added NightTime.lua Split the time assignment into a new file NightTime.lua allowing for it to be disabled. (Restore normal day/night cycle) Also added a popup when a player places a solar panel informing that they are purely cosmetic Removed the recipe for portable solar panels because they are useless, but the technology is needed. * Fixed debug print grid value to show non-rounded value * added support for hidden tiles * Add newline to eof * Fixed no newline, indentation and scope of research * crash_site outposts set hidden tile to 'grass-1' * Log items spawned by crafting in cheat mode * Newline to eof * Put responses into table * Use trigger as table key * Change name of lattice to diagonal lattice (#297) * Add Diagonal Ribbon to map presets (#294) * Reorganize control (#312) * Check for config before disabling fish market (#311) * Force diggy biters to spawn, even if there's no space (#308) * Fixed some small things from feedback and issues (#313) * Update fractal_balls.lua * Add ALo's message and color (#314) * Add join message for ALo * Add ALo's color * Typo in donators.lua * fixed tile corruption issus closes #310 (#317) * Update player_list.lua * Update diagonal_ribbon.lua (#322) * Regulars: remove duplicates and sort alphabetically (#320)
2018-11-12 21:23:25 +02:00
local jail_offender_button = parent.add {type = 'button', name = jail_offender_button_name, caption = 'Jail ' .. reported_player_name}
jail_offender_button.style.height = 24
jail_offender_button.style.font = 'default-small'
jail_offender_button.style.top_padding = 0
jail_offender_button.style.bottom_padding = 0
jail_offender_button.style.left_padding = 0
jail_offender_button.style.right_padding = 0
2018-08-13 17:04:02 +02:00
msg_label.style.single_line = false
msg_label.style.maximal_width = 680
parent.add {type="label", caption=string.format("Time: %s (%s ago)", time, time_ago)}
parent.add {type="label", caption="Reported by: " .. reporting_player_name}
end
2018-08-15 14:15:03 +02:00
Module.show_reports = function(player)
2018-08-13 17:08:24 +02:00
local reports = global.reports or {}
2018-08-13 17:04:02 +02:00
local center = player.gui.center
local report_frame = center[report_frame_name]
if report_frame and report_frame.valid then
Gui.destroy(report_frame)
end
report_frame = center.add {
2018-08-13 19:52:21 +02:00
type = 'frame',
name = report_frame_name,
direction = 'vertical',
caption = 'User reports'
}
report_frame.style.maximal_width = 700
player.opened = report_frame
if #reports > 1 then
local scroll_pane = report_frame.add{type = "scroll-pane", horizontal_scroll_policy = "auto-and-reserve-space", vertical_scroll_policy="never"}
local tab_flow = scroll_pane.add{type="flow"}
for k,report in pairs(reports) do
local button_cell = tab_flow.add{type="flow", caption="reportuid" .. k}
button_cell.add {
type="button",
name=report_tab_button_name,
caption = Game.get_player_by_index(report.reported_player_index).name
2018-08-13 19:52:21 +02:00
}
2018-08-13 17:08:24 +02:00
end
2018-08-13 19:52:21 +02:00
end
2018-08-13 17:08:24 +02:00
local report_body = report_frame.add {type = "scroll-pane", name = report_body_name, horizontal_scroll_policy = "never", vertical_scroll_policy="never"}
report_frame.add {type = 'button', name = report_close_button_name, caption = 'Close'}
draw_report(report_body, #reports)
2018-08-13 17:04:02 +02:00
end
2018-08-18 13:38:46 +02:00
function Module.report(reporting_player, reported_player, message)
2018-08-13 17:08:24 +02:00
table.insert(global.reports, {reporting_player_index = reporting_player.index, reported_player_index = reported_player.index, message = message, tick = game.tick})
2018-08-13 17:04:02 +02:00
2018-08-13 17:08:24 +02:00
local notified = false
2018-09-23 00:25:13 +02:00
for _,p in pairs(game.players) do
2018-08-13 17:08:24 +02:00
if p.admin and p.connected then
Catching up (#2) (#3) * Add creep spread mechanic * Added bot ore islands, use bool flag to turn on. * Added a noise based chest spawning system for artefacts * Added coin loot from biters and mining * Track artefacts launched into space * Add Creepy map preset * Update donators.lua * Add scenario info for crashsite (#291) * Split colors resources from colors code & catchup on donators (#288) * Split colors resources from colors code * Switch back to colors * Added jail button Moved parts of the jail command to report.lua Made jailing possible from a users report. closes #215 * Added sound for new reports Admins now get a sound when a new report is created. Useful for admins that doesn't have Factorio as active window. Currently set the sound_path as utility/tutorial_notice * Split chat triggers from control * Move cheat tracking outside of control.lua * Remove player-specific code * Split donator/on_join messages out of control * Move features into features folder * Indentation fix I aimed to fix the troublesome indentation. * Added a single indent * Make sure biter modifiers are accessible for mods * Consistency change regarding table access * Added NightTime.lua Split the time assignment into a new file NightTime.lua allowing for it to be disabled. (Restore normal day/night cycle) Also added a popup when a player places a solar panel informing that they are purely cosmetic Removed the recipe for portable solar panels because they are useless, but the technology is needed. * Fixed debug print grid value to show non-rounded value * added support for hidden tiles * Add newline to eof * Fixed no newline, indentation and scope of research * crash_site outposts set hidden tile to 'grass-1' * Log items spawned by crafting in cheat mode * Newline to eof * Put responses into table * Use trigger as table key * Change name of lattice to diagonal lattice (#297) * Add Diagonal Ribbon to map presets (#294) * Reorganize control (#312) * Check for config before disabling fish market (#311) * Force diggy biters to spawn, even if there's no space (#308) * Fixed some small things from feedback and issues (#313) * Update fractal_balls.lua * Add ALo's message and color (#314) * Add join message for ALo * Add ALo's color * Typo in donators.lua * fixed tile corruption issus closes #310 (#317) * Update player_list.lua * Update diagonal_ribbon.lua (#322) * Regulars: remove duplicates and sort alphabetically (#320)
2018-11-12 21:23:25 +02:00
p.play_sound{path='utility/tutorial_notice', volume_modifier = 1}
--p.print("Did you hear that too? " .. tostring(game.is_valid_sound_path('utility/wire_connect_pole'))) --Debugging the sound_path
2018-08-15 14:15:03 +02:00
Module.show_reports(p)
2018-08-13 17:08:24 +02:00
if p.afk_time < 3600 then notified = true end
2018-08-13 17:04:02 +02:00
end
2018-08-13 17:08:24 +02:00
end
if not notified then
2018-09-23 00:25:13 +02:00
for _,p in pairs(game.players) do
2018-08-13 17:08:24 +02:00
if p.admin then
2018-08-15 14:15:03 +02:00
Module.show_reports(p)
2018-08-13 17:08:24 +02:00
end
end
end
2018-08-13 17:04:02 +02:00
end
Catching up (#2) (#3) * Add creep spread mechanic * Added bot ore islands, use bool flag to turn on. * Added a noise based chest spawning system for artefacts * Added coin loot from biters and mining * Track artefacts launched into space * Add Creepy map preset * Update donators.lua * Add scenario info for crashsite (#291) * Split colors resources from colors code & catchup on donators (#288) * Split colors resources from colors code * Switch back to colors * Added jail button Moved parts of the jail command to report.lua Made jailing possible from a users report. closes #215 * Added sound for new reports Admins now get a sound when a new report is created. Useful for admins that doesn't have Factorio as active window. Currently set the sound_path as utility/tutorial_notice * Split chat triggers from control * Move cheat tracking outside of control.lua * Remove player-specific code * Split donator/on_join messages out of control * Move features into features folder * Indentation fix I aimed to fix the troublesome indentation. * Added a single indent * Make sure biter modifiers are accessible for mods * Consistency change regarding table access * Added NightTime.lua Split the time assignment into a new file NightTime.lua allowing for it to be disabled. (Restore normal day/night cycle) Also added a popup when a player places a solar panel informing that they are purely cosmetic Removed the recipe for portable solar panels because they are useless, but the technology is needed. * Fixed debug print grid value to show non-rounded value * added support for hidden tiles * Add newline to eof * Fixed no newline, indentation and scope of research * crash_site outposts set hidden tile to 'grass-1' * Log items spawned by crafting in cheat mode * Newline to eof * Put responses into table * Use trigger as table key * Change name of lattice to diagonal lattice (#297) * Add Diagonal Ribbon to map presets (#294) * Reorganize control (#312) * Check for config before disabling fish market (#311) * Force diggy biters to spawn, even if there's no space (#308) * Fixed some small things from feedback and issues (#313) * Update fractal_balls.lua * Add ALo's message and color (#314) * Add join message for ALo * Add ALo's color * Typo in donators.lua * fixed tile corruption issus closes #310 (#317) * Update player_list.lua * Update diagonal_ribbon.lua (#322) * Regulars: remove duplicates and sort alphabetically (#320)
2018-11-12 21:23:25 +02:00
function Module.jail(player, target)
-- Set the name of the jail permission group
local jail_name = 'Jail'
local target_player = game.players[target]
if not target_player then
player.print('Unknown player.')
return
end
local permissions = game.permissions
-- Check if the permission group exists, if it doesn't, create it.
local permission_group = permissions.get_group(jail_name)
if not permission_group then
permission_group = permissions.create_group(jail_name)
end
if target_player.permission_group == permission_group then
player.print('The player ' .. target .. ' is already in Jail.')
return
end
-- Set all permissions to disabled
for action_name, _ in pairs(defines.input_action) do
permission_group.set_allows_action(defines.input_action[action_name], false)
end
-- Enable writing to console to allow a person to speak
permission_group.set_allows_action(defines.input_action.write_to_console, true)
permission_group.set_allows_action(defines.input_action.edit_permission_group, true)
-- Kick player out of vehicle
target_player.driving=false
-- Add player to jail group
permission_group.add_player(target_player)
-- Check if a player is shooting while jailed, if they are, remove the weapon in their active gun slot.
if target_player.shooting_state.state ~= 0 then
-- Use a while loop because if a player has guns in inventory they will auto-refill the slot.
while target_player.get_inventory(defines.inventory.player_guns)[target_player.character.selected_gun_index].valid_for_read do
target_player.remove_item(target_player.get_inventory(defines.inventory.player_guns)[target_player.character.selected_gun_index])
end
target_player.print('Your active weapon has been removed because you were shooting while jailed. Your gun will *not* be returned to you in the event of being unjailed.')
end
-- Check that it worked
if target_player.permission_group == permission_group then
-- Let admin know it worked, let target know what's going on.
player.print(target .. ' has been jailed. They have been advised of this.')
target_player.print('You have been placed in jail by a server admin. The only action you can currently perform is chatting. Please respond to inquiries from the admin.')
else
-- Let admin know it didn't work.
player.print('Something went wrong in the jailing of ' .. target .. '. You can still change their group via /permissions.')
end
end
2018-08-13 17:04:02 +02:00
Gui.on_custom_close(
report_frame_name,
function(event)
Gui.destroy(event.element)
2018-08-13 17:04:02 +02:00
end
)
Gui.on_click(
report_close_button_name,
function(event)
Gui.destroy(event.element.parent)
2018-08-13 17:04:02 +02:00
end
)
Catching up (#2) (#3) * Add creep spread mechanic * Added bot ore islands, use bool flag to turn on. * Added a noise based chest spawning system for artefacts * Added coin loot from biters and mining * Track artefacts launched into space * Add Creepy map preset * Update donators.lua * Add scenario info for crashsite (#291) * Split colors resources from colors code & catchup on donators (#288) * Split colors resources from colors code * Switch back to colors * Added jail button Moved parts of the jail command to report.lua Made jailing possible from a users report. closes #215 * Added sound for new reports Admins now get a sound when a new report is created. Useful for admins that doesn't have Factorio as active window. Currently set the sound_path as utility/tutorial_notice * Split chat triggers from control * Move cheat tracking outside of control.lua * Remove player-specific code * Split donator/on_join messages out of control * Move features into features folder * Indentation fix I aimed to fix the troublesome indentation. * Added a single indent * Make sure biter modifiers are accessible for mods * Consistency change regarding table access * Added NightTime.lua Split the time assignment into a new file NightTime.lua allowing for it to be disabled. (Restore normal day/night cycle) Also added a popup when a player places a solar panel informing that they are purely cosmetic Removed the recipe for portable solar panels because they are useless, but the technology is needed. * Fixed debug print grid value to show non-rounded value * added support for hidden tiles * Add newline to eof * Fixed no newline, indentation and scope of research * crash_site outposts set hidden tile to 'grass-1' * Log items spawned by crafting in cheat mode * Newline to eof * Put responses into table * Use trigger as table key * Change name of lattice to diagonal lattice (#297) * Add Diagonal Ribbon to map presets (#294) * Reorganize control (#312) * Check for config before disabling fish market (#311) * Force diggy biters to spawn, even if there's no space (#308) * Fixed some small things from feedback and issues (#313) * Update fractal_balls.lua * Add ALo's message and color (#314) * Add join message for ALo * Add ALo's color * Typo in donators.lua * fixed tile corruption issus closes #310 (#317) * Update player_list.lua * Update diagonal_ribbon.lua (#322) * Regulars: remove duplicates and sort alphabetically (#320)
2018-11-12 21:23:25 +02:00
Gui.on_click(
jail_offender_button_name,
function(event)
Module.jail(event.player, string.sub(event.element.caption, 6))
end
)
2018-08-13 17:04:02 +02:00
Gui.on_click(
report_tab_button_name,
function(event)
2018-08-13 17:08:24 +02:00
local center = event.player.gui.center
local report_frame = center[report_frame_name]
local report_uid_str = string.sub(event.element.parent.caption, 10)
local report_uid = tonumber(report_uid_str)
draw_report(report_frame[report_body_name], report_uid)
2018-08-13 17:04:02 +02:00
end
)
2018-08-13 17:36:21 +02:00
2018-08-13 19:52:21 +02:00
local reporting_popup_name = Gui.uid_name()
local reporting_cancel_button_name = Gui.uid_name()
local reporting_submit_button_name = Gui.uid_name()
local reporting_input_name = Gui.uid_name()
2018-08-13 20:04:45 +02:00
Module.spawn_reporting_popup = function(player, reported_player)
2018-08-13 19:52:21 +02:00
2018-08-15 01:24:24 +02:00
local center = player.gui.center
2018-08-13 19:52:21 +02:00
local reporting_popup = center[reporting_popup_name]
if reporting_popup and reporting_popup.valid then
Gui.destroy(reporting_popup)
end
reporting_popup = center.add {
2018-08-13 19:52:21 +02:00
type = 'frame',
name = reporting_popup_name,
direction = 'vertical',
caption = 'Report player ' .. reported_player.name
}
Gui.set_data(reporting_popup, {reported_player_index = reported_player.index})
reporting_popup.style.maximal_width = 500
player.opened = reporting_popup
reporting_popup.add {
type = 'label',
caption = 'Report message:'
2018-08-13 20:53:23 +02:00
}
2018-08-13 19:52:21 +02:00
local input = reporting_popup.add {type = 'text-box', name=reporting_input_name}
input.style.width = 400
input.style.height = 85
local button_flow = reporting_popup.add {type = "flow"}
2018-08-18 13:38:46 +02:00
local submit_button = button_flow.add {type = "button", name = reporting_submit_button_name, caption="Submit"}
2018-08-13 19:52:21 +02:00
button_flow.add {type = "button", name = reporting_cancel_button_name, caption="Cancel"}
2018-08-13 17:36:21 +02:00
end
2018-08-13 19:52:21 +02:00
Gui.on_custom_close(
reporting_popup_name,
function(event)
Gui.destroy(event.element)
2018-08-13 19:52:21 +02:00
end
)
Gui.on_click(
reporting_cancel_button_name,
function(event)
local frame = event.element.parent.parent
Gui.destroy(frame)
2018-08-13 19:52:21 +02:00
end
)
Gui.on_click(
reporting_submit_button_name,
function(event)
local frame = event.element.parent.parent
local msg = frame[reporting_input_name].text
local data = Gui.get_data(frame)
local reported_player_index = data["reported_player_index"]
Gui.destroy(frame)
Module.report(event.player, Game.get_player_by_index(reported_player_index), msg)
2018-08-13 19:52:21 +02:00
event.player.print("Sucessfully reported " .. Game.get_player_by_index(reported_player_index).name)
2018-08-13 19:52:21 +02:00
end
)
2018-08-13 17:36:21 +02:00
return Module