Skip to content

Commit 4578314

Browse files
committed
e
1 parent 9f9fafb commit 4578314

File tree

5 files changed

+107
-14
lines changed

5 files changed

+107
-14
lines changed

source/archipelago/APGameState.hx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ class APGameState
687687
var findingPlayerName = _ap.get_player_alias(hint.finding_player);
688688
var receivingPlayerName = _ap.get_player_alias(hint.receiving_player);
689689
var itemName = playerItemName(hint.receiving_player, hint.item);
690+
var songName = getSongAndModFromLocation(hint.location);
690691

691692
trace(itemName + " found in " + locationName + " by " + findingPlayerName + " for " + receivingPlayerName);
692693

@@ -704,13 +705,15 @@ class APGameState
704705
message = "Hint: " + receivingPlayerName + " will find " + itemName + " in " + findingPlayerName + "'s World at " + locationName;
705706
}
706707

707-
if (APFreeplayManager.hintTable.exists(locationName))
708+
var songName = getFullNameFromSongAndMod(songName);
709+
710+
if (APFreeplayManager.hintTable.exists(songName))
708711
{
709-
APFreeplayManager.hintTable.set(locationName, APFreeplayManager.hintTable.get(locationName) + "\n" + message);
712+
APFreeplayManager.hintTable.set(songName, APFreeplayManager.hintTable.get(songName) + "\n" + message);
710713
}
711714
else
712715
{
713-
APFreeplayManager.hintTable.set(locationName, message);
716+
APFreeplayManager.hintTable.set(songName, message);
714717
}
715718
}
716719
else
@@ -1063,6 +1066,18 @@ class APGameState
10631066
return songsAndMods;
10641067
}
10651068

1069+
public function getFullNameFromSongAndMod(snm:{song:String, ?mod:String}):String
1070+
{
1071+
if (snm.mod != null && snm.mod != "")
1072+
{
1073+
return snm.song + " (" + snm.mod + ")";
1074+
}
1075+
else
1076+
{
1077+
return snm.song;
1078+
}
1079+
}
1080+
10661081
public function findSpecialItems():Map<String, Int>
10671082
{
10681083
var specialItems:Map<String, Int> = new Map<String, Int>();

source/archipelago/APItem.hx

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,12 @@ class APItem {
278278
return null;
279279

280280
case "Ghost":
281-
return new APTrap(name, ConditionHelper.PlayState(), function() {
281+
return new APTrap(name, ConditionHelper.PlayState().funcAndReturn(function(c) {
282+
c.extraConditions = [];
283+
c.extraConditions.push(function(e) {
284+
return states.PlayState.instance?.startedSong == true;
285+
});
286+
}), function() {
282287
states.PlayState.instance?.modManager.setValue('sudden', 1);
283288
popup('Suddenly, Notes.', "TrapLink: Ghost Trap");
284289
}, true, true).funcAndReturn(function(t:APItem) {
@@ -302,8 +307,13 @@ class APItem {
302307
});
303308

304309
case "Paralyze Trap":
305-
return new APTrap(name, ConditionHelper.PlayState(), function() {
306-
310+
return new APTrap(name, ConditionHelper.PlayState().funcAndReturn(function(c) {
311+
c.extraConditions = [];
312+
c.extraConditions.push(function(e) {
313+
return states.PlayState.instance?.startedSong == true;
314+
});
315+
}), function() {
316+
307317
APPlayState.instance.boyfriend.stunned = true;
308318
new FlxTimer().start(FlxG.random.int(2, 5), function(tmr:FlxTimer)
309319
{
@@ -368,7 +378,12 @@ class APItem {
368378
});
369379

370380
case 'Ice Trap':
371-
return new APTrap(name, ConditionHelper.PlayState(), function() {
381+
return new APTrap(name, ConditionHelper.PlayState().funcAndReturn(function(c) {
382+
c.extraConditions = [];
383+
c.extraConditions.push(function(e) {
384+
return states.PlayState.instance?.startedSong == true;
385+
});
386+
}), function() {
372387
popup('Effect: Ice Notes', "TrapLink: Ice Trap", true);
373388
APPlayState.instance.doEffect('icebutmoreagressive');
374389
}, true, false).funcAndReturn(function(t:APItem) {
@@ -377,7 +392,12 @@ class APItem {
377392
});
378393

379394
case "Freeze Trap" | "Frozen Trap":
380-
return new APTrap(name, ConditionHelper.PlayState(), function() {
395+
return new APTrap(name, ConditionHelper.PlayState().funcAndReturn(function(c) {
396+
c.extraConditions = [];
397+
c.extraConditions.push(function(e) {
398+
return states.PlayState.instance?.startedSong == true;
399+
});
400+
}), function() {
381401
popup('You\'re Frozen Solid!', 'TrapLink: $name', true);
382402
FlxG.sound.play(Paths.sound('streamervschat/freeze'));
383403
frozenInput++;
@@ -409,7 +429,12 @@ class APItem {
409429

410430
//Spawns a huge amount of notes randomly
411431
case "Army Trap" | "Police Trap" | "Buyon Trap" | "OmoTrap":
412-
return new APTrap(name, ConditionHelper.PlayState(), function() {
432+
return new APTrap(name, ConditionHelper.PlayState().funcAndReturn(function(c) {
433+
c.extraConditions = [];
434+
c.extraConditions.push(function(e) {
435+
return states.PlayState.instance?.startedSong == true;
436+
});
437+
}), function() {
413438
APPlayState.instance.doEffect('insanespam');
414439
popup('WATCH OUT!', 'TrapLink: $name');
415440
}, true, true).funcAndReturn(function(t:APItem) {
@@ -673,8 +698,13 @@ class APItem {
673698
});
674699

675700
case "Poison Trap" | "Poison Mushroom":
676-
return new APTrap(name, ConditionHelper.PlayState(), function() {
677-
popup('Food Poisoning my belovid', 'TrapLink: Poison Trap');
701+
return new APTrap(name, ConditionHelper.PlayState().funcAndReturn(function(c) {
702+
c.extraConditions = [];
703+
c.extraConditions.push(function(e) {
704+
return states.PlayState.instance?.startedSong == true;
705+
});
706+
}), function() {
707+
popup('Food Poisoning my beloved', 'TrapLink: Poison Trap');
678708
APPlayState.instance.doEffect('poisonbutworse');
679709
}, true, true).funcAndReturn(function(t:APItem) {
680710
// Set it as a trap.
@@ -717,7 +747,12 @@ class APItem {
717747
});
718748

719749
case "Fast Trap":
720-
return new APTrap(name, ConditionHelper.PlayState(), function() {
750+
return new APTrap(name, ConditionHelper.PlayState().funcAndReturn(function(c) {
751+
c.extraConditions = [];
752+
c.extraConditions.push(function(e) {
753+
return states.PlayState.instance?.startedSong == true;
754+
});
755+
}), function() {
721756
popup('GOTTA GO FAST!', 'TrapLink: Fast Trap');
722757
APPlayState.instance.lerpSongSpeed(FlxG.random.float(1.25, 4), 1);
723758
}, true, true).funcAndReturn(function(t:APItem) {
@@ -726,7 +761,12 @@ class APItem {
726761
});
727762

728763
case "Slow Trap" | "Slowness Trap":
729-
return new APTrap(name, ConditionHelper.PlayState(), function() {
764+
return new APTrap(name, ConditionHelper.PlayState().funcAndReturn(function(c) {
765+
c.extraConditions = [];
766+
c.extraConditions.push(function(e) {
767+
return states.PlayState.instance?.startedSong == true;
768+
});
769+
}), function() {
730770
popup('Slow down there, buddy', 'TrapLink: Slow Trap');
731771
APPlayState.instance.lerpSongSpeed(FlxG.random.float(0.25, 0.75), 1);
732772
}, true, true).funcAndReturn(function(t:APItem) {

source/backend/Paths.hx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,30 @@ class Paths
692692
return allowNull ? {location: null, modded: false} : null;
693693
}
694694

695+
public static inline function isAssetInCurrentMod(key:String)
696+
{
697+
var assetLoc = assetLocation(key, null, IMAGES, true, true);
698+
#if MODS_ALLOWED
699+
if (assetLoc != null && assetLoc.modded) {
700+
var modDir = Mods.currentModDirectory;
701+
if (modDir == null || modDir == "") return false;
702+
// Check if the asset path contains the current mod directory as its direct folder
703+
return assetLoc.location.indexOf('mods/' + modDir + '/') == 0;
704+
}
705+
#end
706+
return false;
707+
}
708+
709+
public static inline function isAssetInMod(key:String, mod:String)
710+
{
711+
var assetLoc = assetLocation(key, null, IMAGES, true, true);
712+
if (assetLoc != null && assetLoc.modded) {
713+
// Check if the asset path contains the specified mod directory as its direct folder
714+
return assetLoc.location.indexOf('mods/' + mod + '/') == 0;
715+
}
716+
return false;
717+
}
718+
695719
public static inline function assetInTopMod(key:String, ?parentFolder:String = null, ?pathType:PathType = IMAGES):Bool
696720
{
697721
var assetLocation = assetLocation(key, parentFolder, pathType, true, true);

source/states/PlayState.hx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,7 @@ class PlayState extends MusicBeatState
21252125
callOnScripts('onSkipDialogue', [dialogueCount]);
21262126
stagesFunc(function(stage:BaseStage) stage.onSkipDialogue(dialogueCount));
21272127
}
2128+
public var startedSong:Bool = false;
21282129

21292130
function startSong():Void
21302131
{
@@ -2259,7 +2260,9 @@ class PlayState extends MusicBeatState
22592260

22602261
}
22612262
}
2263+
startedSong = true;
22622264
}
2265+
22632266

22642267
private var noteTypes:Array<String> = [];
22652268
private var eventsPushed:Array<String> = [];
@@ -2468,6 +2471,7 @@ class PlayState extends MusicBeatState
24682471
vocals = new FlxSound();
24692472
opponentVocals = new FlxSound();
24702473
gfVocals = new FlxSound();
2474+
var usable = Paths.isAssetInMod;
24712475
try
24722476
{
24732477
if (songData.needsVoices)

source/states/freeplay/FreeplayState.hx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,14 @@ class FreeplayState extends MusicBeatState
596596
try {
597597
var SongInfo = APEntryState.apGame.getSongAndMod(fpManager.songList[curSelected].songName + (fpManager.songList[curSelected].folder != "" ? " (" + fpManager.songList[curSelected].folder + ")" : ""));
598598
if (APEntryState.ap != null) {
599-
APEntryState.ap.Say("!hint " + SongInfo.song + ((SongInfo.mod != "" && SongInfo.mod != null) ? " (" + SongInfo.mod + ")" : ""));
599+
// Check if this is the victory song and if it's already unlocked
600+
if (APFreeplayManager.isVictorySong(SongInfo.song, SongInfo.mod) && APInfo.ticketCount >= APInfo.ticketWinCount && (APFreeplayManager.curUnlocked.filter(function(entry:{song:String, mod:String}) {
601+
return entry.song == SongInfo.song && entry.mod == (SongInfo.mod != null ? SongInfo.mod : "");
602+
}).length != 0)) {
603+
APEntryState.ap.Say("!hint Ticket");
604+
} else {
605+
APEntryState.ap.Say("!hint " + SongInfo.song + ((SongInfo.mod != "" && SongInfo.mod != null) ? " (" + SongInfo.mod + ")" : ""));
606+
}
600607
archipelago.console.SideUI.instance.active = true;
601608
}
602609
} catch (e:Dynamic) {
@@ -914,6 +921,8 @@ class FreeplayState extends MusicBeatState
914921
Song.loadFromJson(poop, songLowercase);
915922
PlayState.isStoryMode = false;
916923
PlayState.storyDifficulty = curDifficulty;
924+
Mods.currentModDirectory = FreeplayManager.instance.songList[curSelected].folder;
925+
917926

918927
trace('CURRENT WEEK: ' + WeekData.getWeekFileName());
919928
}
@@ -1144,6 +1153,7 @@ class FreeplayState extends MusicBeatState
11441153
});
11451154
}
11461155
}
1156+
// Mods.currentModDirectory = fpManager.songList[curSelected].folder;
11471157
}
11481158
catch(e)
11491159
{

0 commit comments

Comments
 (0)