Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpawnZoneRework #8

Merged
merged 9 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ dist/Bepinex
dist/user
src/refDBS

*.js
*.js.map

src/**/**/*.js
src/**/*.js
src/*.js
src/*.js.map
src/**/**/*.js.map
src/**/*.js.map
src/*.js.map
src/**/**.js.map
src/**/**.js
10 changes: 4 additions & 6 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
{
"enableBotSpawning": true,
"spawnSmoothing":true,
"spawnSmoothing": true,

"pmcDifficulty": 0.6,
"scavDifficulty": 0.4,

"scavWaveDistribution": 1.2,
"scavWaveDistribution": 0.8,
"scavWaveQuantity": 1,

"startingPmcs": false,
"pmcWaveDistribution": 0.7,
"pmcWaveDistribution": 0.6,
"pmcWaveQuantity": 1,

"playerOpenZones": false,
"pmcOpenZones": true,
"allOpenZones": false,
"disableCascadingSpawns": false,

"zombiesEnabled": false,
"zombieWaveDistribution": 0.8,
Expand Down
48 changes: 42 additions & 6 deletions config/mapConfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"customs": {
"initialSpawnDelay": 15,
"smoothingDistribution": 0.9,
"mapCullingNearPointValue": 10,
"spawnMinDistance": 30,
"pmcWaveCount": 12,
"scavWaveCount": 21,
Expand All @@ -12,22 +15,31 @@
]
},
"factoryDay": {
"spawnMinDistance": 20,
"initialSpawnDelay": 10,
"smoothingDistribution": 0.4,
"mapCullingNearPointValue": 3,
"spawnMinDistance": 15,
"maxBotCapOverride": 12,
"maxBotPerZoneOverride": 10,
"maxBotPerZoneOverride": 12,
"pmcWaveCount": 8,
"scavWaveCount": 9,
"scavWaveCount": 12,
"zombieWaveCount": 6
},
"factoryNight": {
"spawnMinDistance": 20,
"initialSpawnDelay": 10,
"smoothingDistribution": 0.4,
"mapCullingNearPointValue": 3,
"spawnMinDistance": 15,
"maxBotCapOverride": 12,
"maxBotPerZoneOverride": 10,
"maxBotPerZoneOverride": 12,
"pmcWaveCount": 8,
"scavWaveCount": 9,
"scavWaveCount": 12,
"zombieWaveCount": 6
},
"interchange": {
"initialSpawnDelay": 20,
"smoothingDistribution": 0.9,
"mapCullingNearPointValue": 8,
"spawnMinDistance": 40,
"pmcWaveCount": 14,
"scavWaveCount": 28,
Expand All @@ -38,12 +50,18 @@
]
},
"laboratory": {
"initialSpawnDelay": 15,
"smoothingDistribution": 0.9,
"mapCullingNearPointValue": 3,
"spawnMinDistance": 20,
"pmcWaveCount": 10,
"scavWaveCount": 0,
"zombieWaveCount": 12
},
"lighthouse": {
"initialSpawnDelay": 20,
"smoothingDistribution": 0.9,
"mapCullingNearPointValue": 10,
"spawnMinDistance": 40,
"pmcWaveCount": 12,
"scavWaveCount": 20,
Expand All @@ -54,6 +72,9 @@
]
},
"rezervbase": {
"initialSpawnDelay": 20,
"smoothingDistribution": 0.9,
"mapCullingNearPointValue": 10,
"spawnMinDistance": 40,
"pmcWaveCount": 11,
"scavWaveCount": 24,
Expand All @@ -66,6 +87,9 @@
]
},
"shoreline": {
"initialSpawnDelay": 20,
"smoothingDistribution": 0.9,
"mapCullingNearPointValue": 10,
"spawnMinDistance": 40,
"pmcWaveCount": 14,
"scavWaveCount": 28,
Expand All @@ -78,12 +102,18 @@
]
},
"tarkovstreets": {
"initialSpawnDelay": 20,
"smoothingDistribution": 0.9,
"mapCullingNearPointValue": 10,
"spawnMinDistance": 40,
"pmcWaveCount": 14,
"scavWaveCount": 26,
"zombieWaveCount": 13
},
"woods": {
"initialSpawnDelay": 20,
"smoothingDistribution": 0.9,
"mapCullingNearPointValue": 10,
"spawnMinDistance": 40,
"pmcWaveCount": 14,
"scavWaveCount": 28,
Expand All @@ -96,12 +126,18 @@
]
},
"gzLow": {
"initialSpawnDelay": 10,
"smoothingDistribution": 1,
"mapCullingNearPointValue": 7,
"spawnMinDistance": 30,
"pmcWaveCount": 10,
"scavWaveCount": 18,
"zombieWaveCount": 9
},
"gzHigh": {
"initialSpawnDelay": 10,
"smoothingDistribution": 1,
"mapCullingNearPointValue": 7,
"spawnMinDistance": 30,
"pmcWaveCount": 12,
"scavWaveCount": 18,
Expand Down
Binary file removed dist/DewardianDev-MOAR-2.6.9.zip
Binary file not shown.
Binary file added dist/DewardianDev-MOAR-2.7.0.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MOAR",
"version": "2.6.9",
"version": "2.7.0",
"main": "src/mod.js",
"license": "MIT",
"author": "DewardianDev",
Expand All @@ -22,4 +22,4 @@
"tsyringe": "4.7.0",
"typescript": "4.9.4"
}
}
}
1 change: 1 addition & 0 deletions src/GlobalValues.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/GlobalValues.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/GlobalValues.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import config from "../config/config.json";
import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
import { ILocationBase, ISpawnPointParam } from "@spt/models/eft/common/ILocationBase";

export class globalValues {
public static baseConfig: typeof config = undefined;
Expand All @@ -8,4 +8,5 @@ export class globalValues {
public static currentPreset: string = "";
public static forcedPreset: string = "random";
public static addedMapZones: Record<string, string[]> = {};
public static indexedMapSpawns: Record<number, ISpawnPointParam[]> = {}
}
101 changes: 101 additions & 0 deletions src/SpawnZoneChanges/setupSpawn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { DatabaseServer } from "@spt/servers/DatabaseServer";
import { configLocations, originalMapList } from "../Spawning/constants";
import { DependencyContainer } from "tsyringe";
import mapConfig from "../../config/mapConfig.json";
import { ISpawnPointParam } from "@spt/models/eft/common/ILocationBase";
import { globalValues } from "../GlobalValues";
import { cleanClosest } from "../Spawning/spawnZoneUtils";
import { shuffle } from "../Spawning/utils";

export const setupSpawns = (container: DependencyContainer) => {
const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
const { locations } = databaseServer.getTables();

const indexedMapSpawns: Record<number, ISpawnPointParam[]> = {};

originalMapList.forEach((map, mapIndex) => {
const limit = mapConfig[configLocations[mapIndex]].spawnMinDistance;

locations[map].base.SpawnPointParams.forEach(
(
{ ColliderParams, Categories }: ISpawnPointParam,
innerIndex: number
) => {
if (
!Categories.includes("Boss") &&
ColliderParams?._props?.Radius !== undefined &&
ColliderParams?._props?.Radius < limit
) {
locations[map].base.SpawnPointParams[
innerIndex
].ColliderParams._props.Radius = limit;
}
}
);

let bossSpawnSpawns: ISpawnPointParam[] = [];
let nonBossSpawns: ISpawnPointParam[] = [];
let sniperSpawnSpawnPoints: ISpawnPointParam[] = [];
let coopSpawns: ISpawnPointParam[] = [];

shuffle<ISpawnPointParam[]>(locations[map].base.SpawnPointParams).forEach(
(point) => {
switch (true) {
case point.Categories.includes("Boss"):
bossSpawnSpawns.push(point);
break;
case point.BotZoneName?.toLowerCase().includes("snipe") ||
point.DelayToCanSpawnSec > 40:
sniperSpawnSpawnPoints.push(point);
break;

case (point.Categories.includes("Coop") ||
point.Categories.includes("Player")) &&
!!point.Infiltration:
coopSpawns.push(point);
break;

default:
nonBossSpawns.push(point);
break;
}
}
);

coopSpawns = cleanClosest(coopSpawns, configLocations[mapIndex]).map(
(point, index) => !!point.Categories.length ? {
...point,
Categories: ["Player"],
BotZoneName: point?.BotZoneName ? point.BotZoneName : "coop_" + index,
CorePointId: 0,
Sides: ["Pmc"],
} : point
);

nonBossSpawns = cleanClosest(
nonBossSpawns, configLocations[mapIndex]).map((point, index) => !!point.Categories.length ? ({
...point,
BotZoneName: point?.BotZoneName ? point.BotZoneName : "open_" + index,
Categories: ["Bot"],
// Infiltration: "",
Sides: ["Savage"],
CorePointId: 1,
}) : point);


locations[map].base.OpenZones = "";

indexedMapSpawns[mapIndex] = [
...sniperSpawnSpawnPoints,
...bossSpawnSpawns,
...nonBossSpawns,
...coopSpawns,
]//.filter(({ Categories }) => Categories.length);

// console.log(locations[map].base.SpawnPointParams.length, indexedMapSpawns[mapIndex].filter(({ Categories }) => Categories.length).length)

locations[map].base.SpawnPointParams = [];
});

globalValues.indexedMapSpawns = indexedMapSpawns;
};
2 changes: 1 addition & 1 deletion src/Spawning/Spawning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const buildWaves = (container: DependencyContainer) => {
rezervbase: { pmcbot: { min: 0, max: 0 } },
};

updateSpawnLocations(locationList, config);
updateSpawnLocations(locationList);

setEscapeTimeOverrides(locationList, _mapConfig, Logger, config);

Expand Down
2 changes: 1 addition & 1 deletion src/Spawning/buildBossWaves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export function buildBossWaves(
: { ...boss, ...{ BossChance: 100 } }
);

// if (mapName === "rezervbase")
// if (mapName === "customs")
// console.log(mapName, locationList[index].base.BossLocationSpawn);
});

Expand Down
Loading
Loading