mirror of
https://github.com/ENSL/NS.git
synced 2024-11-26 06:20:57 +00:00
add hud_teamhealthalert
-update ring UI logic to show weldable/healable players rings
This commit is contained in:
parent
3117a9f990
commit
edfee609fc
2 changed files with 18 additions and 9 deletions
|
@ -220,6 +220,8 @@ void CHud :: Init( void )
|
||||||
CVAR_CREATE( "cl_iconb", "221", FCVAR_ARCHIVE);
|
CVAR_CREATE( "cl_iconb", "221", FCVAR_ARCHIVE);
|
||||||
|
|
||||||
CVAR_CREATE("cl_weaponswap", "2", FCVAR_ARCHIVE | FCVAR_USERINFO);
|
CVAR_CREATE("cl_weaponswap", "2", FCVAR_ARCHIVE | FCVAR_USERINFO);
|
||||||
|
CVAR_CREATE("hud_teamhealthalert", "95", FCVAR_ARCHIVE);
|
||||||
|
|
||||||
m_pSpriteList = NULL;
|
m_pSpriteList = NULL;
|
||||||
|
|
||||||
// Clear any old HUD list
|
// Clear any old HUD list
|
||||||
|
|
|
@ -2531,6 +2531,7 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha)
|
||||||
if(theContinue && theLocalPlayer)
|
if(theContinue && theLocalPlayer)
|
||||||
{
|
{
|
||||||
const int kDrawEnemyBuildingDistance = 200;
|
const int kDrawEnemyBuildingDistance = 200;
|
||||||
|
bool healthLowEnough = theHealthPercentage < (CVAR_GET_FLOAT("hud_teamhealthalert") * 0.01f);
|
||||||
|
|
||||||
// Draw effects if we are in top-down mode OR
|
// Draw effects if we are in top-down mode OR
|
||||||
if( this->GetInTopDownMode() ||
|
if( this->GetInTopDownMode() ||
|
||||||
|
@ -2538,14 +2539,15 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha)
|
||||||
// It's an unfriendly building that's very close OR
|
// It's an unfriendly building that's very close OR
|
||||||
(!theEntityIsPlayer && (theDistanceToEntity < kDrawEnemyBuildingDistance)) ||
|
(!theEntityIsPlayer && (theDistanceToEntity < kDrawEnemyBuildingDistance)) ||
|
||||||
|
|
||||||
// It's a friendly entity and we're a builder OR
|
// It's a friendly building and we're a builder OR
|
||||||
(theIsOnOurTeam && (this->GetHUDUser3() == AVH_USER3_ALIEN_PLAYER2)) ||
|
//(theIsOnOurTeam && (this->GetHUDUser3() == AVH_USER3_ALIEN_PLAYER2)) ||
|
||||||
|
(theIsOnOurTeam && !theEntityIsPlayer && (this->GetHUDUser3() == AVH_USER3_ALIEN_PLAYER2)) ||
|
||||||
|
|
||||||
// It's a friendly player with <95% armor and we have a welder in our inventory OR
|
// It's a friendly player with <95% armor/health and we have a welder in our inventory or are gorge OR
|
||||||
(theIsOnOurTeam && theEntityIsPlayer && theHealthPercentage < 0.95f && this->mHasWelder) ||
|
(theIsOnOurTeam && theEntityIsPlayer && healthLowEnough && (this->mHasWelder || this->GetHUDUser3() == AVH_USER3_ALIEN_PLAYER2)) ||
|
||||||
|
|
||||||
// welder/healing spray is selected
|
// welder/healing spray is selected
|
||||||
(this->mCurrentWeaponID == 18 || this->mCurrentWeaponID == 27)
|
(this->mCurrentWeaponID == AVH_WEAPON_WELDER || this->mCurrentWeaponID == AVH_WEAPON_HEALINGSPRAY)
|
||||||
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -2670,9 +2672,12 @@ void AvHHud::DrawSelectionAndBuildEffects()
|
||||||
}
|
}
|
||||||
|
|
||||||
// : 0000988 & 0000991
|
// : 0000988 & 0000991
|
||||||
bool maintanceWeaponSelected = (this->mCurrentWeaponID == 18 || this->mCurrentWeaponID == 27);
|
bool maintanceWeaponSelected = (this->mCurrentWeaponID == AVH_WEAPON_WELDER || this->mCurrentWeaponID == AVH_WEAPON_HEALINGSPRAY);
|
||||||
|
bool hasWelder = this->mHasWelder;
|
||||||
|
bool isGorge = this->GetHUDUser3() == AVH_USER3_ALIEN_PLAYER2;
|
||||||
bool isCommander = this->GetInTopDownMode();
|
bool isCommander = this->GetInTopDownMode();
|
||||||
if (isCommander || maintanceWeaponSelected) {
|
//if (isCommander || maintanceWeaponSelected) {
|
||||||
|
if (isCommander || hasWelder || isGorge) {
|
||||||
gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );
|
gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );
|
||||||
gEngfuncs.pEventAPI->EV_PushPMStates();
|
gEngfuncs.pEventAPI->EV_PushPMStates();
|
||||||
gEngfuncs.pEventAPI->EV_SetSolidPlayers(-1);
|
gEngfuncs.pEventAPI->EV_SetSolidPlayers(-1);
|
||||||
|
@ -2701,7 +2706,9 @@ void AvHHud::DrawSelectionAndBuildEffects()
|
||||||
{
|
{
|
||||||
this->DrawBuildHealthEffectsForEntity(theEntityIndex, 0.2);
|
this->DrawBuildHealthEffectsForEntity(theEntityIndex, 0.2);
|
||||||
}
|
}
|
||||||
else if (maintanceWeaponSelected && theSameTeam && !theIsPlayer)
|
//else if (maintanceWeaponSelected && theSameTeam && !theIsPlayer)
|
||||||
|
else if ((maintanceWeaponSelected && theSameTeam && !theIsPlayer) ||
|
||||||
|
((isGorge || hasWelder) && theSameTeam && theIsPlayer))
|
||||||
{
|
{
|
||||||
if (AvHTraceLineAgainstWorld(gEngfuncs.GetLocalPlayer()->origin, theEntity->origin) == 1.0f)
|
if (AvHTraceLineAgainstWorld(gEngfuncs.GetLocalPlayer()->origin, theEntity->origin) == 1.0f)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue