// getAllNestedContents.js
(function() {
/*global adventurejs A*/
"use strict";
var p = adventurejs.Tangible.prototype;
/**
* Get list of other assets nested within this one.
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#getAllNestedContents
* @return {Array}
*/
p.getAllNestedContents = p.$inventory = function Tangible_getAllNestedContents() {
var contents = [];
contents = contents.concat( this.getAllContents() );
for( var i = 0; i < contents.length; i++ )
{
var child = this.game.getAsset( contents[ i ] );
var nestedContents = child.getAllNestedContents( contents );
for( var n = 0; n < nestedContents.length; n++ )
{
if( -1 === contents.indexOf( nestedContents[ n ] ))
{
contents.push( nestedContents[ n ] );
}
}
}
return contents;
}
}());