So there's a bigass problem with V21: No callbacks when night turns to day/day to night.
I mean, I've read posts that people are so happy that Badspot "finally is helping the modders!" because he added Game Modes.
Yeah, Game Modes are nice. No, they aren't motherloving daycycles. We were promised shadows, shaders, and daycycles. Where is my modding support for those?
Now, I've done a bunch of research on this subject alone with tree() and dump() and frankly, I've got a bit of info but I can't piece it together.
Alright, for starters, here's an example taken out of the default daycycle file.
FRACTION 0.0576022
DIRECTCOLOR 0.601383 0.621495 0.455957 1.000000
AMBIENTCOLOR 0.334940 0.434579 0.282273 1.000000
SKYCOLOR 0.361953 0.562198 0.691589 1.000000
FOGCOLOR 0.631374 0.733645 0.589658 1.000000
SHADOWCOLOR 0.152153 0.289428 0.485981 1.000000
SUNFLARECOLOR 0.641643 0.663551 0.328675 1.000000
What can we glean from this? I'll summarize.
First line is fraction, this tells the system what part of the whole cycle this should be at. For example, the above suggests that at 5% of the way through the cycle, it will show the above settings applied to the sun, sky, fog, and shadows.
How does this work on our end? After all, that isn't a nice prefs.cs or anything that actually defines variables, right? Wrong.
DayCycle.dump(); suggests that the system applies the above information as "member fields" to the DayCycle simObject in the form of an array.
Here's the above excerpt, taken from the game.
targetAmbientColor[1] = "85 111 72 255"
targetDirectColor[1] = "153 158 116 255"
targetFogColor[1] = "161 187 150 255"
targetFraction[1] = "0.0576022"
targetShadowColor[1] = "39 74 124 255"
targetSkyColor[1] = "92 143 176 255"
targetSunFlareColor[1] = "164 169 84 255"
targetUseDefaultVector[1] = "0"
What does this tell us? Well, obviously these values are accessable from ingame. Obviously we can loop through them, because they are an array.
But do they help us in any way? forget no!
See, I've dreamt up a few ways to try to approach the onDay and onNight events/callback system.
Among my ideas were the following.
onDay and onNight callbacks, as I was under the mistaken impression we were promised? // BUSTED, there are none!
Perhaps set schedules, based on the dayLength in seconds setting? // BUSTED! Thanks to that amazingly beautiful system so that updates a propagated immediately, you can't get a good fix on this. Your schedules will be offset.
Perhaps loop through the default.daycycle settings to compare the settings to the current values of the sun, when they equal, it's that time of day? // BUSTED! You can't actually get the dynamic settings of the sun. You can only get the static settings, which are defined by those loving slider bars in the envGui.
So, what do we do? We can't latch onto DayCycle.dayLength with schedules, as there is nothing to check against.
There are no default callbacks.
You can't get the current values of the current position of the sun and such during a daycycle, it only returns the static settings.
What the hell do we do, coding help?