// getPrintableListOfContents.js
(function () {
/* global adventurejs A */
var p = adventurejs.Tangible.prototype;
/**
* Get a printable list of assets within all
* Aspects of this asset, for example
* to append to asset description when player inputs
* "examine this". Returns a string.
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#getPrintableListOfContents
* @param {Object} params
* @returns {String}
*/
p.getPrintableListOfContents = function Tangible_getPrintableListOfContents(
params = {}
) {
this.game.log(
"L1488",
"log",
"high",
`[getPrintableListOfContents.js] ${this.id}.getPrintableListOfContents()`,
"Tangible"
);
params.caller = params.caller || "examine";
let msg = "";
for (let prep in this.aspects) {
let aspect = this.aspects[prep];
if (
(params.caller === "room" &&
aspect.list_contents_in_room &&
aspect.contents.length > 0) ||
(params.caller === "examine" &&
aspect.list_contents_in_examine &&
aspect.contents.length > 0) ||
aspect.vessel?.class
) {
msg += this.getPrintableListOfContentsAt(aspect, params);
}
}
return msg;
};
})();