1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-04 00:15:45 +02:00
ComfyFactorio/maps/pitch_black/main.lua
Gerkiz e91b6a352f 2.0 changes
Change global -> storage
Rework how rendering works
Game prototypes are now stored inside 'prototypes.#'
Renamed entity names
2024-10-22 21:47:11 +02:00

50 lines
1.1 KiB
Lua

require 'modules.biter_reanimator'
local Blood_moon = require 'maps.pitch_black.blood_moon'
local Gui = require 'maps.pitch_black.gui'
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)
Difficulty.add_score(entity)
end
local function on_tick()
local tick = game.tick
if tick % 2 ~= 0 then
return
end
local surface = game.surfaces[1]
Blood_moon.set_daytime(surface, tick)
if tick % 30 ~= 0 then
return
end
Difficulty.set_daytime_difficulty(surface, tick)
Difficulty.set_biter_difficulty()
Gui.update()
end
local function on_init()
local surface = game.surfaces[1]
surface.freeze_daytime = true
surface.min_brightness = 0
storage.daytime = 0
storage.map_score = 0
end
local Event = require 'utils.event'
Event.add(defines.events.on_entity_died, on_entity_died)
Event.add(defines.events.on_tick, on_tick)
Event.on_init(on_init)