// areAnscestorsKnown.js
(function () {
/*global adventurejs A*/
var p = adventurejs.Tangible.prototype;
/**
* Checks to see if this asset and its containing parent(s)
* are known to player. Takes into account nesting doll
* situations and looks all the way up the chain.
* Useful for determining whether a player can "see"
* a nested object.
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#areAnscestorsKnown
* @returns {Boolean}
*/
p.areAnscestorsKnown = function Tangible_AreThisAndAnscestorsKnown() {
var input = this.game.getInput();
var subject = input.getSubject();
var parent_is_known = true;
var parent = this.getPlaceAsset();
if (
parent &&
"undefined" !== typeof parent.is.known &&
"undefined" !== typeof parent.areAnscestorsKnown
) {
parent_is_known = parent.areAnscestorsKnown();
}
if (subject.knowsAbout(this) && parent_is_known) {
return true;
} else {
return false;
}
};
})();