This commit is contained in:
Anuken
2020-08-20 18:37:15 -04:00
parent c946b42360
commit 52489ef777
8 changed files with 35 additions and 13 deletions

View File

@@ -1,6 +1,5 @@
package mindustry.async;
import arc.*;
import arc.box2d.*;
import arc.box2d.BodyDef.*;
import arc.math.geom.*;
@@ -98,7 +97,7 @@ public class PhysicsProcess implements AsyncProcess{
ref.lastVelocity.set(ref.velocity);
}
physics.step(Core.graphics.getDeltaTime(), 5, 8);
physics.step(1f/45f, 5, 8);
//get delta vectors
for(PhysicRef ref : refs){

View File

@@ -592,6 +592,7 @@ public class UnitTypes implements ContentList{
bullet = new BasicBulletType(7f, 60){{
width = 12f;
height = 18f;
lifetime = 30f;
shootEffect = Fx.shootBig;
}};
}}

View File

@@ -264,7 +264,7 @@ public abstract class BulletType extends Content{
bullet.damage = damage < 0 ? this.damage : damage;
bullet.add();
if(keepVelocity && owner instanceof Hitboxc) bullet.vel.add(((Hitboxc)owner).deltaX(), ((Hitboxc)owner).deltaY());
if(keepVelocity && owner instanceof Hitboxc) bullet.vel.add(((Hitboxc)owner).deltaX() / Time.delta, ((Hitboxc)owner).deltaY() / Time.delta);
return bullet;
}

View File

@@ -13,7 +13,7 @@ abstract class MechComp implements Posc, Flyingc, Hitboxc, Unitc, Mechc, Elevati
@Override
public void update(){
float len = deltaLen();
baseRotation = Angles.moveToward(baseRotation, deltaAngle(), type().baseRotateSpeed * Mathf.clamp(len / type().speed));
walkTime += Time.delta *len;
baseRotation = Angles.moveToward(baseRotation, deltaAngle(), type().baseRotateSpeed * Mathf.clamp(len / type().speed / Time.delta) * Time.delta);
walkTime += len;
}
}

View File

@@ -1,5 +1,6 @@
package mindustry.entities.comp;
import arc.math.*;
import arc.math.geom.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
@@ -18,7 +19,7 @@ abstract class VelComp implements Posc{
@Override
public void update(){
move(vel.x * Time.delta, vel.y * Time.delta);
vel.scl(1f - drag * Time.delta);
vel.scl(Mathf.clamp(1f - drag * Time.delta));
}
boolean moving(){

View File

@@ -593,8 +593,8 @@ public class DesktopInput extends InputHandler{
if(aimCursor){
unit.lookAt(mouseAngle);
}else{
if(unit.moving()){
unit.lookAt(unit.vel().angle());
if(!movement.isZero()){
unit.lookAt(unit.vel.isZero() ? movement.angle() : unit.vel.angle());
}
}
@@ -616,7 +616,6 @@ public class DesktopInput extends InputHandler{
//update payload input
if(unit instanceof Payloadc){
Payloadc pay = (Payloadc)unit;
if(Core.input.keyTap(Binding.pickupCargo)){
tryPickupPayload();

View File

@@ -171,16 +171,14 @@ public class Conveyor extends Block implements Autotiler{
@Override
public void unitOn(Unit unit){
if(clogHeat > 0.5f){
return;
}
if(clogHeat > 0.5f) return;
noSleep();
float mspeed = speed * tilesize * 55f;
float centerSpeed = 0.1f;
float centerDstScl = 3f;
float tx = Geometry.d4[rotation].x, ty = Geometry.d4[rotation].y;
float tx = Geometry.d4x[rotation], ty = Geometry.d4y[rotation];
float centerx = 0f, centery = 0f;

View File

@@ -4,6 +4,7 @@ import arc.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.*;
import mindustry.content.*;
import mindustry.entities.*;
@@ -187,5 +188,28 @@ public class Reconstructor extends UnitBlock{
UnitType[] r = Structs.find(upgrades, arr -> arr[0] == type);
return r == null ? null : r[1];
}
@Override
public byte version(){
return 1;
}
@Override
public void write(Writes write){
super.write(write);
write.f(progress);
}
@Override
public void read(Reads read, byte revision){
super.read(read, revision);
if(revision == 1){
progress = read.f();
}
}
}
}