1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-10 00:43:27 +02:00
ComfyFactorio/maps/native_war/map_info.lua

60 lines
2.0 KiB
Lua
Raw Normal View History

2021-03-24 21:14:55 +02:00
--luacheck: ignore
2020-02-23 05:02:58 +02:00
local Public = {}
local function create_map_intro_button(player)
2021-03-24 17:46:00 +02:00
if player.gui.top['map_intro_button'] then
return
end
local b = player.gui.top.add({type = 'sprite-button', caption = '?', name = 'map_intro_button', tooltip = 'Map Info'})
b.style.font_color = {r = 0.5, g = 0.3, b = 0.99}
b.style.font = 'heading-1'
b.style.minimal_height = 38
b.style.minimal_width = 38
b.style.top_padding = 1
b.style.left_padding = 1
b.style.right_padding = 1
b.style.bottom_padding = 1
2020-02-23 05:02:58 +02:00
end
local function create_map_intro(player)
2021-03-24 17:46:00 +02:00
if player.gui.center['map_intro_frame'] then
player.gui.center['map_intro_frame'].destroy()
end
local frame = player.gui.center.add {type = 'frame', name = 'map_intro_frame', direction = 'vertical'}
local frame = frame.add {type = 'frame'}
local l = frame.add {type = 'label', caption = {'native_war.map_info'}, name = 'native_war_map_intro'}
l.style.single_line = false
l.style.font = 'heading-2'
l.style.font_color = {r = 0.7, g = 0.6, b = 0.99}
2020-02-23 05:02:58 +02:00
end
function Public.player_joined_game(player)
2021-03-24 17:46:00 +02:00
create_map_intro_button(player)
player.print('Check the question mark button "?" for basic information', {255, 0, 0})
if player.online_time == 0 then
--create_map_intro(player)
end
2020-02-23 05:02:58 +02:00
end
function Public.gui_click(player, element)
2021-03-24 17:46:00 +02:00
if element.name == 'close_map_intro_frame' then
player.gui.center['map_intro_frame'].destroy()
return true
end
if element.name == 'native_war_map_intro' then
player.gui.center['map_intro_frame'].destroy()
return true
end
if element.name == 'map_intro_button' then
if player.gui.center['map_intro_frame'] then
player.gui.center['map_intro_frame'].destroy()
return true
else
create_map_intro(player)
return true
end
end
2020-02-23 05:02:58 +02:00
end
return Public