From 494f1ac3cac6da942b80b879ce4dcaaec527e474 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Tue, 10 Jan 2023 13:54:54 +0100 Subject: [PATCH] fixed the scripts --- buildnumber.txt | 2 +- source/funkin/game/PlayState.hx | 4 ++-- source/funkin/menus/FreeplayState.hx | 4 ++-- source/funkin/system/CoolUtil.hx | 1 + source/funkin/system/Song.hx | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/buildnumber.txt b/buildnumber.txt index b8a521cd..d8f80992 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1991 \ No newline at end of file +1994 \ No newline at end of file diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index e55ecae6..2d75b98c 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -549,8 +549,8 @@ class PlayState extends MusicBeatState // ADD YOUR HARDCODED SCRIPTS HERE! default: for(content in [ - Paths.getFolderContent('songs/${SONG.song.toLowerCase()}/scripts', true, !fromMods), - Paths.getFolderContent('data/charts/', true, !fromMods)]) { + Paths.getFolderContent('songs/${SONG.song.toLowerCase()}/scripts', true, fromMods ? MODS : SOURCE), + Paths.getFolderContent('data/charts/', true, fromMods ? MODS : SOURCE)]) { for(file in content) { var ext = Path.extension(file).toLowerCase(); if (Script.scriptExtensions.contains(ext)) diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index 992632e8..633bc8c4 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -260,7 +260,7 @@ class FreeplaySonglist { try { var json:FreeplayJSON = Json.parse(Paths.assetsTree.getSpecificAsset(path, "TEXT", source)); addOGSongs = CoolUtil.getDefault(json.addOGSongs, true); - _addJSONSongs(json.songs, false); + _addJSONSongs(json.songs, source == SOURCE); } catch(e) { Logs.trace('Couldn\'t parse Freeplay JSON: ${e.toString()}'); } @@ -286,7 +286,7 @@ class FreeplaySonglist { }); } } - _addJSONSongs(found, false); + _addJSONSongs(found, source == SOURCE); } return addOGSongs; } diff --git a/source/funkin/system/CoolUtil.hx b/source/funkin/system/CoolUtil.hx index 11a95a63..5699dd5e 100644 --- a/source/funkin/system/CoolUtil.hx +++ b/source/funkin/system/CoolUtil.hx @@ -274,6 +274,7 @@ class CoolUtil } public static function __loadSong(name:String, difficulty:String) { PlayState.difficulty = difficulty; + PlayState.SONG = Song.loadFromJson(name, difficulty); } public static function setSpriteSize(sprite:FlxSprite, width:Float, height:Float) { diff --git a/source/funkin/system/Song.hx b/source/funkin/system/Song.hx index 4dbb5d01..82d1d65b 100644 --- a/source/funkin/system/Song.hx +++ b/source/funkin/system/Song.hx @@ -31,7 +31,7 @@ class Song public static function loadFromJson(songName:String, ?difficulty:String = "normal"):SwagSong { var assetPath = Paths.chart(songName, difficulty); - PlayState.fromMods = assetPath.startsWith("mods"); + PlayState.fromMods = Paths.assetsTree.existsSpecific(assetPath, "TEXT", MODS); var rawJson = Assets.getText(assetPath).trim(); while (!rawJson.endsWith("}"))