Unit cleanup

This commit is contained in:
Anuken
2020-06-07 14:17:42 -04:00
parent 8993c1db04
commit 42a6b0e369
6 changed files with 9 additions and 16 deletions

View File

@@ -21,7 +21,7 @@ import static mindustry.Vars.*;
@Component
abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, Itemsc, Rotc, Unitc, Weaponsc, Drawc, Boundedc, Syncc, Shieldc{
@Import float x, y, rotation, elevation, maxHealth;
@Import float x, y, rotation, elevation, maxHealth, drag, armor;
private UnitController controller;
private UnitType type;
@@ -85,13 +85,14 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
public void type(UnitType type){
this.type = type;
this.maxHealth = type.health;
this.drag = type.drag;
this.elevation = type.flying ? 1f : type.baseElevation;
this.armor = type.armor;
heal();
drag(type.drag);
hitSize(type.hitsize);
controller(type.createController());
setupWeapons(type);
elevation = type.flying ? 1f : 0f;
}
@Override