// isOn.js
(function () {
/*global adventurejs A*/
var p = adventurejs.Tangible.prototype;
/**
* <strong>isOn</strong> tests whether
* one asset is specifically in the <code>on</code> aspect of another asset.
* This is a one-to-one check that doesn't take nesting into consideration.
* <pre class="display"><code class="language-javascript">if( MyGame.$('fishbowl').$isOn('credenza') ){ // do stuff }
* </code></pre>
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#isOn
* @param {Object|String} asset Can be string or object.
* @returns {boolean}
*/
p.isOn = p.$isOn = function Tangible_isOn(asset) {
if ("undefined" === typeof asset) {
return this.getPlacePreposition() === "on";
}
if ("string" === typeof asset) asset = this.game.getAsset(asset);
if (!asset || !asset.id || !asset.hasClass("Tangible")) return false;
if (this.getPlacePreposition() !== "on") return false;
if (this.getPlaceAsset().id !== asset.id) return false;
return true;
};
})();