Skip to content

Commit ca52e38

Browse files
committed
Merge branch 'Archipelago' of https://github.com/Z11Coding/Mixtape-Engine-Rework into Archipelago
2 parents afea239 + 58f1c0c commit ca52e38

File tree

9 files changed

+1108
-937
lines changed

9 files changed

+1108
-937
lines changed

source/Main.hx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ class Main extends Sprite
186186
//Stolen from Psych Online. Thanks for making the next hour of my life not hell.
187187
Lib.current.addChild(new archipelago.console.SideUI());
188188
//Lib.current.addChild(new objects.Nightlight());
189+
190+
// trace("Words loaded: " + backend.MusicBeatState.words);
189191
}
190192

191193
@:dox(hide)
@@ -1174,14 +1176,7 @@ class CommandPrompt
11741176
yutautil.AprilFools.debug = true;
11751177
print("April Fools debug mode enabled.");
11761178
case "flip":
1177-
{
1178-
var flip = !backend.MusicBeatState.APFlip;
1179-
var targetAngle = flip ? 180 : 0;
1180-
FlxTween.tween(FlxG.camera, {angle: targetAngle}, 0.5, {
1181-
ease: FlxEase.quadOut
1182-
});
1183-
backend.MusicBeatState.APFlip = flip;
1184-
}
1179+
backend.MusicBeatState.APFlip = !backend.MusicBeatState.APFlip;
11851180
default:
11861181
print("Error: Unknown debug argument.");
11871182
}

source/archipelago/APCategoryState.hx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ class APCategoryState extends states.CategoryState {
1010

1111
public function new(gameState:archipelago.APGameState, ?AP:archipelago.Client) {
1212
this.gameState = gameState;
13-
while (true) {
13+
var attempts = 0;
14+
while (attempts < 20) {
1415
try {
1516
this.AP = gameState.info();
1617
break;
1718
} catch (e) {
18-
// Optionally, add a small delay to avoid busy looping
19+
attempts++;
1920
Sys.sleep(0.1);
2021
}
2122
}
@@ -47,14 +48,18 @@ class APCategoryState extends states.CategoryState {
4748
}
4849

4950
// this.specialOptions.pushMulti([opFunc, quitFunc]);
50-
51-
states.ExitState.addExitCallback(function() {
51+
var cleanupFunc = function() {
5252
if (AP != null){
53-
APGameState.instance?.updateSaveData();
54-
trace("Properly disconnecting from server before exiting...");
55-
AP.disconnect_socket();}
53+
APGameState.instance?.updateSaveData();
54+
trace("Properly disconnecting from server before exiting...");
55+
AP.disconnect_socket();
56+
}
5657
AP = null;
57-
});
58+
};
59+
60+
if (!states.ExitState.cleanupFunctions.contains(cleanupFunc)) {
61+
states.ExitState.addExitCallback(cleanupFunc);
62+
}
5863
}
5964

6065
override function create()

0 commit comments

Comments
 (0)