generated from AriasCreations/vsmodtemplate
parent
ac8ac62d27
commit
a88807045e
4 changed files with 164 additions and 43 deletions
|
@ -32,14 +32,6 @@ namespace AriasServerUtils
|
|||
internal bool isFirstStart = true;
|
||||
|
||||
|
||||
internal static string[] saveInvTypes = new string[] {
|
||||
GlobalConstants.hotBarInvClassName,
|
||||
GlobalConstants.backpackInvClassName,
|
||||
GlobalConstants.craftingInvClassName,
|
||||
GlobalConstants.mousecursorInvClassName,
|
||||
GlobalConstants.characterInvClassName
|
||||
};
|
||||
|
||||
List<EntityAgent> SleepingPlayers { get; set; } = new();
|
||||
float OriginalSpeed { get; set; } = 0.0f;
|
||||
public double Hours { get; private set; } = 0.0;
|
||||
|
@ -503,42 +495,10 @@ namespace AriasServerUtils
|
|||
|
||||
private void OnPlayerDeath(IServerPlayer player, DamageSource damageSource)
|
||||
{
|
||||
PlayerInventory inv = new PlayerInventory();
|
||||
var invMgr = player.InventoryManager;
|
||||
|
||||
PlayerInventory inv = RustyGearUtils.GetAllItems(player);
|
||||
NewBackCacheForPlayer(player);
|
||||
|
||||
|
||||
var iBackpackSlotNum = 0;
|
||||
foreach (var type in saveInvTypes)
|
||||
{
|
||||
foreach (var stack in invMgr.GetOwnInventory(type))
|
||||
{
|
||||
|
||||
if (iBackpackSlotNum >= 4)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (type == GlobalConstants.backpackInvClassName)
|
||||
{
|
||||
iBackpackSlotNum++;
|
||||
}
|
||||
if (stack.Empty) continue;
|
||||
if (stack.Inventory.ClassName == GlobalConstants.characterInvClassName)
|
||||
{
|
||||
if (stack.Itemstack.ItemAttributes?["protectionModifiers"].Exists ?? false)
|
||||
{
|
||||
inv.Items.Add(stack.Itemstack.Clone());
|
||||
}
|
||||
}
|
||||
else
|
||||
inv.Items.Add(stack.Itemstack.Clone());
|
||||
|
||||
API.Logger.Notification($"SAVED STORAGE ITEM TYPE: {stack.Itemstack}");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
backupInventory[player.PlayerName] = inv;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue