vgui/50-hud.js
/**
* 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[]}
*/
export const 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
*/
export class Hud {
/**
* Controls if the hud element should be visible in certain situations.
*/
static setHideType(type) {
if (document._className != "CEmpHudJavascript")
throw new Error("Unable to set hidden bits for non-hud elements");
__hud_SetHiddenBits(type);
}
}