I've added the loop
let val;
for(val in controller_X) {
console.log(controller_1[val])
}
after both controllders were defined.
For the controller_1 that loop returns that:
[22:03:55][shard3]5bbcaabd9099fc012e6321b9
[22:03:55][shard3][room W42S38]
[22:03:55][shard3][room W42S38 pos 18,39]
[22:03:55][shard3]undefined
[22:03:55][shard3]function (id) {
OwnedStructure.call(this, id);
}
[22:03:55][shard3]undefined
[22:03:55][shard3][object Object]
[22:03:55][shard3]0
[22:03:55][shard3]undefined
[22:03:55][shard3]undefined
[22:03:55][shard3]undefined
[22:03:55][shard3]undefined
[22:03:55][shard3]undefined
[22:03:55][shard3]0
[22:03:55][shard3]undefined
[22:03:55][shard3]false
[22:03:55][shard3]function() {
var result = {};
for(var i in this) {
if(i[0] == '_' || _.contains(['toJSON','toString'],i)) {
continue;
}
result[i] = this[i];
}
return result;
}
[22:03:55][shard3]function() {
if(!this.my) {
return C.ERR_NOT_OWNER;
}
intents.set(this.id, 'unclaim', {});
return C.OK;
}
[22:03:55][shard3]function() {
if(!this.my) {
return C.ERR_NOT_OWNER;
}
if(this.safeModeAvailable <= 0) {
return C.ERR_NOT_ENOUGH_RESOURCES;
}
if(this.safeModeCooldown || this.upgradeBlocked > 0 ||
this.ticksToDowngrade < C.CONTROLLER_DOWNGRADE[this.level]/2 - C.CONTROLLER_DOWNGRADE_SAFEMODE_THRESHOLD) {
return C.ERR_TIRED;
}
if(_.any(register.structures, i => i.structureType == 'controller' && i.my && i.safeMode)) {
return C.ERR_BUSY;
}
if(lastActivateSafeMode) {
intents.remove(lastActivateSafeMode, 'activateSafeMode');
}
lastActivateSafeMode = this.id;
intents.set(this.id, 'activateSafeMode', {});
return C.OK;
}
[22:03:55][shard3]undefined
[22:03:55][shard3]undefined
[22:03:55][shard3]undefined
[22:03:55][shard3]undefined
[22:03:55][shard3]controller
[22:03:55][shard3]function() {
return `[structure (${this.structureType}) #${this.id}]`;
}
[22:03:55][shard3]function() {
if(!this.room) {
return C.ERR_INVALID_TARGET;
}
if(!this.room.controller || !this.room.controller.my) {
return C.ERR_NOT_OWNER;
}
if(this.room.find(C.FIND_HOSTILE_CREEPS).length > 0 ||
this.room.find(C.FIND_HOSTILE_POWER_CREEPS).length > 0) {
return C.ERR_BUSY;
}
intents.pushByName('room', 'destroyStructure', {roomName: this.room.name, id: this.id});
return C.OK;
}
[22:03:55][shard3]function(enabled) {
if(!this.room) {
return C.ERR_INVALID_TARGET;
}
if(this.my === false || (this.room.controller && this.room.controller.owner && !this.room.controller.my)) {
return C.ERR_NOT_OWNER;
}
if(!_.isBoolean(enabled)) {
return C.ERR_INVALID_ARGS;
}
if(enabled != data(this.id).notifyWhenAttacked) {
intents.set(this.id, 'notifyWhenAttacked', {enabled});
}
return C.OK;
}
[22:03:55][shard3]function() {
if(!this.owner) {
return true;
}
if(!C.CONTROLLER_STRUCTURES[data(this.id).type]) {
return true;
}
if(!this.room || !this.room.controller) {
return false;
}
return utils.checkStructureAgainstController(data(this.id), register.objectsByRoom[data(this.id).room], data(this.room.controller.id));
}
But for the controller_2 that loop returns that:
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]function Array() { [native code] }
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]function toString() { [native code] }
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
[22:03:23][shard3]undefined
Look like that is the reason why method creep.reserveController(target) doesn't work for the second case.
Is that an error, or expected behavior?