Trying to withdraw from a container from inside a safemode room results in ERR_NOT_OWNER even if container is not in that room



  • If I have a creep that is trying to withdraw from a container with code like:

    if (creep.withdraw(container, RESOURCE_ENERGY) === ERR_NOT_IN_RANGE) {
      creep.moveTo(container);
    }

    and the creep is in an enemy room with safe mode activated, the withdraw call will fail with ERR_NOT_OWNER, even though the container itself is in a different room that doesn't have safe mode on, and doesn't have a hostile rampart over it.

    The call should not fail in this case.

    The documentation for withdraw lacks mentions of the effect of safe mode too.


  • YP

    While I agree that it does not make sense to block the call completly when the target is not in the room, it is documented in the StructureController documentation that all calls of the withdraw function are blocked in the room with safe mode activated.

    Blocks attackrangedAttackrangedMassAttackdismantlehealrangedHealattackController and withdraw methods of all hostile creeps in the room.

     



  • I'd hope a mention of the safe mode would find its way into the error code list in these methods



  • I created a pull request with the documentation changes: https://github.com/screeps/docs/pull/54