Initial release

Nexus page: https://www.nexusmods.com/stardewvalley/mods/13099

Caveats:
    - The music will go silent after dark (6-8pm depending on season).
    - There may be a short pause between each loop.
    - Music will not loop unless you are outdoors or in the mines.
This commit is contained in:
Strelkasaurus 2022-07-26 01:42:36 +02:00
commit e56b014c96
8 changed files with 790 additions and 0 deletions

57
SoundLoopMod/ModEntry.cs Normal file
View file

@ -0,0 +1,57 @@
// SoundLoop Stardew Valley Mod
// Copyright (C) 2022 strelkasaur
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
using System;
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewModdingAPI.Utilities;
using StardewValley;
using StardewValley.Locations;
namespace SoundLoopMod
{
public class ModEntry : Mod
{
public override void Entry(IModHelper helper)
{
helper.Events.GameLoop.OneSecondUpdateTicking += this.CheckMusicNeedsRestarting;
}
private void CheckMusicNeedsRestarting(object? sender, OneSecondUpdateTickingEventArgs e)
{
if (!Context.IsWorldReady)
return;
MineShaft.timeSinceLastMusic = 999999;
// Avoid playing morning song in the mines etc.
if (!Game1.currentLocation.IsOutdoors)
return;
// The game keeps trying to stop the music if it's dark. We won't fight it for now
if (Game1.isDarkOut())
return;
if (Game1.currentSong == null || Game1.currentSong.IsStopped || Game1.requestedMusicTrack.ToLower().Contains("ambient"))
{
Game1.playMorningSong();
this.Monitor.Log("Restarted music");
}
}
}
}

View file

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>10</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.0.1" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,10 @@
{
"Name": "SoundLoop Mod",
"Author": "strelkasaur",
"Version": "1.0.0",
"Description": "Loops the in-game music",
"UniqueID": "com.strelkasaurus.sm.soundloop",
"EntryDll": "SoundLoopMod.dll",
"MinimumApiVersion": "3.0.0",
"UpdateKeys": ["Nexus:13099"]
}