Implement keeping pocket items on death to LostOnDeath.json configuration (!246)

Addresses: https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/443

Re-added the ability to keep pocket items on death. The reason for the naming is to not confuse the root `Pockets` item. Where as `PocketItems` is a better descriptive fit for the behaviour.

New property in lostondeath.json -> `equipment.PocketItems` default `true` to discard items in pockets as normal on death.

Co-authored-by: Cj <161484149+CJ-SPT@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/246
Co-authored-by: Cj <cj@noreply.dev.sp-tarkov.com>
Co-committed-by: Cj <cj@noreply.dev.sp-tarkov.com>
This commit is contained in:
Cj 2024-03-06 08:50:04 +00:00 committed by chomp
parent 03ae37ec2f
commit 4da70b80d3
3 changed files with 11 additions and 0 deletions

View File

@ -8,6 +8,7 @@
"ArmorVest": true, "ArmorVest": true,
"Eyewear": true, "Eyewear": true,
"TacticalVest": true, "TacticalVest": true,
"PocketItems": true,
"Backpack": true, "Backpack": true,
"Holster": true, "Holster": true,
"FirstPrimaryWeapon": true, "FirstPrimaryWeapon": true,

View File

@ -707,6 +707,9 @@ export class InRaidHelper
*/ */
protected isItemKeptAfterDeath(pmcData: IPmcData, itemToCheck: Item): boolean protected isItemKeptAfterDeath(pmcData: IPmcData, itemToCheck: Item): boolean
{ {
// Use pocket slotId's otherwise it deletes the root pocket item.
const pocketSlots = ["pocket1", "pocket2", "pocket3", "pocket4"];
// No parentId = base inventory item, always keep // No parentId = base inventory item, always keep
if (!itemToCheck.parentId) if (!itemToCheck.parentId)
{ {
@ -727,6 +730,12 @@ export class InRaidHelper
return true; return true;
} }
// Should we keep items in pockets on death
if (!this.lostOnDeathConfig.equipment.PocketItems && pocketSlots.includes(itemToCheck.slotId))
{
return true;
}
// Is quest item + quest item not lost on death // Is quest item + quest item not lost on death
if (itemToCheck.parentId === pmcData.Inventory.questRaidItems && !this.lostOnDeathConfig.questItems) if (itemToCheck.parentId === pmcData.Inventory.questRaidItems && !this.lostOnDeathConfig.questItems)
{ {

View File

@ -20,6 +20,7 @@ export interface Equipment
ArmorVest: boolean; ArmorVest: boolean;
Eyewear: boolean; Eyewear: boolean;
TacticalVest: boolean; TacticalVest: boolean;
PocketItems: boolean;
Backpack: boolean; Backpack: boolean;
Holster: boolean; Holster: boolean;
FirstPrimaryWeapon: boolean; FirstPrimaryWeapon: boolean;