diff --git a/src/NetscriptFunctions/Hacknet.ts b/src/NetscriptFunctions/Hacknet.ts index bb93b87e4..cbe6a433a 100644 --- a/src/NetscriptFunctions/Hacknet.ts +++ b/src/NetscriptFunctions/Hacknet.ts @@ -201,7 +201,11 @@ export function NetscriptHacknet(): InternalAPI { (_upgName, _upgTarget = "", _count = 1) => { const upgName = helpers.string(ctx, "upgName", _upgName); const upgTarget = helpers.string(ctx, "upgTarget", _upgTarget); - const count = helpers.number(ctx, "count", _count); + const count = Math.floor(helpers.number(ctx, "count", _count)); + // TODO (3.0.0): use helpers.positiveInteger + if (!(count >= 0)) { + throw helpers.errorMessage(ctx, "count may not be negative"); + } if (!hasHacknetServers()) { return false; }