Various tweaks
This commit is contained in:
@@ -218,6 +218,13 @@ public class Fx{
|
||||
});
|
||||
}).ground(),
|
||||
|
||||
unitLandSmall = new Effect(30, e -> {
|
||||
color(Tmp.c1.set(e.color).mul(1.1f));
|
||||
randLenVectors(e.id, 6, 12f * e.finpow(), (x, y) -> {
|
||||
Fill.circle(e.x + x, e.y + y, e.fout() * 3f + 0.1f);
|
||||
});
|
||||
}).ground(),
|
||||
|
||||
unitPickup = new Effect(18, e -> {
|
||||
color(Pal.lightishGray);
|
||||
stroke(e.fin() * 2f);
|
||||
|
||||
@@ -71,10 +71,30 @@ public class UnitTypes implements ContentList{
|
||||
cix = new UnitType("cix"){{
|
||||
drag = 0.1f;
|
||||
speed = 0.8f;
|
||||
hitsize = 8f;
|
||||
health = 130;
|
||||
hitsize = 11f;
|
||||
health = 140;
|
||||
|
||||
legCount = 6;
|
||||
rotateShooting = false;
|
||||
|
||||
weapons.add(
|
||||
new Weapon("missiles-mount"){{
|
||||
reload = 20f;
|
||||
x = 4f;
|
||||
rotate = true;
|
||||
mirror = false;
|
||||
shake = 1f;
|
||||
bullet = Bullets.missileSwarm;
|
||||
}},
|
||||
new Weapon("missiles-mount"){{
|
||||
reload = 20f;
|
||||
x = -4f;
|
||||
rotate = true;
|
||||
mirror = false;
|
||||
flipSprite = true;
|
||||
shake = 1f;
|
||||
bullet = Bullets.missileSwarm;
|
||||
}});
|
||||
}};
|
||||
|
||||
titan = new UnitType("titan"){{
|
||||
|
||||
@@ -549,7 +549,7 @@ public class NetServer implements ApplicationListener{
|
||||
connection.viewHeight = viewHeight;
|
||||
|
||||
//disable shooting when a mech flies
|
||||
if(!player.dead() && player.unit().isFlying() && !player.unit().type().flying){
|
||||
if(!player.dead() && player.unit().isFlying() && player.unit() instanceof Mechc){
|
||||
shooting = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import mindustry.type.*;
|
||||
import mindustry.type.Sector.*;
|
||||
import mindustry.type.Weather.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
import mindustry.world.blocks.legacy.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
@@ -78,6 +79,18 @@ public class World{
|
||||
return height()*tilesize;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Floor floor(int x, int y){
|
||||
Tile tile = tile(x, y);
|
||||
return tile == null ? Blocks.air.asFloor() : tile.floor();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Floor floorWorld(float x, float y){
|
||||
Tile tile = tileWorld(x, y);
|
||||
return tile == null ? Blocks.air.asFloor() : tile.floor();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Tile tile(int pos){
|
||||
return tile(Point2.x(pos), Point2.y(pos));
|
||||
|
||||
@@ -2,16 +2,20 @@ package mindustry.entities.comp;
|
||||
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
|
||||
@Component
|
||||
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
@Import float x, y, rotation, elevation;
|
||||
@Import float x, y, elevation;
|
||||
|
||||
transient Leg[] legs = {};
|
||||
transient float totalLength;
|
||||
transient int lastGroup;
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
@@ -20,7 +24,9 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
|
||||
int count = type().legCount;
|
||||
float legLength = type().legLength;
|
||||
float rotation = vel().angle();
|
||||
|
||||
//set up initial leg positions
|
||||
if(legs.length != type().legCount){
|
||||
this.legs = new Leg[count];
|
||||
|
||||
@@ -43,7 +49,25 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
totalLength += Mathf.dst(deltaX(), deltaY());
|
||||
|
||||
int stage = (int)(totalLength / moveSpace);
|
||||
int odd = stage % div;
|
||||
int group = stage % div;
|
||||
|
||||
if(lastGroup != group){
|
||||
//create ripple effects when switching leg groups
|
||||
int i = 0;
|
||||
for(Leg l : legs){
|
||||
if(i++ % div == lastGroup){
|
||||
Floor floor = Vars.world.floorWorld(l.base.x, l.base.y);
|
||||
if(floor.isLiquid){
|
||||
floor.walkEffect.at(l.base.x, l.base.y, 0, floor.mapColor);
|
||||
}else{
|
||||
Fx.unitLandSmall.at(l.base.x, l.base.y, 0.5f, floor.mapColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastGroup = group;
|
||||
}
|
||||
|
||||
float movespace = 360f / legs.length / 4f;
|
||||
float trns = vel().len() * 12.5f * div/1.5f;
|
||||
|
||||
@@ -58,7 +82,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
Tmp.v1.trns(dstRot, legLength).add(x, y).add(Tmp.v4);
|
||||
Tmp.v2.trns(rot2, legLength / 2f).add(x, y).add(Tmp.v4);
|
||||
|
||||
if(i % div == odd){
|
||||
if(i % div == group){
|
||||
l.base.lerpDelta(Tmp.v1, moveSpeed);
|
||||
l.joint.lerpDelta(Tmp.v2, moveSpeed / 4f);
|
||||
}
|
||||
|
||||
@@ -579,11 +579,11 @@ public class DesktopInput extends InputHandler{
|
||||
float speed = unit.type().speed * Mathf.lerp(1f, unit.type().canBoost ? unit.type().boostMultiplier : 1f, unit.elevation()) * strafePenalty;
|
||||
float xa = Core.input.axis(Binding.move_x);
|
||||
float ya = Core.input.axis(Binding.move_y);
|
||||
boolean boosted = (!unit.type().flying && unit.isFlying());
|
||||
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||
|
||||
movement.set(xa, ya).nor().scl(speed);
|
||||
float mouseAngle = Angles.mouseAngle(unit.x(), unit.y());
|
||||
boolean aimCursor = omni && isShooting && unit.type().hasWeapons() && unit.type().faceTarget && !boosted;
|
||||
boolean aimCursor = omni && isShooting && unit.type().hasWeapons() && unit.type().faceTarget && !boosted && unit.type().rotateShooting;
|
||||
|
||||
if(aimCursor){
|
||||
unit.lookAt(mouseAngle);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class UnitType extends UnlockableContent{
|
||||
public float drag = 0.3f, accel = 0.5f, landShake = 0f;
|
||||
public float health = 200f, range = -1, armor = 0f;
|
||||
public boolean targetAir = true, targetGround = true;
|
||||
public boolean faceTarget = true, isCounted = true, lowAltitude = false;
|
||||
public boolean faceTarget = true, rotateShooting = true, isCounted = true, lowAltitude = false;
|
||||
public boolean canBoost = false;
|
||||
public int legCount = 4;
|
||||
public float legLength = 24f;
|
||||
@@ -288,7 +288,7 @@ public class UnitType extends UnlockableContent{
|
||||
Draw.rect(weapon.region,
|
||||
unit.x() + Angles.trnsx(rotation, weapon.x * i, weapon.y) + Angles.trnsx(weaponRotation, 0, recoil),
|
||||
unit.y() + Angles.trnsy(rotation, weapon.x * i, weapon.y) + Angles.trnsy(weaponRotation, 0, recoil),
|
||||
width * Draw.scl,
|
||||
width * Draw.scl * -Mathf.sign(weapon.flipSprite),
|
||||
weapon.region.getHeight() * Draw.scl,
|
||||
weaponRotation);
|
||||
}
|
||||
@@ -323,21 +323,24 @@ public class UnitType extends UnlockableContent{
|
||||
Leg[] legs = unit.legs();
|
||||
|
||||
|
||||
float srad = 2.1f;
|
||||
float ssize = footRegion.getWidth() * Draw.scl * 1.5f;
|
||||
|
||||
for(Leg leg : legs){
|
||||
Drawf.shadow(leg.base.x, leg.base.y, ssize);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
|
||||
for(Leg leg : legs){
|
||||
boolean flip = index++ >= legs.length/2f;
|
||||
int flips = Mathf.sign(flip);
|
||||
|
||||
Draw.color();
|
||||
|
||||
Lines.stroke(legRegion.getHeight() * Draw.scl);
|
||||
Lines.stroke(legRegion.getHeight() * Draw.scl * flips);
|
||||
Lines.line(legRegion, unit.x(), unit.y(), leg.joint.x, leg.joint.y, CapStyle.none, 0);
|
||||
|
||||
Lines.stroke(legBaseRegion.getHeight() * Draw.scl);
|
||||
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);
|
||||
|
||||
float angle1 = unit.angleTo(leg.joint), angle2 = unit.angleTo(leg.base);
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Weapon{
|
||||
/** whether to mirror the weapon (draw two of them, which is the default) */
|
||||
public boolean mirror = true;
|
||||
/** whether to flip the weapon's position/side on the ship (only valid when mirror is false) */
|
||||
public boolean flipped = false;
|
||||
public boolean flipped = false, flipSprite = false;
|
||||
/** whether to shoot the weapons in different arms one after another, rather than all at once; only valid when mirror = true */
|
||||
public boolean alternate = false;
|
||||
/** whether to rotate toward the target independently of unit */
|
||||
|
||||
Reference in New Issue
Block a user