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
|
|
|
{
|
2019-01-06 15:21:06 +08:00
|
|
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
2016-10-20 15:15:14 +08:00
|
|
|
}
|
|
|
|
|
2017-07-30 08:03:22 +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>
|
2017-07-30 08:03:22 +08:00
|
|
|
/// <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)
|
2018-12-30 18:00:05 +08:00
|
|
|
{
|
2018-05-01 09:21:31 +08:00
|
|
|
foreach (Pet pet in Game1.player.currentLocation.getCharacters().OfType<Pet>().ToArray())
|
2017-08-06 11:08:42 +08:00
|
|
|
pet.currentLocation.characters.Remove(pet);
|
2016-10-20 15:15:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|