Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// getThingThisIsTiedToPlayerBy.js
(function() {
	/*global adventurejs A*/ 
  "use strict";
  var p = adventurejs.Tangible.prototype;	
  /**
   * Assuming this asset is tied to the player asset by means of a third 
   * thing, get that third thing. 
   * Returns an asset object.
   * @memberOf adventurejs.Tangible
	 * @method adventurejs.Tangible#getThingThisIsTiedToPlayerBy
   * @return {Object}
   */
  p.getThingThisIsTiedToPlayerBy = function Tangible_getThingThisIsTiedToPlayerBy()
  {
    var player = this.game.getPlayer();
    var ropeTiedToPlayer;
    for( var i = 0; i < this.iov.tie.with_params.connections.length; i++ ) 
    {
      var rope = this.game.getAsset( this.iov.tie.with_params.connections[i] );
      if( rope.isIn( player )
      || -1 < rope.dov.tie.with_params.connections.indexOf( player.id ) )
      {
        ropeTiedToPlayer = rope;
      }
    }
    return ropeTiedToPlayer;
}
}());