mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-13 12:16:53 +07:00
more legs
This commit is contained in:
parent
60684b4ef9
commit
39e3ae931c
BIN
core/assets-raw/sprites/units/reaper.aseprite
Normal file
BIN
core/assets-raw/sprites/units/reaper.aseprite
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 812 KiB After Width: | Height: | Size: 818 KiB |
Binary file not shown.
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 125 KiB |
@ -1274,7 +1274,7 @@ public class Blocks implements ContentList{
|
||||
//region storage
|
||||
|
||||
coreShard = new CoreBlock("core-shard"){{
|
||||
requirements(Category.effect, BuildVisibility.debugOnly, ItemStack.with());
|
||||
requirements(Category.effect, BuildVisibility.hidden, ItemStack.with());
|
||||
alwaysUnlocked = true;
|
||||
|
||||
health = 1100;
|
||||
@ -1283,7 +1283,7 @@ public class Blocks implements ContentList{
|
||||
}};
|
||||
|
||||
coreFoundation = new CoreBlock("core-foundation"){{
|
||||
requirements(Category.effect, BuildVisibility.debugOnly, ItemStack.with());
|
||||
requirements(Category.effect, BuildVisibility.hidden, ItemStack.with());
|
||||
|
||||
health = 2000;
|
||||
itemCapacity = 9000;
|
||||
@ -1291,7 +1291,7 @@ public class Blocks implements ContentList{
|
||||
}};
|
||||
|
||||
coreNucleus = new CoreBlock("core-nucleus"){{
|
||||
requirements(Category.effect, BuildVisibility.debugOnly, ItemStack.with());
|
||||
requirements(Category.effect, BuildVisibility.hidden, ItemStack.with());
|
||||
|
||||
health = 4000;
|
||||
itemCapacity = 13000;
|
||||
|
@ -17,6 +17,9 @@ public class UnitTypes implements ContentList{
|
||||
//ground + builder
|
||||
public static @EntityDef({Unitc.class, Mechc.class, Builderc.class}) UnitType oculon, tau;
|
||||
|
||||
//legs
|
||||
public static @EntityDef({Unitc.class, Legsc.class}) UnitType cix;
|
||||
|
||||
//air
|
||||
public static @EntityDef({Unitc.class}) UnitType wraith, reaper, ghoul, revenant, lich;
|
||||
|
||||
@ -65,6 +68,15 @@ public class UnitTypes implements ContentList{
|
||||
}});
|
||||
}};
|
||||
|
||||
cix = new UnitType("cix"){{
|
||||
drag = 0.1f;
|
||||
speed = 0.8f;
|
||||
hitsize = 8f;
|
||||
health = 130;
|
||||
|
||||
legCount = 6;
|
||||
}};
|
||||
|
||||
titan = new UnitType("titan"){{
|
||||
dagger.upgrade = this;
|
||||
tier = 2;
|
||||
|
8
core/src/mindustry/entities/Leg.java
Normal file
8
core/src/mindustry/entities/Leg.java
Normal file
@ -0,0 +1,8 @@
|
||||
package mindustry.entities;
|
||||
|
||||
import arc.math.geom.*;
|
||||
|
||||
public class Leg{
|
||||
public final Vec2 joint = new Vec2(), base = new Vec2(), target = new Vec2();
|
||||
public boolean moving = false;
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package mindustry.entities.comp;
|
||||
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
@ -9,7 +8,7 @@ import static mindustry.Vars.tilesize;
|
||||
|
||||
@Component
|
||||
abstract class BlockUnitComp implements Unitc{
|
||||
@ReadOnly @NonNull Tilec tile;
|
||||
@ReadOnly Tilec tile;
|
||||
|
||||
public void tile(Tilec tile){
|
||||
this.tile = tile;
|
||||
@ -33,11 +32,13 @@ abstract class BlockUnitComp implements Unitc{
|
||||
|
||||
@Replace
|
||||
public boolean dead(){
|
||||
return tile.dead();
|
||||
return tile == null || tile.dead();
|
||||
}
|
||||
|
||||
@Replace
|
||||
public void team(Team team){
|
||||
tile.team(team);
|
||||
if(tile != null){
|
||||
tile.team(team);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
75
core/src/mindustry/entities/comp/LegsComp.java
Normal file
75
core/src/mindustry/entities/comp/LegsComp.java
Normal file
@ -0,0 +1,75 @@
|
||||
package mindustry.entities.comp;
|
||||
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
@Component
|
||||
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
@Import float x, y, rotation, elevation;
|
||||
|
||||
transient Leg[] legs = {};
|
||||
transient float totalLength;
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
int count = type().legCount;
|
||||
float legLength = type().legLength;
|
||||
|
||||
if(legs.length != type().legCount){
|
||||
this.legs = new Leg[count];
|
||||
|
||||
float spacing = 360f / count;
|
||||
|
||||
for(int i = 0; i < legs.length; i++){
|
||||
Leg l = new Leg();
|
||||
|
||||
l.joint.trns(i * spacing + rotation, legLength/2f).add(x, y);
|
||||
l.base.trns(i * spacing + rotation, legLength).add(x, y);
|
||||
|
||||
legs[i] = l;
|
||||
}
|
||||
}
|
||||
|
||||
float moveSpeed = 0.1f;
|
||||
|
||||
int div = Math.max(legs.length / 3, 2);
|
||||
|
||||
float moveSpace = legLength / 1.6f / (div / 2f);
|
||||
|
||||
elevation = 0.5f;
|
||||
|
||||
totalLength += Mathf.dst(deltaX(), deltaY());
|
||||
|
||||
int stage = (int)(totalLength / moveSpace);
|
||||
int odd = stage % div;
|
||||
float movespace = 360f / legs.length / 4f;
|
||||
float trns = vel().len() * 12.5f * div/2f;
|
||||
|
||||
Tmp.v4.trns(rotation, trns);
|
||||
|
||||
for(int i = 0; i < legs.length; i++){
|
||||
float dstRot = rotation + 360f / legs.length * i + (360f / legs.length / 2f);
|
||||
float rot2 = Angles.moveToward(dstRot, rotation + (Angles.angleDist(dstRot, rotation) < 90f ? 180f : 0), movespace);
|
||||
|
||||
//float ox = Mathf.randomSeedRange(i, 6f), oy = Mathf.randomSeedRange(i, 6f);
|
||||
|
||||
Leg l = legs[i];
|
||||
|
||||
//Tmp.v3.trns(Mathf.randomSeed(stage + i*3, 360f), 10f);
|
||||
Tmp.v3.setZero();
|
||||
|
||||
Tmp.v1.trns(dstRot, legLength).add(x, y).add(Tmp.v3).add(Tmp.v4);
|
||||
Tmp.v2.trns(rot2, legLength / 2f).add(x, y).add(Tmp.v3).add(Tmp.v4);
|
||||
|
||||
if(i % div == odd){
|
||||
l.base.lerpDelta(Tmp.v1, moveSpeed);
|
||||
l.joint.lerpDelta(Tmp.v2, moveSpeed / 4f);
|
||||
}
|
||||
|
||||
l.joint.lerpDelta(Tmp.v2, moveSpeed / 4f);
|
||||
}
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ public class Pal{
|
||||
bulletYellowBack = Color.valueOf("f9c27a"),
|
||||
|
||||
darkMetal = Color.valueOf("6e7080"),
|
||||
darkerMetal = Color.valueOf("565666"),
|
||||
|
||||
missileYellow = Color.valueOf("ffd2ae"),
|
||||
missileYellowBack = Color.valueOf("e58956"),
|
||||
|
@ -14,6 +14,7 @@ import arc.util.ArcAnnotate.*;
|
||||
import mindustry.ai.types.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
@ -38,6 +39,8 @@ public class UnitType extends UnlockableContent{
|
||||
public boolean targetAir = true, targetGround = true;
|
||||
public boolean faceTarget = true, isCounted = true, lowAltitude = false;
|
||||
public boolean canBoost = false;
|
||||
public int legCount = 4;
|
||||
public float legLength = 24f;
|
||||
public float sway = 1f;
|
||||
|
||||
public int itemCapacity = 30;
|
||||
@ -140,13 +143,17 @@ public class UnitType extends UnlockableContent{
|
||||
Draw.z(z - 0.02f);
|
||||
|
||||
if(legs != null){
|
||||
drawLegs(legs);
|
||||
drawMech(legs);
|
||||
|
||||
float ft = Mathf.sin(legs.walkTime(), 3f, 3f);
|
||||
legOffset.trns(legs.baseRotation(), 0f, Mathf.lerp(ft * 0.18f * sway, 0f, unit.elevation()));
|
||||
unit.trns(legOffset.x, legOffset.y);
|
||||
}
|
||||
|
||||
if(unit instanceof Legsc){
|
||||
drawLegs((Legsc)unit);
|
||||
}
|
||||
|
||||
Draw.z(Math.min(z - 0.01f, Layer.bullet - 1f));
|
||||
drawOcclusion(unit);
|
||||
|
||||
@ -309,7 +316,33 @@ public class UnitType extends UnlockableContent{
|
||||
}
|
||||
}
|
||||
|
||||
public void drawLegs(Mechc unit){
|
||||
public void drawLegs(Legsc unit){
|
||||
Leg[] legs = unit.legs();
|
||||
|
||||
Lines.stroke(4f, Color.gray);
|
||||
float srad = 2.1f;
|
||||
|
||||
for(Leg leg : legs){
|
||||
|
||||
Draw.color();
|
||||
|
||||
Lines.line(legRegion, unit.x(), unit.y(), leg.joint.x, leg.joint.y, CapStyle.none, 0);
|
||||
Lines.line(legRegion, leg.joint.x, leg.joint.y, leg.base.x, leg.base.y, CapStyle.none, 0);
|
||||
|
||||
Draw.color(Pal.darkMetal);
|
||||
Fill.circle(leg.joint.x, leg.joint.y, srad);
|
||||
|
||||
Draw.color(Pal.darkerMetal);
|
||||
Fill.circle(leg.base.x, leg.base.y, srad);
|
||||
|
||||
Draw.color();
|
||||
//Lines.line(unit.x(), unit.y(), leg.base.x, leg.base.y);
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public void drawMech(Mechc unit){
|
||||
Draw.reset();
|
||||
|
||||
Draw.mixcol(Color.white, unit.hitTime());
|
||||
|
@ -22,7 +22,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
public Color botColor = Color.valueOf("565656");
|
||||
|
||||
public @Load(value = "@-top-#", length = 7) TextureRegion[] topRegions;
|
||||
public @Load(value = "@-bottom-#", length = 7, fallback = "conduit") TextureRegion[] botRegions;
|
||||
public @Load(value = "@-bottom-#", length = 7, fallback = "conduit-bottom-#") TextureRegion[] botRegions;
|
||||
|
||||
public float leakResistance = 1.5f;
|
||||
|
||||
@ -44,8 +44,6 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
Draw.alpha(0.5f);
|
||||
Draw.rect(botRegions[bits[0]], req.drawx(), req.drawy(), req.rotation * 90);
|
||||
Draw.color();
|
||||
|
||||
|
||||
Draw.rect(topRegions[bits[0]], req.drawx(), req.drawy(), req.rotation * 90);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user