Updated the PlayerData constructors.
Added a new constructor with a parameter that is responsible for installing TShock items into inventory. The `TSPlayer` parameter was not used, so I labeled the constructor obsolete.
This commit is contained in:
parent
c67d5cf152
commit
2e8823434c
1 changed files with 18 additions and 8 deletions
|
|
@ -23,6 +23,7 @@ using Terraria.Localization;
|
||||||
using Terraria.GameContent.NetModules;
|
using Terraria.GameContent.NetModules;
|
||||||
using Terraria.Net;
|
using Terraria.Net;
|
||||||
using Terraria.ID;
|
using Terraria.ID;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
{
|
{
|
||||||
|
|
@ -63,13 +64,22 @@ namespace TShockAPI
|
||||||
public int unlockedSuperCart;
|
public int unlockedSuperCart;
|
||||||
public int enabledSuperCart;
|
public int enabledSuperCart;
|
||||||
|
|
||||||
public PlayerData(TSPlayer player)
|
/// <summary>
|
||||||
|
/// Sets the default values for the inventory.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("The player argument is not used.")]
|
||||||
|
public PlayerData(TSPlayer player) : this(true) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the default values for the inventory.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="includingStarterInventory">Is it necessary to load items from TShock's config</param>
|
||||||
|
public PlayerData(bool includingStarterInventory = true)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NetItem.MaxInventory; i++)
|
for (int i = 0; i < NetItem.MaxInventory; i++)
|
||||||
{
|
|
||||||
this.inventory[i] = new NetItem();
|
this.inventory[i] = new NetItem();
|
||||||
}
|
|
||||||
|
|
||||||
|
if (includingStarterInventory)
|
||||||
for (int i = 0; i < TShock.ServerSideCharacterConfig.Settings.StartingInventory.Count; i++)
|
for (int i = 0; i < TShock.ServerSideCharacterConfig.Settings.StartingInventory.Count; i++)
|
||||||
{
|
{
|
||||||
var item = TShock.ServerSideCharacterConfig.Settings.StartingInventory[i];
|
var item = TShock.ServerSideCharacterConfig.Settings.StartingInventory[i];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue