Draft: Power Creeps API


  • SUN

    @helam Also, given that power creeps are essentially defenseless in non-power enabled rooms, it would be very useful to be able to avoid pathing through those rooms.


  • Dev Team

    @helam No, the power enabled flag is available only for objects loaded from the database (i.e. visible rooms). You may want to observe them yourself periodically and cache this info. It's not like novice/respawn areas, since you do have the way to check it, you just need to obtain visibility.



  • @artch so Room objects will have a property to tell us if power is enabled or not? If we can observe it this is good.


  • Dev Team

    @helam It's Room.controller.isPowerEnabled, see the first post here:

    StructureController.prototype.isPowerEnabled

    A boolean value indicating whether power usage is enabled in this room.



  • @artch O.o I must have missed that, sorry and thank you. Has it been decided how to handle power in rooms without controllers? In this post (https://screeps.com/forum/topic/2183/power-creeps-update/19) it was mentioned that it had not been decided yet.



  • Will there a method to get all available (created in account) power creeps? Something like Game.powerCreeps or PowerCreep.getCreeps(). Will they also occured in Game.creeps? If yes then only if spawned or when unspawned too? Also maybe there must by a property spawned in any case.


  • Dev Team

    @u-238

    Will there a method to get all available (created in account) power creeps? Something like Game.powerCreeps or PowerCreep.getCreeps().

    I think that examples in the first post answer your question. It's Game.powerCreeps.

    Also maybe there must by a property spawned in any case.

    spawnCooldown property serves this purpose:

    the number of ticks to wait until the creep can be spawned in the world, or undefined if it is already spawned;



  • @helam @artch

    If power creeps work in rooms without controllers, please consider adding a isPowerEnabled property on the room instead of on the controller.

    Also please consider making a better way for me to tell if one of my rooms is being attacked with a power apart from periodically cycling through every single roomObject in every single room I own to check if there is an entry in .effects that I don't expect to be there. For hostile effects, it would be amazing if you told me which player owns the effect.

    For instance, maybe there could be a Room.activeEffects property that is an array of all the effects active in a room. Even better would be if it were a hashmap to a list of effects indexed by owner. So Room.activeEffects['shedletsky'] will give me an array of all my active effects.


  • Dev Team

    @shedletsky I think that adding power events to the room events log will be more correct approach.



  • @artch Yes, I didn't know about the room event log when I posted. I think adding the owner/creator as a property on each effect in the log would be helpful, otherwise figuring out when I'm being messed with could be challenging.