From ae5f48c29cf86fa1c9691eb1c6d854a5c1712d6b Mon Sep 17 00:00:00 2001
From: EliteMasterEric <ericmyllyoja@gmail.com>
Date: Tue, 5 Mar 2024 00:22:29 -0500
Subject: [PATCH] Fix issues with story mode colors breaking

---
 source/funkin/ui/story/Level.hx          | 11 +++++++++--
 source/funkin/ui/story/LevelProp.hx      | 14 ++++++++++++--
 source/funkin/ui/story/StoryMenuState.hx |  7 ++++---
 3 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/source/funkin/ui/story/Level.hx b/source/funkin/ui/story/Level.hx
index c93ad41a6..b548b7b1e 100644
--- a/source/funkin/ui/story/Level.hx
+++ b/source/funkin/ui/story/Level.hx
@@ -201,8 +201,15 @@ class Level implements IRegistryEntry<LevelData>
       if (existingProp != null)
       {
         existingProp.propData = propData;
-        existingProp.x = propData.offsets[0] + FlxG.width * 0.25 * propIndex;
-        existingProp.visible = true;
+        if (existingProp.propData == null)
+        {
+          existingProp.visible = false;
+        }
+        else
+        {
+          existingProp.visible = true;
+          existingProp.x = propData.offsets[0] + FlxG.width * 0.25 * propIndex;
+        }
       }
       else
       {
diff --git a/source/funkin/ui/story/LevelProp.hx b/source/funkin/ui/story/LevelProp.hx
index 5af383de9..b126f0243 100644
--- a/source/funkin/ui/story/LevelProp.hx
+++ b/source/funkin/ui/story/LevelProp.hx
@@ -11,11 +11,11 @@ class LevelProp extends Bopper
   function set_propData(value:LevelPropData):LevelPropData
   {
     // Only reset the prop if the asset path has changed.
-    if (propData == null || value.assetPath != this.propData.assetPath)
+    if (propData == null || value?.assetPath != propData?.assetPath)
     {
       this.visible = (value != null);
       this.propData = value;
-      danceEvery = this.propData.danceEvery;
+      danceEvery = this.propData?.danceEvery ?? 0;
       applyData();
     }
 
@@ -35,6 +35,16 @@ class LevelProp extends Bopper
 
   function applyData():Void
   {
+    if (propData == null)
+    {
+      this.visible = false;
+      return;
+    }
+    else
+    {
+      this.visible = true;
+    }
+
     var isAnimated:Bool = propData.animations.length > 0;
     if (isAnimated)
     {
diff --git a/source/funkin/ui/story/StoryMenuState.hx b/source/funkin/ui/story/StoryMenuState.hx
index ba1d2ed21..8b477feee 100644
--- a/source/funkin/ui/story/StoryMenuState.hx
+++ b/source/funkin/ui/story/StoryMenuState.hx
@@ -141,10 +141,10 @@ class StoryMenuState extends MusicBeatState
 
     persistentUpdate = persistentDraw = true;
 
-    updateData();
-
     rememberSelection();
 
+    updateData();
+
     // Explicitly define the background color.
     this.bgColor = FlxColor.BLACK;
 
@@ -403,7 +403,8 @@ class StoryMenuState extends MusicBeatState
 
   function hasModdedLevels():Bool
   {
-    return LevelRegistry.instance.listModdedLevelIds().length > 0;
+    return false;
+    // return LevelRegistry.instance.listModdedLevelIds().length > 0;
   }
 
   /**