Add visual counter for health regen from healing

This commit is contained in:
Anton Tarasenko 2024-03-19 14:34:24 +07:00
parent 2bf5f3dbe1
commit 87f60c9c60
2 changed files with 34 additions and 4 deletions

View File

@ -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<NiceVeterancyTypes> 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;

View File

@ -846,7 +846,7 @@ function VeterancyChanged(){
nicePlayer.TriggerSelectEventOnPerkChange(nicePrevPerkClass,
class<NiceVeterancyTypes>(KFPRI.ClientVeteranSkill));
}
super.VeterancyChanged();
}
simulated function AltFire(optional float F){