// selectTangibleOrSubstance.js
(function () {
/* global adventurejs A */
var p = adventurejs.Parser.prototype;
/**
* Exclude from a list of assets all non-tangible assets.
* @method adventurejs.Parser#selectTangibleOrSubstance
* @memberOf adventurejs.Parser
* @param {Array} list
* @returns {Array}
*/
p.selectTangibleOrSubstance = function Parser_selectTangibleOrSubstance(
list
) {
if ("string" === typeof list) list = [list];
if (!Array.isArray(list)) {
this.game.log(
"L1095",
"error",
"critical",
[
"[selectTangibleOrSubstance.js] selectTangibleOrSubstance() received non-array",
list,
],
"Parser"
);
return [];
}
var foundObjects = [];
for (var i = 0; i < list.length; i++) {
var object = this.game.getAsset(list[i]);
if (
object instanceof adventurejs.Tangible ||
object instanceof adventurejs.Substance ||
object instanceof adventurejs.Room ||
object instanceof adventurejs.Exit ||
//|| object instanceof adventurejs.Floor
//|| object instanceof adventurejs.Ceiling
object instanceof adventurejs.Scenery ||
object.is.global /*&& !object.is.abstract @todo handle abstractions */
) {
foundObjects.push(list[i]);
}
}
return foundObjects;
};
})();