Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
breaking apart globals for customization
Browse files Browse the repository at this point in the history
  • Loading branch information
king committed Jan 24, 2023
1 parent 0e8bf8f commit df7df0a
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 3 deletions.
3 changes: 3 additions & 0 deletions assets/database/configs/gameplay.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
},
"raid": {
"allowSelectEntryPoint": true,
"removeRestrictionsInRaid": true,
"_useCustomizedStaminaSettings": "/assets/database/configs/globals/stamina.json",
"useCustomizedStaminaSettings": true,
"maxBotsAliveOnMap": 20,
"waveCoef": {
"low": 1,
Expand Down
129 changes: 129 additions & 0 deletions assets/database/configs/globals/stamina.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"Stamina": {
"Capacity": 100,
"SprintDrainRate": 4.2,
"BaseRestorationRate": 4.4,
"JumpConsumption": 16,
"GrenadeHighThrow": 11,
"GrenadeLowThrow": 8,
"AimDrainRate": 1.1,
"AimRangeFinderDrainRate": 0.55,
"OxygenCapacity": 300,
"OxygenRestoration": 4,
"WalkOverweightLimits": {
"x": 42,
"y": 70,
"z": 0
},
"BaseOverweightLimits": {
"x": 21,
"y": 62,
"z": 0
},
"SprintOverweightLimits": {
"x": 21,
"y": 58,
"z": 0
},
"WalkSpeedOverweightLimits": {
"x": 32,
"y": 70,
"z": 0
},
"CrouchConsumption": {
"x": 0.17,
"y": 1,
"z": 0
},
"WalkConsumption": {
"x": 0.2,
"y": 0.5,
"z": 0
},
"StandupConsumption": {
"x": 10,
"y": 20,
"z": 0
},
"TransitionSpeed": {
"x": 1,
"y": 0.66,
"z": 0
},
"SprintAccelerationLowerLimit": 0.8,
"SprintSpeedLowerLimit": 0.1,
"SprintSensitivityLowerLimit": 0.5,
"AimConsumptionByPose": {
"x": 0.15,
"y": 0.75,
"z": 1
},
"RestorationMultiplierByPose": {
"x": 1.45,
"y": 1.25,
"z": 1
},
"OverweightConsumptionByPose": {
"x": -4,
"y": -3,
"z": 0
},
"AimingSpeedMultiplier": 0.4,
"WalkVisualEffectMultiplier": 0.1,
"HandsCapacity": 70,
"HandsRestoration": 2.1,
"ProneConsumption": 1,
"BaseHoldBreathConsumption": 4,
"SoundRadius": {
"x": 1,
"y": 4,
"z": 0
},
"ExhaustedMeleeSpeed": 0.65,
"FatigueRestorationRate": 0.42,
"FatigueAmountToCreateEffect": 15,
"ExhaustedMeleeDamageMultiplier": 0.33,
"FallDamageMultiplier": 3.9,
"SafeHeightOverweight": 1.75,
"SitToStandConsumption": 1,
"StaminaExhaustionCausesJiggle": true,
"StaminaExhaustionStartsBreathSound": true,
"StaminaExhaustionRocksCamera": false,
"HoldBreathStaminaMultiplier": {
"x": 2,
"y": 1,
"z": 0
},
"PoseLevelIncreaseSpeed": {
"x": 0.65,
"y": 0.4,
"z": 0
},
"PoseLevelDecreaseSpeed": {
"x": 0.85,
"y": 0.6,
"z": 0
},
"PoseLevelConsumptionPerNotch": {
"x": 1.1,
"y": 3,
"z": 0
}
},
"StaminaRestoration": {
"LowerLeftPoint": 0.9,
"LowerRightPoint": 0.5,
"LeftPlatoPoint": 0.1,
"RightPlatoPoint": 0.9,
"RightLimit": 1.5,
"ZeroValue": 0.07
},
"StaminaDrain": {
"LowerLeftPoint": 1.2,
"LowerRightPoint": 1.5,
"LeftPlatoPoint": 0.9,
"RightPlatoPoint": 1,
"RightLimit": 1.5,
"ZeroValue": 2
}
}
45 changes: 42 additions & 3 deletions lib/engine/DatabaseLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,45 @@ class DatabaseLoader {

//raid
config["AllowSelectEntryPoint"] = gameplay.raid.allowSelectEntryPoint;
[config.TimeBeforeDeploy, config.TimeBeforeDeployLocal] = [gameplay.raid.timeBeforeDeploy, gameplay.raid.timeBeforeDeploy]

[config.TimeBeforeDeploy, config.TimeBeforeDeployLocal] = [gameplay.raid.timeBeforeDeploy, gameplay.raid.timeBeforeDeploy];

if (gameplay.raid.removeRestrictionsInRaid)
config.RestrictionsInRaid = [];

if (gameplay.raid.useCustomizedStaminaSettings) {
const stamina = await readParsed(gameplay.raid._useCustomizedStaminaSettings, true);
const [Stamina, StaminaRestoration, StaminaDrain] =
[stamina.Stamina, stamina.StaminaRestoration, stamina.StaminaDrain];

let changed = false;
for (const [key, value] of Object.entries(config.Stamina)) {
if (!Stamina.hasOwnProperty(key)) {
Stamina[key] = value;
if (!changed)
changed = true;
}
}
for (const [key, value] of Object.entries(config.StaminaRestoration)) {
if (!StaminaRestoration.hasOwnProperty(key)) {
StaminaRestoration[key] = value;
if (!changed)
changed = true;
}
}
for (const [key, value] of Object.entries(config.StaminaDrain)) {
if (!StaminaDrain.hasOwnProperty(key)) {
StaminaDrain[key] = value;
if (!changed)
changed = true;
}
}

if (changed) {
await writeFile(gameplay.raid._useCustomizedStaminaSettings, stringify(stamina), true);
logger.warn(`Stamina settings have been updated in ${gameplay.raid._useCustomizedStaminaSettings}. All custom adjustments have been transfered. If you don't care, ignore this prompt!`);
}
}

//bots
config.MaxBotsAliveOnMap = gameplay.raid.maxBotsAliveOnMap;
Expand Down Expand Up @@ -184,7 +222,8 @@ class DatabaseLoader {
for (const item of template.Items) {
// Tasmanian Tiger Trooper 35 is mis-categorized
if (item.Id === "639346cc1c8f182ad90c8972") {
item.ParentId = "5b5f6f6c86f774093f2ecf0b";
if (item.ParentId !== "5b5f6f6c86f774093f2ecf0b")
item.ParentId = "5b5f6f6c86f774093f2ecf0b";
break;
}
}
Expand Down Expand Up @@ -272,7 +311,7 @@ class DatabaseLoader {
}

location.base = await readParsed(`${path}/base.json`);

location.dynamicAvailableSpawns = await readParsed(`${path}/availableSpawns.json`);

// load presets (default bsg variants varied from 1 to 6)
Expand Down

0 comments on commit df7df0a

Please sign in to comment.