diff --git a/YAMS-LIB/Program.cs b/YAMS-LIB/Program.cs index c1239fc..1be1f49 100644 --- a/YAMS-LIB/Program.cs +++ b/YAMS-LIB/Program.cs @@ -2147,14 +2147,16 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te // Flashlight PrependGMLInCode(characterVarsCode, "global.flashlightLevel = 0;"); + ReplaceGMLInCode(gmData.Code.ByName("gml_Script_ApplyLightPreset"), "global.darkness", "lightLevel"); PrependGMLInCode(gmData.Code.ByName("gml_Script_ApplyLightPreset"), -""" - global.darkness -= global.flashlightLevel - if (global.darkness < 0) - global.darkness = 0 - if (global.darkness > 4) - global.darkness = 4 - """); + """ + var lightLevel = 0 + lightLevel = global.darkness - global.flashlightLevel + if (lightLevel < 0) + lightLevel = 0 + if (lightLevel > 4) + lightLevel = 4 + """); // Set starting items bool alreadyAddedMissiles = false;