0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00

Added system to strip children from containers defined in new config property tplsToStripChildItemsFrom

Fixes Christmas gifts causing strange behaviour when moved to stash as we generate container gift loot when player opens then
This commit is contained in:
Chomp 2025-01-08 19:03:50 +00:00
parent 0eb31c468f
commit 33591df715
3 changed files with 17 additions and 1 deletions

View File

@ -539,5 +539,11 @@
"nonTriggered": 80, "nonTriggered": 80,
"triggered": 90 "triggered": 90
}, },
"tplsToStripChildItemsFrom": [
"63a8970d7108f713591149f5",
"63a897c6b1ff6e29734fcc95",
"63a898a328e385334e0640a5",
"634959225289190e5e773b3b"
],
"nonMaps": ["base", "develop", "hideout", "privatearea", "suburbs", "terminal", "town"] "nonMaps": ["base", "develop", "hideout", "privatearea", "suburbs", "terminal", "town"]
} }

View File

@ -429,7 +429,10 @@ export class LocationLootGenerator {
const tplsToAddToContainer = tplsForced.concat(chosenTpls); const tplsToAddToContainer = tplsForced.concat(chosenTpls);
for (const tplToAdd of tplsToAddToContainer) { for (const tplToAdd of tplsToAddToContainer) {
const chosenItemWithChildren = this.createStaticLootItem(tplToAdd, staticAmmoDist, parentId); const chosenItemWithChildren = this.createStaticLootItem(tplToAdd, staticAmmoDist, parentId);
const items = chosenItemWithChildren.items;
const items = this.locationConfig.tplsToStripChildItemsFrom.includes(tplToAdd)
? [chosenItemWithChildren.items[0]] // Strip children from parent
: chosenItemWithChildren.items;
const width = chosenItemWithChildren.width; const width = chosenItemWithChildren.width;
const height = chosenItemWithChildren.height; const height = chosenItemWithChildren.height;
@ -918,6 +921,11 @@ export class LocationLootGenerator {
// Ensure all IDs are unique // Ensure all IDs are unique
itemWithChildren = this.itemHelper.replaceIDs(itemWithChildren); itemWithChildren = this.itemHelper.replaceIDs(itemWithChildren);
if (this.locationConfig.tplsToStripChildItemsFrom.includes(chosenItem._tpl)) {
// Strip children from parent before adding
itemWithChildren = [itemWithChildren[0]];
}
itemWithMods.push(...itemWithChildren); itemWithMods.push(...itemWithChildren);
} }

View File

@ -45,6 +45,8 @@ export interface ILocationConfig extends IBaseConfig {
equipmentLootSettings: IEquipmentLootSettings; equipmentLootSettings: IEquipmentLootSettings;
/** min percentage to set raider spawns at, -1 makes no changes */ /** min percentage to set raider spawns at, -1 makes no changes */
reserveRaiderSpawnChanceOverrides: IReserveRaiderSpawnChanceOverrides; reserveRaiderSpawnChanceOverrides: IReserveRaiderSpawnChanceOverrides;
/** Containers to remove all children from when generating static/loose loot */
tplsToStripChildItemsFrom: string[];
/** Map ids players cannot visit */ /** Map ids players cannot visit */
nonMaps: string[]; nonMaps: string[];
} }