From 087e93237c15f42661860e317ec14cbebfb9ad3b Mon Sep 17 00:00:00 2001 From: pathurs Date: Tue, 3 Oct 2017 19:37:36 +1100 Subject: [PATCH] Add configurable to memory property of creep, flag, room, spawn. --- src/game/creeps.js | 1 + src/game/flags.js | 1 + src/game/rooms.js | 1 + src/game/structures.js | 1 + 4 files changed, 4 insertions(+) diff --git a/src/game/creeps.js b/src/game/creeps.js index 845dea93..be7b6bc0 100644 --- a/src/game/creeps.js +++ b/src/game/creeps.js @@ -96,6 +96,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) { }); Object.defineProperty(Creep.prototype, 'memory', { + configurable: true, get: function() { if(this.id && !this.my) { return undefined; diff --git a/src/game/flags.js b/src/game/flags.js index 1469c89c..70f4de41 100644 --- a/src/game/flags.js +++ b/src/game/flags.js @@ -29,6 +29,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) { Flag.prototype.constructor = Flag; Object.defineProperty(Flag.prototype, 'memory', { + configurable: true, get: function() { if(_.isUndefined(globals.Memory.flags) || globals.Memory.flags === 'undefined') { globals.Memory.flags = {}; diff --git a/src/game/rooms.js b/src/game/rooms.js index d000a7e1..8b5c419d 100644 --- a/src/game/rooms.js +++ b/src/game/rooms.js @@ -511,6 +511,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) { }); Object.defineProperty(Room.prototype, 'memory', { + configurable: true, get: function() { if(_.isUndefined(globals.Memory.rooms) || globals.Memory.rooms === 'undefined') { globals.Memory.rooms = {}; diff --git a/src/game/structures.js b/src/game/structures.js index 1ab24513..2239097f 100644 --- a/src/game/structures.js +++ b/src/game/structures.js @@ -914,6 +914,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) { }); Object.defineProperty(StructureSpawn.prototype, 'memory', { + configurable: true, get: function() { if(!this.my) { return undefined;