Fixed #10410
This commit is contained in:
@@ -59,6 +59,8 @@ abstract class HealthComp implements Entityc, Posc{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void damage(float amount){
|
void damage(float amount){
|
||||||
|
if(Float.isNaN(health)) health = 0f;
|
||||||
|
|
||||||
health -= amount;
|
health -= amount;
|
||||||
hitTime = 1f;
|
hitTime = 1f;
|
||||||
if(health <= 0 && !dead){
|
if(health <= 0 && !dead){
|
||||||
@@ -86,6 +88,7 @@ abstract class HealthComp implements Entityc, Posc{
|
|||||||
|
|
||||||
void clampHealth(){
|
void clampHealth(){
|
||||||
health = Math.min(health, maxHealth);
|
health = Math.min(health, maxHealth);
|
||||||
|
if(Float.isNaN(health)) health = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Heals by a flat amount. */
|
/** Heals by a flat amount. */
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ abstract class ShieldComp implements Healthc, Posc{
|
|||||||
protected void rawDamage(float amount){
|
protected void rawDamage(float amount){
|
||||||
boolean hadShields = shield > 0.0001f;
|
boolean hadShields = shield > 0.0001f;
|
||||||
|
|
||||||
|
if(Float.isNaN(health)) health = 0f;
|
||||||
|
|
||||||
if(hadShields){
|
if(hadShields){
|
||||||
shieldAlpha = 1f;
|
shieldAlpha = 1f;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user