Unit cleanup
This commit is contained in:
@@ -11,8 +11,8 @@ import mindustry.type.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
|
||||
@Component
|
||||
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
@Import float x, y, elevation;
|
||||
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc, ElevationMovec{
|
||||
@Import float x, y;
|
||||
@Import UnitType type;
|
||||
|
||||
transient Leg[] legs = {};
|
||||
@@ -22,9 +22,6 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
//keep elevation halfway
|
||||
elevation = 0.4f;
|
||||
|
||||
if(Mathf.dst(deltaX(), deltaY()) > 0.001f){
|
||||
baseRotation = Mathf.slerpDelta(baseRotation, Mathf.angle(deltaX(), deltaY()), 0.1f);
|
||||
}
|
||||
@@ -111,11 +108,6 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
return rotation + 360f / legs.length * index + (360f / legs.length / 2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(){
|
||||
elevation = 0.4f;
|
||||
}
|
||||
|
||||
/*
|
||||
@Replace
|
||||
public boolean isGrounded(){
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user