From 9ba6304eab11db232b296b98cd6fb6b5a5f3278e Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Sun, 26 Apr 2020 19:56:32 +0200 Subject: [PATCH] Fix healthbar display for players if they were overhealed on map change. --- zscript/swwm_common.zsc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zscript/swwm_common.zsc b/zscript/swwm_common.zsc index 9d2fbf67f..58ee617bf 100644 --- a/zscript/swwm_common.zsc +++ b/zscript/swwm_common.zsc @@ -595,7 +595,12 @@ Class SWWMCombatTracker : Thinker if ( target.player || target.bISMONSTER ) t.mytag = target.player?target.player.GetUserName():target.GetTag(); else t.mytag = ""; - t.lasthealth = t.maxhealth = target.health; + if ( target.player ) + { + t.lasthealth = target.health; + t.maxhealth = target.default.health; + } + else t.lasthealth = t.maxhealth = target.health; t.updated = int.min; t.height = t.mytarget.height; t.pos = level.Vec3Offset(target.pos,(0,0,t.height)); @@ -653,12 +658,12 @@ Class SWWMCombatTracker : Thinker // only update height while alive height = mytarget.height; tcnt++; - if ( tcnt == 1 ) + if ( (tcnt == 1) && !mytarget.player ) { // post-spawn health inflation check if ( lasthealth > maxhealth ) maxhealth = lasthealth; } - if ( tcnt == 6 ) + if ( (tcnt == 6) && !mytarget.player ) { // legendoom check for ( Inventory i=mytarget.inv; i; i=i.inv )