Esempio n. 1
0
  /* (non-Javadoc)
   * @see org.virtue.game.entity.Entity#process()
   */
  @Override
  public void process() {
    if (owner != null) {
      if (!owner.exists()) {
        this.destroy();
      }
    }
    if (respawnTime > 0) {
      respawnTime--;
    } else if (respawnTime == 0) {
      respawn();
      respawnTime = -1;
    }
    if (!this.exists()) {
      return;
    }
    if (canWalk()) {
      processRandomWalk();
    }

    if (currentAction != null) {
      try {
        if (currentAction.process(this)) {
          currentAction.stop(this);
          currentAction = null;
        }
      } catch (RuntimeException ex) {
        logger.error("Error running action for npc " + typeId, ex);
        currentAction = null;
      }
    }
    super.process();
  }
Esempio n. 2
0
 /* (non-Javadoc)
  * @see org.virtue.game.entity.Entity#stopAll()
  */
 @Override
 public void stopAll() {
   super.stopAll();
   if (currentAction != null) {
     currentAction.stop(this);
     currentAction = null;
   }
 }