33-- @module NightTime
44--
55
6-
76-- dependencies
87local Event = require ' utils.event'
98local RS = require ' map_gen.shared.redmew_surface'
@@ -19,30 +18,17 @@ local NightTime = {}
1918local function on_built_entity (event )
2019 local player = game .get_player (event .player_index )
2120 local entity = event .entity
22- if (entity .name == ' solar-panel' ) then
23- Popup .player (
24- player , {' diggy.night_time_warning' }
25- )
21+ if entity .name == ' solar-panel' then
22+ Popup .player (player , { ' diggy.night_time_warning' })
2623 end
2724end
2825
29- --- Event handler for on_research_finished
30- -- sets the force, which the research belongs to, recipe for solar-panel-equipment
31- -- to false, to prevent wastefully crafting. The technology is needed for further progression
32- -- @param event table containing the on_research_finished event specific attributes
33- --
34- local function on_research_finished (event )
35- local force = event .research .force
36- force .recipes [" solar-panel-equipment" ].enabled = false
37- end
38-
3926--- Setup of on_built_entity and on_research_finished events
4027-- assigns the two events to the corresponding local event handlers
4128-- @param config table containing the configurations for NightTime.lua
4229--
4330function NightTime .register ()
4431 Event .add (defines .events .on_built_entity , on_built_entity )
45- Event .add (defines .events .on_research_finished , on_research_finished )
4632end
4733
4834--- Sets the daytime to 0.5 and freezes the day/night circle.
5137function NightTime .on_init ()
5238 local surface = RS .get_surface ()
5339
54- surface .daytime = 0.5
40+ surface .daytime = 0.42 -- 0. 5
5541 surface .freeze_daytime = true
42+ surface .solar_power_multiplier = 0
43+ surface .min_brightness = 0.11
44+ surface .show_clouds = false
45+ surface .brightness_visual_weights = { 1 / 0.85 , 1 / 0.85 , 1 / 0.85 }
5646end
5747
5848return NightTime
0 commit comments