Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// setPlace.js
(function() {
	/*global adventurejs A*/ 
  "use strict";
  var p = adventurejs.Tangible.prototype;	
  /**
   * Set an asset's place, aka parent asset and aspect. 
   * This is how one thing is put inside another.
   * cap.setPlace( 'attached', 'pen' );
   * @memberOf adventurejs.Tangible
	 * @method adventurejs.Tangible#setPlace
   * @param {String} aspect
   * @param {String} asset_id
   * @return {Object}
   */
  p.setPlace = function Tangible_setPlace( aspect, asset_id )
  {
    if( asset_id && !aspect )
    {
      var asset = this.game.getAsset( asset_id );
      if( asset )
      {
        aspect = asset.default_aspect;
      }
    }
    if( asset_id && aspect )
    {
      this.place = { [aspect]: asset_id };
    }
    else this.place = {};
    return this.place;
  }
}());