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

80 lines
3.0 KiB
Lua
Raw Normal View History

2019-03-18 05:47:27 +02:00
local event = require 'utils.event'
local info = [[
2019-03-18 06:51:32 +02:00
- - B I T E R B A T T L E S - -
2019-03-18 05:47:27 +02:00
2019-03-27 04:58:22 +02:00
Your objective is to defend your team's rocket silo and defeat the other team.
2019-03-18 11:15:51 +02:00
Feed the opponent's biters with science packs to increase their strength.
High tier science juice will yield stronger results.
2019-03-18 15:23:12 +02:00
There is no major direct pvp combat.
2019-03-18 06:51:32 +02:00
The horizontal border river is landfill proof.
Construction robots can not build on the other teams's side.
2019-03-18 15:23:12 +02:00
The random map layout is mirrored to provide a fair competition.
2019-03-18 05:47:27 +02:00
2019-03-18 06:51:32 +02:00
There is no biter evolution from pollution, time or destruction.
2019-03-18 11:15:51 +02:00
ONLY feeding increases their power and will lead to your teams victory.
2019-03-18 06:51:32 +02:00
The gui yields two different main stats for each team's biters.
- EVO -
2019-03-18 15:23:12 +02:00
The evolution of the biters, which increases when they get fed.
2019-03-18 06:51:32 +02:00
It can go above 100% which unlocks endgame modifiers,
2019-03-18 11:15:51 +02:00
granting them increased damage and evasion.
2019-03-18 06:51:32 +02:00
- THREAT -
2019-03-19 05:05:32 +02:00
Causes biters to attack and reduces when biters are slain.
Feeding gives permanent "threat-income", as well as creating instant threat.
2019-03-18 11:15:51 +02:00
A high threat value causes big attacks.
2019-03-19 05:05:32 +02:00
Values of zero or below will cause no attacks.
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"}
local l = frame.add {type = "label", caption = info, name = "map_intro_text"}
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
local function on_player_joined_game(event)
local player = game.players[event.player_index]
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
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
local player = game.players[event.element.player_index]
2019-03-18 06:51:32 +02:00
if event.element.name == "close_map_intro_frame" then player.gui.center["map_intro_frame"].destroy() return end
if event.element.name == "map_intro_text" then player.gui.center["map_intro_frame"].destroy() return end
2019-03-18 05:47:27 +02:00
if event.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()
2019-03-18 05:47:27 +02:00
else
create_map_intro(player)
end
return
end
end
event.add(defines.events.on_player_joined_game, on_player_joined_game)
event.add(defines.events.on_gui_click, on_gui_click)