// selectBodyOfSubstance.js
(function() {
/*global adventurejs A*/
"use strict";
var p = adventurejs.Parser.prototype;
/**
* Exclude from a list of assets all assets that are not bodies
* of substance such as a lake or a beach.
* @method adventurejs.Parser#selectBodyOfSubstance
* @memberOf adventurejs.Parser
* @param {Array} list
* @returns {Array}
*/
p.selectBodyOfSubstance = function Parser_selectBodyOfSubstance(list)
{
if("string" === typeof list) list = [list];
if( !Array.isArray( list ) )
{
this.game.log( "warn", "critical", "selectBodyOfSubstance.js > received non-array", 'Parser' );
return [];
}
var foundObjects = [];
for(var i = 0; i < list.length; i++)
{
var object;
object = this.game.getAsset( list[i] );
if( object.$is("body") )
{
foundObjects.push( list[i] );
}
}
return foundObjects;
}
}());