Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// isPlacedAtAspectAndAsset.js
(function () {
  /*global adventurejs A*/
  var p = adventurejs.Tangible.prototype;
  /**
   * Determine whether asset has a place. Can be used
   * to test against specific aspects and parent assets.
   * For example, cap.isPlacedAtAspectAndAsset( 'attached', 'pen' )
   * @memberOf adventurejs.Tangible
   * @method adventurejs.Tangible#isPlacedAtAspectAndAsset
   * @param {String} aspect
   * @param {String} asset
   * @return {Boolean}
   */
  p.isPlacedAtAspectAndAsset = function Tangible_isPlacedAtAspectAndAsset(
    aspect,
    asset
  ) {
    if (!this.__place) return false;
    if (!this.__place.aspect) return false;
    if (!this.__place.asset) return false;

    if (aspect && aspect !== this.__place.aspect) return false;
    if (asset && asset !== this.__place.asset) return false;

    return true;
  };
})();