1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-16 10:19:27 +02:00
RedMew/map_gen/maps/crash_site/crash_site_toast.lua

48 lines
1.2 KiB
Lua
Raw Normal View History

2019-01-31 19:16:37 +02:00
local Gui = require 'utils.gui'
local Toast = require 'features.gui.toast'
local Color = require 'resources.color_presets'
local Public = {}
local find_outpost_name = Gui.uid_name()
2019-03-08 19:49:06 +02:00
function Public.do_outpost_toast(market, message)
2019-01-31 19:16:37 +02:00
Toast.toast_all_players_template(
15,
function(container)
local sprite =
container.add {
type = 'sprite-button',
name = find_outpost_name,
sprite = 'utility/search_icon',
style = 'slot_button'
}
2019-03-08 19:30:28 +02:00
Gui.set_data(sprite, market.position)
2019-01-31 19:16:37 +02:00
local label =
container.add {
type = 'label',
name = Toast.close_toast_name,
caption = message
}
local label_style = label.style
label_style.single_line = false
label_style.font_color = Color.lawn_green
end
)
end
Gui.on_click(
find_outpost_name,
function(event)
local player = event.player
local element = event.element
2019-03-08 19:30:28 +02:00
local position = Gui.get_data(element)
2019-01-31 19:16:37 +02:00
2019-03-08 19:30:28 +02:00
player.zoom_to_world(position, 0.5)
2019-01-31 19:16:37 +02:00
end
)
return Public