From 43def948cedb43806ae7f47c440bf087010f0141 Mon Sep 17 00:00:00 2001 From: JeffGainsNGames Date: Mon, 2 Oct 2023 18:01:30 -0400 Subject: [PATCH] add lightLevel to remove modifying global.darkness --- YAMS-LIB/Program.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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;