Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MapLights] Add setting to toggle warning #49

Merged
merged 1 commit into from
Jan 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/KK_Fix_UnlimitedMapLights/UnlimitedMapLights.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Reflection.Emit;
using BepInEx.Logging;
using BepInEx.Configuration;

namespace IllusionFixes
{
Expand All @@ -16,16 +17,21 @@ public class UnlimitedMapLights : BaseUnityPlugin

private static new ManualLogSource Logger;

private static ConfigEntry<bool> showWarning;

private void Awake()
{
Logger = base.Logger;

showWarning = Config.Bind("Logging", "Show Maplight Warning", true, "Toggle the Warning that gets displayed if more than two maplights are added to the scene");

Harmony.CreateAndPatchAll(typeof(UnlimitedMapLights));
}

[HarmonyPostfix, HarmonyPatch(typeof(Studio.SceneInfo), nameof(Studio.SceneInfo.AddLight))]
private static void UnlimitedLights(Studio.SceneInfo __instance)
{
if(__instance.lightCount > 2)
if(__instance.lightCount > 2 && showWarning.Value)
Logger.LogMessage("Warning: Lights above 2 might not affect characters and some items!");
}

Expand Down