// getCountOfListableContentsAt.js
(function () {
/*global adventurejs A*/
"use strict";
var p = adventurejs.Tangible.prototype;
/**
* Get a count of assets within this asset that are listable in
* this asset's description, for example when player examines this.
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#getCountOfListableContentsAt
* @param {String} where
* @returns {int}
*/
p.getCountOfListableContentsAt = function Tangible_getCountOfListableContents(
where
) {
if ("" === this.game.dictionary.getStringLookup("prepositions", where)) {
console.warn("Bad request to count_listable_contents", where);
return 0;
}
var list = this.aspects[where].contents;
var num = list.length;
for (var i = num - 1; i > -1; i--) {
if (!this.game.getAsset(list[i]).is.listed_in_parent) {
num--;
}
}
return num;
};
})();