Added some comments and a way to disable DarkerNight.

This commit is contained in:
Joshua Navarro 2018-12-24 13:00:33 -08:00
parent b0b7a8f5dc
commit ccdc99ab8e
2 changed files with 31 additions and 1 deletions

View File

@ -10,17 +10,38 @@ using Microsoft.Xna.Framework;
namespace Revitalize.Framework.Environment namespace Revitalize.Framework.Environment
{ {
/// <summary>
/// Deals with making night time darker in Stardew.
/// </summary>
public class DarkerNight public class DarkerNight
{ {
/// <summary>
/// Darkness intensity.
/// </summary>
public static float IncrediblyDark = 0.9f; public static float IncrediblyDark = 0.9f;
/// <summary>
/// Darkness intensity.
/// </summary>
public static float VeryDark = 0.75f; public static float VeryDark = 0.75f;
/// <summary>
/// Darkness intensity.
/// </summary>
public static float SomewhatDark = 0.50f; public static float SomewhatDark = 0.50f;
/// <summary>
/// The config file.
/// </summary>
public static DarkerNightConfig Config; public static DarkerNightConfig Config;
/// <summary>
/// The calculated night color.
/// </summary>
private static Color CalculatedColor; private static Color CalculatedColor;
/// <summary>
/// Initializes the config for DarkerNight.
/// </summary>
public static void InitializeConfig() public static void InitializeConfig()
{ {
if (File.Exists(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "Configs", "DarkerNightConfig.json"))) if (File.Exists(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "Configs", "DarkerNightConfig.json")))
@ -34,17 +55,24 @@ namespace Revitalize.Framework.Environment
} }
} }
/// <summary>
/// Sets the color of darkness at night.
/// </summary>
public static void SetDarkerColor() public static void SetDarkerColor()
{ {
if (Config.Enabled == false) return;
if (Game1.player.currentLocation.IsOutdoors && Game1.timeOfDay >= Game1.getStartingToGetDarkTime()) if (Game1.player.currentLocation.IsOutdoors && Game1.timeOfDay >= Game1.getStartingToGetDarkTime())
{ {
Game1.outdoorLight = CalculatedColor; Game1.outdoorLight = CalculatedColor;
} }
} }
/// <summary>
/// Calculates how dark it should be a night.
/// </summary>
public static void CalculateDarkerNightColor() public static void CalculateDarkerNightColor()
{ {
if (Config.Enabled == false) return;
if (Game1.player == null) return; if (Game1.player == null) return;
//Calculate original lighting. //Calculate original lighting.

View File

@ -9,9 +9,11 @@ namespace Revitalize.Framework.Environment
{ {
public class DarkerNightConfig public class DarkerNightConfig
{ {
public bool Enabled;
public float DarknessIntensity; public float DarknessIntensity;
public DarkerNightConfig() public DarkerNightConfig()
{ {
this.Enabled = true;
this.DarknessIntensity = .9f; this.DarknessIntensity = .9f;
} }