From 579a0aec55ba6da408c74be6ce523b60626b3f9a Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sun, 6 May 2018 03:49:11 -0400 Subject: [PATCH] make script base cost a constant --- src/Constants.js | 1 + src/Script.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Constants.js b/src/Constants.js index 8c6aebfc0..6212c726f 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -40,6 +40,7 @@ let CONSTANTS = { /* Netscript Constants */ //RAM Costs for different commands + ScriptBaseRamCost: 1.4, ScriptWhileRamCost: 0.2, ScriptForRamCost: 0.2, ScriptIfRamCost: 0.15, diff --git a/src/Script.js b/src/Script.js index 5ccb5c05e..d4ca64dbb 100644 --- a/src/Script.js +++ b/src/Script.js @@ -417,7 +417,7 @@ function parseOnlyRamCalculate(server, code, workerScript) { // Finally, walk the reference map and generate a ram cost. The initial set of keys to scan // are those that start with __SPECIAL_INITIAL_MODULE__. - let ram = 1.4; + let ram = CONSTANTS.ScriptBaseRamCost; const unresolvedRefs = Object.keys(dependencyMap).filter(s => s.startsWith(initialModule)); const resolvedRefs = new Set(); while (unresolvedRefs.length > 0) {