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

51 lines
1.5 KiB
Lua
Raw Normal View History

2019-03-14 19:06:39 +02:00
local event = require 'utils.event'
local gui = require "maps.biter_battles_v2.gui"
local ai = require "maps.biter_battles_v2.ai"
2019-03-17 03:35:58 +02:00
local chunk_pregen = require "maps.biter_battles_v2.pregenerate_chunks"
2019-03-14 19:06:39 +02:00
2019-03-15 04:59:43 +02:00
local function reveal_team(f)
local m = 32
if f == "north" then
game.forces["south"].chart(
game.surfaces["biter_battles"],
{{x = global.force_area[f].x_top - m, y = global.force_area[f].y_top - m}, {x = global.force_area[f].x_bot + m, y = global.force_area[f].y_bot + m}}
)
else
game.forces["north"].chart(
game.surfaces["biter_battles"],
{{x = global.force_area[f].x_top - m, y = global.force_area[f].y_top - m}, {x = global.force_area[f].x_bot + m, y = global.force_area[f].y_bot + m}}
)
end
end
2019-03-14 19:06:39 +02:00
local function on_tick(event)
2019-03-17 03:35:58 +02:00
if game.tick % 30 ~= 0 then return end
chunk_pregen()
if game.tick % 60 ~= 0 then return end
2019-03-16 08:31:34 +02:00
global.bb_threat["north_biters"] = global.bb_threat["north_biters"] + global.bb_threat_income["north_biters"]
global.bb_threat["south_biters"] = global.bb_threat["south_biters"] + global.bb_threat_income["south_biters"]
2019-03-14 23:50:09 +02:00
gui()
2019-03-15 04:59:43 +02:00
if game.tick % 300 ~= 0 then return end
if global.spy_fish_timeout["south"] - game.tick > 0 then
reveal_team("north")
else
global.spy_fish_timeout["south"] = 0
end
if global.spy_fish_timeout["north"] - game.tick > 0 then
reveal_team("south")
else
global.spy_fish_timeout["north"] = 0
2019-03-16 08:31:34 +02:00
end
if game.tick % 3600 ~= 0 then return end
if global.bb_game_won_by_team then return end
2019-03-16 08:31:34 +02:00
ai.main_attack()
2019-03-17 03:35:58 +02:00
ai.send_near_biters_to_silo()
2019-03-14 19:06:39 +02:00
end
event.add(defines.events.on_tick, on_tick)