// setAspectContentsSeen.js
(function () {
/*global adventurejs A*/
"use strict";
var p = adventurejs.Tangible.prototype;
/**
* When player sees an asset, call this function to
* make its contents known. Generally, contents of
* behind/in/on/under are listed automatically and seen,
* whereas attachments may go unlisted in room descriptions.
* This function is chiefly for setting is.seen
* for attachments, but can be applied to any aspects.
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#setAspectContentsSeen
*/
p.setAspectContentsSeen = function Tangible_setAspectContentsSeen(
aspect,
value
) {
//console.warn(this.id, "setAspectContentsSeen", aspect, value);
if ("undefined" === typeof value) return false;
if (!this.hasAspectAt(aspect)) {
this.game.log(
"warn",
"high",
"setAspectContentsSeen.js > Bad request",
"Tangible"
);
return false;
}
var contents = this.aspects[aspect].contents;
for (var i = 0; i < contents.length; i++) {
var object = this.game.getAsset(contents[i]);
// we don't want this to be recursive
// object.is._known = value;
object.is._seen = value;
}
return;
};
})();