Fix issues with story mode colors breaking

This commit is contained in:
EliteMasterEric 2024-03-05 00:22:29 -05:00
parent 1f1ccf6256
commit ae5f48c29c
3 changed files with 25 additions and 7 deletions

View file

@ -201,8 +201,15 @@ class Level implements IRegistryEntry<LevelData>
if (existingProp != null) if (existingProp != null)
{ {
existingProp.propData = propData; existingProp.propData = propData;
existingProp.x = propData.offsets[0] + FlxG.width * 0.25 * propIndex; if (existingProp.propData == null)
{
existingProp.visible = false;
}
else
{
existingProp.visible = true; existingProp.visible = true;
existingProp.x = propData.offsets[0] + FlxG.width * 0.25 * propIndex;
}
} }
else else
{ {

View file

@ -11,11 +11,11 @@ class LevelProp extends Bopper
function set_propData(value:LevelPropData):LevelPropData function set_propData(value:LevelPropData):LevelPropData
{ {
// Only reset the prop if the asset path has changed. // 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.visible = (value != null);
this.propData = value; this.propData = value;
danceEvery = this.propData.danceEvery; danceEvery = this.propData?.danceEvery ?? 0;
applyData(); applyData();
} }
@ -35,6 +35,16 @@ class LevelProp extends Bopper
function applyData():Void function applyData():Void
{ {
if (propData == null)
{
this.visible = false;
return;
}
else
{
this.visible = true;
}
var isAnimated:Bool = propData.animations.length > 0; var isAnimated:Bool = propData.animations.length > 0;
if (isAnimated) if (isAnimated)
{ {

View file

@ -141,10 +141,10 @@ class StoryMenuState extends MusicBeatState
persistentUpdate = persistentDraw = true; persistentUpdate = persistentDraw = true;
updateData();
rememberSelection(); rememberSelection();
updateData();
// Explicitly define the background color. // Explicitly define the background color.
this.bgColor = FlxColor.BLACK; this.bgColor = FlxColor.BLACK;
@ -403,7 +403,8 @@ class StoryMenuState extends MusicBeatState
function hasModdedLevels():Bool function hasModdedLevels():Bool
{ {
return LevelRegistry.instance.listModdedLevelIds().length > 0; return false;
// return LevelRegistry.instance.listModdedLevelIds().length > 0;
} }
/** /**