Unit cleanup
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 359 B |
Binary file not shown.
|
After Width: | Height: | Size: 230 B |
Binary file not shown.
|
After Width: | Height: | Size: 378 B |
@@ -11,8 +11,8 @@ import mindustry.type.*;
|
|||||||
import mindustry.world.blocks.environment.*;
|
import mindustry.world.blocks.environment.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc, ElevationMovec{
|
||||||
@Import float x, y, elevation;
|
@Import float x, y;
|
||||||
@Import UnitType type;
|
@Import UnitType type;
|
||||||
|
|
||||||
transient Leg[] legs = {};
|
transient Leg[] legs = {};
|
||||||
@@ -22,9 +22,6 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
//keep elevation halfway
|
|
||||||
elevation = 0.4f;
|
|
||||||
|
|
||||||
if(Mathf.dst(deltaX(), deltaY()) > 0.001f){
|
if(Mathf.dst(deltaX(), deltaY()) > 0.001f){
|
||||||
baseRotation = Mathf.slerpDelta(baseRotation, Mathf.angle(deltaX(), deltaY()), 0.1f);
|
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);
|
return rotation + 360f / legs.length * index + (360f / legs.length / 2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void add(){
|
|
||||||
elevation = 0.4f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@Replace
|
@Replace
|
||||||
public boolean isGrounded(){
|
public boolean isGrounded(){
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import static mindustry.Vars.*;
|
|||||||
@Component
|
@Component
|
||||||
abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, Itemsc, Rotc, Unitc, Weaponsc, Drawc, Boundedc, Syncc, Shieldc{
|
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 UnitController controller;
|
||||||
private UnitType type;
|
private UnitType type;
|
||||||
@@ -85,13 +85,14 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
public void type(UnitType type){
|
public void type(UnitType type){
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.maxHealth = type.health;
|
this.maxHealth = type.health;
|
||||||
|
this.drag = type.drag;
|
||||||
|
this.elevation = type.flying ? 1f : type.baseElevation;
|
||||||
|
this.armor = type.armor;
|
||||||
|
|
||||||
heal();
|
heal();
|
||||||
drag(type.drag);
|
|
||||||
hitSize(type.hitsize);
|
hitSize(type.hitsize);
|
||||||
controller(type.createController());
|
controller(type.createController());
|
||||||
setupWeapons(type);
|
setupWeapons(type);
|
||||||
|
|
||||||
elevation = type.flying ? 1f : 0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
public float sway = 1f;
|
public float sway = 1f;
|
||||||
public int payloadCapacity = 1;
|
public int payloadCapacity = 1;
|
||||||
public int commandLimit = 24;
|
public int commandLimit = 24;
|
||||||
|
public float baseElevation = 0f;
|
||||||
|
|
||||||
public int legCount = 4;
|
public int legCount = 4;
|
||||||
public float legLength = 24f, legSpeed = 0.1f, legTrns = 1f, legBaseOffset = 0f, legMoveSpace = 1f;
|
public float legLength = 24f, legSpeed = 0.1f, legTrns = 1f, legBaseOffset = 0f, legMoveSpace = 1f;
|
||||||
@@ -81,7 +82,6 @@ public class UnitType extends UnlockableContent{
|
|||||||
public Unitc create(Team team){
|
public Unitc create(Team team){
|
||||||
Unitc unit = constructor.get();
|
Unitc unit = constructor.get();
|
||||||
unit.team(team);
|
unit.team(team);
|
||||||
unit.armor(armor);
|
|
||||||
unit.type(this);
|
unit.type(this);
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
@@ -331,7 +331,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawLegs(Legsc unit){
|
public void drawLegs(Legsc unit){
|
||||||
Draw.z(Layer.groundUnit - 0.02f);
|
//Draw.z(Layer.groundUnit - 0.02f);
|
||||||
|
|
||||||
Leg[] legs = unit.legs();
|
Leg[] legs = unit.legs();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user