Fix healing messages not showing up when healed with medic dart

This commit is contained in:
Anton Tarasenko 2024-03-19 13:51:38 +07:00
parent 2ddd4a34f0
commit 2bf5f3dbe1
2 changed files with 37 additions and 22 deletions

View File

@ -203,34 +203,45 @@ simulated function RemovePoisonAndBleed(NiceHumanPawn healed)
}
// Tells server to heal given human pawn.
simulated function ServerHealTarget(NiceHumanPawn healed, float charPotency,
Pawn instigator){
simulated function ServerHealTarget(
NiceHumanPawn healed,
float charPotency,
Pawn instigator
) {
local NiceHumanPawn healer;
local PlayerController healedPC;
local KFPlayerReplicationInfo KFPRI;
local NiceMedicGun healingTool;
local float healTotal;
local float healPotency;
if(instigator == none || healed == none) return;
if(healed.health <= 0 || healed.health >= healed.healthMax) return;
KFPRI = KFPlayerReplicationInfo(instigator.PlayerReplicationInfo);
if(KFPRI == none || KFPRI.ClientVeteranSkill == none)
return;
if(KFPRI == none || KFPRI.ClientVeteranSkill == none) return;
healer = NiceHumanPawn(instigator);
if(healer == none)
return;
if(healer == none) return;
healingTool = NiceMedicGun(healer.weapon);
healPotency = KFPRI.ClientVeteranSkill.static.GetHealPotency(KFPRI);
healTotal = charPotency * healPotency;
healer.AlphaAmount = 255;
if(NiceMedicGun(healer.weapon) != none)
NiceMedicGun(healer.weapon).ClientSuccessfulHeal(healer, healed);
if(healed.health >= healed.healthMax){
if(healingTool != none) {
healingTool.ClientSuccessfulHeal(healer, healed);
}
healedPC = PlayerController(healed.controller);
if(healedPC != none) {
healedPC.ClientMessage(
"You've been healed by" @ healer.GetPlayerName(),
'CriticalEvent');
}
if(healed.health >= healed.healthMax) {
healed.GiveHealth(healTotal, healed.healthMax);
return;
}
HandleNiceHealingMechanicsAndSkills(healer, healed, healPotency);
if(healed.health < healed.healthMax){
healed.TakeHealing( healed, healTotal, healPotency,
KFWeapon(instigator.weapon));
if(healed.health < healed.healthMax) {
healed.TakeHealing(healed, healTotal, healPotency, healingTool);
}
RemovePoisonAndBleed(healed);
}

View File

@ -66,15 +66,19 @@ simulated function WeaponTick(float dt){
}
super.WeaponTick(dt);
}
simulated function ClientSuccessfulHeal(NiceHumanPawn healer, NiceHumanPawn healed){
if(healed == none)
return;
if(instigator != none && PlayerController(instigator.controller) != none)
PlayerController(instigator.controller).
ClientMessage("You've healed"@healed.GetPlayerName(), 'CriticalEvent');
if(NiceHumanPawn(instigator) != none && PlayerController(healed.controller) != none)
PlayerController(healed.controller).
ClientMessage("You've been healed by"@healer.GetPlayerName(), 'CriticalEvent');
simulated function ClientSuccessfulHeal(
NiceHumanPawn healer,
NiceHumanPawn healed
){
if(healed == none) {
return;
}
if(instigator != none && PlayerController(instigator.controller) != none) {
PlayerController(instigator.controller).ClientMessage(
"You've healed" @ healed.GetPlayerName(),
'CriticalEvent');
}
}
defaultproperties