From dba6b5f629ec38e0577f0f5394e072229aafc386 Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 9 Jul 2023 14:47:02 +0100 Subject: [PATCH] Allow modifcaiton of the container airdrop will use (capacity etc) --- project/assets/configs/airdrop.json | 6 ++++++ project/src/controllers/LocationController.ts | 10 +++++----- project/src/models/eft/location/IAirdropLootResult.ts | 7 +++++++ project/src/models/spt/config/IAirdropConfig.ts | 1 + 4 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 project/src/models/eft/location/IAirdropLootResult.ts diff --git a/project/assets/configs/airdrop.json b/project/assets/configs/airdrop.json index b0b9da8f..9f3f0ffc 100644 --- a/project/assets/configs/airdrop.json +++ b/project/assets/configs/airdrop.json @@ -21,6 +21,12 @@ "planeVolume": 0.5, "planeSpeed": 65, "crateFallSpeed": 3, + "containerIds": { + "mixed": "6223349b3136504a544d1608", + "weaponArmor": "6223349b3136504a544d1608", + "foodMedical": "6223349b3136504a544d1608", + "barter": "6223349b3136504a544d1608" + }, "loot": { "mixed": { "presetCount": { diff --git a/project/src/controllers/LocationController.ts b/project/src/controllers/LocationController.ts index 351c44f7..6a291748 100644 --- a/project/src/controllers/LocationController.ts +++ b/project/src/controllers/LocationController.ts @@ -9,11 +9,11 @@ import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { ConfigTypes } from "../models/enums/ConfigTypes"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocations } from "../models/spt/server/ILocations"; -import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -55,7 +55,7 @@ export class LocationController public generate(name: string): ILocationBase { const location: ILocation = this.databaseServer.getTables().locations[name]; - const output: ILocationBase = location.base; + const output: ILocationBase = this.jsonUtil.clone(location.base); // const ids = {}; output.UnixDateTime = this.timeUtil.getTimestamp(); @@ -68,7 +68,7 @@ export class LocationController const locationName = location.base.Name; - // generate loot + // Copy loot data const staticWeapons = this.jsonUtil.clone(this.databaseServer.getTables().loot.staticContainers[locationName].staticWeapons); const staticContainers = this.jsonUtil.clone(this.databaseServer.getTables().loot.staticContainers[locationName].staticContainers); const staticForced = this.jsonUtil.clone(this.databaseServer.getTables().loot.staticContainers[locationName].staticForced); @@ -146,7 +146,7 @@ export class LocationController * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ - public getAirdropLoot(): LootItem[] + public getAirdropLoot(): IAirdropLootResult { const airdropType = this.chooseAirdropType(); @@ -154,7 +154,7 @@ export class LocationController const airdropConfig = this.getAirdropLootConfigByType(airdropType); - return this.lootGenerator.createRandomLoot(airdropConfig); + return {dropType: airdropType, loot: this.lootGenerator.createRandomLoot(airdropConfig)}; } /** diff --git a/project/src/models/eft/location/IAirdropLootResult.ts b/project/src/models/eft/location/IAirdropLootResult.ts new file mode 100644 index 00000000..d9896320 --- /dev/null +++ b/project/src/models/eft/location/IAirdropLootResult.ts @@ -0,0 +1,7 @@ +import { LootItem } from "../../../models/spt/services/LootItem"; + +export interface IAirdropLootResult +{ + dropType: string + loot: LootItem[] +} \ No newline at end of file diff --git a/project/src/models/spt/config/IAirdropConfig.ts b/project/src/models/spt/config/IAirdropConfig.ts index 58839beb..56d80138 100644 --- a/project/src/models/spt/config/IAirdropConfig.ts +++ b/project/src/models/spt/config/IAirdropConfig.ts @@ -12,6 +12,7 @@ export interface IAirdropConfig extends IBaseConfig planeVolume: number planeSpeed: number crateFallSpeed: number + containerIds: Record airdropMinStartTimeSeconds: number airdropMaxStartTimeSeconds: number loot: Record