Cave darkness smoothly fades away as you reach hell
This commit is contained in:
1 parent
fbb23e2ed6
commit
efca114610
1 file changed
+9
-1
@@ -418,7 +418,15 @@ namespace CalamityMod.CalPlayer
|
||||
double playerUndergroundDepth = point.Y - Main.worldSurface;
|
||||
double depthRatio = playerUndergroundDepth / totalUndergroundDepth;
|
||||
int lightStrength = modPlayer.GetTotalLightStrength();
|
||||
float darknessStrength = (float)depthRatio;
|
||||
|
||||
// In the last 50 blocks before hell, the darkness smoothly fades away.
|
||||
float FadeAwayStart = (float)(1D - 50D / totalUndergroundDepth);
|
||||
float darknessStrength = (float)(depthRatio / FadeAwayStart);
|
||||
if (depthRatio > FadeAwayStart)
|
||||
{
|
||||
// Varies from 1.0 to 0.0 as depthRatio varies from FadeAwayStart to 1.0.
|
||||
darknessStrength = (1f - (float)depthRatio) / (1f - FadeAwayStart);
|
||||
}
|
||||
|
||||
// Reduce the power of cave darkness based on your light level. 5+ is enough to totally eliminate it.
|
||||
switch (lightStrength)
|
||||
|
||||
Reference in new issue
Block a user