Eruptor legs
|
Before Width: | Height: | Size: 757 B After Width: | Height: | Size: 761 B |
|
Before Width: | Height: | Size: 848 KiB After Width: | Height: | Size: 843 KiB |
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 279 KiB After Width: | Height: | Size: 279 KiB |
|
Before Width: | Height: | Size: 915 KiB After Width: | Height: | Size: 915 KiB |
@@ -14,7 +14,7 @@ import mindustry.type.*;
|
|||||||
public class UnitTypes implements ContentList{
|
public class UnitTypes implements ContentList{
|
||||||
|
|
||||||
//ground
|
//ground
|
||||||
public static @EntityDef({Unitc.class, Mechc.class}) UnitType titan, dagger, crawler, fortress, eruptor, chaosArray, eradicator;
|
public static @EntityDef({Unitc.class, Mechc.class}) UnitType titan, dagger, crawler, fortress, chaosArray, eradicator;
|
||||||
|
|
||||||
//ground + builder
|
//ground + builder
|
||||||
public static @EntityDef({Unitc.class, Mechc.class, Builderc.class}) UnitType tau;
|
public static @EntityDef({Unitc.class, Mechc.class, Builderc.class}) UnitType tau;
|
||||||
@@ -23,7 +23,7 @@ public class UnitTypes implements ContentList{
|
|||||||
public static @EntityDef({Unitc.class, Mechc.class, Builderc.class, Minerc.class, Commanderc.class}) UnitType oculon;
|
public static @EntityDef({Unitc.class, Mechc.class, Builderc.class, Minerc.class, Commanderc.class}) UnitType oculon;
|
||||||
|
|
||||||
//legs
|
//legs
|
||||||
public static @EntityDef({Unitc.class, Legsc.class}) UnitType cix;
|
public static @EntityDef({Unitc.class, Legsc.class}) UnitType cix, eruptor;
|
||||||
|
|
||||||
//air
|
//air
|
||||||
public static @EntityDef({Unitc.class}) UnitType wraith, reaper, ghoul, revenant, lich;
|
public static @EntityDef({Unitc.class}) UnitType wraith, reaper, ghoul, revenant, lich;
|
||||||
@@ -233,6 +233,11 @@ public class UnitTypes implements ContentList{
|
|||||||
targetAir = false;
|
targetAir = false;
|
||||||
health = 600;
|
health = 600;
|
||||||
immunities = ObjectSet.with(StatusEffects.burning, StatusEffects.melting);
|
immunities = ObjectSet.with(StatusEffects.burning, StatusEffects.melting);
|
||||||
|
legCount = 4;
|
||||||
|
legLength = 9f;
|
||||||
|
legTrns = 2f;
|
||||||
|
legMoveSpace = 1.4f;
|
||||||
|
|
||||||
weapons.add(new Weapon("eruption"){{
|
weapons.add(new Weapon("eruption"){{
|
||||||
shootY = 3f;
|
shootY = 3f;
|
||||||
reload = 10f;
|
reload = 10f;
|
||||||
@@ -303,7 +308,6 @@ public class UnitTypes implements ContentList{
|
|||||||
drag = 0.016f;
|
drag = 0.016f;
|
||||||
flying = true;
|
flying = true;
|
||||||
range = 140f;
|
range = 140f;
|
||||||
//rotateShooting = false;
|
|
||||||
hitsize = 18f;
|
hitsize = 18f;
|
||||||
lowAltitude = true;
|
lowAltitude = true;
|
||||||
|
|
||||||
|
|||||||
@@ -18,15 +18,22 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
|||||||
transient Leg[] legs = {};
|
transient Leg[] legs = {};
|
||||||
transient float totalLength;
|
transient float totalLength;
|
||||||
transient int lastGroup;
|
transient int lastGroup;
|
||||||
|
transient float baseRotation;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
//keep elevation halfway
|
//keep elevation halfway
|
||||||
elevation = 0.5f;
|
elevation = 0.4f;
|
||||||
|
|
||||||
|
if(Mathf.dst(deltaX(), deltaY()) > 0.001f){
|
||||||
|
baseRotation = Mathf.slerpDelta(baseRotation, Mathf.angle(deltaX(), deltaY()), 0.1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.info(baseRotation);
|
||||||
|
|
||||||
|
float rot = baseRotation;
|
||||||
int count = type.legCount;
|
int count = type.legCount;
|
||||||
float legLength = type.legLength;
|
float legLength = type.legLength;
|
||||||
float rotation = vel().angle();
|
|
||||||
|
|
||||||
//set up initial leg positions
|
//set up initial leg positions
|
||||||
if(legs.length != type.legCount){
|
if(legs.length != type.legCount){
|
||||||
@@ -37,8 +44,8 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
|||||||
for(int i = 0; i < legs.length; i++){
|
for(int i = 0; i < legs.length; i++){
|
||||||
Leg l = new Leg();
|
Leg l = new Leg();
|
||||||
|
|
||||||
l.joint.trns(i * spacing + rotation, legLength/2f).add(x, y);
|
l.joint.trns(i * spacing + rot, legLength/2f + type.legBaseOffset).add(x, y);
|
||||||
l.base.trns(i * spacing + rotation, legLength).add(x, y);
|
l.base.trns(i * spacing + rot, legLength + type.legBaseOffset).add(x, y);
|
||||||
|
|
||||||
legs[i] = l;
|
legs[i] = l;
|
||||||
}
|
}
|
||||||
@@ -46,7 +53,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
|||||||
|
|
||||||
float moveSpeed = type.legSpeed;
|
float moveSpeed = type.legSpeed;
|
||||||
int div = Math.max(legs.length / 2, 2);
|
int div = Math.max(legs.length / 2, 2);
|
||||||
float moveSpace = legLength / 1.6f / (div / 2f);
|
float moveSpace = legLength / 1.6f / (div / 2f) * type.legMoveSpace;
|
||||||
|
|
||||||
totalLength += Mathf.dst(deltaX(), deltaY());
|
totalLength += Mathf.dst(deltaX(), deltaY());
|
||||||
|
|
||||||
@@ -78,16 +85,19 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
|||||||
float movespace = 360f / legs.length / 4f;
|
float movespace = 360f / legs.length / 4f;
|
||||||
float trns = vel().len() * 12.5f * div/1.5f * type.legTrns;
|
float trns = vel().len() * 12.5f * div/1.5f * type.legTrns;
|
||||||
|
|
||||||
Tmp.v4.trns(rotation, trns);
|
//rotation + offset vector
|
||||||
|
Tmp.v4.trns(rot, trns);
|
||||||
|
|
||||||
for(int i = 0; i < legs.length; i++){
|
for(int i = 0; i < legs.length; i++){
|
||||||
float dstRot = rotation + 360f / legs.length * i + (360f / legs.length / 2f);
|
float dstRot = legAngle(rot, i);
|
||||||
float rot2 = Angles.moveToward(dstRot, rotation + (Angles.angleDist(dstRot, rotation) < 90f ? 180f : 0), movespace);
|
float rot2 = Angles.moveToward(dstRot, rot + (Angles.angleDist(dstRot, rot) < 90f ? 180f : 0), movespace);
|
||||||
|
|
||||||
Leg l = legs[i];
|
Leg l = legs[i];
|
||||||
|
|
||||||
Tmp.v1.trns(dstRot, legLength).add(x, y).add(Tmp.v4);
|
//leg destination
|
||||||
Tmp.v2.trns(rot2, legLength / 2f).add(x, y).add(Tmp.v4);
|
Tmp.v1.trns(dstRot, legLength + type.legBaseOffset).add(x, y).add(Tmp.v4);
|
||||||
|
//join destination
|
||||||
|
Tmp.v2.trns(rot2, legLength / 2f + type.legBaseOffset).add(x, y).add(Tmp.v4);
|
||||||
|
|
||||||
if(i % div == group){
|
if(i % div == group){
|
||||||
l.base.lerpDelta(Tmp.v1, moveSpeed);
|
l.base.lerpDelta(Tmp.v1, moveSpeed);
|
||||||
@@ -98,8 +108,24 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return outwards facing angle of leg at the specified index. */
|
||||||
|
float legAngle(float rotation, int index){
|
||||||
|
return rotation + 360f / legs.length * index + (360f / legs.length / 2f);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(){
|
public void add(){
|
||||||
elevation = 0.5f;
|
elevation = 0.4f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Replace
|
||||||
|
public boolean isGrounded(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Replace
|
||||||
|
public boolean isFlying(){
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
public int commandLimit = 24;
|
public int commandLimit = 24;
|
||||||
|
|
||||||
public int legCount = 4;
|
public int legCount = 4;
|
||||||
public float legLength = 24f, legSpeed = 0.1f, legTrns = 1f;
|
public float legLength = 24f, legSpeed = 0.1f, legTrns = 1f, legBaseOffset = 0f, legMoveSpace = 1f;
|
||||||
|
|
||||||
public int itemCapacity = 30;
|
public int itemCapacity = 30;
|
||||||
public int drillTier = -1;
|
public int drillTier = -1;
|
||||||
@@ -331,30 +331,41 @@ public class UnitType extends UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawLegs(Legsc unit){
|
public void drawLegs(Legsc unit){
|
||||||
|
Draw.z(Layer.groundUnit - 0.02f);
|
||||||
|
|
||||||
Leg[] legs = unit.legs();
|
Leg[] legs = unit.legs();
|
||||||
|
|
||||||
|
|
||||||
float ssize = footRegion.getWidth() * Draw.scl * 1.5f;
|
float ssize = footRegion.getWidth() * Draw.scl * 1.5f;
|
||||||
|
float rotation = unit.baseRotation();
|
||||||
|
|
||||||
for(Leg leg : legs){
|
for(Leg leg : legs){
|
||||||
Drawf.shadow(leg.base.x, leg.base.y, ssize);
|
Drawf.shadow(leg.base.x, leg.base.y, ssize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO should be below/above legs
|
||||||
|
if(baseRegion.found()){
|
||||||
|
Draw.rect(baseRegion, unit.x(), unit.y(), rotation);
|
||||||
|
}
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
|
//TODO figure out layering
|
||||||
for(Leg leg : legs){
|
for(Leg leg : legs){
|
||||||
|
float angle = unit.legAngle(rotation, index);
|
||||||
boolean flip = index++ >= legs.length/2f;
|
boolean flip = index++ >= legs.length/2f;
|
||||||
int flips = Mathf.sign(flip);
|
int flips = Mathf.sign(flip);
|
||||||
|
|
||||||
|
Vec2 position = legOffset.trns(angle, legBaseOffset).add(unit);
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|
||||||
Lines.stroke(legRegion.getHeight() * Draw.scl * flips);
|
Lines.stroke(legRegion.getHeight() * Draw.scl * flips);
|
||||||
Lines.line(legRegion, unit.x(), unit.y(), leg.joint.x, leg.joint.y, CapStyle.none, 0);
|
Lines.line(legRegion, position.x, position.y, leg.joint.x, leg.joint.y, CapStyle.none, 0);
|
||||||
|
|
||||||
Lines.stroke(legBaseRegion.getHeight() * Draw.scl * flips);
|
Lines.stroke(legBaseRegion.getHeight() * Draw.scl * flips);
|
||||||
Lines.line(legBaseRegion, leg.joint.x, leg.joint.y, leg.base.x, leg.base.y, CapStyle.none, 0);
|
Lines.line(legBaseRegion, leg.joint.x, leg.joint.y, leg.base.x, leg.base.y, CapStyle.none, 0);
|
||||||
|
|
||||||
float angle1 = unit.angleTo(leg.joint), angle2 = unit.angleTo(leg.base);
|
float angle2 = position.angleTo(leg.base);
|
||||||
|
|
||||||
Draw.rect(jointRegion, leg.joint.x, leg.joint.y);
|
Draw.rect(jointRegion, leg.joint.x, leg.joint.y);
|
||||||
Draw.rect(footRegion, leg.base.x, leg.base.y, angle2);
|
Draw.rect(footRegion, leg.base.x, leg.base.y, angle2);
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=930b894ae4bf0ce21d331f97cf06db9c5077711f
|
archash=07d1bede12332e51be13f3cd6d3deabc86a95eef
|
||||||
|
|||||||