This commit is contained in:
Anuken
2025-01-12 10:02:42 -05:00
parent 0d5a4636c8
commit ca7f34e6e1
2 changed files with 5 additions and 0 deletions

View File

@@ -59,6 +59,8 @@ abstract class HealthComp implements Entityc, Posc{
}
void damage(float amount){
if(Float.isNaN(health)) health = 0f;
health -= amount;
hitTime = 1f;
if(health <= 0 && !dead){
@@ -86,6 +88,7 @@ abstract class HealthComp implements Entityc, Posc{
void clampHealth(){
health = Math.min(health, maxHealth);
if(Float.isNaN(health)) health = 0f;
}
/** Heals by a flat amount. */

View File

@@ -45,6 +45,8 @@ abstract class ShieldComp implements Healthc, Posc{
protected void rawDamage(float amount){
boolean hadShields = shield > 0.0001f;
if(Float.isNaN(health)) health = 0f;
if(hadShields){
shieldAlpha = 1f;
}