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-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-16 03:36:06 +02:00
|
|
|
if game.tick % 60 ~= 0 then return end
|
|
|
|
global.bb_threat["north"] = global.bb_threat["north"] + global.bb_threat_income["north"]
|
|
|
|
global.bb_threat["south"] = global.bb_threat["south"] + global.bb_threat_income["south"]
|
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
|
|
|
|
end
|
2019-03-14 19:06:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
event.add(defines.events.on_tick, on_tick)
|