Add pocket item to mannequin on area upgrade
This commit is contained in:
parent
7dfa911213
commit
0d611eae24
@ -298,8 +298,7 @@ export class HideoutController {
|
|||||||
this.addContainerUpgradeToClientOutput(sessionID, dbHideoutArea.type, dbHideoutArea, hideoutStage, output);
|
this.addContainerUpgradeToClientOutput(sessionID, dbHideoutArea.type, dbHideoutArea, hideoutStage, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO - surround with if check to only run when working with HideoutAreas.WEAPON_STAND
|
// Some hideout areas (Gun stand) have child areas linked to it
|
||||||
// The Gun stand has a child area linked to it, it needs to also be added
|
|
||||||
const childDbArea = this.databaseService
|
const childDbArea = this.databaseService
|
||||||
.getHideout()
|
.getHideout()
|
||||||
.areas.find((area) => area.parentArea === dbHideoutArea._id);
|
.areas.find((area) => area.parentArea === dbHideoutArea._id);
|
||||||
@ -347,16 +346,29 @@ export class HideoutController {
|
|||||||
|
|
||||||
// No child, add it
|
// No child, add it
|
||||||
if (!existingMannequin) {
|
if (!existingMannequin) {
|
||||||
|
const standId = this.hashUtil.generate();
|
||||||
const mannequinToAdd = {
|
const mannequinToAdd = {
|
||||||
_id: this.hashUtil.generate(),
|
_id: standId,
|
||||||
_tpl: ItemTpl.INVENTORY_DEFAULT,
|
_tpl: ItemTpl.INVENTORY_DEFAULT,
|
||||||
parentId: equipmentPresetHideoutArea._id,
|
parentId: equipmentPresetHideoutArea._id,
|
||||||
slotId: mannequinSlot._name,
|
slotId: mannequinSlot._name,
|
||||||
};
|
};
|
||||||
pmcData.Inventory.items.push(mannequinToAdd);
|
pmcData.Inventory.items.push(mannequinToAdd);
|
||||||
|
|
||||||
|
// Add pocket child item
|
||||||
|
const mannequinPocketItemToAdd: Item = {
|
||||||
|
_id: this.hashUtil.generate(),
|
||||||
|
_tpl: pmcData.Inventory.items.find(
|
||||||
|
(item) => item.slotId === "Pockets" && item.parentId === pmcData.Inventory.equipment,
|
||||||
|
)._tpl, // Same pocket tpl as players profile (unheard get bigger, matching pockets etc)
|
||||||
|
parentId: standId,
|
||||||
|
slotId: "Pockets",
|
||||||
|
};
|
||||||
|
pmcData.Inventory.items.push(mannequinPocketItemToAdd);
|
||||||
|
|
||||||
// Inform client of new item being added to inventory
|
// Inform client of new item being added to inventory
|
||||||
output.profileChanges[sessionId].items.new.push(mannequinToAdd);
|
output.profileChanges[sessionId].items.new.push(mannequinToAdd);
|
||||||
|
output.profileChanges[sessionId].items.new.push(mannequinPocketItemToAdd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user