WIP actually insect-like unit

This commit is contained in:
Anuken 2022-02-01 00:07:00 -05:00
parent 77e29af522
commit 092ce9d5ff
15 changed files with 100 additions and 16 deletions

View file

@ -92,6 +92,17 @@ android{
}
}
buildTypes{
all{
minifyEnabled = true
shrinkResources = true
//this is the ONLY WAY I could find to force r8 to keep its filthy hands off of my default interfaces.
//may have undesirable side effects
debuggable = true
proguardFiles("proguard-rules.pro")
}
}
if(project.hasProperty("RELEASE_STORE_FILE") || System.getenv("CI") == "true"){
buildTypes{
release{

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Before After
Before After

View file

@ -519,3 +519,4 @@
63184=crystal-orbs|block-crystal-orbs-ui
63183=conquer|unit-conquer-ui
63182=disrupt|unit-disrupt-ui
63181=krepost|unit-krepost-ui

Binary file not shown.

View file

@ -3147,14 +3147,14 @@ public class Blocks{
//TODO balance, set up, where is liquid/sec displayed? status effects maybe?
ammo(
Liquids.ozone, new ContinuousFlameBulletType(){{
damage = 85f;
damage = 90f;
length = range;
knockback = 1f;
colors = new Color[]{Color.valueOf("eb7abe").a(0.55f), Color.valueOf("e189f5").a(0.7f), Color.valueOf("907ef7").a(0.8f), Color.valueOf("91a4ff"), Color.white};
}},
Liquids.cyanogen, new ContinuousFlameBulletType(){{
damage = 180f;
damage = 200f;
rangeChange = 70f;
length = range + rangeChange;
knockback = 2f;
@ -3167,7 +3167,7 @@ public class Blocks{
);
acceptCoolant = false;
scaledHealth = 320;
scaledHealth = 330;
shootLength = 7f;
size = 3;
}};

View file

@ -125,7 +125,7 @@ public class SectorPresets{
three = new SectorPreset("three", erekir, 32){{
captureWave = 8;
difficulty = 8;
difficulty = 5;
}};
//endregion

View file

@ -2650,6 +2650,42 @@ public class UnitTypes{
}});
}};
krepost = new UnitType("krepost"){{
drag = 0.1f;
speed = 1f;
hitSize = 19f;
health = 7300;
armor = 5f;
outlineColor = Pal.darkOutline;
envDisabled = Env.space;
rotateSpeed = 1.8f;
lockLegBase = true;
legStraightness = 1f;
baseLegStraightness = 0.6f;
legCount = 8;
legLength = 30f;
legTrns = 2f;
legMoveSpace = 1.05f;
rippleScale = 1.2f;
landShake = 0.5f;
legGroupSize = 2;
legExtension = -5f;
legBaseOffset = 19f;
legStraightLength = 0.9f;
maxStretch = 1.2f;
ammoType = new PowerAmmoType(2000);
legSplashDamage = 32;
legSplashRange = 32;
drownTimeMultiplier = 2f;
hovering = true;
visualElevation = 0.4f;
groundLayer = Layer.legUnit;
}};
//endregion
//region erekir - flying

View file

@ -17,7 +17,9 @@ import mindustry.world.blocks.environment.*;
@Component
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
@Import float x, y;
private static final Vec2 straightVec = new Vec2();
@Import float x, y, rotation;
@Import UnitType type;
@Import Team team;
@ -83,6 +85,10 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
baseRotation = Angles.moveToward(baseRotation, Mathf.angle(deltaX(), deltaY()), type.rotateSpeed);
}
if(type.lockLegBase){
baseRotation = rotation;
}
float rot = baseRotation;
float legLength = type.legLength;
@ -106,8 +112,8 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
int deeps = 0;
for(int i = 0; i < legs.length; i++){
float dstRot = legAngle(rot, i);
Vec2 baseOffset = Tmp.v5.trns(dstRot, type.legBaseOffset).add(x, y);
float dstRot = legAngle(i);
Vec2 baseOffset = legOffset(Tmp.v5, i).add(x, y);
Leg l = legs[i];
l.joint.sub(baseOffset).limit(type.maxStretch * legLength/2f).add(baseOffset);
@ -121,6 +127,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
//back legs have reversed directions
boolean backLeg = Math.abs((i + 0.5f) - legs.length/2f) <= 0.501f;
if(backLeg && type.flipBackLegs) side = !side;
if(type.flipLegSide) side = !side;
l.moving = move;
l.stage = moving ? stageF % 1f : Mathf.lerpDelta(l.stage, 0f, 0.1f);
@ -180,9 +187,29 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
}
}
Vec2 legOffset(Vec2 out, int index){
out.trns(defaultLegAngle(index), type.legBaseOffset);
if(type.legStraightness > 0){
straightVec.trns(defaultLegAngle(index) - baseRotation, type.legBaseOffset);
straightVec.y = Mathf.sign(straightVec.y) * type.legBaseOffset * type.legStraightLength;
straightVec.rotate(baseRotation);
out.lerp(straightVec, type.baseLegStraightness);
}
return out;
}
/** @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);
float legAngle(int index){
if(type.legStraightness > 0){
return Mathf.slerp(defaultLegAngle(index), (index >= legs.length/2 ? -90 : 90f) + baseRotation, type.legStraightness);
}
return defaultLegAngle(index);
}
float defaultLegAngle(int index){
return baseRotation + 360f / legs.length * index + (360f / legs.length / 2f);
}
}

View file

@ -111,7 +111,12 @@ public class UnitType extends UnlockableContent{
public int legCount = 4, legGroupSize = 2;
public float legLength = 10f, legSpeed = 0.1f, legTrns = 1f, legBaseOffset = 0f, legMoveSpace = 1f, legExtension = 0, legPairOffset = 0, legLengthScl = 1f, kinematicScl = 1f, maxStretch = 1.75f;
public float legSplashDamage = 0f, legSplashRange = 5;
public boolean flipBackLegs = true;
public float legStraightLength = 1f;
/** If true, legs are locked to the base of the unit instead of being on an implicit rotating "mount". */
public boolean lockLegBase = false;
public float baseLegStraightness, legStraightness;
/** TODO neither of these appear to do much */
public boolean flipBackLegs = true, flipLegSide = false;
public float mechSideSway = 0.54f, mechFrontSway = 0.1f;
public float mechStride = -1f;
@ -1028,23 +1033,25 @@ public class UnitType extends UnlockableContent{
float rotation = unit.baseRotation();
float invDrown = 1f - unit.drownTime;
if(footRegion.found()){
for(Leg leg : legs){
Drawf.shadow(leg.base.x, leg.base.y, ssize, invDrown);
}
}
//legs are drawn front first
for(int j = legs.length - 1; j >= 0; j--){
int i = (j % 2 == 0 ? j/2 : legs.length - 1 - j/2);
Leg leg = legs[i];
float angle = unit.legAngle(rotation, i);
float angle = unit.legAngle(i);
boolean flip = i >= legs.length/2f;
int flips = Mathf.sign(flip);
Vec2 position = legOffset.trns(angle, legBaseOffset).add(unit);
Vec2 position = unit.legOffset(legOffset, i).add(unit);
Tmp.v1.set(leg.base).sub(leg.joint).inv().setLength(legExtension);
if(leg.moving && visualElevation > 0){
if(footRegion.found() && leg.moving && visualElevation > 0){
float scl = visualElevation * invDrown;
float elev = Mathf.slope(1f - leg.stage) * scl;
Draw.color(Pal.shadow);
@ -1054,7 +1061,9 @@ public class UnitType extends UnlockableContent{
Draw.mixcol(Tmp.c3, Tmp.c3.a);
if(footRegion.found()){
Draw.rect(footRegion, leg.base.x, leg.base.y, position.angleTo(leg.base));
}
Lines.stroke(legRegion.height * Draw.scl * flips);
Lines.line(legRegion, position.x, position.y, leg.joint.x, leg.joint.y, false);