Handle looping correctly for the woods and the bus
This commit is contained in:
parent
e56b014c96
commit
d7e8314eb9
|
@ -1,5 +1,10 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
### 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
|
## [1.0.0] - 2022-07-26
|
||||||
### Added
|
### Added
|
||||||
- Restart in-game "morning" song when it is not playing and player is outside.
|
- Restart in-game "morning" song when it is not playing and player is outside.
|
||||||
|
|
|
@ -34,9 +34,12 @@ namespace SoundLoopMod
|
||||||
|
|
||||||
private void CheckMusicNeedsRestarting(object? sender, OneSecondUpdateTickingEventArgs e)
|
private void CheckMusicNeedsRestarting(object? sender, OneSecondUpdateTickingEventArgs e)
|
||||||
{
|
{
|
||||||
|
// Don't do anything if we're at the title screen
|
||||||
if (!Context.IsWorldReady)
|
if (!Context.IsWorldReady)
|
||||||
return;
|
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;
|
MineShaft.timeSinceLastMusic = 999999;
|
||||||
|
|
||||||
// Avoid playing morning song in the mines etc.
|
// Avoid playing morning song in the mines etc.
|
||||||
|
@ -47,9 +50,33 @@ namespace SoundLoopMod
|
||||||
if (Game1.isDarkOut())
|
if (Game1.isDarkOut())
|
||||||
return;
|
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.currentSong == null || Game1.currentSong.IsStopped || Game1.requestedMusicTrack.ToLower().Contains("ambient"))
|
||||||
{
|
{
|
||||||
|
if (Game1.currentLocation.Name == "Woods")
|
||||||
|
{
|
||||||
|
// The music for the secret woods is a bit of a special case.
|
||||||
|
// Handle this in a way similar to the game when entering the woods.
|
||||||
|
|
||||||
|
// The game doesn't start the woods song after 1800, do the same here
|
||||||
|
if (Game1.timeOfDay >= 1800)
|
||||||
|
return;
|
||||||
|
Game1.changeMusicTrack("woodsTheme");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// General case, let the game figure out what song to play.
|
||||||
Game1.playMorningSong();
|
Game1.playMorningSong();
|
||||||
|
}
|
||||||
this.Monitor.Log("Restarted music");
|
this.Monitor.Log("Restarted music");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"Name": "SoundLoop Mod",
|
"Name": "SoundLoop Mod",
|
||||||
"Author": "strelkasaur",
|
"Author": "strelkasaur",
|
||||||
"Version": "1.0.0",
|
"Version": "1.0.1-beta1",
|
||||||
"Description": "Loops the in-game music",
|
"Description": "Loops the in-game music",
|
||||||
"UniqueID": "com.strelkasaurus.sm.soundloop",
|
"UniqueID": "com.strelkasaurus.sm.soundloop",
|
||||||
"EntryDll": "SoundLoopMod.dll",
|
"EntryDll": "SoundLoopMod.dll",
|
||||||
|
|
Loading…
Reference in a new issue