Various tweaks
|
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 820 KiB After Width: | Height: | Size: 826 KiB |
|
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 126 KiB |
@@ -218,6 +218,13 @@ public class Fx{
|
|||||||
});
|
});
|
||||||
}).ground(),
|
}).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 -> {
|
unitPickup = new Effect(18, e -> {
|
||||||
color(Pal.lightishGray);
|
color(Pal.lightishGray);
|
||||||
stroke(e.fin() * 2f);
|
stroke(e.fin() * 2f);
|
||||||
|
|||||||
@@ -71,10 +71,30 @@ public class UnitTypes implements ContentList{
|
|||||||
cix = new UnitType("cix"){{
|
cix = new UnitType("cix"){{
|
||||||
drag = 0.1f;
|
drag = 0.1f;
|
||||||
speed = 0.8f;
|
speed = 0.8f;
|
||||||
hitsize = 8f;
|
hitsize = 11f;
|
||||||
health = 130;
|
health = 140;
|
||||||
|
|
||||||
legCount = 6;
|
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"){{
|
titan = new UnitType("titan"){{
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
connection.viewHeight = viewHeight;
|
connection.viewHeight = viewHeight;
|
||||||
|
|
||||||
//disable shooting when a mech flies
|
//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;
|
shooting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import mindustry.type.*;
|
|||||||
import mindustry.type.Sector.*;
|
import mindustry.type.Sector.*;
|
||||||
import mindustry.type.Weather.*;
|
import mindustry.type.Weather.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.blocks.environment.*;
|
||||||
import mindustry.world.blocks.legacy.*;
|
import mindustry.world.blocks.legacy.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@@ -78,6 +79,18 @@ public class World{
|
|||||||
return height()*tilesize;
|
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
|
@Nullable
|
||||||
public Tile tile(int pos){
|
public Tile tile(int pos){
|
||||||
return tile(Point2.x(pos), Point2.y(pos));
|
return tile(Point2.x(pos), Point2.y(pos));
|
||||||
|
|||||||
@@ -2,16 +2,20 @@ package mindustry.entities.comp;
|
|||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import mindustry.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.world.blocks.environment.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||||
@Import float x, y, rotation, elevation;
|
@Import float x, y, elevation;
|
||||||
|
|
||||||
transient Leg[] legs = {};
|
transient Leg[] legs = {};
|
||||||
transient float totalLength;
|
transient float totalLength;
|
||||||
|
transient int lastGroup;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
@@ -20,7 +24,9 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
|||||||
|
|
||||||
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
|
||||||
if(legs.length != type().legCount){
|
if(legs.length != type().legCount){
|
||||||
this.legs = new Leg[count];
|
this.legs = new Leg[count];
|
||||||
|
|
||||||
@@ -43,7 +49,25 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
|||||||
totalLength += Mathf.dst(deltaX(), deltaY());
|
totalLength += Mathf.dst(deltaX(), deltaY());
|
||||||
|
|
||||||
int stage = (int)(totalLength / moveSpace);
|
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 movespace = 360f / legs.length / 4f;
|
||||||
float trns = vel().len() * 12.5f * div/1.5f;
|
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.v1.trns(dstRot, legLength).add(x, y).add(Tmp.v4);
|
||||||
Tmp.v2.trns(rot2, legLength / 2f).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.base.lerpDelta(Tmp.v1, moveSpeed);
|
||||||
l.joint.lerpDelta(Tmp.v2, moveSpeed / 4f);
|
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 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 xa = Core.input.axis(Binding.move_x);
|
||||||
float ya = Core.input.axis(Binding.move_y);
|
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);
|
movement.set(xa, ya).nor().scl(speed);
|
||||||
float mouseAngle = Angles.mouseAngle(unit.x(), unit.y());
|
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){
|
if(aimCursor){
|
||||||
unit.lookAt(mouseAngle);
|
unit.lookAt(mouseAngle);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
public float drag = 0.3f, accel = 0.5f, landShake = 0f;
|
public float drag = 0.3f, accel = 0.5f, landShake = 0f;
|
||||||
public float health = 200f, range = -1, armor = 0f;
|
public float health = 200f, range = -1, armor = 0f;
|
||||||
public boolean targetAir = true, targetGround = true;
|
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 boolean canBoost = false;
|
||||||
public int legCount = 4;
|
public int legCount = 4;
|
||||||
public float legLength = 24f;
|
public float legLength = 24f;
|
||||||
@@ -288,7 +288,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
Draw.rect(weapon.region,
|
Draw.rect(weapon.region,
|
||||||
unit.x() + Angles.trnsx(rotation, weapon.x * i, weapon.y) + Angles.trnsx(weaponRotation, 0, recoil),
|
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),
|
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,
|
weapon.region.getHeight() * Draw.scl,
|
||||||
weaponRotation);
|
weaponRotation);
|
||||||
}
|
}
|
||||||
@@ -323,21 +323,24 @@ public class UnitType extends UnlockableContent{
|
|||||||
Leg[] legs = unit.legs();
|
Leg[] legs = unit.legs();
|
||||||
|
|
||||||
|
|
||||||
float srad = 2.1f;
|
|
||||||
float ssize = footRegion.getWidth() * Draw.scl * 1.5f;
|
float ssize = footRegion.getWidth() * Draw.scl * 1.5f;
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
for(Leg leg : legs){
|
for(Leg leg : legs){
|
||||||
|
boolean flip = index++ >= legs.length/2f;
|
||||||
|
int flips = Mathf.sign(flip);
|
||||||
|
|
||||||
Draw.color();
|
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.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);
|
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 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) */
|
/** whether to mirror the weapon (draw two of them, which is the default) */
|
||||||
public boolean mirror = true;
|
public boolean mirror = true;
|
||||||
/** whether to flip the weapon's position/side on the ship (only valid when mirror is false) */
|
/** 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 */
|
/** 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;
|
public boolean alternate = false;
|
||||||
/** whether to rotate toward the target independently of unit */
|
/** whether to rotate toward the target independently of unit */
|
||||||
|
|||||||