Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// getWornOptics.js
(function () {
  /*global adventurejs A*/
  "use strict";
  var p = adventurejs.Character.prototype;
  /**
   * Get all worn optical devices (aka glasses).
   * @memberOf adventurejs.Character
   * @method adventurejs.Character#getWornOptics
   * @return {Array}
   */
  p.getWornOptics = function Character_getWornOptics() {
    var worn = this.getWornAssets();
    var optics = [];
    for (var i = 0; i < worn.length; i++) {
      var asset = this.game.getAsset(worn[i]);
      if (asset.is.lookthroughable) {
        optics.push(worn[i]);
      }
    }
    return optics;
  };
})();