Home Reference Source

vgui/obj/50-hud.js

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 * List of hud hiding behavors.
 * Can be combined using |
 *
 * - weaponSelection: Hides when player is no longer able to select a weapon (in certain vehicles for example).
 * - flashlight: Hides if server / map doesn't allow flashlight usage
 * - all: Don't use this. Has no extra behaviour
 * - health: Hides when health elements are hidden (command mode)
 * - playerDead: Hides the hud element when the player is dead
 * - needSuit: Not unused in Empires
 * - chat: Hides when chat elements hide
 * - crosshair: Hides when crosshair hides
 * - vehicleCrosshair: Hides when vehicle crosshair hides
 * - inVehicle: Hides when player is in vehicle
 * - bonusProgress: Unused
 * - commander: Hide when player is not command mode
 *
 * @type {HideType[]}
 */
var HideType = exports.HideType = {
  weaponSelection: 1 << 0,
  flashlight: 1 << 1,
  all: 1 << 2, // Don't use this, it is always set for every HudElement. See: https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/client/hud.cpp#L948 
  health: 1 << 3,
  playerDead: 1 << 4,
  needSuit: 1 << 5,
  miscStatus: 1 << 6,
  chat: 1 << 7,
  crosshair: 1 << 8,
  vehicleCrosshair: 1 << 9,
  inVehicle: 1 << 10,
  bonusProgress: 1 << 11,
  commander: 1 << 12

  /**
   * Used to control hud-only properties
   * Do not use if not being run from hud
   */
};
var Hud = exports.Hud = function () {
  function Hud() {
    _classCallCheck(this, Hud);
  }

  _createClass(Hud, null, [{
    key: "setHideType",


    /**
     * Controls if the hud element should be visible in certain situations.
     */
    value: function setHideType(type) {
      if (document._className != "CEmpHudJavascript") throw new Error("Unable to set hidden bits for non-hud elements");
      __hud_SetHiddenBits(type);
    }
  }]);

  return Hud;
}();