Stardew_Valley_Mods/GeneralMods/NoMorePets/NoMorePets.cs

37 lines
1.1 KiB
C#
Raw Normal View History

2016-10-20 15:15:14 +08:00
using System;
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
{
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
2016-10-20 15:15:14 +08:00
}
/*********
** 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)
2016-10-20 15:15:14 +08:00
{
foreach (Pet pet in Utility.getAllCharacters().OfType<Pet>().ToArray())
pet.currentLocation.characters.Remove(pet);
2016-10-20 15:15:14 +08:00
}
}
}