1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-06 00:23:49 +02:00
ComfyFactorio/maps/pitch_black/blood_moon.lua

34 lines
830 B
Lua
Raw Normal View History

2020-02-03 09:35:20 +02:00
local Public = {}
2021-03-24 17:46:00 +02:00
local get_noise = require 'utils.get_noise'
2020-02-03 09:35:20 +02:00
local math_abs = math.abs
2020-02-03 10:57:10 +02:00
local math_round = math.round
2020-02-03 09:35:20 +02:00
function Public.set_daytime(surface, tick)
2021-03-24 17:46:00 +02:00
local noise = get_noise('n1', {x = tick * 1, y = 0}, surface.map_gen_settings.seed)
local daytime = math_abs(math_round(noise, 5))
local brightness_modifier = 1.55 - daytime * 1.5
if brightness_modifier < 0 then
brightness_modifier = 0
end
if brightness_modifier > 1 then
brightness_modifier = 1
end
if noise > 0 then
surface.brightness_visual_weights = {1, brightness_modifier, 1}
else
surface.brightness_visual_weights = {brightness_modifier, 1, 1}
end
global.daytime = daytime
if daytime > 0.55 then
daytime = 0.55
end
surface.daytime = daytime
2020-02-03 09:35:20 +02:00
end
2021-03-24 17:46:00 +02:00
return Public