Compare commits

..

No commits in common. "96de8284ac4ed3c55b7c7d8389ec504900358d98" and "e56b014c9604cfd53ad5c89f98123d9d2a0ee8f6" have entirely different histories.

3 changed files with 3 additions and 44 deletions

View file

@ -1,10 +1,5 @@
# Changelog
## [1.0.1] - 2022-07-27
### Fixed
- Don't try to restart the music while on the bus.
- Handle the specific secret woods case; play it's specific song instead of the generic seasonal.
## [1.0.0] - 2022-07-26
### Added
- Restart in-game "morning" song when it is not playing and player is outside.

View file

@ -30,19 +30,13 @@ namespace SoundLoopMod
public override void Entry(IModHelper helper)
{
helper.Events.GameLoop.OneSecondUpdateTicking += this.CheckMusicNeedsRestarting;
helper.Events.Player.Warped += this.ResetMusicSecretWoods;
}
private const string WoodsName = "Woods";
private void CheckMusicNeedsRestarting(object? sender, OneSecondUpdateTickingEventArgs e)
{
// Don't do anything if we're at the title screen
if (!Context.IsWorldReady)
return;
// Music won't play again in the mines if this timestamp is lower than 150000. Set to some arbitrary large value.
// The skull cavern is considered an extension of the mines, so this should affect that as well.
MineShaft.timeSinceLastMusic = 999999;
// Avoid playing morning song in the mines etc.
@ -53,41 +47,11 @@ namespace SoundLoopMod
if (Game1.isDarkOut())
return;
// Don't start music while on the bus
// shouldHideCharacters seems to only be used for the bus, seems to be the nicest way to get this info
if (Game1.currentLocation.shouldHideCharacters())
return;
// Be extra-safe about not doing anything during an event (to protect the special cases below)
if (Game1.eventUp)
return;
// Seems to be safe to touch the current song, check if it has finished
if (Game1.currentSong == null || Game1.currentSong.IsStopped || Game1.requestedMusicTrack.ToLower().Contains("ambient"))
{
if (Game1.currentLocation.Name == WoodsName)
{
// The music for the secret woods is a bit of a special case.
Game1.changeMusicTrack("woodsTheme");
}
else
{
// General case, let the game figure out what song to play.
Game1.playMorningSong();
}
this.Monitor.Log("Restarted music");
}
}
private void ResetMusicSecretWoods(object? sender, WarpedEventArgs e)
{
// The game won't touch the music when entering the woods after 1800, causing the previously playing
// music to keep playing. Hence we stop it and let CheckMusicNeedsRestarting play the woods theme.
// However, after dark, let it keep playing the ambient night sound.
if (e.IsLocalPlayer && e.NewLocation.Name == WoodsName && !Game1.isDarkOut())
{
Game1.changeMusicTrack("none");
}
}
}
}

View file

@ -1,7 +1,7 @@
{
"Name": "SoundLoop Mod",
"Author": "strelkasaur",
"Version": "1.0.1",
"Version": "1.0.0",
"Description": "Loops the in-game music",
"UniqueID": "com.strelkasaurus.sm.soundloop",
"EntryDll": "SoundLoopMod.dll",