1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-03-03 14:53:01 +02:00

Merge pull request #299 from plague006/features_split

Move features into features folder
This commit is contained in:
Valansch 2018-11-11 20:37:16 +01:00 committed by GitHub
commit dbe845db79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 430 additions and 418 deletions

View File

@ -1,40 +1,52 @@
-- Libraries. Removing these will likely lead to game crashes
require 'config'
require 'utils.utils'
require 'utils.list_utils'
require 'utils.math'
local Game = require 'utils.game'
require 'user_groups'
require 'custom_commands'
require 'base_data'
require 'train_station_names'
require 'nuke_control'
require 'follow'
require 'autodeconstruct'
require 'corpse_util'
--require 'infinite_storage_chest'
--require 'fish_market'
require 'reactor_meltdown'
require 'train_saviour'
require 'map_gen.shared.perlin_noise'
require 'map_layout'
require 'bot'
require 'player_colors'
-- GUIs the order determines the order they appear at the top.
require 'info'
require 'player_list'
require 'poll'
require 'tag_group'
require 'tasklist'
require 'blueprint_helper'
require 'paint'
require 'score'
require 'popup'
local Event = require 'utils.event'
local Donators = require 'resources.donators'
require 'map_gen.shared.perlin_noise'
require 'map_layout'
-- Specific to RedMew hosts, can be disabled safely if not hosting on RedMew servers
require 'features.bot'
-- Library modules which, if missing, will cause other feature modules to fail
require 'features.base_data'
require 'features.follow'
require 'features.user_groups'
-- Feature modules, each can be disabled
require 'features.autodeconstruct'
require 'features.corpse_util'
--require 'features.fish_market'
--require 'features.infinite_storage_chest'
require 'features.nuke_control'
require 'features.player_colors'
require 'features.reactor_meltdown'
require 'features.train_saviour'
require 'features.train_station_names'
-- Contains various commands for users and admins alike
require 'features.custom_commands'
-- GUIs the order determines the order they appear from left to right.
-- These can be safely disabled. Some map presets will add GUI modules themselves.
require 'features.gui.info'
require 'features.gui.player_list'
require 'features.gui.poll'
require 'features.gui.tag_group'
require 'features.gui.tasklist'
require 'features.gui.blueprint_helper'
require 'features.gui.paint'
require 'features.gui.score'
require 'features.gui.popup'
local function player_created(event)
local player = Game.get_player_by_index(event.player_index)

View File

@ -1,10 +1,10 @@
local Task = require 'utils.Task'
local Event = require 'utils.event'
local Token = require 'utils.global_token'
local UserGroups = require 'user_groups'
local UserGroups = require 'features.user_groups'
local Utils = require 'utils.utils'
local Game = require 'utils.game'
--local Antigrief = require 'antigrief'
--local Antigrief = require 'features.antigrief'
local function invoke(cmd)
if not (game.player and game.player.admin) then
@ -707,7 +707,7 @@ commands.add_command(
)
commands.add_command('a', 'Admin chat. Messages all other admins (Admins only)', admin_chat)
local Report = require('report')
local Report = require('features.report')
local function report(cmd)
local reporting_player = game.player

View File

@ -19,7 +19,7 @@ make pet follow you moar
local Event = require 'utils.event'
local Token = require 'utils.global_token'
local Task = require 'utils.Task'
local PlayerStats = require 'player_stats'
local PlayerStats = require 'features.player_stats'
local Game = require 'utils.game'
local Utils = require 'utils.utils'

View File

@ -1,7 +1,7 @@
local Gui = require 'utils.gui'
local Global = require 'utils.global'
local Event = require 'utils.event'
local UserGroups = require 'user_groups'
local UserGroups = require 'features.user_groups'
local Game = require 'utils.game'
local normal_color = {r = 1, g = 1, b = 1}

View File

@ -2,10 +2,10 @@ local Event = require 'utils.event'
local Global = require 'utils.global'
local Gui = require 'utils.gui'
local Donators = require 'resources.donators'
local UserGroups = require 'user_groups'
local PlayerStats = require 'player_stats'
local UserGroups = require 'features.user_groups'
local PlayerStats = require 'features.player_stats'
local Utils = require 'utils.utils'
local Report = require 'report'
local Report = require 'features.report'
local Game = require 'utils.game'
local name = require "utils.math"

View File

@ -1,7 +1,7 @@
local Gui = require 'utils.gui'
local Global = require 'utils.global'
local Event = require 'utils.event'
local UserGroups = require 'user_groups'
local UserGroups = require 'features.user_groups'
local Game = require 'utils.game'
local math = require "utils.math"
local Utils = require "utils.utils"

View File

@ -1,7 +1,7 @@
local Event = require 'utils.event'
local Gui = require 'utils.gui'
local Global = require 'utils.global'
local UserGroups = require 'user_groups'
local UserGroups = require 'features.user_groups'
local Game = require 'utils.game'
local Utils = require "utils.utils"

View File

@ -1,7 +1,7 @@
local Event = require 'utils.event'
local Gui = require 'utils.gui'
local Global = require 'utils.global'
local UserGroups = require 'user_groups'
local UserGroups = require 'features.user_groups'
local Utils = require 'utils.utils'
local Game = require 'utils.game'
local math = require "utils.math"

View File

@ -1,5 +1,5 @@
local Event = require "utils.event"
local UserGroups = require "user_groups"
local UserGroups = require "features.user_groups"
local Utils = require "utils.utils"
local Game = require 'utils.game'

View File

@ -1,181 +1,181 @@
--Reactors melt down if:
--temperature is at 1000°C and health is 0 or reactor is picked up
--
--a reactors loses 2 damage per second at 1000°C
local Event = require 'utils.event'
local Game = require 'utils.game'
global.reactors_enabled = false
global.wastelands = {}
global.reactors = {}
local wasteland_duration_seconds = 300
local function spawn_wasteland(surface, position)
local positions = {
{0, 0},
{0, 12},
{0, -12},
{12, 0},
{-12, 0},
{-8.5, 8.5},
{-8.5, -8.5},
{8.5, -8.5},
{8.5, 8.5},
{4, 4},
{-4, 4},
{-4, -4},
{4, -4},
{13, 7.5},
{-13, 7.5},
{-13, -7.5},
{13, -7.5},
{7.5, 13},
{-7.5, 13},
{-7.5, -13},
{7.5, -13},
{0, 15},
{-15, 0},
{15, 0},
{0, -15}
}
for _, rel_position in pairs(positions) do
surface.create_entity {
name = 'poison-capsule',
position = position,
target = {position.x + rel_position[1], position.y + rel_position[2]},
speed = 0.4
}
end
end
local function entity_destroyed(event)
if not global.reactors_enabled or not event.entity.valid or event.entity.name ~= 'nuclear-reactor' then
return
end
local reactor = event.entity
if reactor.temperature > 700 then
reactor.surface.create_entity {name = 'atomic-rocket', position = reactor.position, target = reactor, speed = 1}
spawn_wasteland(reactor.surface, reactor.position)
global.wastelands[reactor.position.x .. '/' .. reactor.position.y] = {
position = reactor.position,
surface_id = reactor.surface.index,
creation_time = game.tick
}
end
end
local function alert(reactor)
for _, p in pairs(game.players) do
p.add_custom_alert(
reactor,
{type = 'item', name = 'nuclear-reactor'},
string.format('Reactor at %s°C', math.floor(reactor.temperature)),
true
)
end
end
local function check_reactors()
for _, surface in pairs(game.surfaces) do
for i, reactor in pairs(global.reactors) do
if reactor.valid then
if reactor.temperature > 800 then
alert(reactor)
end
if reactor.temperature == 1000 then
reactor.force = 'enemy'
reactor.destructible = false
reactor.health = 0
reactor.surface.create_entity {
name = 'atomic-rocket',
position = reactor.position,
target = reactor,
speed = 1
}
spawn_wasteland(reactor.surface, reactor.position)
global.wastelands[reactor.position.x .. '/' .. reactor.position.y] = {
position = reactor.position,
surface_id = reactor.surface.index,
creation_time = game.tick
}
table.remove(global.reactors, i)
else
reactor.health = 500 - (reactor.temperature - 800) * 2.5
end
else
table.remove(global.reactors, i)
end
end
global.last_reactor_warning = last_reactor_warning
end
end
local function check_wastelands()
for index, wl in pairs(global.wastelands) do
local age = game.tick - wl.creation_time
wl.last_checked = wl.last_checked or 0
if (game.tick - wl.last_checked) > 899 then
wl.last_checked = game.tick
spawn_wasteland(game.surfaces[wl.surface_id], wl.position)
if age > wasteland_duration_seconds * 60 - 1 then
global.wastelands[index] = nil
local reactors =
game.surfaces[wl.surface_id].find_entities_filtered {
position = wl.position,
name = 'nuclear-reactor'
}
if reactors[1] then
reactors[1].destroy()
end
end
end
end
end
local function on_tick()
if global.reactors_enabled then
check_wastelands()
check_reactors()
end
end
local function entity_build(event)
if not event.created_entity.valid then
return
end
if event.created_entity.name == 'nuclear-reactor' and event.created_entity.surface.name ~= "antigrief" then
table.insert(global.reactors, event.created_entity)
end
end
local function reactor_toggle()
if not game.player or game.player.admin then
global.reactors_enabled = not global.reactors_enabled
if global.reactors_enabled then
game.print('Reactor meltdown activated.')
else
game.print('Reactor meltdown deactivated.')
end
end
end
local function is_meltdown()
if global.reactors_enabled then
Game.player_print('Reactor meltdown is enabled.')
else
Game.player_print('Reactor meltdown is disabled.')
end
end
commands.add_command('meltdown', 'Toggles if reactors blow up', reactor_toggle)
commands.add_command('is-meltdown', 'Prints if meltdown is enabled', is_meltdown)
Event.on_nth_tick(60, on_tick)
Event.add(defines.events.on_player_mined_entity, entity_destroyed)
Event.add(defines.events.on_robot_mined_entity, entity_destroyed)
Event.add(defines.events.on_entity_died, entity_destroyed)
Event.add(defines.events.on_built_entity, entity_build)
Event.add(defines.events.on_robot_built_entity, entity_build)
--Reactors melt down if:
--temperature is at 1000°C and health is 0 or reactor is picked up
--
--a reactors loses 2 damage per second at 1000°C
local Event = require 'utils.event'
local Game = require 'utils.game'
global.reactors_enabled = false
global.wastelands = {}
global.reactors = {}
local wasteland_duration_seconds = 300
local function spawn_wasteland(surface, position)
local positions = {
{0, 0},
{0, 12},
{0, -12},
{12, 0},
{-12, 0},
{-8.5, 8.5},
{-8.5, -8.5},
{8.5, -8.5},
{8.5, 8.5},
{4, 4},
{-4, 4},
{-4, -4},
{4, -4},
{13, 7.5},
{-13, 7.5},
{-13, -7.5},
{13, -7.5},
{7.5, 13},
{-7.5, 13},
{-7.5, -13},
{7.5, -13},
{0, 15},
{-15, 0},
{15, 0},
{0, -15}
}
for _, rel_position in pairs(positions) do
surface.create_entity {
name = 'poison-capsule',
position = position,
target = {position.x + rel_position[1], position.y + rel_position[2]},
speed = 0.4
}
end
end
local function entity_destroyed(event)
if not global.reactors_enabled or not event.entity.valid or event.entity.name ~= 'nuclear-reactor' then
return
end
local reactor = event.entity
if reactor.temperature > 700 then
reactor.surface.create_entity {name = 'atomic-rocket', position = reactor.position, target = reactor, speed = 1}
spawn_wasteland(reactor.surface, reactor.position)
global.wastelands[reactor.position.x .. '/' .. reactor.position.y] = {
position = reactor.position,
surface_id = reactor.surface.index,
creation_time = game.tick
}
end
end
local function alert(reactor)
for _, p in pairs(game.players) do
p.add_custom_alert(
reactor,
{type = 'item', name = 'nuclear-reactor'},
string.format('Reactor at %s°C', math.floor(reactor.temperature)),
true
)
end
end
local function check_reactors()
for _, surface in pairs(game.surfaces) do
for i, reactor in pairs(global.reactors) do
if reactor.valid then
if reactor.temperature > 800 then
alert(reactor)
end
if reactor.temperature == 1000 then
reactor.force = 'enemy'
reactor.destructible = false
reactor.health = 0
reactor.surface.create_entity {
name = 'atomic-rocket',
position = reactor.position,
target = reactor,
speed = 1
}
spawn_wasteland(reactor.surface, reactor.position)
global.wastelands[reactor.position.x .. '/' .. reactor.position.y] = {
position = reactor.position,
surface_id = reactor.surface.index,
creation_time = game.tick
}
table.remove(global.reactors, i)
else
reactor.health = 500 - (reactor.temperature - 800) * 2.5
end
else
table.remove(global.reactors, i)
end
end
global.last_reactor_warning = last_reactor_warning
end
end
local function check_wastelands()
for index, wl in pairs(global.wastelands) do
local age = game.tick - wl.creation_time
wl.last_checked = wl.last_checked or 0
if (game.tick - wl.last_checked) > 899 then
wl.last_checked = game.tick
spawn_wasteland(game.surfaces[wl.surface_id], wl.position)
if age > wasteland_duration_seconds * 60 - 1 then
global.wastelands[index] = nil
local reactors =
game.surfaces[wl.surface_id].find_entities_filtered {
position = wl.position,
name = 'nuclear-reactor'
}
if reactors[1] then
reactors[1].destroy()
end
end
end
end
end
local function on_tick()
if global.reactors_enabled then
check_wastelands()
check_reactors()
end
end
local function entity_build(event)
if not event.created_entity.valid then
return
end
if event.created_entity.name == 'nuclear-reactor' and event.created_entity.surface.name ~= "antigrief" then
table.insert(global.reactors, event.created_entity)
end
end
local function reactor_toggle()
if not game.player or game.player.admin then
global.reactors_enabled = not global.reactors_enabled
if global.reactors_enabled then
game.print('Reactor meltdown activated.')
else
game.print('Reactor meltdown deactivated.')
end
end
end
local function is_meltdown()
if global.reactors_enabled then
Game.player_print('Reactor meltdown is enabled.')
else
Game.player_print('Reactor meltdown is disabled.')
end
end
commands.add_command('meltdown', 'Toggles if reactors blow up', reactor_toggle)
commands.add_command('is-meltdown', 'Prints if meltdown is enabled', is_meltdown)
Event.on_nth_tick(60, on_tick)
Event.add(defines.events.on_player_mined_entity, entity_destroyed)
Event.add(defines.events.on_robot_mined_entity, entity_destroyed)
Event.add(defines.events.on_entity_died, entity_destroyed)
Event.add(defines.events.on_built_entity, entity_build)
Event.add(defines.events.on_robot_built_entity, entity_build)

View File

@ -1,188 +1,188 @@
local Module = {}
local Gui = require("utils.gui")
local Utils = require("utils.utils");
local Game = require 'utils.game'
local report_frame_name = Gui.uid_name()
local report_close_button_name = Gui.uid_name()
local report_tab_button_name = Gui.uid_name()
local report_body_name = Gui.uid_name()
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
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
local time = Utils.format_time(report.tick)
local time_ago = Utils.format_time(game.tick - report.tick)
local message = report.message
Gui.clear(parent)
parent.add {type="label", caption="Offender: " .. reported_player_name}
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}
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
Module.show_reports = function(player)
local reports = global.reports or {}
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 {
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
}
end
end
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)
end
function Module.report(reporting_player, reported_player, message)
table.insert(global.reports, {reporting_player_index = reporting_player.index, reported_player_index = reported_player.index, message = message, tick = game.tick})
local notified = false
for _,p in pairs(game.players) do
if p.admin and p.connected then
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
Module.show_reports(p)
end
end
end
end
Gui.on_custom_close(
report_frame_name,
function(event)
Gui.destroy(event.element)
end
)
Gui.on_click(
report_close_button_name,
function(event)
Gui.destroy(event.element.parent)
end
)
Gui.on_click(
report_tab_button_name,
function(event)
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)
end
)
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()
Module.spawn_reporting_popup = function(player, reported_player)
local center = player.gui.center
local reporting_popup = center[reporting_popup_name]
if reporting_popup and reporting_popup.valid then
Gui.destroy(reporting_popup)
end
reporting_popup = center.add {
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:'
}
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"}
local submit_button = button_flow.add {type = "button", name = reporting_submit_button_name, caption="Submit"}
button_flow.add {type = "button", name = reporting_cancel_button_name, caption="Cancel"}
end
Gui.on_custom_close(
reporting_popup_name,
function(event)
Gui.destroy(event.element)
end
)
Gui.on_click(
reporting_cancel_button_name,
function(event)
local frame = event.element.parent.parent
Gui.destroy(frame)
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)
event.player.print("Sucessfully reported " .. Game.get_player_by_index(reported_player_index).name)
end
)
return Module
local Module = {}
local Gui = require("utils.gui")
local Utils = require("utils.utils");
local Game = require 'utils.game'
local report_frame_name = Gui.uid_name()
local report_close_button_name = Gui.uid_name()
local report_tab_button_name = Gui.uid_name()
local report_body_name = Gui.uid_name()
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
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
local time = Utils.format_time(report.tick)
local time_ago = Utils.format_time(game.tick - report.tick)
local message = report.message
Gui.clear(parent)
parent.add {type="label", caption="Offender: " .. reported_player_name}
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}
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
Module.show_reports = function(player)
local reports = global.reports or {}
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 {
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
}
end
end
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)
end
function Module.report(reporting_player, reported_player, message)
table.insert(global.reports, {reporting_player_index = reporting_player.index, reported_player_index = reported_player.index, message = message, tick = game.tick})
local notified = false
for _,p in pairs(game.players) do
if p.admin and p.connected then
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
Module.show_reports(p)
end
end
end
end
Gui.on_custom_close(
report_frame_name,
function(event)
Gui.destroy(event.element)
end
)
Gui.on_click(
report_close_button_name,
function(event)
Gui.destroy(event.element.parent)
end
)
Gui.on_click(
report_tab_button_name,
function(event)
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)
end
)
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()
Module.spawn_reporting_popup = function(player, reported_player)
local center = player.gui.center
local reporting_popup = center[reporting_popup_name]
if reporting_popup and reporting_popup.valid then
Gui.destroy(reporting_popup)
end
reporting_popup = center.add {
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:'
}
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"}
local submit_button = button_flow.add {type = "button", name = reporting_submit_button_name, caption="Submit"}
button_flow.add {type = "button", name = reporting_cancel_button_name, caption="Cancel"}
end
Gui.on_custom_close(
reporting_popup_name,
function(event)
Gui.destroy(event.element)
end
)
Gui.on_click(
reporting_cancel_button_name,
function(event)
local frame = event.element.parent.parent
Gui.destroy(frame)
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)
event.player.print("Sucessfully reported " .. Game.get_player_by_index(reported_player_index).name)
end
)
return Module

View File

@ -2,7 +2,7 @@ local Event = require 'utils.event'
local Market_items = require 'resources.market_items'
local Global = require 'utils.global'
local Donators = require 'resources.donators'
local UserGroups = require 'user_groups'
local UserGroups = require 'features.user_groups'
local Game = require 'utils.game'
local train_perk_flag = Donators.donator_perk_flags.train

View File

@ -1,7 +1,7 @@
local Event = require 'utils.event'
local Token = require 'utils.global_token'
local Task = require 'utils.Task'
local PlayerStats = require 'player_stats'
local PlayerStats = require 'features.player_stats'
local Game = require 'utils.game'
local Utils = require "utils.utils"

View File

@ -321,7 +321,7 @@ function DiggyCaveCollapse.register(cfg)
end
if (nil ~= support_beam_entities[event.entity.name]) then
require 'popup'.player(
require 'features.gui.popup'.player(
Game.get_player_by_index(player_index),[[
Mining entities such as walls, stone paths, concrete
and rocks, can cause a cave-in, be careful miner!

View File

@ -1,7 +1,7 @@
-- dependencies
local Config = require 'map_gen.Diggy.Config'
local Debug = require 'map_gen.Diggy.Debug'
local ScenarioInfo = require 'info'
local ScenarioInfo = require 'features.gui.info'
local Event = require 'utils.event'
require 'utils.list_utils'

View File

@ -21,7 +21,7 @@ local math = require 'utils.math'
local market_items = require "map_gen.combined.cave_miner.market_items"
local Game = require 'utils.game'
local Info = require 'info'
local Info = require 'features.gui.info'
Info.set_map_name('Cave Miner')
Info.set_map_description([[

View File

@ -8,7 +8,7 @@ local Random = require 'map_gen.shared.random'
local OutpostBuilder = require 'map_gen.presets.crash_site.outpost_builder'
local math = require 'utils.math'
local degrees = math.degrees
local ScenarioInfo = require 'info'
local ScenarioInfo = require 'features.gui.info'
-- Comment out this block if you're getting scenario info from another source.
ScenarioInfo.set_map_name('Crashsite')

View File

@ -1,7 +1,7 @@
local Gui = require 'utils.gui'
local Event = require 'utils.event'
local Global = require 'utils.global'
local PlayerStats = require 'player_stats'
local PlayerStats = require 'features.player_stats'
local Game = require 'utils.game'
local math = require "utils.math"

View File

@ -4,7 +4,7 @@ local Global = require 'utils.global'
local Event = require 'utils.event'
local Task = require 'utils.Task'
local Market = require 'map_gen.presets.crash_site.market'
local PlayerStats = require 'player_stats'
local PlayerStats = require 'features.player_stats'
local b = require 'map_gen.shared.builders'

View File

@ -105,7 +105,7 @@ end
map = b.apply_effect(map, effect)
require 'spawn_control'
require 'features.spawn_control'
add_spawn('left', -88, -88)
add_spawn('right', 88, 88)