Renamed LocationGenerator to LocationLootGenerator

This commit is contained in:
Dev 2024-07-06 13:54:04 +01:00
parent d71bf2c2c0
commit 494fd66f51
4 changed files with 9 additions and 24 deletions

View File

@ -1,7 +1,7 @@
import { inject, injectable } from "tsyringe";
import { ApplicationContext } from "@spt/context/ApplicationContext";
import { ContextVariableType } from "@spt/context/ContextVariableType";
import { LocationGenerator } from "@spt/generators/LocationGenerator";
import { LocationLootGenerator } from "@spt/generators/LocationLootGenerator";
import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
import { ILocationsGenerateAllResponse } from "@spt/models/eft/common/ILocationsSourceDestinationBase";
import { ILooseLoot, SpawnpointTemplate } from "@spt/models/eft/common/ILooseLoot";
@ -26,7 +26,7 @@ export class LocationController
constructor(
@inject("PrimaryLogger") protected logger: ILogger,
@inject("LocationGenerator") protected locationGenerator: LocationGenerator,
@inject("LocationLootGenerator") protected locationLootGenerator: LocationLootGenerator,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("RaidTimeAdjustmentService") protected raidTimeAdjustmentService: RaidTimeAdjustmentService,
@inject("DatabaseService") protected databaseService: DatabaseService,
@ -73,12 +73,12 @@ export class LocationController
const staticAmmoDist = this.cloner.clone(location.staticAmmo);
// Create containers and add loot to them
const staticLoot = this.locationGenerator.generateStaticContainers(locationBaseClone, staticAmmoDist);
const staticLoot = this.locationLootGenerator.generateStaticContainers(locationBaseClone, staticAmmoDist);
locationBaseClone.Loot.push(...staticLoot);
// Add dynamic loot to output loot
const dynamicLootDistClone: ILooseLoot = this.cloner.clone(location.looseLoot);
const dynamicSpawnPoints: SpawnpointTemplate[] = this.locationGenerator.generateDynamicLoot(
const dynamicSpawnPoints: SpawnpointTemplate[] = this.locationLootGenerator.generateDynamicLoot(
dynamicLootDistClone,
staticAmmoDist,
name,

View File

@ -68,7 +68,7 @@ import { BotLevelGenerator } from "@spt/generators/BotLevelGenerator";
import { BotLootGenerator } from "@spt/generators/BotLootGenerator";
import { BotWeaponGenerator } from "@spt/generators/BotWeaponGenerator";
import { FenceBaseAssortGenerator } from "@spt/generators/FenceBaseAssortGenerator";
import { LocationGenerator } from "@spt/generators/LocationGenerator";
import { LocationLootGenerator } from "@spt/generators/LocationLootGenerator";
import { LootGenerator } from "@spt/generators/LootGenerator";
import { PlayerScavGenerator } from "@spt/generators/PlayerScavGenerator";
import { PMCLootGenerator } from "@spt/generators/PMCLootGenerator";
@ -537,7 +537,7 @@ export class Container
depContainer.register<BotWeaponGenerator>("BotWeaponGenerator", BotWeaponGenerator);
depContainer.register<BotLootGenerator>("BotLootGenerator", BotLootGenerator);
depContainer.register<BotInventoryGenerator>("BotInventoryGenerator", BotInventoryGenerator);
depContainer.register<LocationGenerator>("LocationGenerator", { useClass: LocationGenerator });
depContainer.register<LocationLootGenerator>("LocationLootGenerator", { useClass: LocationLootGenerator });
depContainer.register<PMCLootGenerator>("PMCLootGenerator", PMCLootGenerator, {
lifecycle: Lifecycle.Singleton,
});

View File

@ -44,7 +44,7 @@ export interface IContainerGroupCount
}
@injectable()
export class LocationGenerator
export class LocationLootGenerator
{
protected locationConfig: ILocationConfig;

View File

@ -1,28 +1,13 @@
import { inject, injectable } from "tsyringe";
import { LocationCallbacks } from "@spt/callbacks/LocationCallbacks";
import { DynamicRouter, RouteAction } from "@spt/di/Router";
import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
import { DynamicRouter } from "@spt/di/Router";
@injectable()
export class LocationDynamicRouter extends DynamicRouter
{
constructor(@inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks)
{
super([
new RouteAction(
"/client/location/getLocalloot",
async (
url: string,
info: any,
sessionID: string,
_output: string,
): Promise<IGetBodyResponseData<ILocationBase>> =>
{
return this.locationCallbacks.getLocation(url, info, sessionID);
},
),
]);
super([]);
}
public override getTopLevelRoute(): string