1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-08 00:39:30 +02:00
ComfyFactorio/maps/hunger_games_map_intro.lua

65 lines
2.0 KiB
Lua
Raw Normal View History

local event = require 'utils.event'
2019-04-13 19:14:52 +02:00
local main_caption = " --Hunger Games Mode-- "
2019-02-05 09:42:45 +02:00
local sub_caption = "Deep in the meadow, hidden far away."
2019-01-12 02:37:54 +02:00
local info = [[
2019-02-05 09:42:45 +02:00
Create / Join a group to play!!
2019-01-12 02:37:54 +02:00
Use the [Group] button!
2019-01-10 01:37:08 +02:00
Use /s yourmessage in chat for global chat.
Anything goes.
2019-01-10 01:37:08 +02:00
No rules.
]]
2019-01-11 02:57:24 +02:00
local function create_map_intro(player)
if player.gui.left["map_intro_frame"] then player.gui.left["map_intro_frame"].destroy() end
local frame = player.gui.left.add {type = "frame", name = "map_intro_frame", direction = "vertical"}
local t = frame.add {type = "table", column_count = 1}
local tt = t.add {type = "table", column_count = 3}
local l = tt.add {type = "label", caption = main_caption}
2019-04-13 19:14:52 +02:00
l.style.font = "heading-1"
2019-02-05 09:42:45 +02:00
l.style.font_color = {r=35, g=130, b=60}
l.style.top_padding = 6
l.style.bottom_padding = 6
local l = tt.add {type = "label", caption = sub_caption}
2019-04-13 19:14:52 +02:00
l.style.font = "heading-2"
2019-02-05 09:42:45 +02:00
l.style.font_color = {r=0.75, g=0.75, b=0.2}
l.style.minimal_width = 280
2019-04-13 19:14:52 +02:00
local b = tt.add {type = "button", caption = "X", name = "close_map_intro_frame"}
b.style.font = "heading-1"
b.style.minimal_height = 30
b.style.minimal_width = 30
b.style.top_padding = 2
b.style.left_padding = 4
b.style.right_padding = 4
b.style.bottom_padding = 2
2019-04-13 19:14:52 +02:00
local frame = frame.add {type = "frame"}
local l = frame.add {type = "label", caption = info}
2019-04-13 19:14:52 +02:00
l.style.single_line = false
l.style.font = "heading-3"
l.style.font_color = {r=0.95, g=0.95, b=0.95}
2019-04-13 19:14:52 +02:00
l.style.minimal_width = 500
end
local function on_player_joined_game(event)
local player = game.players[event.player_index]
create_map_intro(player)
end
local function on_gui_click(event)
if not event then return end
if not event.element then return end
if not event.element.valid then return end
2019-01-11 02:57:24 +02:00
local player = game.players[event.player_index]
if event.element.name == "close_map_intro_frame" then player.gui.left["map_intro_frame"].destroy() end
end
event.add(defines.events.on_player_joined_game, on_player_joined_game)
event.add(defines.events.on_gui_click, on_gui_click)