Mod init
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
/* eslint-disable prefer-const */
|
||||
/* eslint-disable @typescript-eslint/brace-style */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ConfigTypes_1 = require("/snapshot/project/obj/models/enums/ConfigTypes");
|
||||
let botConfig;
|
||||
let pmcConfig;
|
||||
let configServer;
|
||||
class SAIN {
|
||||
postDBLoad(container) {
|
||||
configServer = container.resolve("ConfigServer");
|
||||
pmcConfig = configServer.getConfig(ConfigTypes_1.ConfigTypes.PMC);
|
||||
botConfig = configServer.getConfig(ConfigTypes_1.ConfigTypes.BOT);
|
||||
const databaseServer = container.resolve("DatabaseServer");
|
||||
const tables = databaseServer.getTables();
|
||||
// Only allow `pmcBot` brains to spawn for PMCs
|
||||
for (const pmcType in pmcConfig.pmcType) {
|
||||
for (const map in pmcConfig.pmcType[pmcType]) {
|
||||
const pmcBrains = pmcConfig.pmcType[pmcType][map];
|
||||
for (const brain in pmcBrains) {
|
||||
if (brain === "pmcBot") {
|
||||
pmcBrains[brain] = 1;
|
||||
}
|
||||
else {
|
||||
pmcBrains[brain] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Only allow `assault` brains for scavs
|
||||
for (const map in botConfig.assaultBrainType) {
|
||||
const scavBrains = botConfig.assaultBrainType[map];
|
||||
for (const brain in scavBrains) {
|
||||
if (brain === "assault") {
|
||||
scavBrains[brain] = 1;
|
||||
}
|
||||
else {
|
||||
scavBrains[brain] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Only allow `pmcBot` brains for player scavs
|
||||
for (const map in botConfig.playerScavBrainType) {
|
||||
const playerScavBrains = botConfig.playerScavBrainType[map];
|
||||
for (const brain in playerScavBrains) {
|
||||
if (brain === "pmcBot") {
|
||||
playerScavBrains[brain] = 1;
|
||||
}
|
||||
else {
|
||||
playerScavBrains[brain] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const locationName in tables.locations) {
|
||||
const location = tables.locations[locationName].base;
|
||||
if (location && location.BotLocationModifier) {
|
||||
location.BotLocationModifier.AccuracySpeed = 1;
|
||||
location.BotLocationModifier.GainSight = 1;
|
||||
location.BotLocationModifier.Scattering = 1;
|
||||
location.BotLocationModifier.VisibleDistance = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = { mod: new SAIN() };
|
||||
//# sourceMappingURL=mod.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mod.js","sourceRoot":"","sources":["mod.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,mDAAmD;;AAEnD,gFAA6E;AAQ7E,IAAI,SAAqB,CAAC;AAC1B,IAAI,SAAqB,CAAC;AAC1B,IAAI,YAA0B,CAAC;AAE/B,MAAM,IAAI;IACC,UAAU,CAAC,SAA8B;QAC5C,YAAY,GAAG,SAAS,CAAC,OAAO,CAAe,cAAc,CAAC,CAAC;QAC/D,SAAS,GAAG,YAAY,CAAC,SAAS,CAAa,yBAAW,CAAC,GAAG,CAAC,CAAC;QAChE,SAAS,GAAG,YAAY,CAAC,SAAS,CAAa,yBAAW,CAAC,GAAG,CAAC,CAAC;QAChE,MAAM,cAAc,GAAG,SAAS,CAAC,OAAO,CAAiB,gBAAgB,CAAC,CAAC;QAC3E,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC;QAE1C,+CAA+C;QAC/C,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,OAAO,EACvC,CAAC;YACG,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAC5C,CAAC;gBACG,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAA;gBACjD,KAAK,MAAM,KAAK,IAAI,SAAS,EAC7B,CAAC;oBACG,IAAI,KAAK,KAAK,QAAQ,EACtB,CAAC;wBACG,SAAS,CAAC,KAAK,CAAC,GAAG,CA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,CAAC,CAAC;gBAC3C,QAAQ,CAAC,mBAAmB,CAAC,UAAU,GAAG,CAAC,CAAC;gBAC5C,QAAQ,CAAC,mBAAmB,CAAC,eAAe,GAAG,CAAC,CAAC;YACrD,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AACD,MAAM,CAAC,OAAO,GAAG,EAAE,GAAG,EAAE,IAAI,IAAI,EAAE,EAAE,CAAA"}
|
||||
@@ -0,0 +1,92 @@
|
||||
/* eslint-disable prefer-const */
|
||||
/* eslint-disable @typescript-eslint/brace-style */
|
||||
|
||||
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
||||
import { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod";
|
||||
import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig";
|
||||
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
|
||||
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
|
||||
let botConfig: IBotConfig;
|
||||
let pmcConfig: IPmcConfig;
|
||||
let configServer: ConfigServer;
|
||||
|
||||
class SAIN implements IPostDBLoadMod {
|
||||
public postDBLoad(container: DependencyContainer): void {
|
||||
configServer = container.resolve<ConfigServer>("ConfigServer");
|
||||
pmcConfig = configServer.getConfig<IPmcConfig>(ConfigTypes.PMC);
|
||||
botConfig = configServer.getConfig<IBotConfig>(ConfigTypes.BOT);
|
||||
const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
|
||||
const tables = databaseServer.getTables();
|
||||
|
||||
// Only allow `pmcBot` brains to spawn for PMCs
|
||||
for (const pmcType in pmcConfig.pmcType)
|
||||
{
|
||||
for (const map in pmcConfig.pmcType[pmcType])
|
||||
{
|
||||
const pmcBrains = pmcConfig.pmcType[pmcType][map]
|
||||
for (const brain in pmcBrains)
|
||||
{
|
||||
if (brain === "pmcBot")
|
||||
{
|
||||
pmcBrains[brain] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pmcBrains[brain] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only allow `assault` brains for scavs
|
||||
for (const map in botConfig.assaultBrainType)
|
||||
{
|
||||
const scavBrains = botConfig.assaultBrainType[map];
|
||||
for (const brain in scavBrains)
|
||||
{
|
||||
if (brain === "assault")
|
||||
{
|
||||
scavBrains[brain] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
scavBrains[brain] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only allow `pmcBot` brains for player scavs
|
||||
for (const map in botConfig.playerScavBrainType)
|
||||
{
|
||||
const playerScavBrains = botConfig.playerScavBrainType[map];
|
||||
for (const brain in playerScavBrains)
|
||||
{
|
||||
if (brain === "pmcBot")
|
||||
{
|
||||
playerScavBrains[brain] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
playerScavBrains[brain] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const locationName in tables.locations)
|
||||
{
|
||||
const location = tables.locations[locationName].base;
|
||||
|
||||
if (location && location.BotLocationModifier)
|
||||
{
|
||||
location.BotLocationModifier.AccuracySpeed = 1;
|
||||
location.BotLocationModifier.GainSight = 1;
|
||||
location.BotLocationModifier.Scattering = 1;
|
||||
location.BotLocationModifier.VisibleDistance = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = { mod: new SAIN() }
|
||||
Reference in New Issue
Block a user