[Request] Make Darkness Writable, Move from Game to Surfaces
[Request] Make Darkness Writable, Move from Game to Surfaces
What it says on the tin. Darkness should be writable, and darkness should be a per-surface property (so underground surfaces are always partial darkness, for example).
-
- Filter Inserter
- Posts: 841
- Joined: Mon Sep 14, 2015 7:40 am
- Contact:
Re: [Request] Make Darkness Writable, Move from Game to Surfaces
Definitely, this would also be needed if a user-made mod wanted to implement the Space Platform idea, naturally for solar power there it'd always be full brightness.
Re: [Request] Make Darkness Writable, Move from Game to Surfaces
daytime, wind_speed, wind_orientation, wind_orientation_change, and peaceful_mode have all been moved to LuaSurface for 0.13.
Darkness is a calculated field based off the daytime and as such isn't writable directly. Simply changing daytime effects darkness.
Darkness is a calculated field based off the daytime and as such isn't writable directly. Simply changing daytime effects darkness.
If you want to get ahold of me I'm almost always on Discord.
Re: [Request] Make Darkness Writable, Move from Game to Surfaces
Fantastic news! You guys rock.Rseding91 wrote:daytime, wind_speed, wind_orientation, wind_orientation_change, and peaceful_mode have all been moved to LuaSurface for 0.13.
Darkness is a calculated field based off the daytime and as such isn't writable directly.
Simply is an understatement. It took me 160 lines of code. https://github.com/Afforess/Gloom/blob/ ... ght.lua#L4Rseding91 wrote:Simply changing daytime effects darkness.
Also, there is no way to go below 0.14 brightness.
Re: [Request] Make Darkness Writable, Move from Game to Surfaces
1) You made a mistake here :
should be 0.6725
and I would have written that this way :
It's much shorter
Code: Select all
elseif light_level <= 0.62 then
return 0.6225
and I would have written that this way :
Code: Select all
if light_level <= 0.14 then
return 0.5
elseif light_level > 0.99
return 0.8
else return =0.2*light_level+0.55
end
Koub - Please consider English is not my native language.
Re: [Request] Make Darkness Writable, Move from Game to Surfaces
Is that the official formula? I dug around but the wiki didn't have it documented.Koub wrote: and I would have written that this way :It's much shorterCode: Select all
if light_level <= 0.14 then return 0.5 elseif light_level > 0.99 return 0.8 else return =0.2*light_level+0.55 end
Edit: Rseding91 shared it in IRC: http://pastebin.com/raw/cRaYBrUn
Re: [Request] Make Darkness Writable, Move from Game to Surfaces
No I just took your code, noticed that apart from the first and last value, you were just calculating a linear function for every increment of 0.01, so I put that in a formula that basically computes instead of chaining if then elseifs ^^.
Koub - Please consider English is not my native language.
Re: [Request] Make Darkness Writable, Move from Game to Surfaces
Nice... I got my numbers from sampling. Was not fun. Turns out your formula actually does match the derived formula from the game too. So congrats.Koub wrote:No I just took your code, noticed that apart from the first and last value, you were just calculating a linear function for every increment of 0.01, so I put that in a formula that basically computes instead of chaining if then elseifs ^^.
-
- Filter Inserter
- Posts: 952
- Joined: Sat May 23, 2015 12:10 pm
- Contact:
Re: [Request] Make Darkness Writable, Move from Game to Surfaces
putting the values in a spreadsheet and making a graph out of it will help seeing those things.Afforess wrote:Nice... I got my numbers from sampling. Was not fun. Turns out your formula actually does match the derived formula from the game too. So congrats.Koub wrote:No I just took your code, noticed that apart from the first and last value, you were just calculating a linear function for every increment of 0.01, so I put that in a formula that basically computes instead of chaining if then elseifs ^^.