Draft: Power Creeps API


  • Dev Team

    @tigga

    Looks good! Should delete be suicide to match with regular creeps?

    suicide is when the creep is killed and becomes not spawned in the world, but still exists and occupies Power Levels. delete is when it is totally removed from your account.

    Will power spawns also need a Spawning object and/or?

    No, due to this: The creep is spawned immediately on the next tick.



  • PowerSpawn.prototype.spawnPowerCreep(name)

    Should this have a directions property? It would be great to not spawn my power creeps outside of ramparts if I have a power spawn on the edge of a defended line.

    Since I don't see any "can spawn" functions, are we to assume that power creeps are free to spawn if they are off cooldown? 😢

    PowerCreep.prototype.delete()
    The creep must not be spawned in the world in order to call this method.

    Why does this require the power creep be spawned? So, if while testing I create a power creep, and then I want to delete it, I have to spawn it first?

    Otherwise this looks great!


  • Dev Team

    @gankdalf

    Should this have a directions property? It would be great to not spawn my power creeps outside of ramparts if I have a power spawn on the edge of a defended line.

    We'll consider it.

    Since I don't see any "can spawn" functions, are we to assume that power creeps are free to spawn if they are off cooldown?

    Yes, they are free to spawn.

    Why does this require the power creep be spawned?

    You misread, it requires the creep to be NOT spawned.

    😬


  • You misread, it requires the creep to be NOT spawned.

    That makes so much more sense.



  • Will there be anything like the following:

    Game.map.isPowerEnabled(roomName)?

    Room.prototype.powerEnabled?

    It would be good to make sure that every possible information gathering feature is added for anything related to all of this. Want to avoid informational gaps similar to the lack of a way to know which rooms on the map are blocked by novice/respawn zones or not.


  • 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.