Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// setVesselAt.js
(function () {
  /*global adventurejs A*/
  "use strict";
  var p = adventurejs.Tangible.prototype;
  /**
   * Add a substance container at the specified aspect on this asset.
   * @memberOf adventurejs.Tangible
   * @method adventurejs.Tangible#setVesselAt
   * @param {string} aspect - The aspect to add.
   * @return {Array}
   */
  p.setVesselAt = function Tangible_addVesselAt(aspect, params) {
    if (!this.hasAspectAt(aspect)) {
      this.setAspectAt(aspect, { parent_id: this.id });
    }
    if (!this.hasVesselAtAspect(aspect)) {
      if (!params) params = {};
      if (!params.parent_id) params.parent_id = this.id;
      this.aspects[aspect] = new adventurejs.Aspect(aspect, this.game_name).set(
        params
      );
    } else {
      if (params) this.getVesselAt(aspect).set(params);
    }

    return this.getVesselAt(aspect);
  };
})();