I ran into an issue that seemed like a bug when trying to store an instance of a class in Memory. Here's some minimal code to reproduce it:
main.js:
class Doggo {
bark() {console.log('woof')}
}
module.exports.loop = function () {
if (Game.time % 5 == 0) {
Memory.pooch = new Doggo();
console.log("Single pooch instanceof Doggo (same tick as created): " + (Memory.pooch instanceof Doggo));
Memory.pooch.bark();
}
else {
console.log("Single pooch instanceof Doggo: " + (Memory.pooch instanceof Doggo));
Memory.pooch.bark();
}
}
And sample output: