This commit is contained in:
Anuken
2020-04-26 21:59:49 -04:00
parent 1941b0fa8a
commit f6bf229b0a
21 changed files with 2997 additions and 2877 deletions

View File

@@ -0,0 +1,30 @@
package mindustry.entities.def;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
@Component
abstract class ShieldComp implements Healthc{
@Import float health, hitTime;
@Import boolean dead;
/** Absorbs health damage. */
float shield;
@Replace
@Override
public void damage(float amount){
hitTime = 1f;
float shieldDamage = Math.min(shield, amount);
shield -= shieldDamage;
amount -= shieldDamage;
if(amount > 0){
health -= amount;
if(health <= 0 && !dead){
kill();
}
}
}
}

View File

@@ -24,6 +24,8 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
private UnitController controller;
private UnitType type;
int level;
public void moveAt(Vec2 vector){
moveAt(vector, type.accel);
}