1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-03-05 15:05:57 +02:00
RedMew/features/gui/blueprint_helper.lua

632 lines
18 KiB
Lua
Raw Normal View History

2018-05-17 15:20:48 +01:00
-- Soft mod version of Blueprint Flipper and Turner https://mods.factorio.com/mods/Marthen/Blueprint_Flip_Turn
local Event = require 'utils.event'
local Global = require 'utils.global'
2018-05-20 16:29:05 +01:00
local Gui = require 'utils.gui'
2018-05-17 15:20:48 +01:00
local player_filters = {}
Global.register(
2019-06-20 11:25:24 +01:00
player_filters,
function(tbl)
2019-06-20 11:25:24 +01:00
player_filters = tbl
2019-01-30 18:17:55 -05:00
end
)
2018-05-17 15:20:48 +01:00
local function getBlueprintCursorStack(player)
local cursor = player.cursor_stack
if
cursor.valid_for_read and (cursor.name == 'blueprint' or cursor.name == 'blueprint-book') and
cursor.is_blueprint_setup()
then --check if is a blueprint, work in book as well
return cursor
end
return nil
end
2018-06-01 22:23:39 +01:00
local function flip_v(cursor)
2019-06-20 11:25:24 +01:00
local entities = cursor.get_blueprint_entities()
if entities ~= nil then
for i = 1, #entities do
local entity = entities[i]
local dir = entity.direction or 0
if entity.name == 'curved-rail' then
entity.direction = (13 - dir) % 8
elseif entity.name == 'storage-tank' then
if entity.direction == 2 or entity.direction == 6 then
entity.direction = 4
2018-05-17 15:20:48 +01:00
else
2019-06-20 11:25:24 +01:00
entity.direction = 2
2018-05-17 15:20:48 +01:00
end
2019-06-20 11:25:24 +01:00
elseif entity.name == 'rail-signal' or entity.name == 'rail-chain-signal' then
2018-06-01 22:23:39 +01:00
if dir == 1 then
2019-06-20 11:25:24 +01:00
entity.direction = 7
2018-06-01 22:23:39 +01:00
elseif dir == 2 then
2019-06-20 11:25:24 +01:00
entity.direction = 6
2018-06-01 22:23:39 +01:00
elseif dir == 3 then
2019-06-20 11:25:24 +01:00
entity.direction = 5
2018-06-01 22:23:39 +01:00
elseif dir == 5 then
2019-06-20 11:25:24 +01:00
entity.direction = 3
2018-06-01 22:23:39 +01:00
elseif dir == 6 then
2019-06-20 11:25:24 +01:00
entity.direction = 2
2018-06-01 22:23:39 +01:00
elseif dir == 7 then
2019-06-20 11:25:24 +01:00
entity.direction = 1
2018-05-17 15:20:48 +01:00
end
2019-06-20 11:25:24 +01:00
elseif entity.name == 'train-stop' then
2018-06-01 22:23:39 +01:00
if dir == 2 then
2019-06-20 11:25:24 +01:00
entity.direction = 6
2018-06-01 22:23:39 +01:00
elseif dir == 6 then
2019-06-20 11:25:24 +01:00
entity.direction = 2
2018-05-17 15:20:48 +01:00
end
2018-06-01 22:23:39 +01:00
else
2019-06-20 11:25:24 +01:00
entity.direction = (12 - dir) % 8
end
entity.position.y = -entity.position.y
if entity.drop_position then
entity.drop_position.y = -entity.drop_position.y
end
if entity.pickup_position then
entity.pickup_position.y = -entity.pickup_position.y
2018-05-17 15:20:48 +01:00
end
2019-06-20 11:25:24 +01:00
local input_priority = entity.input_priority
if input_priority == 'left' then
entity.input_priority = 'right'
elseif input_priority == 'right' then
entity.input_priority = 'left'
2018-06-01 22:23:39 +01:00
end
2019-06-20 11:25:24 +01:00
local output_priority = entity.output_priority
if output_priority == 'left' then
entity.output_priority = 'right'
elseif output_priority == 'right' then
entity.output_priority = 'left'
2018-06-01 22:23:39 +01:00
end
end
2019-06-20 11:25:24 +01:00
cursor.set_blueprint_entities(entities)
2018-06-01 22:23:39 +01:00
end
2019-06-20 11:25:24 +01:00
local tiles = cursor.get_blueprint_tiles()
if tiles ~= nil then
for i = 1, #tiles do
local tile = tiles[i]
local dir = tile.direction or 0
tile.direction = (12 - dir) % 8
tile.position.y = -tile.position.y
2018-05-17 15:20:48 +01:00
end
2019-06-20 11:25:24 +01:00
cursor.set_blueprint_tiles(entities)
2018-05-17 15:20:48 +01:00
end
end
2018-06-01 22:23:39 +01:00
local function flip_h(cursor)
2019-06-20 11:25:24 +01:00
local entities = cursor.get_blueprint_entities()
if entities ~= nil then
for i = 1, #entities do
local entity = entities[i]
local dir = entity.direction or 0
if entity.name == 'curved-rail' then
entity.direction = (9 - dir) % 8
elseif entity.name == 'storage-tank' then
if entity.direction == 2 or entity.direction == 6 then
entity.direction = 4
2018-05-17 15:20:48 +01:00
else
2019-06-20 11:25:24 +01:00
entity.direction = 2
2018-05-17 15:20:48 +01:00
end
2019-06-20 11:25:24 +01:00
elseif entity.name == 'rail-signal' or entity.name == 'rail-chain-signal' then
2018-06-01 22:23:39 +01:00
if dir == 0 then
2019-06-20 11:25:24 +01:00
entity.direction = 4
2018-06-01 22:23:39 +01:00
elseif dir == 1 then
2019-06-20 11:25:24 +01:00
entity.direction = 3
2018-06-01 22:23:39 +01:00
elseif dir == 3 then
2019-06-20 11:25:24 +01:00
entity.direction = 1
2018-06-01 22:23:39 +01:00
elseif dir == 4 then
2019-06-20 11:25:24 +01:00
entity.direction = 0
2018-06-01 22:23:39 +01:00
elseif dir == 5 then
2019-06-20 11:25:24 +01:00
entity.direction = 7
2018-06-01 22:23:39 +01:00
elseif dir == 7 then
2019-06-20 11:25:24 +01:00
entity.direction = 5
2018-05-17 15:20:48 +01:00
end
2019-06-20 11:25:24 +01:00
elseif entity.name == 'train-stop' then
2018-06-01 22:23:39 +01:00
if dir == 0 then
2019-06-20 11:25:24 +01:00
entity.direction = 4
2018-06-01 22:23:39 +01:00
elseif dir == 4 then
2019-06-20 11:25:24 +01:00
entity.direction = 0
2018-05-17 15:20:48 +01:00
end
2018-06-01 22:23:39 +01:00
else
2019-06-20 11:25:24 +01:00
entity.direction = (16 - dir) % 8
2018-05-17 15:20:48 +01:00
end
2019-06-20 11:25:24 +01:00
entity.position.x = -entity.position.x
if entity.drop_position then
entity.drop_position.x = -entity.drop_position.x
2018-06-01 22:23:39 +01:00
end
2019-06-20 11:25:24 +01:00
if entity.pickup_position then
entity.pickup_position.x = -entity.pickup_position.x
end
local input_priority = entity.input_priority
if input_priority == 'left' then
entity.input_priority = 'right'
elseif input_priority == 'right' then
entity.input_priority = 'left'
end
local output_priority = entity.output_priority
if output_priority == 'left' then
entity.output_priority = 'right'
elseif output_priority == 'right' then
entity.output_priority = 'left'
2018-06-01 22:23:39 +01:00
end
2018-05-17 15:20:48 +01:00
end
2019-06-20 11:25:24 +01:00
cursor.set_blueprint_entities(entities)
2018-05-17 15:20:48 +01:00
end
2019-06-20 11:25:24 +01:00
local tiles = cursor.get_blueprint_tiles()
if tiles ~= nil then
for i = 1, #tiles do
local tile = tiles[i]
local dir = tile.direction or 0
tile.direction = (16 - dir) % 8
tile.position.x = -tile.position.x
2018-06-01 22:23:39 +01:00
end
2019-06-20 11:25:24 +01:00
cursor.set_blueprint_tiles(tiles)
2018-05-20 16:29:05 +01:00
end
2018-06-01 22:23:39 +01:00
end
2018-05-20 16:29:05 +01:00
2018-06-01 22:23:39 +01:00
local function build_filters(data)
2018-05-20 16:29:05 +01:00
local filters = {}
for _, filter in pairs(data) do
2019-06-20 11:25:24 +01:00
local from = filter.from.parent.caption
local to = filter.to.parent.caption
2018-05-21 18:22:07 +01:00
if from ~= '' and to ~= '' then
filters[from] = to
2018-05-20 16:29:05 +01:00
end
end
2018-06-01 22:23:39 +01:00
return filters
end
local function convert(cursor, filters)
local entities = cursor.get_blueprint_entities()
if not entities then
return
end
2018-05-20 16:29:05 +01:00
for _, e in ipairs(entities) do
local to_name = filters[e.name]
if to_name then
e.name = to_name
end
end
cursor.set_blueprint_entities(entities)
end
2019-06-20 11:25:24 +01:00
local filter_blacklist = {
['escape-pod-assembler'] = true,
['escape-pod-lab'] = true,
['infinity-chest'] = true,
['simple-entity-with-force'] = true,
['simple-entity-with-owner'] = true,
['electric-energy-interface'] = true,
['heat-interface'] = true,
['infinity-pipe'] = true,
['player-port'] = true,
['escape-pod-power'] = true,
['bait-chest'] = true,
['cutscene-gun-turret'] = true,
['blue-chest'] = true,
['market'] = true,
['red-chest'] = true
2018-05-21 18:22:07 +01:00
}
2019-06-20 11:25:24 +01:00
local cached_valid_filters = nil
local function build_valid_filters()
local filters = {}
local count = 0
for name, data in pairs(game.entity_prototypes) do
local has_flag = data.has_flag
if has_flag('player-creation') and not has_flag('placeable-off-grid') and not filter_blacklist[name] then
count = count + 1
filters[count] = name
end
end
return filters
end
local function get_valid_filters()
if cached_valid_filters == nil then
cached_valid_filters = build_valid_filters()
end
return cached_valid_filters
end
2018-05-21 23:48:50 +01:00
-- Gui implementation.
2019-06-20 11:25:24 +01:00
local minimal_width = 400
2018-05-21 23:48:50 +01:00
2018-05-20 16:29:05 +01:00
local main_button_name = Gui.uid_name()
local main_frame_name = Gui.uid_name()
local flip_h_button_name = Gui.uid_name()
local flip_v_button_name = Gui.uid_name()
local convert_button_name = Gui.uid_name()
2018-05-17 15:20:48 +01:00
2018-05-21 18:22:07 +01:00
local filter_button_name = Gui.uid_name()
local filter_element_name = Gui.uid_name()
local filters_table_name = Gui.uid_name()
local filter_table_close_button_name = Gui.uid_name()
local filter_table_clear_name = Gui.uid_name()
2018-05-21 23:48:50 +01:00
local clear_all_filters_name = Gui.uid_name()
2018-05-21 18:22:07 +01:00
2020-09-14 21:14:15 +01:00
local function player_created(event)
local player = game.get_player(event.player_index)
2018-05-17 15:20:48 +01:00
if not player or not player.valid then
return
end
2019-06-20 11:25:24 +01:00
player.gui.top.add(
{
name = main_button_name,
type = 'sprite-button',
sprite = 'item/blueprint',
tooltip = {'blueprint_helper.tooltip'}
}
)
2018-05-17 15:20:48 +01:00
end
2018-05-21 18:22:07 +01:00
local function draw_filters_table(event)
local center = event.player.gui.center
2018-05-22 01:02:47 +01:00
if center[filters_table_name] then
return
end
2019-06-20 11:29:00 +01:00
local frame =
center.add {
type = 'frame',
name = filters_table_name,
direction = 'vertical',
caption = {'blueprint_helper.set_filter_caption'}
}
2018-05-21 18:22:07 +01:00
2018-05-22 13:56:03 +01:00
local t = frame.add {type = 'table', column_count = 10}
2018-05-21 18:22:07 +01:00
t.style.horizontal_spacing = 0
t.style.vertical_spacing = 0
2019-06-20 11:25:24 +01:00
local prototypes = game.entity_prototypes
for _, v in ipairs(get_valid_filters()) do
local flow = t.add {type = 'flow', caption = v}
local b =
flow.add {
type = 'sprite-button',
name = filter_element_name,
sprite = 'entity/' .. v,
tooltip = prototypes[v].localised_name or v
}
2018-05-21 18:22:07 +01:00
Gui.set_data(b, frame)
b.style = 'slot_button'
end
local flow = frame.add {type = 'flow'}
2020-10-04 21:13:09 +01:00
local close_button = Gui.make_close_button(flow, filter_table_close_button_name)
Gui.set_data(close_button, frame)
2018-05-21 18:22:07 +01:00
2019-06-20 11:25:24 +01:00
local clear =
flow.add {type = 'button', name = filter_table_clear_name, caption = {'blueprint_helper.clear_filters'}}
2018-05-21 18:22:07 +01:00
Gui.set_data(clear, frame)
event.player.opened = frame
Gui.set_data(frame, event.element)
end
2018-05-20 16:29:05 +01:00
local function toggle(event)
2018-05-22 13:56:03 +01:00
local p_filters = player_filters[event.player_index]
2018-05-22 11:22:47 +01:00
if not p_filters then
p_filters = {}
for i = 1, 9 do
p_filters[i] = {from = '', to = ''}
end
2018-05-22 13:56:03 +01:00
player_filters[event.player_index] = p_filters
2018-05-22 11:22:47 +01:00
end
2018-05-17 15:20:48 +01:00
2018-06-07 21:06:48 +01:00
local player = event.player
2019-06-20 12:39:18 +01:00
local gui = player.gui
local left = gui.left
2018-05-17 15:20:48 +01:00
local main_frame = left[main_frame_name]
2019-06-20 12:39:18 +01:00
local main_button = gui.top[main_button_name]
2018-05-22 11:22:47 +01:00
2018-05-17 15:20:48 +01:00
if main_frame and main_frame.valid then
2018-05-22 11:22:47 +01:00
local filters = Gui.get_data(main_frame)
for i, f in pairs(filters) do
2019-06-20 11:25:24 +01:00
p_filters[i].from = f.from.parent.caption
p_filters[i].to = f.to.parent.caption
2018-05-22 11:22:47 +01:00
end
2019-06-20 11:25:24 +01:00
Gui.destroy(main_frame)
2018-06-07 21:06:48 +01:00
if player.opened_gui_type == defines.gui_type.custom then
local opened = player.opened
if opened and opened.valid and opened.name == filters_table_name then
2018-12-01 22:06:24 +01:00
Gui.remove_data_recursively(opened)
2018-06-07 21:06:48 +01:00
opened.destroy()
end
end
2019-06-20 12:39:18 +01:00
main_button.style = 'icon_button'
2018-05-17 15:20:48 +01:00
else
2020-05-26 17:35:14 +01:00
main_button.style = 'slot_sized_button'
2019-06-20 12:39:18 +01:00
local style = main_button.style
style.width = 38
style.height = 38
2018-05-17 15:20:48 +01:00
main_frame =
left.add {
type = 'frame',
name = main_frame_name,
direction = 'vertical',
2019-06-20 11:25:24 +01:00
caption = {'blueprint_helper.tooltip'}
2018-05-17 15:20:48 +01:00
}
2018-05-20 16:29:05 +01:00
local scroll_pane =
main_frame.add {type = 'scroll-pane', direction = 'vertical', vertical_scroll_policy = 'auto'}
scroll_pane.style.maximal_height = 500
-- Flipper.
2019-06-20 11:25:24 +01:00
local flipper_frame =
scroll_pane.add {type = 'frame', caption = {'blueprint_helper.flipper_caption'}, direction = 'vertical'}
flipper_frame.style.minimal_width = minimal_width
2018-05-20 16:29:05 +01:00
2018-05-23 12:16:13 +01:00
local label =
flipper_frame.add {
2018-05-17 15:20:48 +01:00
type = 'label',
2019-06-20 11:25:24 +01:00
caption = {'blueprint_helper.flipper_label'}
2018-05-17 15:20:48 +01:00
}
2018-05-23 12:16:13 +01:00
label.style.single_line = false
2018-05-21 18:22:07 +01:00
local flow = flipper_frame.add {type = 'flow'}
flow.add {
2018-05-17 15:20:48 +01:00
type = 'button',
name = flip_h_button_name,
2019-06-20 11:25:24 +01:00
caption = {'blueprint_helper.flip_horizontal'}
2018-05-17 15:20:48 +01:00
}
2018-05-21 18:22:07 +01:00
flow.add {
2018-05-17 15:20:48 +01:00
type = 'button',
name = flip_v_button_name,
2019-06-20 11:25:24 +01:00
caption = {'blueprint_helper.flip_vertical'}
2018-05-17 15:20:48 +01:00
}
2018-05-20 16:29:05 +01:00
-- Converter.
2019-06-20 11:25:24 +01:00
local filter_frame =
scroll_pane.add {
type = 'frame',
caption = {'blueprint_helper.entity_converter_caption'},
direction = 'vertical'
}
filter_frame.style.minimal_width = minimal_width
2018-05-20 16:29:05 +01:00
2018-05-21 23:48:50 +01:00
filter_frame.add {
type = 'label',
2019-06-20 11:25:24 +01:00
caption = {'blueprint_helper.entity_converter_label'}
2018-05-21 23:48:50 +01:00
}
2018-05-20 16:29:05 +01:00
2018-05-22 11:22:47 +01:00
local filter_table = filter_frame.add {type = 'table', column_count = 12}
2018-05-20 16:29:05 +01:00
local filters = {}
2019-06-20 11:25:24 +01:00
local prototypes = game.entity_prototypes
2018-05-22 11:22:47 +01:00
for i = 1, 9 do
2018-05-20 16:29:05 +01:00
local filler = filter_table.add {type = 'label'}
filler.style.minimal_width = 16
2018-05-22 11:22:47 +01:00
2019-06-20 11:25:24 +01:00
local from = p_filters[i].from
local to = p_filters[i].to
local from_tooltip, to_tooltip
if from ~= '' then
from_tooltip = prototypes[from].localised_name or from
end
if to ~= '' then
to_tooltip = prototypes[to].localised_name or to
end
2018-05-22 11:22:47 +01:00
local from_filter =
2019-06-20 11:25:24 +01:00
filter_table.add({type = 'flow', caption = from}).add {
2018-05-22 11:22:47 +01:00
type = 'sprite-button',
name = filter_button_name,
tooltip = from_tooltip,
2019-06-20 11:25:24 +01:00
sprite = from ~= '' and 'entity/' .. from or nil
2018-05-22 11:22:47 +01:00
}
from_filter.style = 'slot_button'
filter_table.add {type = 'label', caption = ''}
local to_filter =
2019-06-20 11:25:24 +01:00
filter_table.add({type = 'flow', caption = to}).add {
2018-05-22 11:22:47 +01:00
type = 'sprite-button',
name = filter_button_name,
tooltip = to_tooltip,
2019-06-20 11:25:24 +01:00
sprite = to ~= '' and 'entity/' .. to or nil
2018-05-22 11:22:47 +01:00
}
to_filter.style = 'slot_button'
table.insert(filters, {from = from_filter, to = to_filter})
2018-05-20 16:29:05 +01:00
end
2018-05-21 23:48:50 +01:00
local converter_buttons_flow = filter_frame.add {type = 'flow'}
local clear_button =
2019-06-20 11:25:24 +01:00
converter_buttons_flow.add {
type = 'button',
name = clear_all_filters_name,
caption = {'blueprint_helper.clear_filters'}
}
2018-05-21 23:48:50 +01:00
Gui.set_data(clear_button, filters)
local filter_button =
2019-06-20 11:25:24 +01:00
converter_buttons_flow.add {
type = 'button',
name = convert_button_name,
caption = {'blueprint_helper.convert'}
}
2018-05-20 16:29:05 +01:00
Gui.set_data(filter_button, filters)
2020-10-04 21:13:09 +01:00
Gui.make_close_button(main_frame, main_button_name)
2018-05-22 11:22:47 +01:00
Gui.set_data(main_frame, filters)
2018-05-17 15:20:48 +01:00
end
end
2018-05-20 16:29:05 +01:00
Gui.on_click(main_button_name, toggle)
Gui.on_click(
flip_h_button_name,
function(event)
2018-06-01 22:23:39 +01:00
local player = event.player
local cursor = getBlueprintCursorStack(player)
if cursor then
flip_h(cursor)
else
2019-06-20 11:25:24 +01:00
player.print({'blueprint_helper.empty_cursor_error_message'})
2018-06-01 22:23:39 +01:00
end
2018-05-18 01:14:09 +01:00
end
2018-05-20 16:29:05 +01:00
)
2018-05-18 01:14:09 +01:00
2018-05-20 16:29:05 +01:00
Gui.on_click(
flip_v_button_name,
function(event)
2018-06-01 22:23:39 +01:00
local player = event.player
local cursor = getBlueprintCursorStack(player)
if cursor then
flip_v(cursor)
else
2019-06-20 11:25:24 +01:00
player.print({'blueprint_helper.empty_cursor_error_message'})
2018-06-01 22:23:39 +01:00
end
2018-05-17 15:20:48 +01:00
end
2018-05-20 16:29:05 +01:00
)
2018-05-17 15:20:48 +01:00
2018-05-21 18:22:07 +01:00
Gui.on_click(
filter_button_name,
function(event)
if event.button == defines.mouse_button_type.right then
local element = event.element
element.sprite = 'utility/pump_cannot_connect_icon'
element.tooltip = ''
2019-06-20 11:25:24 +01:00
element.parent.caption = ''
2018-05-21 18:22:07 +01:00
else
draw_filters_table(event)
end
end
)
Gui.on_click(
filter_element_name,
function(event)
local element = event.element
local frame = Gui.get_data(element)
local filter_button = Gui.get_data(frame)
2018-06-07 21:06:48 +01:00
if filter_button and filter_button.valid then
filter_button.sprite = element.sprite
filter_button.tooltip = element.tooltip
2019-06-20 11:25:24 +01:00
filter_button.parent.caption = element.parent.caption
2018-06-07 21:06:48 +01:00
end
2018-05-21 18:22:07 +01:00
2019-06-20 11:25:24 +01:00
Gui.destroy(frame)
2018-05-21 18:22:07 +01:00
end
)
Gui.on_click(
filter_table_close_button_name,
function(event)
local frame = Gui.get_data(event.element)
2019-06-20 11:25:24 +01:00
Gui.destroy(frame)
2018-05-21 18:22:07 +01:00
end
)
Gui.on_click(
filter_table_clear_name,
function(event)
local frame = Gui.get_data(event.element)
local filter_button = Gui.get_data(frame)
filter_button.sprite = 'utility/pump_cannot_connect_icon'
filter_button.tooltip = ''
2019-06-20 11:25:24 +01:00
filter_button.parent.caption = ''
2018-05-21 18:22:07 +01:00
2019-06-20 11:25:24 +01:00
Gui.destroy(frame)
2018-05-21 18:22:07 +01:00
end
)
2018-05-21 23:48:50 +01:00
Gui.on_click(
clear_all_filters_name,
function(event)
local filters = Gui.get_data(event.element)
for _, filter in ipairs(filters) do
local from = filter.from
local to = filter.to
from.sprite = 'utility/pump_cannot_connect_icon'
from.tooltip = ''
2019-06-20 11:25:24 +01:00
from.parent.caption = ''
2018-05-21 23:48:50 +01:00
to.sprite = 'utility/pump_cannot_connect_icon'
to.tooltip = ''
2019-06-20 11:25:24 +01:00
to.parent.caption = ''
2018-05-21 23:48:50 +01:00
end
end
)
2018-05-20 16:29:05 +01:00
Gui.on_click(
convert_button_name,
function(event)
2018-06-01 22:23:39 +01:00
local player = event.player
local cursor = getBlueprintCursorStack(player)
if not cursor then
2019-06-20 11:25:24 +01:00
player.print({'blueprint_helper.empty_cursor_error_message'})
2018-06-07 13:55:01 +01:00
return
2018-06-01 22:23:39 +01:00
end
2018-05-20 16:29:05 +01:00
local data = Gui.get_data(event.element)
2018-06-01 22:23:39 +01:00
local filters = build_filters(data)
if next(filters) == nil then
2019-06-20 11:25:24 +01:00
player.print({'blueprint_helper.no_filters_error_message'})
2018-06-01 22:23:39 +01:00
end
convert(cursor, filters)
2018-05-17 15:20:48 +01:00
end
2018-05-20 16:29:05 +01:00
)
2018-05-17 15:20:48 +01:00
2018-05-21 18:22:07 +01:00
Gui.on_custom_close(
filters_table_name,
function(event)
local element = event.element
2019-06-20 11:25:24 +01:00
Gui.destroy(element)
2018-05-21 18:22:07 +01:00
end
)
Gui.allow_player_to_toggle_top_element_visibility(main_button_name)
2020-09-14 21:14:15 +01:00
Event.add(defines.events.on_player_created, player_created)