Stardew_Valley_Mods/GeneralMods/NoMorePets/NoMorePets.cs

36 lines
1.1 KiB
C#
Raw Normal View History

using System.Linq;
2016-10-20 15:15:14 +08:00
using StardewModdingAPI;
using StardewModdingAPI.Events;
2016-10-20 15:15:14 +08:00
using StardewValley;
using StardewValley.Characters;
2017-07-28 08:28:39 +08:00
namespace Omegasis.NoMorePets
2016-10-20 15:15:14 +08:00
{
/// <summary>The mod entry point.</summary>
public class NoMorePets : Mod
2016-10-20 15:15:14 +08:00
{
/*********
** Public methods
*********/
/// <summary>The mod entry point, called after the mod is first loaded.</summary>
/// <param name="helper">Provides simplified APIs for writing mods.</param>
public override void Entry(IModHelper helper)
2016-10-20 15:15:14 +08:00
{
2019-01-06 15:21:06 +08:00
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
2016-10-20 15:15:14 +08:00
}
/*********
** Private methods
*********/
2019-01-06 15:21:06 +08:00
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
/// <param name="sender">The event sender.</param>
2019-01-06 15:21:06 +08:00
/// <param name="e">The event arguments.</param>
public void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
{
foreach (Pet pet in Game1.player.currentLocation.getCharacters().OfType<Pet>().ToArray())
pet.currentLocation.characters.Remove(pet);
2016-10-20 15:15:14 +08:00
}
}
}