Hi, I'm trying to create a new sort of lightning strikes (solar flares) and I searched everywhere how to make the lightning strike when the sun is up, which I can't find neither in LightningPrototype, nor LightningProperties. Lightning will always strike at night.
My suggestion would be to have a start_time and end_time in LightningProperties, that go from 0 to 1 (like day_night_cycle_color_lookup)
Add PlanetPrototype.LightningProperties.start_time and end_time
Add PlanetPrototype.LightningProperties.start_time and end_time
Planet Moshine, GUI Unifier + 17 mods, contributed graphically and otherwise to 70+ mods
Re: Add PlanetPrototype.LightningProperties.start_time and end_time
+1
This would be a good addition as well, have the lightning active time be customisable over the span of the day
This would be a good addition as well, have the lightning active time be customisable over the span of the day
Re: Add PlanetPrototype.LightningProperties.start_time and end_time
Currently amount of lightnings generated is based on the surface's darkness - its not quite the same as LuaSurface::darkness because the darkness used for lightnings is not capped by a value set by LuaSurface::min_brightness. Primary issue is that right now the darkness is 0 at day and 1 at night with a gradual change on the dusk-evening transition and on the dawn-morning transition. Having straight set of start_time and end_time is not enough to preserve transitions as they are right now and if i cannot make a change to be backwards compatible with existing mods i am not going to add it.
Re: Add PlanetPrototype.LightningProperties.start_time and end_time
Then add the same four-point system you use for the daytime: dusk/dawn/evening/morning. Which, by the way, should be bundled in a table. Changing only one rarely makes sense, but trying to change them one by one olny ever causes problems.
Re: Add PlanetPrototype.LightningProperties.start_time and end_time
Ah yes I understand, thanks for looking at this.boskid wrote: Sat May 10, 2025 9:00 am Currently amount of lightnings generated is based on the surface's darkness - its not quite the same as LuaSurface::darkness because the darkness used for lightnings is not capped by a value set by LuaSurface::min_brightness. Primary issue is that right now the darkness is 0 at day and 1 at night with a gradual change on the dusk-evening transition and on the dawn-morning transition. Having straight set of start_time and end_time is not enough to preserve transitions as they are right now and if i cannot make a change to be backwards compatible with existing mods i am not going to add it.
I didn't know that was progressive and tied to the darkness property (which could be de-hardcoded as well I think), so I have another proposition:
- Have the same kind of table as for color lookup:
Code: Select all
planet.lightning_properties.timed_intensity = {
{0.0, 0},
{0.35, 0.5},
{0.40, 0.7},
{0.85, 0},
},
Planet Moshine, GUI Unifier + 17 mods, contributed graphically and otherwise to 70+ mods
Re: Add PlanetPrototype.LightningProperties.start_time and end_time
I see. That is a reasonable modding interface request, independent of this topic. Ability to change all 4 daytime points is implemented for 2.0.48 as LuaSurface::daytime_parameters read/write.curiosity wrote: Sat May 10, 2025 11:59 am Which, by the way, should be bundled in a table. Changing only one rarely makes sense, but trying to change them one by one olny ever causes problems.
preview
Re: Add PlanetPrototype.LightningProperties.start_time and end_time
From possible options, i think the most easy for me to implement would be to add SurfacePropertyID into LightningProperties - if it would be set, then amount of lightnings would be controlled by that surface property. This value could then be set by PlanetPrototype::surface_properties or set/changed at runtime using LuaSurface::set_property. That would however require mods to adjust surface properties each tick if a more interesting daytime profile is needed. Would that be acceptable?
Re: Add PlanetPrototype.LightningProperties.start_time and end_time
Would it be possible to decouple the lightning from the daytime completely as an option?
I dream of it like this, have the following parameters
Planet surface setting:
- Lightning_coupled_to_nighttime: true/false
Default true, decides whether base model like it is right now is used OR:
- Lightning_Intensity: 0-1 (?) mandatory parameter if above is false, sets lightning intensity as is. Make this accessible at runtime.
(Maybe i understand it wrong but on second read you are basically suggesting a lightning_intensity option at runtime right?)
This would also allow lightning storms / freak lightning events etc without changing the surface daytime.
Also probably out of scope and discussed here viewtopic.php?p=671447#p671447 but related to the mechanic:
My only other wish would be to be able to set the endangered_by_lightning warning icon to a different one if the lightning_properties define another icon rather than the default one. Also being able to turn it off at runtime for a machine, so if the lightning mechanic is a event the warning icon isnt always blinking.
Im not deep in the lua code so i hope this isnt too outlandish, thank you for checking my suggestion out, have a great day!
I dream of it like this, have the following parameters
Planet surface setting:
- Lightning_coupled_to_nighttime: true/false
Default true, decides whether base model like it is right now is used OR:
- Lightning_Intensity: 0-1 (?) mandatory parameter if above is false, sets lightning intensity as is. Make this accessible at runtime.
(Maybe i understand it wrong but on second read you are basically suggesting a lightning_intensity option at runtime right?)
This would also allow lightning storms / freak lightning events etc without changing the surface daytime.
Also probably out of scope and discussed here viewtopic.php?p=671447#p671447 but related to the mechanic:
My only other wish would be to be able to set the endangered_by_lightning warning icon to a different one if the lightning_properties define another icon rather than the default one. Also being able to turn it off at runtime for a machine, so if the lightning mechanic is a event the warning icon isnt always blinking.
Im not deep in the lua code so i hope this isnt too outlandish, thank you for checking my suggestion out, have a great day!