// setAspectContentsKnown.js
(function () {
/*global adventurejs A*/
"use strict";
var p = adventurejs.Tangible.prototype;
/**
* When player knows an asset, call this function to
* make its contents known. Generally, contents of
* behind/in/on/under are listed automatically and known,
* whereas attachments may go unlisted in room descriptions.
* This function is chiefly for setting is.known
* for attachments, but can be applied to any aspects.
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#setAspectContentsKnown
*/
p.setAspectContentsKnown = function Tangible_setAspectContentsKnown(
aspect,
value
) {
//console.warn(this.id, "setAspectContentsKnown", aspect, value);
if ("undefined" === typeof value) return false;
if (!this.hasAspectAt(aspect)) {
this.game.log(
"warn",
"high",
"setAspectContentsKnown.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;
};
})();