// selectNotGlobal.js
(function () {
/* global adventurejs A */
var p = adventurejs.Parser.prototype;
/**
* Exclude from a list of assets all global assets.
* @method adventurejs.Parser#selectNotGlobal
* @memberOf adventurejs.Parser
* @param {Array} list
* @returns {Array}
*/
p.selectNotGlobal = function Parser_selectNotGlobal(list) {
if ("string" === typeof list) list = [list];
if (!Array.isArray(list)) {
this.game.log(
"L1097",
"error",
"critical",
["[selectNotGlobal.js] selectNotGlobal() received non-array"],
"Parser"
);
return [];
}
this.game.log(
"L1120",
"log",
"high",
`[selectNotGlobal.js] selectNotGlobal() receive:\n${list}`,
"Parser"
);
var foundObjects = [];
for (var i = 0; i < list.length; i++) {
var object = this.game.getAsset(list[i]);
// @TODO mo'bettah handling for global floor
if (!object.is.global || object.id === "global_floor") {
foundObjects.push(list[i]);
}
}
return foundObjects;
};
})();