For user code, Game.cpu.getUsed() returns NaN which seems to also be corrupting bucket data.
Steps to reproduce: after starting a server and resetting its data, get spawned in and set this main module code as the whole bot:
module.exports.loop = function () {
console.log(`cpu used ${Game.cpu.getUsed()}, ${JSON.stringify(Game.cpu)}`);
}
This results in the output: cpu used NaN, {"tickLimit":100,"limit":100,"bucket":0} each tick; the bucket number never accumulates.
In the database, the user's bucket value (cpuAvailable) is NaN, as well as a couple other CPU values:
storage.db["users"].findOne({ username: "bot" })
{
#...(snipped irrelevant fields)...
cpu: 100,
cpuAvailable: NaN,
active: 10000,
lastUsedCpu: NaN,
lastUsedDirtyTime: NaN,
}
Setting cpuAvailable to an integer value has no apparent effect and seems to be written back to NaN on next tick.
For user code,
Game.cpu.getUsed()returnsNaNwhich seems to also be corrupting bucket data.Steps to reproduce: after starting a server and resetting its data, get spawned in and set this main module code as the whole bot:
This results in the output:
cpu used NaN, {"tickLimit":100,"limit":100,"bucket":0}each tick; the bucket number never accumulates.In the database, the user's bucket value (
cpuAvailable) isNaN, as well as a couple other CPU values:Setting
cpuAvailableto an integer value has no apparent effect and seems to be written back toNaNon next tick.