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

47 lines
1.6 KiB
Lua
Raw Normal View History

2020-01-02 17:09:24 +02:00
local Public = {}
2019-03-18 05:47:27 +02:00
local function create_map_intro_button(player)
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"})
2019-03-18 06:51:32 +02:00
b.style.font_color = {r=0.5, g=0.3, b=0.99}
2019-03-18 05:47:27 +02:00
b.style.font = "heading-1"
b.style.minimal_height = 38
b.style.minimal_width = 38
2019-03-18 06:51:32 +02:00
b.style.top_padding = 1
b.style.left_padding = 1
b.style.right_padding = 1
b.style.bottom_padding = 1
2019-03-18 05:47:27 +02:00
end
local function create_map_intro(player)
2019-03-18 06:51:32 +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"}
2019-12-05 09:58:26 +02:00
local l = frame.add {type = "label", caption = {"biter_battles.map_info"}, name = "biter_battles_map_intro"}
2019-03-18 05:47:27 +02:00
l.style.single_line = false
2019-03-18 06:51:32 +02:00
l.style.font = "heading-2"
l.style.font_color = {r=0.7, g=0.6, b=0.99}
2019-03-18 05:47:27 +02:00
end
2020-01-02 17:09:24 +02:00
function Public.player_joined_game(player)
2019-03-18 05:47:27 +02:00
create_map_intro_button(player)
if player.online_time == 0 then
2019-08-14 21:16:56 +02:00
--create_map_intro(player)
2019-03-18 05:47:27 +02:00
end
end
2020-01-02 17:09:24 +02:00
function Public.gui_click(player, element)
if element.name == "close_map_intro_frame" then player.gui.center["map_intro_frame"].destroy() return true end
if element.name == "biter_battles_map_intro" then player.gui.center["map_intro_frame"].destroy() return true end
if element.name == "map_intro_button" then
2019-03-18 06:51:32 +02:00
if player.gui.center["map_intro_frame"] then
player.gui.center["map_intro_frame"].destroy()
2020-01-02 17:09:24 +02:00
return true
2019-03-18 05:47:27 +02:00
else
create_map_intro(player)
2020-01-02 17:09:24 +02:00
return true
end
2019-03-18 05:47:27 +02:00
end
end
2020-01-02 17:09:24 +02:00
return Public