Skip to content

Commit

Permalink
Fix negative flashlights
Browse files Browse the repository at this point in the history
  • Loading branch information
Miepee committed Oct 2, 2023
1 parent 23d6c17 commit 72e713b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions YAMS-LIB/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2147,11 +2147,14 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te

// Flashlight
PrependGMLInCode(characterVarsCode, "global.flashlightLevel = 0;");
PrependGMLInCode(gmData.Code.ByName("gml_Script_ApplyLightPreset"), """
global.darkness -= global.flashlightLevel
if (global.darkness < 0)
global.darkness = 0
""");
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
""");

// Set starting items
bool alreadyAddedMissiles = false;
Expand Down

0 comments on commit 72e713b

Please sign in to comment.