// selectCharacter.js
(function() {
/*global adventurejs A*/
"use strict";
var p = adventurejs.Parser.prototype;
/**
* Exclude from a list of assets all assets that are not characters.
* @method adventurejs.Parser#selectCharacter
* @memberOf adventurejs.Parser
* @param {Array} list
* @returns {Array}
*/
p.selectCharacter = function Parser_selectCharacter(list)
{
if(typeof list !== "object" )
{
console.warn("selectCharacter received non-array", list);
return [];
}
var foundObjects = [];
for(var i = 0; i < list.length; i++)
{
var object = this.game.getAsset( list[i] );
if( object instanceof adventurejs.Character )
{
foundObjects.push( list[i] );
}
// TODO sentient vs non-sentient characters?
}
return foundObjects;
}
}());