Stardew_Valley_Mods/GeneralMods/NoMorePets/NoMorePets.cs

37 lines
1.1 KiB
C#

using System;
using System.Linq;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
using StardewValley.Characters;
namespace Omegasis.NoMorePets
{
/// <summary>The mod entry point.</summary>
public class NoMorePets : Mod
{
/*********
** 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)
{
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
}
/*********
** Private methods
*********/
/// <summary>The method invoked after the player loads a save.</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>
public void SaveEvents_AfterLoad(object sender, EventArgs e)
{
foreach (Pet pet in Game1.player.currentLocation.getCharacters().OfType<Pet>().ToArray())
pet.currentLocation.characters.Remove(pet);
}
}
}