// selectCarried.js
(function () {
/* global adventurejs A */
var p = adventurejs.Parser.prototype;
/**
* Exclude from a list of assets all assets that are not carried by player.
* @method adventurejs.Parser#selectCarried
* @memberOf adventurejs.Parser
* @param {Array} list
* @returns {Array}
*/
p.selectCarried = function Parser_selectCarried(list) {
if (typeof list !== "object") {
this.game.log(
"L1561",
"error",
"critical",
[`[selectCarried.js] selectCarried() received non-array,`, list],
"Parser"
);
return [];
}
var foundObjects = [];
for (var i = 0; i < list.length; i++) {
console.log("selectCarried list[i]", list[i]);
var object = this.game.getAsset(list[i]);
if (object.isWithin(this.game.getPlayer())) {
foundObjects.push(list[i]);
}
}
return foundObjects;
};
})();