Skip to content

Commit f862926

Browse files
committed
Goodness.
1 parent 62deec9 commit f862926

File tree

4 files changed

+36
-14
lines changed

4 files changed

+36
-14
lines changed

source/archipelago/APPlayState.hx

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,17 +1423,28 @@ class APPlayState extends PlayState {
14231423
var available:Array<Int> = [];
14241424

14251425
public function doEffect(effect:String)
1426-
{
1427-
trace('im finna act up');
1428-
if (paused || endingSong) return;
1429-
1430-
if (effectMap.exists(effect)) {
1431-
effectMap.get(effect)();
1426+
{
1427+
// trace('im finna act up');
1428+
if (!APEntryState.inArchipelagoMode)
1429+
if (paused || endingSong) return;
1430+
1431+
if (APEntryState.inArchipelagoMode && (paused || endingSong)) {
1432+
new FlxTimer().start(0.1, function(tmr:FlxTimer) {
1433+
if (!paused && !endingSong) {
1434+
doEffect(effect);
1435+
}
1436+
FlxDestroyUtil.destroy(tmr);
1437+
});
1438+
return;
1439+
}
1440+
1441+
if (effectMap.exists(effect)) {
1442+
effectMap.get(effect)();
14321443
trace('running effect: $effect');
1433-
} else {
1434-
trace("Effect not found: " + effect);
1435-
}
1436-
}
1444+
} else {
1445+
trace("Effect not found: " + effect);
1446+
}
1447+
}
14371448

14381449
inline public function applyEffect(ttl:Float, onEnd:(Void->Void), playSound:String, playSoundVol:Float, noIcon:Bool, alwaysEnd:Bool = false, ?effect:String = "")
14391450
{

source/psychlua/FunkinLua.hx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#if LUA_ALLOWED
22
package psychlua;
3+
import archipelago.APEntryState;
34

45
import backend.WeekData;
56
import backend.Highscore;
@@ -460,6 +461,12 @@ class FunkinLua {
460461
});
461462

462463
Lua_helper.add_callback(lua, "loadSong", function(?name:String = null, ?difficultyNum:Int = -1) {
464+
if(APEntryState.inArchipelagoMode)
465+
{
466+
luaTrace('loadSong: A Script is loading a new song. Checking!', false, false, FlxColor.RED);
467+
states.FreeplayState.forceUnlockCheck(Song.loadedSongName, archipelago.APPlayState.currentMod);
468+
}
469+
463470
if(name == null || name.length < 1)
464471
name = Song.loadedSongName;
465472
if (difficultyNum == -1)

source/psychlua/LegacyFunkinLua.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,11 @@ class LegacyFunkinLua {
938938
});
939939

940940
Lua_helper.add_callback(lua, "loadSong", function(?name:String = null, ?difficultyNum:Int = -1) {
941+
if(archipelago.APEntryState.inArchipelagoMode)
942+
{
943+
luaTrace('loadSong: A Script is loading a new song. Checking!', false, false, FlxColor.RED);
944+
states.FreeplayState.forceUnlockCheck(Song.loadedSongName, archipelago.APPlayState.currentMod);
945+
}
941946
if(name == null || name.length < 1)
942947
name = PlayState.SONG.song;
943948
if (difficultyNum == -1)

source/states/FreeplayState.hx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ class FreeplayState extends MusicBeatState
725725
var holdTime:Float = 0;
726726
var stopMusicPlay:Bool = false;
727727

728-
function forceUnlockCheck(songName:String, modName:String):Void {
728+
public static function forceUnlockCheck(songName:String, modName:String):Void {
729729
var locationId = songName;
730730
trace(modName);
731731
if (modName.trim() != "") {
@@ -804,9 +804,8 @@ class FreeplayState extends MusicBeatState
804804
APEntryState.apGame.info().set_goal();
805805
}
806806
}
807-
808-
reloadSongs(true);
809-
807+
if (instance != null)
808+
instance.reloadSongs(true);
810809
}
811810

812811

0 commit comments

Comments
 (0)