Cleanup / Armor support
This commit is contained in:
@@ -5,19 +5,26 @@ import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
import static mindustry.Vars.minArmorDamage;
|
||||
|
||||
@Component
|
||||
abstract class ShieldComp implements Healthc, Posc{
|
||||
@Import float health, hitTime;
|
||||
@Import float health, hitTime, x, y;
|
||||
@Import boolean dead;
|
||||
|
||||
/** Absorbs health damage. */
|
||||
float shield;
|
||||
/** Absorbs percentage of damage, up to 90% */
|
||||
float armor;
|
||||
/** Shield opacity. */
|
||||
transient float shieldAlpha = 0f;
|
||||
|
||||
@Replace
|
||||
@Override
|
||||
public void damage(float amount){
|
||||
//apply armor
|
||||
amount *= Math.max(1f - armor, minArmorDamage);
|
||||
|
||||
hitTime = 1f;
|
||||
|
||||
boolean hadShields = shield > 0.0001f;
|
||||
@@ -37,7 +44,7 @@ abstract class ShieldComp implements Healthc, Posc{
|
||||
}
|
||||
|
||||
if(hadShields && shield <= 0.0001f){
|
||||
Fx.unitShieldBreak.at(x(), y(), 0, this);
|
||||
Fx.unitShieldBreak.at(x, y, 0, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user