Event handlers



  • Event callbacks on a given room (for example) would make reacting to certain events much more efficient.

    Say my code calls for a total of 20 creeps in a given room. I can try to create them all every tick until one returns a success, or I could create them all initially, and then only react when one expires for whatever reason.

    Ditto for reacting to Enemy Incursions. I could either try to attack the nearest enemy with my guards every tick, even when there are no enemies to attack, or I could set some flag when an enemy appears and clear it when they're all gone.

    You're letting people change the prototypes for their creeps, spawners, and so forth. Callbacks are entirely possible, they'd just need some code support and documentation.



  • I'm afraid such implementations need to be build from the ground up (there is no open and generic implementation about this yet as far as I know), but luckily there is a Memory object which is able to store a lot of reusable data. This should be a good base for an eventual design for an actual implementation.