Skip to content

Commit

Permalink
2.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewgdewar committed Jan 1, 2025
1 parent 13c8175 commit f0f324d
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 83 deletions.
8 changes: 6 additions & 2 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@

"startingPmcs": false,

"pmcWaveDistribution": 0.8,
"playerOpenZones": false,
"pmcOpenZones": false,
"allOpenZones": false,

"pmcWaveDistribution": 0.7,
"pmcWaveQuantity": 1,

"zombiesEnabled": false,
Expand All @@ -18,7 +22,7 @@
"zombieHealth": 1,

"maxBotCap": 25,
"maxBotPerZone": 7,
"maxBotPerZone": 5,

"moreScavGroups": false,
"morePmcGroups": false,
Expand Down
Binary file removed dist/DewardianDev-MOAR-2.6.1.zip
Binary file not shown.
Binary file added dist/DewardianDev-MOAR-2.6.3.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MOAR",
"version": "2.6.1",
"version": "2.6.3",
"main": "src/mod.js",
"license": "MIT",
"author": "DewardianDev",
Expand Down
10 changes: 7 additions & 3 deletions src/Spawning/Spawning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { DependencyContainer } from "tsyringe";
import { globalValues } from "../GlobalValues";
import { cloneDeep, getRandomPresetOrCurrentlySelectedPreset } from "../utils";
import {
cloneDeep,
getRandomPresetOrCurrentlySelectedPreset,
saveToFile,
} from "../utils";
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig.d";
import { originalMapList } from "./constants";
import { buildBossWaves } from "./buildBossWaves";
Expand Down Expand Up @@ -127,7 +131,7 @@ export const buildWaves = (container: DependencyContainer) => {
rezervbase: { pmcbot: { min: 0, max: 0 } },
};

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

setEscapeTimeOverrides(locationList, _mapConfig, Logger, config);

Expand All @@ -143,7 +147,7 @@ export const buildWaves = (container: DependencyContainer) => {
}

buildPmcs(config, locationList);

originalMapList.forEach((name, index) => {
if (!locations[name]) {
console.log("[MOAR] OH CRAP we have a problem!", name);
Expand Down
18 changes: 6 additions & 12 deletions src/Spawning/buildPmcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,22 @@ export default function buildPmcs(
.filter(
({ Categories, BotZoneName }) =>
!!BotZoneName &&
(Categories.includes("Player") ||
(map === "laboratory" &&
!BotZoneName.includes("BotZoneGate"))) &&
!BotZoneName.includes("snipe")
!BotZoneName.includes("snipe") &&
(Categories.includes("Player") || Categories.includes("All")) &&
!BotZoneName.includes("BotZoneGate")
)
.map(({ BotZoneName, ...rest }) => {
return BotZoneName;
})
),
...pmcHotZones,
]);

// Make labs have only named zones
if (map === "laboratory") {
pmcZones = new Array(10).fill(pmcZones).flat(1);
// console.log(pmcZones);
}

const timeLimit = locationList[index].base.EscapeTimeLimit * 60;

const { pmcWaveCount } = mapConfig[map];

const escapeTimeLimitRatio = Math.round(
Expand All @@ -58,13 +55,12 @@ export default function buildPmcs(
const totalWaves = Math.round(
pmcWaveCount * config.pmcWaveQuantity * escapeTimeLimitRatio
);
// console.log(pmcZones.length, totalWaves);

const numberOfZoneless = totalWaves - pmcZones.length;
if (numberOfZoneless > 0) {
const addEmpty = new Array(numberOfZoneless).fill("");
pmcZones = shuffle<string[]>([...pmcZones, ...addEmpty]);
}
// if (map === "laboratory") console.log(numberOfZoneless, pmcZones);

if (config.debug) {
console.log(`${map} PMC count ${totalWaves} \n`);
Expand All @@ -74,11 +70,9 @@ export default function buildPmcs(
`${map} PMC wave count changed from ${pmcWaveCount} to ${totalWaves} due to escapeTimeLimit adjustment`
);
}
const timeLimit = locationList[index].base.EscapeTimeLimit * 60;

const waves = buildPmcWaves(pmcWaveCount, timeLimit, config, pmcZones);
// if (map === "laboratory")
// console.log(waves.map(({ BossZone }) => BossZone));
// apply our new waves
locationList[index].base.BossLocationSpawn = [
...waves,
...locationList[index].base.BossLocationSpawn,
Expand Down
46 changes: 19 additions & 27 deletions src/Spawning/buildScavMarksmanWaves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,16 @@ export default function buildScavMarksmanWaves(
const sniperLocations = new Set(
[...locationList[index].base.SpawnPointParams]
.filter(
({ Categories, Sides, BotZoneName }) =>
!!BotZoneName &&
Sides.includes("Savage") &&
!Categories.includes("Boss")
({ Categories, DelayToCanSpawnSec, BotZoneName, Sides }) =>
!Categories.includes("Boss") &&
Sides[0] === "Savage" &&
(BotZoneName?.toLowerCase().includes("snipe") ||
DelayToCanSpawnSec > 40)
)
.filter(
({ BotZoneName, DelayToCanSpawnSec }) =>
BotZoneName?.toLowerCase().includes("snipe") ||
DelayToCanSpawnSec > 300
)
.map(({ BotZoneName }) => BotZoneName)
.map(({ BotZoneName }) => BotZoneName || "")
);


if (sniperLocations.size) {
locationList[index].base.MinMaxBots = [
{
Expand All @@ -112,32 +109,21 @@ export default function buildScavMarksmanWaves(
];
}

const scavZones = shuffle<string[]>([
let scavZones = shuffle<string[]>([
...new Set(
[...locationList[index].base.SpawnPointParams]
.filter(
({ Categories, Sides, BotZoneName }) =>
!!BotZoneName &&
Sides.includes("Savage") &&
!Categories.includes("Boss")
Categories.includes("Bot") &&
(Sides.includes("Savage") || Sides.includes("All"))
)
.map(({ BotZoneName }) => BotZoneName)
.filter((name) => !sniperLocations.has(name))
),
]);

// Reduced Zone Delay
locationList[index].base.SpawnPointParams = locationList[
index
].base.SpawnPointParams.map((spawn) => ({
...spawn,
DelayToCanSpawnSec:
spawn.DelayToCanSpawnSec > 20
? Math.round(spawn.DelayToCanSpawnSec / 10)
: spawn.DelayToCanSpawnSec,
}));

const timeLimit = locationList[index].base.EscapeTimeLimit * 60;
const { scavWaveCount } = mapConfig[map];

const escapeTimeLimitRatio = Math.round(
Expand All @@ -149,12 +135,19 @@ export default function buildScavMarksmanWaves(
scavWaveCount * scavWaveQuantity * escapeTimeLimitRatio
);

const numberOfZoneless = scavTotalWaveCount - scavZones.length;
// console.log(numberOfZoneless);
if (numberOfZoneless > 0) {
const addEmpty = new Array(numberOfZoneless).fill("");
scavZones = shuffle<string[]>([...scavZones, ...addEmpty]);
}
// console.log(scavZones);
config.debug &&
escapeTimeLimitRatio !== 1 &&
console.log(
`${map} Scav wave count changed from ${scavWaveCount} to ${scavTotalWaveCount} due to escapeTimeLimit adjustment`
);

const timeLimit = locationList[index].base.EscapeTimeLimit * 60;
let snipers = waveBuilder(
sniperLocations.size,
Math.round(timeLimit / 4),
Expand All @@ -166,14 +159,13 @@ export default function buildScavMarksmanWaves(
[],
shuffle([...sniperLocations]),
80,
false,
true,
true
);

if (snipersHaveFriends)
snipers = snipers.map((wave) => ({
...wave,
slots_min: 0,
...(snipersHaveFriends && wave.slots_max < 2
? { slots_min: 1, slots_max: 2 }
: {}),
Expand Down
99 changes: 83 additions & 16 deletions src/Spawning/updateSpawnLocations.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,103 @@
import { ILocation } from "@spt/models/eft/common/ILocation";
import { configLocations } from "./constants";
import mapConfig from "../../config/mapConfig.json";
import _config from "../../config/config.json";

export default function updateSpawnLocations(locationList: ILocation[]) {
export default function updateSpawnLocations(
locationList: ILocation[],
config: typeof _config
) {
for (let index = 0; index < locationList.length; index++) {
const map = configLocations[index];

// console.log(map);
const limit = mapConfig[map].spawnMinDistance;

// console.log("\n" + map);
locationList[index].base.SpawnPointParams.forEach(
(
{ ColliderParams, BotZoneName, DelayToCanSpawnSec, Categories, Sides },
{
ColliderParams,
BotZoneName,
DelayToCanSpawnSec,
Categories,
Sides,
Infiltration,
},
innerIndex
) => {
if (
ColliderParams?._props?.Radius !== undefined &&
ColliderParams?._props?.Radius < limit &&
!Categories.includes("Boss") &&
!BotZoneName?.toLowerCase().includes("snipe") &&
DelayToCanSpawnSec < 300
DelayToCanSpawnSec < 41
) {
// console.log(
// "----",
// ColliderParams._props.Radius,
// "=>",
// limit,
// BotZoneName
// );
// Make it so players can spawn anywhere.
if (
config.playerOpenZones &&
!!Infiltration &&
(Sides.includes("Pmc") || Sides.includes("All")) &&
Categories.length === 1 &&
Categories[0] === "Player"
) {
locationList[index].base.SpawnPointParams[innerIndex].Categories = [
"Player",
"Coop",
innerIndex % 2 === 0 ? "Group" : "Opposite",
];

// console.log(
// BotZoneName || "none",
// locationList[index].base.SpawnPointParams[innerIndex].Categories,
// locationList[index].base.SpawnPointParams[innerIndex].Sides
// );
}

if (
config.pmcOpenZones &&
Categories.includes("Bot") &&
Sides[0] === "Savage" &&
!Infiltration
) {
locationList[index].base.SpawnPointParams[innerIndex].Categories = [
"Player",
"Bot",
];
}

if (!Infiltration && config.allOpenZones) {
locationList[index].base.SpawnPointParams[innerIndex].Categories = [
"Bot",
"Player",
"Coop",
innerIndex % 2 === 0 ? "Group" : "Opposite",
];
locationList[index].base.SpawnPointParams[innerIndex].Sides = [
"All",
];
}

locationList[index].base.SpawnPointParams[
innerIndex
].ColliderParams._props.Radius = limit;
if (
ColliderParams?._props?.Radius !== undefined &&
ColliderParams?._props?.Radius < limit
) {
locationList[index].base.SpawnPointParams[
innerIndex
].ColliderParams._props.Radius = limit;
}
} else {
if (!Categories.includes("Boss") && DelayToCanSpawnSec > 40) {
locationList[index].base.SpawnPointParams[
innerIndex
].DelayToCanSpawnSec = Math.round(
DelayToCanSpawnSec * Math.random() * Math.random()
);
// console.log(
// count,
// BotZoneName,
// DelayToCanSpawnSec,
// locationList[index].base.SpawnPointParams[innerIndex]
// .DelayToCanSpawnSec
// );
}
}
}
);
Expand Down
Loading

0 comments on commit f0f324d

Please sign in to comment.