diff --git a/src/game/creeps.js b/src/game/creeps.js index fa1238d5..682271ed 100644 --- a/src/game/creeps.js +++ b/src/game/creeps.js @@ -98,7 +98,8 @@ exports.make = function(_runtimeData, _intents, _register, _globals) { throw new Error('Could not set creep memory'); } globals.Memory.creeps[this.name] = value; - } + }, + configurable: true }); Creep.prototype.toString = register.wrapFn(function() { diff --git a/src/game/flags.js b/src/game/flags.js index 1469c89c..66ed3b64 100644 --- a/src/game/flags.js +++ b/src/game/flags.js @@ -47,7 +47,8 @@ exports.make = function(_runtimeData, _intents, _register, _globals) { throw new Error('Could not set flag memory'); } globals.Memory.flags[this.name] = value; - } + }, + configurable: true }); Flag.prototype.toString = register.wrapFn(function() { diff --git a/src/game/game.js b/src/game/game.js index 224a3e2b..8a323a3c 100644 --- a/src/game/game.js +++ b/src/game/game.js @@ -429,13 +429,16 @@ runCodeCache[userId].memory._parsed = null; } + this.Memory = runCodeCache[userId].memory._parsed; + + return runCodeCache[userId].memory._parsed; + }, + set(memory) { Object.defineProperty(runCodeCache[userId].globals, 'Memory', { configurable: true, enumerable: true, - value: runCodeCache[userId].memory._parsed + value: memory }); - - return runCodeCache[userId].memory._parsed; } }); diff --git a/src/game/rooms.js b/src/game/rooms.js index b2ee09ba..b484430e 100644 --- a/src/game/rooms.js +++ b/src/game/rooms.js @@ -532,7 +532,8 @@ exports.make = function(_runtimeData, _intents, _register, _globals) { throw new Error('Could not set room memory'); } globals.Memory.rooms[this.name] = value; - } + }, + configurable: true }); Room.prototype.find = register.wrapFn(function(type, opts) { diff --git a/src/game/structures.js b/src/game/structures.js index 5df958ae..bf256f51 100644 --- a/src/game/structures.js +++ b/src/game/structures.js @@ -912,7 +912,8 @@ exports.make = function(_runtimeData, _intents, _register, _globals) { throw new Error('Could not set spawn memory'); } globals.Memory.spawns[data(this.id).name] = value; - } + }, + configurable: true }); StructureSpawn.prototype.toString = register.wrapFn(function() {