Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// removeThatFromThis.js
(function () {
  /*global adventurejs A*/
  "use strict";
  var p = adventurejs.Tangible.prototype;
  /**
   * Removes an asset from another asset. It's not meant to be
   * called directly, but is the last piece, or bedrock, of the
   * removal process after checking for custom logic.
   * @memberOf adventurejs.Tangible
   * @method adventurejs.Tangible#removeThatFromThis
   * @param {Object} asset
   */
  p.removeThatFromThis = function Tangible_removeThatFromThis(asset) {
    this.game.log(
      "log",
      "high",
      this.name + " removeThatFromThis " + asset.name + ".",
      "Behavior"
    );
    for (var aspect in this.aspects) {
      if (!this.hasAspectAt(aspect)) {
        continue;
      }
      if (-1 < this.aspects[aspect].contents.indexOf(asset.id)) {
        this.aspects[aspect].contents.splice(
          this.aspects[aspect].contents.indexOf(asset.id),
          1
        );
      }
    }
    return;
  };
})();