From 87f60c9c60c4c0081d4e14d3db8d707f537883f1 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Tue, 19 Mar 2024 14:34:24 +0700 Subject: [PATCH] Add visual counter for health regen from healing --- sources/GUI/NiceInteraction.uc | 36 +++++++++++++++++++++++++++++++--- sources/NiceHumanPawn.uc | 2 +- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/sources/GUI/NiceInteraction.uc b/sources/GUI/NiceInteraction.uc index a52af06..103d2cd 100644 --- a/sources/GUI/NiceInteraction.uc +++ b/sources/GUI/NiceInteraction.uc @@ -107,6 +107,10 @@ function PostRender(Canvas C) local int x, y, center, barWidth, offset; local int missesWidth, missesHeight, missesSpace; local int missesX, missesY; + local TeamInfo team; + local int healthToGive, totalExpectedHealth; + local float textWidth, textHeight; + local string textToDraw; // local Vector CamPos, ViewDir; // local Rotator CamRot; // local float OffsetX, BarLength, BarHeight, XL, YL, posY; @@ -256,6 +260,32 @@ function PostRender(Canvas C) } } + team = C.ViewPort.Actor.Pawn.PlayerReplicationInfo.Team; + //// Draw health still in regen timer + healthToGive = ScrnHumanPawn(C.ViewPort.Actor.Pawn).clientHealthToGive; + if (healthToGive > 0) { + totalExpectedHealth = healthToGive + C.ViewPort.Actor.Pawn.health;; + C.Font = class'ROHUD'.Static.LoadSmallFontStatic(3); + if (totalExpectedHealth >= C.ViewPort.Actor.Pawn.healthMax) { + if(team.teamIndex == 0) { + C.SetDrawColor(255, 64, 64); + } + else { + C.SetDrawColor( + team.teamColor.R, + team.teamColor.G, + team.teamColor.B); + } + } + else { + C.SetDrawColor(128, 128, 128); + } + textToDraw = "+" $ healthToGive; + C.TextSize(textToDraw, textWidth, textHeight); + C.SetPos(C.ClipX * 0.05, C.ClipY * 0.9); + C.DrawText(textToDraw); + } + //// Draw cooldowns if (nicePlayer.abilityManager == none) return; @@ -273,7 +303,7 @@ function PostRender(Canvas C) { if (niceMutator.niceCounterSet[i].value != 0 || niceMutator.niceCounterSet[i].bShowZeroValue) { - DrawCounter(C, niceMutator.niceCounterSet[i], x, y, C.ViewPort.Actor.Pawn.PlayerReplicationInfo.Team); + DrawCounter(C, niceMutator.niceCounterSet[i], x, y, team); x += 128 + 4; } } @@ -283,7 +313,7 @@ function PostRender(Canvas C) function DrawCounter(Canvas C, NicePack.CounterDisplay counter, int x, int y, TeamInfo team){ local float borderSpace; local Texture textureToDraw; - local float textWidth, textHeight; + local float textWidth, textHeight; local string textToDraw; // Some per-defined values for drawing local int iconSize, backgroundWidth, backgroundHeight; @@ -320,7 +350,7 @@ function DrawAbilityCooldown(Canvas C, int abilityIndex){ local class niceVet; local int x, y; local string textToDraw; - local float textWidth, textHeight; + local float textWidth, textHeight; local NiceAbilityManager.EAbilityState abilityState; if(C == none) return; if(C.ViewPort == none) return; diff --git a/sources/NiceHumanPawn.uc b/sources/NiceHumanPawn.uc index b6f1ece..448e554 100644 --- a/sources/NiceHumanPawn.uc +++ b/sources/NiceHumanPawn.uc @@ -846,7 +846,7 @@ function VeterancyChanged(){ nicePlayer.TriggerSelectEventOnPerkChange(nicePrevPerkClass, class(KFPRI.ClientVeteranSkill)); } - + super.VeterancyChanged(); } simulated function AltFire(optional float F){