// selectTangibleOrSubstance.js
(function () {
/* global AdventureJS A */
var p = AdventureJS.Parser.prototype;
/**
* Exclude from a list of assets all non-matter assets.
* @method AdventureJS.Parser#selectTangibleOrSubstance
* @memberOf AdventureJS.Parser
* @param {Array} list
* @returns {Array}
* @deprecated
*/
p.selectTangibleOrSubstance = function Parser_selectTangibleOrSubstance(
list
) {
if ("string" === typeof list) list = [list];
if (!Array.isArray(list)) {
this.game.log(
"",
"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.Assets.Tangible ||
object instanceof AdventureJS.Assets.Substance ||
object instanceof AdventureJS.Assets.Room ||
object instanceof AdventureJS.Assets.Exit ||
//|| object instanceof AdventureJS.Assets.Floor
//|| object instanceof AdventureJS.Assets.Ceiling
object instanceof AdventureJS.Assets.Scenery ||
object.is.global /*&& !object.is.abstract @todo handle abstractions */
) {
foundObjects.push(list[i]);
}
}
this.game.log(
"",
"log",
"high",
`[selectTangibleOrSubstance.js] selectTangibleOrSubstance() return:\n${foundObjects}`,
"Parser"
);
return foundObjects;
};
})();