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

39 lines
943 B
Lua
Raw Normal View History

2020-02-03 10:57:10 +02:00
require "modules.biter_reanimator"
2020-02-03 09:35:20 +02:00
local Blood_moon = require "maps.pitch_black.blood_moon"
2020-02-03 10:57:10 +02:00
local Difficulty = require "maps.pitch_black.difficulty"
local function on_entity_died(event)
local entity = event.entity
if not entity.valid then return end
local cause = event.cause
Difficulty.fleeing_biteys(entity, cause)
end
2020-02-03 09:35:20 +02:00
local function on_tick()
local tick = game.tick
2020-02-03 10:57:10 +02:00
if tick % 2 ~= 0 then return end
2020-02-03 09:35:20 +02:00
local surface = game.surfaces[1]
2020-02-03 10:57:10 +02:00
2020-02-03 09:35:20 +02:00
Blood_moon.set_daytime(surface, tick)
2020-02-03 10:57:10 +02:00
if tick % 20 ~= 0 then return end
Difficulty.set_daytime_difficulty(surface, tick)
Difficulty.set_biter_difficulty()
2020-02-03 09:35:20 +02:00
end
local function on_init()
local surface = game.surfaces[1]
surface.freeze_daytime = true
2020-02-03 10:57:10 +02:00
surface.min_brightness = 0
global.daytime = 0
global.map_score = 0
2020-02-03 09:35:20 +02:00
end
local Event = require 'utils.event'
2020-02-03 10:57:10 +02:00
Event.add(defines.events.on_entity_died, on_entity_died)
2020-02-03 09:35:20 +02:00
Event.add(defines.events.on_tick, on_tick)
Event.on_init(on_init)