1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-26 03:52:22 +02:00

43 lines
1.0 KiB
Lua
Raw Normal View History

2020-02-03 09:57:10 +01:00
require "modules.biter_reanimator"
2020-02-03 08:35:20 +01:00
local Blood_moon = require "maps.pitch_black.blood_moon"
2020-02-03 10:33:27 +01:00
local Gui = require "maps.pitch_black.gui"
2020-02-03 09:57:10 +01: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)
2020-02-03 10:33:27 +01:00
Difficulty.add_score(entity)
2020-02-03 09:57:10 +01:00
end
2020-02-03 08:35:20 +01:00
local function on_tick()
local tick = game.tick
2020-02-03 09:57:10 +01:00
if tick % 2 ~= 0 then return end
2020-02-03 08:35:20 +01:00
local surface = game.surfaces[1]
2020-02-03 09:57:10 +01:00
2020-02-03 08:35:20 +01:00
Blood_moon.set_daytime(surface, tick)
2020-02-03 09:57:10 +01:00
2020-02-03 10:33:27 +01:00
if tick % 30 ~= 0 then return end
2020-02-03 09:57:10 +01:00
Difficulty.set_daytime_difficulty(surface, tick)
Difficulty.set_biter_difficulty()
2020-02-03 10:33:27 +01:00
Gui.update()
2020-02-03 08:35:20 +01:00
end
local function on_init()
local surface = game.surfaces[1]
surface.freeze_daytime = true
2020-02-03 09:57:10 +01:00
surface.min_brightness = 0
global.daytime = 0
global.map_score = 0
2020-02-03 08:35:20 +01:00
end
local Event = require 'utils.event'
2020-02-03 09:57:10 +01:00
Event.add(defines.events.on_entity_died, on_entity_died)
2020-02-03 08:35:20 +01:00
Event.add(defines.events.on_tick, on_tick)
Event.on_init(on_init)