restore obsolete SPlayer for backwards compatibility, mark deprecated
This commit is contained in:
parent
7cb77dd2be
commit
1a5eb12cc6
|
@ -7,7 +7,7 @@ For players:
|
|||
* Fixed console exiting immediately when some exceptions occur.
|
||||
* Fixed an error in 1.0 when mod uses `config.json` but the file doesn't exist.
|
||||
* Fixed critical errors being saved to a separate log file.
|
||||
* Fixed compatibility with mods that use obsolete `Log` methods.<sup>1.1.1</sup>
|
||||
* Fixed compatibility with some older mods.<sup>1.1.1, 1.1.2</sup>
|
||||
* Fixed race condition where some mods would sometimes crash because the game wasn't ready yet.<sup>1.1.1</sup>
|
||||
|
||||
For developers:
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using StardewModdingAPI.Framework;
|
||||
using StardewValley;
|
||||
|
||||
namespace StardewModdingAPI.Entities
|
||||
{
|
||||
/// <summary>Static class for integrating with the player.</summary>
|
||||
[Obsolete("This API was never officially documented and will be removed soon.")]
|
||||
public class SPlayer
|
||||
{
|
||||
/*********
|
||||
** Accessors
|
||||
*********/
|
||||
/// <summary>Obsolete.</summary>
|
||||
[Obsolete("Use " + nameof(Game1) + "." + nameof(Game1.getAllFarmers) + " instead")]
|
||||
public static List<Farmer> AllFarmers
|
||||
{
|
||||
get
|
||||
{
|
||||
Program.DeprecationManager.Warn(nameof(SPlayer), "1.0", DeprecationLevel.Info);
|
||||
return Game1.getAllFarmers();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Obsolete.</summary>
|
||||
[Obsolete("Use " + nameof(Game1) + "." + nameof(Game1.player) + " instead")]
|
||||
public static Farmer CurrentFarmer
|
||||
{
|
||||
get
|
||||
{
|
||||
Program.DeprecationManager.Warn(nameof(SPlayer), "1.0", DeprecationLevel.Info);
|
||||
return Game1.player;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Obsolete.</summary>
|
||||
[Obsolete("Use " + nameof(Game1) + "." + nameof(Game1.player) + " instead")]
|
||||
public static Farmer Player
|
||||
{
|
||||
get
|
||||
{
|
||||
Program.DeprecationManager.Warn(nameof(SPlayer), "1.0", DeprecationLevel.Info);
|
||||
return Game1.player;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Obsolete.</summary>
|
||||
[Obsolete("Use " + nameof(Game1) + "." + nameof(Game1.player) + "." + nameof(Farmer.currentLocation) + " instead")]
|
||||
public static GameLocation CurrentFarmerLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
Program.DeprecationManager.Warn(nameof(SPlayer), "1.0", DeprecationLevel.Info);
|
||||
return Game1.player.currentLocation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -166,6 +166,7 @@
|
|||
<Compile Include="Command.cs" />
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Entities\SPlayer.cs" />
|
||||
<Compile Include="Events\ControlEvents.cs" />
|
||||
<Compile Include="Events\EventArgsCommand.cs" />
|
||||
<Compile Include="Events\EventArgsClickableMenuChanged.cs" />
|
||||
|
|
Loading…
Reference in New Issue