1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2025-03-11 02:19:56 +07:00

Various tweaks

This commit is contained in:
Anuken 2020-09-12 21:41:43 -04:00
parent e5ff429241
commit 8234f31e83
20 changed files with 105 additions and 24 deletions

View File

@ -36,7 +36,7 @@ allprojects{
if(!project.hasProperty("versionType")) versionType = 'official'
appName = 'Mindustry'
steamworksVersion = '891ed912791e01fe9ee6237a6497e5212b85c256'
rhinoVersion = 'bf4150f7add42d26c98e33c24acfd94fa87be2e1'
rhinoVersion = '8437435dab9993769d72739608580d40c5343285'
loadVersionProps = {
return new Properties().with{p -> p.load(file('../core/assets/version.properties').newReader()); return p }

Binary file not shown.

Before

(image error) Size: 255 B

After

(image error) Size: 253 B

Binary file not shown.

Before

(image error) Size: 354 B

After

(image error) Size: 341 B

Binary file not shown.

Before

(image error) Size: 747 B

After

(image error) Size: 804 B

Binary file not shown.

Before

(image error) Size: 670 B

After

(image error) Size: 740 B

Binary file not shown.

Before

(image error) Size: 647 KiB

After

(image error) Size: 647 KiB

Binary file not shown.

Before

(image error) Size: 960 KiB

After

(image error) Size: 960 KiB

Binary file not shown.

Before

(image error) Size: 378 KiB

After

(image error) Size: 378 KiB

Binary file not shown.

Before

(image error) Size: 185 KiB

After

(image error) Size: 189 KiB

Binary file not shown.

Before

(image error) Size: 1.3 MiB

After

(image error) Size: 1.3 MiB

Binary file not shown.

Before

(image error) Size: 2.1 MiB

After

(image error) Size: 2.1 MiB

Binary file not shown.

Before

(image error) Size: 186 KiB

After

(image error) Size: 191 KiB

Binary file not shown.

Before

(image error) Size: 1.3 MiB

After

(image error) Size: 1.3 MiB

View File

@ -433,6 +433,7 @@ public class Bullets implements ContentList{
hitSize = 7f;
lifetime = 18f;
pierce = true;
collidesAir = false;
statusDuration = 60f * 4;
shootEffect = Fx.shootSmallFlame;
hitEffect = Fx.hitFlameSmall;
@ -447,6 +448,7 @@ public class Bullets implements ContentList{
hitSize = 7f;
lifetime = 18f;
pierce = true;
collidesAir = false;
statusDuration = 60f * 6;
shootEffect = Fx.shootPyraFlame;
hitEffect = Fx.hitFlameSmall;

View File

@ -103,6 +103,7 @@ public class UnitTypes implements ContentList{
targetAir = false;
health = 790;
armor = 9f;
mechFrontSway = 0.55f;
weapons.add(new Weapon("artillery"){{
y = 1f;
@ -131,11 +132,13 @@ public class UnitTypes implements ContentList{
speed = 0.35f;
hitsize = 20f;
rotateSpeed = 2.1f;
targetAir = false;
health = 9000;
armor = 11f;
mechLegMoveScl = 1.3f;
canDrown = false;
mechFrontSway = 1f;
mechStepParticles = true;
mechStepShake = 0.15f;
weapons.add(
new Weapon("scepter-weapon"){{
@ -188,11 +191,13 @@ public class UnitTypes implements ContentList{
speed = 0.35f;
hitsize = 26f;
rotateSpeed = 1.65f;
targetAir = false;
health = 24000;
armor = 14f;
mechLegMoveScl = 1.75f;
mechStepParticles = true;
mechStepShake = 0.75f;
canDrown = false;
mechFrontSway = 1.9f;
mechSideSway = 0.6f;
weapons.add(
new Weapon("reign-weapon"){{
@ -201,7 +206,7 @@ public class UnitTypes implements ContentList{
shootY = 11f;
reload = 9f;
recoil = 5f;
shake = 4f;
shake = 2f;
ejectEffect = Fx.shellEjectBig;
shootSound = Sounds.artillery;
@ -319,6 +324,7 @@ public class UnitTypes implements ContentList{
landShake = 2f;
commandLimit = 24;
mechFrontSway = 0.55f;
speed = 0.4f;
hitsize = 10f;
@ -357,7 +363,7 @@ public class UnitTypes implements ContentList{
speed = 0.85f;
hitsize = 8f;
health = 170;
sway = 0.25f;
mechSideSway = 0.25f;
range = 40f;
weapons.add(new Weapon(){{

View File

@ -10,7 +10,7 @@ import static mindustry.Vars.*;
public class EntityCollisions{
//range for tile collision scanning
private static final int r = 1;
private static final int r = 2;
//move in 1-unit chunks
private static final float seg = 1f;

View File

@ -57,7 +57,7 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
each(Entityc::update);
}
public void copy(Seq arr){
public void copy(Seq<T> arr){
arr.addAll(array);
}

View File

@ -8,7 +8,7 @@ import mindustry.gen.*;
@Component
abstract class MechComp implements Posc, Flyingc, Hitboxc, Unitc, Mechc, ElevationMovec{
@SyncField(false) @SyncLocal float baseRotation;
transient float walkTime;
transient float walkTime, walkExtension;
@Override
public void update(){

View File

@ -48,7 +48,6 @@ public class UnitType extends UnlockableContent{
public boolean canBoost = false;
public boolean destructibleWreck = true;
public float groundLayer = Layer.groundUnit;
public float sway = 1f;
public float payloadCapacity = 8;
public int commandLimit = 24;
public float visualElevation = -1f;
@ -62,7 +61,12 @@ public class UnitType extends UnlockableContent{
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 mechLegMoveScl = 1f;
public float mechSideSway = 0.54f, mechFrontSway = 0.1f;
public float mechStride = -1f;
public float mechStepShake = -1f;
public boolean mechStepParticles = false;
public Color mechLegColor = Pal.darkMetal;
public int itemCapacity = -1;
public int ammoCapacity = 220;
@ -133,6 +137,42 @@ public class UnitType extends UnlockableContent{
a.update(unit);
}
}
if(unit instanceof Mechc){
updateMechEffects(unit);
}
}
public void updateMechEffects(Unit unit){
Mechc mech = (Mechc)unit;
float extend = walkExtend((Mechc)unit, false);
float base = walkExtend((Mechc)unit, true);
float extendScl = base % 1f;
float lastExtend = mech.walkExtension();
if(extendScl < lastExtend && base % 2f > 1f){
int side = -Mathf.sign(extend);
float width = hitsize / 2f * side, length = mechStride * 1.35f;
float cx = unit.x + Angles.trnsx(mech.baseRotation(), length, width),
cy = unit.y + Angles.trnsy(mech.baseRotation(), length, width);
if(mechStepShake > 0){
Effect.shake(mechStepShake, mechStepShake, cx, cy);
}
if(mechStepParticles){
Tile tile = world.tileWorld(cx, cy);
if(tile != null){
Color color = tile.floor().mapColor;
Fx.unitLand.at(cx, cy, hitsize/8f, color);
}
}
}
mech.walkExtension(extendScl);
}
public void landed(Unit unit){}
@ -208,6 +248,15 @@ public class UnitType extends UnlockableContent{
}
}
if(mechStride < 0){
mechStride = 4f + (hitsize-8f)/2.1f;
}
if(mechStepShake < 0){
mechStepShake = Mathf.round((hitsize - 11f) / 9f);
mechStepParticles = hitsize > 15f;
}
canHeal = weapons.contains(w -> w.bullet instanceof HealBulletType);
//add mirrored weapon variants
@ -286,10 +335,14 @@ public class UnitType extends UnlockableContent{
Draw.z(z - 0.02f);
if(mech != null){
drawMech((Unit & Mechc)mech);
drawMech(mech);
//side
legOffset.trns(mech.baseRotation(), 0f, Mathf.lerp(Mathf.sin(walkExtend(mech, true), 2f/Mathf.PI, 1) * mechSideSway, 0f, unit.elevation));
//front
legOffset.add(Tmp.v1.trns(mech.baseRotation() + 90, 0f, Mathf.lerp(Mathf.sin(walkExtend(mech, true), 1f/Mathf.PI, 1) * mechFrontSway, 0f, unit.elevation)));
float ft = Mathf.sin(mech.walkTime(), 3f * mechLegMoveScl, 3f);
legOffset.trns(mech.baseRotation(), 0f, Mathf.lerp(ft * 0.18f * sway, 0f, unit.elevation));
unit.trns(legOffset.x, legOffset.y);
}
@ -551,14 +604,15 @@ public class UnitType extends UnlockableContent{
Draw.reset();
}
public <T extends Unit & Mechc> void drawMech(T unit){
public void drawMech(Mechc mech){
Unit unit = (Unit)mech;
Draw.reset();
Draw.mixcol(Color.white, unit.hitTime);
float e = unit.elevation;
float sin = Mathf.lerp(Mathf.sin(unit.walkTime(), 3f * mechLegMoveScl, 1f), 0f, e);
float ft = sin*(2.5f + (unit.hitSize-8f)/2f);
float sin = Mathf.lerp(Mathf.sin(walkExtend(mech, true), 2f / Mathf.PI, 1f), 0f, e);
float extension = walkExtend(mech, false);
float boostTrns = e * 2f;
Floor floor = unit.isFlying() ? Blocks.air.asFloor() : unit.floorOn();
@ -568,25 +622,43 @@ public class UnitType extends UnlockableContent{
}
for(int i : Mathf.signs){
Draw.mixcol(Tmp.c1.set(mechLegColor).lerp(Color.white, Mathf.clamp(unit.hitTime)), Math.max(Math.max(0, i * extension / mechStride), unit.hitTime));
Draw.rect(legRegion,
unit.x + Angles.trnsx(unit.baseRotation(), ft * i - boostTrns, -boostTrns*i),
unit.y + Angles.trnsy(unit.baseRotation(), ft * i - boostTrns, -boostTrns*i),
unit.x + Angles.trnsx(mech.baseRotation(), extension * i - boostTrns, -boostTrns*i),
unit.y + Angles.trnsy(mech.baseRotation(), extension * i - boostTrns, -boostTrns*i),
legRegion.getWidth() * i * Draw.scl,
legRegion.getHeight() * Draw.scl - Math.max(-sin * i, 0) * legRegion.getHeight() * 0.5f * Draw.scl,
unit.baseRotation() - 90 + 35f*i*e);
mech.baseRotation() - 90 + 35f*i*e);
}
Draw.mixcol(Color.white, unit.hitTime);
if(floor.isLiquid){
Draw.color(Color.white, floor.mapColor, unit.drownTime() * 0.4f);
}else{
Draw.color(Color.white);
}
Draw.rect(baseRegion, unit, unit.baseRotation() - 90);
Draw.rect(baseRegion, unit, mech.baseRotation() - 90);
Draw.mixcol();
}
public float walkExtend(Mechc mech, boolean scaled){
//now ranges from -maxExtension to maxExtension*3
float raw = mech.walkTime() % (mechStride * 4);
if(scaled) return raw / mechStride;
if(raw > mechStride*3) raw = raw - mechStride * 4;
else if(raw > mechStride*2) raw = mechStride * 2 - raw;
else if(raw > mechStride) raw = mechStride * 2 - raw;
return raw;
}
public void applyColor(Unit unit){
Draw.color();
Draw.mixcol(Color.white, unit.hitTime);

View File

@ -39,6 +39,7 @@ public class CoreItemsDisplay extends Table{
for(Item item : content.items()){
if(usedItems.contains(item)){
image(item.icon(Cicon.small)).padRight(3);
//TODO leaks garbage
label(() -> core == null ? "0" : UI.formatAmount(core.items.get(item))).padRight(3).left();
if(++i % 4 == 0){