Allow calling notifyWhenAttacked during spawning

  • Creep.prototype.notifyWhenAttacked has a check that prevents it from being called during spawning, which doesn't really make sense as that action doesn't affect the world around it.

    Also I think we should have an option in the spawnCreep call to disable notifications at spawn time.


  • This has annoyed me since the first time I wanted to use the notifyWhenAttacked function. I can't speak for other players, but I have never wanted to change the notification status of a creep programmatically except for once per creep, at the beginning of that creep's life. I would love either a spawn option or the ability to call the function while the creep is spawning.

  • This would be nice.

  • Quick hack to fix this.

    Creep.prototype._notifyWhenAttacked = Creep.prototype.notifyWhenAttacked;
    Creep.prototype.notifyWhenAttacked = function(notify) {
      const spawning = this.spawning;
      this.spawning = false;
      const ret = this._notifyWhenAttacked(notify);
      this.spawning = spawning;
      return ret;

    The processor doesn't check that the creep isn't spawning. So bypassing the client side check in Game is all you need.

    Getting rid of the restriction entirely is better idea though. The change is simple and sane enough that you would probably get it done faster by creating a pull request than asking them to do it for you.

    PS: Devs, please make an official intents api, most (all?) client side checks can be bypassed anyways.