Legs -> Mech

This commit is contained in:
Anuken
2020-05-25 16:41:55 -04:00
parent 08af9aaa02
commit 60684b4ef9
7 changed files with 10 additions and 10 deletions

View File

@@ -19,8 +19,8 @@ public class GroundAI extends AIController{
target = null; target = null;
//TODO this is hacky, cleanup //TODO this is hacky, cleanup
if(unit instanceof Legsc && unit.moving()){ if(unit instanceof Mechc && unit.moving()){
unit.lookAt(((Legsc)unit).baseRotation()); unit.lookAt(((Mechc)unit).baseRotation());
} }
} }

View File

@@ -12,10 +12,10 @@ import mindustry.type.*;
public class UnitTypes implements ContentList{ public class UnitTypes implements ContentList{
//ground //ground
public static @EntityDef({Unitc.class, Legsc.class}) UnitType titan, dagger, crawler, fortress, eruptor, chaosArray, eradicator; public static @EntityDef({Unitc.class, Mechc.class}) UnitType titan, dagger, crawler, fortress, eruptor, chaosArray, eradicator;
//ground + builder //ground + builder
public static @EntityDef({Unitc.class, Legsc.class, Builderc.class}) UnitType oculon, tau; public static @EntityDef({Unitc.class, Mechc.class, Builderc.class}) UnitType oculon, tau;
//air //air
public static @EntityDef({Unitc.class}) UnitType wraith, reaper, ghoul, revenant, lich; public static @EntityDef({Unitc.class}) UnitType wraith, reaper, ghoul, revenant, lich;

View File

@@ -569,7 +569,7 @@ public class NetClient implements ApplicationListener{
unit.x(), unit.y(), unit.x(), unit.y(),
player.unit().aimX(), player.unit().aimY(), player.unit().aimX(), player.unit().aimY(),
unit.rotation(), unit.rotation(),
unit instanceof Legsc ? ((Legsc)unit).baseRotation() : 0, unit instanceof Mechc ? ((Mechc)unit).baseRotation() : 0,
unit.vel().x, unit.vel().y, unit.vel().x, unit.vel().y,
player.miner().mineTile(), player.miner().mineTile(),
control.input.isBoosting, control.input.isShooting, ui.chatfrag.shown(), control.input.isBoosting, control.input.isShooting, ui.chatfrag.shown(),

View File

@@ -640,7 +640,7 @@ public class NetServer implements ApplicationListener{
fbuffer.position(0); fbuffer.position(0);
//now, put the new position, rotation and baserotation into the buffer so it can be read //now, put the new position, rotation and baserotation into the buffer so it can be read
if(unit instanceof Legsc) fbuffer.put(baseRotation); //base rotation is optional if(unit instanceof Mechc) fbuffer.put(baseRotation); //base rotation is optional
fbuffer.put(rotation); //rotation is always there fbuffer.put(rotation); //rotation is always there
fbuffer.put(newx); fbuffer.put(newx);
fbuffer.put(newy); fbuffer.put(newy);

View File

@@ -6,7 +6,7 @@ import mindustry.annotations.Annotations.*;
import mindustry.gen.*; import mindustry.gen.*;
@Component @Component
abstract class LegsComp implements Posc, Flyingc, Hitboxc, Unitc, Legsc, ElevationMovec{ abstract class MechComp implements Posc, Flyingc, Hitboxc, Unitc, Mechc, ElevationMovec{
@SyncField(false) @SyncLocal float baseRotation; @SyncField(false) @SyncLocal float baseRotation;
transient float walkTime; transient float walkTime;

View File

@@ -125,7 +125,7 @@ public class UnitType extends UnlockableContent{
//region drawing //region drawing
public void draw(Unitc unit){ public void draw(Unitc unit){
Legsc legs = unit instanceof Legsc ? (Legsc)unit : null; Mechc legs = unit instanceof Mechc ? (Mechc)unit : null;
float z = unit.elevation() > 0.5f ? (lowAltitude ? Layer.flyingUnitLow : Layer.flyingUnit) : Layer.groundUnit; float z = unit.elevation() > 0.5f ? (lowAltitude ? Layer.flyingUnitLow : Layer.flyingUnit) : Layer.groundUnit;
if(unit.controller().isBeingControlled(player.unit())){ if(unit.controller().isBeingControlled(player.unit())){
@@ -309,7 +309,7 @@ public class UnitType extends UnlockableContent{
} }
} }
public void drawLegs(Legsc unit){ public void drawLegs(Mechc unit){
Draw.reset(); Draw.reset();
Draw.mixcol(Color.white, unit.hitTime()); Draw.mixcol(Color.white, unit.hitTime());

View File

@@ -246,7 +246,7 @@ public class Generators{
Image image = ImagePacker.get(type.region); Image image = ImagePacker.get(type.region);
if(type.constructor.get() instanceof Legsc){ if(type.constructor.get() instanceof Mechc){
image.drawCenter(type.baseRegion); image.drawCenter(type.baseRegion);
image.drawCenter(type.legRegion); image.drawCenter(type.legRegion);
image.drawCenter(type.legRegion, true, false); image.drawCenter(type.legRegion, true, false);