// get.js
(function () {
/*global adventurejs A*/
var p = adventurejs.Tangible.prototype;
/**
* Utility function that provides an easy way for
* authors to test for various conditions.
* <ul>
* <li>all - list all children in all aspects of this</li>
* <li>allnested - list all descendents in all aspects of this</li>
* <li>behind - list things behind this</li>
* <li>in - list things in this</li>
* <li>on - list things on this</li>
* <li>under - list things under this</li>
* <li>attached - list things attached to this</li>
* </ul>
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#get
* @param {String} property
* @param {String} qualifier
*/
p.get = p.$get = function Tangible_$get(property, qualifier) {
if (
this.game.dictionary.isPreposition(property) &&
this.hasAspectAt(property)
) {
// this returns a list of ids
// what if author wants a nice formatted list?
return this.aspects[property].contents;
}
switch (property) {
case "allnested":
return this.getAllNestedContents();
case "all":
return this.getAllContents();
default:
if ("undefined" === typeof this[property]) {
console.warn(
"Tangible.get() couldn't find a property called " +
property +
" on " +
this.name +
"."
);
return false;
}
return this[property];
} // switch
}; // adventurejs.Tangible.prototype.get
})();