Introduce support for loadouts, and save current loadout index to SSC
We needed to modify `NetItem` to know that these new inventory now exist. `PlayerData` can now re/store these items, and properly sync them. It also now knows of the player's currently selected index, and how to sync it.
This commit is contained in:
parent
3163c88d4a
commit
bfaa47ad1a
5 changed files with 300 additions and 14 deletions
|
|
@ -81,10 +81,22 @@ namespace TShockAPI
|
|||
/// </summary>
|
||||
public static readonly int TrashSlots = 1;
|
||||
|
||||
/// <summary>
|
||||
/// The number of armor slots in a loadout.
|
||||
/// </summary>
|
||||
public static readonly int LoadoutArmorSlots = ArmorSlots;
|
||||
|
||||
/// <summary>
|
||||
/// The number of dye slots in a loadout.
|
||||
/// </summary>
|
||||
public static readonly int LoadoutDyeSlots = DyeSlots;
|
||||
|
||||
/// <summary>
|
||||
/// 180 - The inventory size (inventory, held item, armour, dies, coins, ammo, piggy, safe, and trash)
|
||||
/// </summary>
|
||||
public static readonly int MaxInventory = InventorySlots + ArmorSlots + DyeSlots + MiscEquipSlots + MiscDyeSlots + PiggySlots + SafeSlots + ForgeSlots + VoidSlots + 1;
|
||||
public static readonly int MaxInventory = InventorySlots + ArmorSlots + DyeSlots + MiscEquipSlots + MiscDyeSlots + PiggySlots +
|
||||
SafeSlots + ForgeSlots + VoidSlots + TrashSlots + (LoadoutArmorSlots * 3) +
|
||||
(LoadoutDyeSlots * 3);
|
||||
|
||||
public static readonly Tuple<int, int> InventoryIndex = new Tuple<int, int>(0, InventorySlots);
|
||||
public static readonly Tuple<int, int> ArmorIndex = new Tuple<int, int>(InventoryIndex.Item2, InventoryIndex.Item2 + ArmorSlots);
|
||||
|
|
@ -97,6 +109,15 @@ namespace TShockAPI
|
|||
public static readonly Tuple<int, int> ForgeIndex = new Tuple<int, int>(TrashIndex.Item2, TrashIndex.Item2 + ForgeSlots);
|
||||
public static readonly Tuple<int, int> VoidIndex = new Tuple<int, int>(ForgeIndex.Item2, ForgeIndex.Item2 + VoidSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout1Armor = new Tuple<int, int>(VoidIndex.Item2, VoidIndex.Item2 + LoadoutArmorSlots);
|
||||
public static readonly Tuple<int, int> Loadout1Dye = new Tuple<int, int>(Loadout1Armor.Item2, Loadout1Armor.Item2 + LoadoutDyeSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout2Armor = new Tuple<int, int>(Loadout1Dye.Item2, Loadout1Dye.Item2 + LoadoutArmorSlots);
|
||||
public static readonly Tuple<int, int> Loadout2Dye = new Tuple<int, int>(Loadout2Armor.Item2, Loadout2Armor.Item2 + LoadoutDyeSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout3Armor = new Tuple<int, int>(Loadout2Dye.Item2, Loadout2Dye.Item2 + LoadoutArmorSlots);
|
||||
public static readonly Tuple<int, int> Loadout3Dye = new Tuple<int, int>(Loadout3Armor.Item2, Loadout3Armor.Item2 + LoadoutDyeSlots);
|
||||
|
||||
[JsonProperty("netID")]
|
||||
private int _netId;
|
||||
[JsonProperty("prefix")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue