2016-10-20 15:15:14 +08:00
|
|
|
|
using System;
|
2017-08-06 11:08:42 +08:00
|
|
|
|
using System.Linq;
|
2016-10-20 15:15:14 +08:00
|
|
|
|
using StardewModdingAPI;
|
2017-07-30 08:03:22 +08:00
|
|
|
|
using StardewModdingAPI.Events;
|
2016-10-20 15:15:14 +08:00
|
|
|
|
using StardewValley;
|
2017-08-06 11:08:42 +08:00
|
|
|
|
using StardewValley.Characters;
|
2017-07-28 08:28:39 +08:00
|
|
|
|
|
|
|
|
|
namespace Omegasis.NoMorePets
|
2016-10-20 15:15:14 +08:00
|
|
|
|
{
|
2017-07-30 08:03:22 +08:00
|
|
|
|
/// <summary>The mod entry point.</summary>
|
|
|
|
|
public class NoMorePets : Mod
|
2016-10-20 15:15:14 +08:00
|
|
|
|
{
|
2017-07-30 08:03:22 +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>
|
2016-12-09 08:34:28 +08:00
|
|
|
|
public override void Entry(IModHelper helper)
|
2016-10-20 15:15:14 +08:00
|
|
|
|
{
|
2017-08-06 11:08:42 +08:00
|
|
|
|
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
2016-10-20 15:15:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-30 08:03:22 +08:00
|
|
|
|
|
|
|
|
|
/*********
|
|
|
|
|
** Private methods
|
|
|
|
|
*********/
|
2017-08-06 11:08:42 +08:00
|
|
|
|
/// <summary>The method invoked after the player loads a save.</summary>
|
2017-07-30 08:03:22 +08:00
|
|
|
|
/// <param name="sender">The event sender.</param>
|
|
|
|
|
/// <param name="e">The event data.</param>
|
2017-08-06 11:08:42 +08:00
|
|
|
|
public void SaveEvents_AfterLoad(object sender, EventArgs e)
|
2016-10-20 15:15:14 +08:00
|
|
|
|
{
|
2017-08-06 11:08:42 +08:00
|
|
|
|
foreach (Pet pet in Utility.getAllCharacters().OfType<Pet>().ToArray())
|
|
|
|
|
pet.currentLocation.characters.Remove(pet);
|
2016-10-20 15:15:14 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|