MISC: move server constants into their own constant (#1075)

This commit is contained in:
Caldwell
2024-02-10 10:13:42 +01:00
committed by GitHub
parent fd5b0f8241
commit 4d551915b3
13 changed files with 56 additions and 48 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
import { CONSTANTS } from "../../Constants";
import { currentNodeMults } from "../../BitNode/BitNodeMultipliers";
import { Person as IPerson, Server as IServer } from "@nsdefs";
import { ServerConstants } from "../data/Constants";
// Returns the log of the growth rate. When passing 1 for threads, this gives a useful constant.
export function calculateServerGrowthLog(server: IServer, threads: number, p: IPerson, cores = 1): number {
@@ -10,9 +10,9 @@ export function calculateServerGrowthLog(server: IServer, threads: number, p: IP
//Get adjusted growth log, which accounts for server security
//log1p computes log(1+p), it is far more accurate for small values.
let adjGrowthLog = Math.log1p(CONSTANTS.ServerBaseGrowthIncr / hackDifficulty);
if (adjGrowthLog >= CONSTANTS.ServerMaxGrowthLog) {
adjGrowthLog = CONSTANTS.ServerMaxGrowthLog;
let adjGrowthLog = Math.log1p(ServerConstants.ServerBaseGrowthIncr / hackDifficulty);
if (adjGrowthLog >= ServerConstants.ServerMaxGrowthLog) {
adjGrowthLog = ServerConstants.ServerMaxGrowthLog;
}
//Calculate adjusted server growth rate based on parameters