Fixed many various physics bugs
This commit is contained in:
@@ -27,7 +27,7 @@ allprojects {
|
|||||||
appName = 'Mindustry'
|
appName = 'Mindustry'
|
||||||
gdxVersion = '1.9.8'
|
gdxVersion = '1.9.8'
|
||||||
roboVMVersion = '2.3.0'
|
roboVMVersion = '2.3.0'
|
||||||
uCoreVersion = 'ee0de709b7ab7bc993db42436a378ceee88c6460'
|
uCoreVersion = '8b72f5b0fadc4a2133337d9db4651ac4794581d9'
|
||||||
|
|
||||||
getVersionString = {
|
getVersionString = {
|
||||||
String buildVersion = getBuildVersion()
|
String buildVersion = getBuildVersion()
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public class Mechs implements ContentList{
|
|||||||
speed = 0.5f;
|
speed = 0.5f;
|
||||||
boostSpeed = 0.85f;
|
boostSpeed = 0.85f;
|
||||||
weapon = Weapons.blaster;
|
weapon = Weapons.blaster;
|
||||||
maxSpeed = 4f;
|
|
||||||
trailColorTo = Color.valueOf("ffd37f");
|
trailColorTo = Color.valueOf("ffd37f");
|
||||||
armor = 20f;
|
armor = 20f;
|
||||||
}
|
}
|
||||||
@@ -89,7 +88,6 @@ public class Mechs implements ContentList{
|
|||||||
weaponOffsetY = -1;
|
weaponOffsetY = -1;
|
||||||
weapon = Weapons.shockgun;
|
weapon = Weapons.shockgun;
|
||||||
trailColorTo = Color.valueOf("d3ddff");
|
trailColorTo = Color.valueOf("d3ddff");
|
||||||
maxSpeed = 5f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -122,7 +120,6 @@ public class Mechs implements ContentList{
|
|||||||
drag = 0.35f;
|
drag = 0.35f;
|
||||||
boostSpeed = 0.8f;
|
boostSpeed = 0.8f;
|
||||||
weapon = Weapons.healBlaster;
|
weapon = Weapons.healBlaster;
|
||||||
maxSpeed = 5f;
|
|
||||||
armor = 15f;
|
armor = 15f;
|
||||||
trailColorTo = Palette.heal;
|
trailColorTo = Palette.heal;
|
||||||
}
|
}
|
||||||
@@ -166,7 +163,6 @@ public class Mechs implements ContentList{
|
|||||||
weaponOffsetY = 0;
|
weaponOffsetY = 0;
|
||||||
weapon = Weapons.swarmer;
|
weapon = Weapons.swarmer;
|
||||||
trailColorTo = Color.valueOf("feb380");
|
trailColorTo = Color.valueOf("feb380");
|
||||||
maxSpeed = 3.5f;
|
|
||||||
armor = 45f;
|
armor = 45f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +214,6 @@ public class Mechs implements ContentList{
|
|||||||
drillPower = 1;
|
drillPower = 1;
|
||||||
mineSpeed = 0.9f;
|
mineSpeed = 0.9f;
|
||||||
speed = 0.4f;
|
speed = 0.4f;
|
||||||
maxSpeed = 10f;
|
|
||||||
drag = 0.1f;
|
drag = 0.1f;
|
||||||
armor = 10f;
|
armor = 10f;
|
||||||
weapon = Weapons.blasterSmall;
|
weapon = Weapons.blasterSmall;
|
||||||
@@ -235,7 +230,6 @@ public class Mechs implements ContentList{
|
|||||||
{
|
{
|
||||||
drillPower = -1;
|
drillPower = -1;
|
||||||
speed = 0.11f;
|
speed = 0.11f;
|
||||||
maxSpeed = 10f;
|
|
||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
mass = 2f;
|
mass = 2f;
|
||||||
armor = 5f;
|
armor = 5f;
|
||||||
@@ -290,7 +284,6 @@ public class Mechs implements ContentList{
|
|||||||
{
|
{
|
||||||
drillPower = 2;
|
drillPower = 2;
|
||||||
speed = 0.12f;
|
speed = 0.12f;
|
||||||
maxSpeed = 10f;
|
|
||||||
drag = 0.035f;
|
drag = 0.035f;
|
||||||
mass = 2.5f;
|
mass = 2.5f;
|
||||||
turnCursor = false;
|
turnCursor = false;
|
||||||
@@ -313,7 +306,6 @@ public class Mechs implements ContentList{
|
|||||||
drillPower = 4;
|
drillPower = 4;
|
||||||
mineSpeed = 1.3f;
|
mineSpeed = 1.3f;
|
||||||
speed = 0.32f;
|
speed = 0.32f;
|
||||||
maxSpeed = 10f;
|
|
||||||
drag = 0.06f;
|
drag = 0.06f;
|
||||||
mass = 3f;
|
mass = 3f;
|
||||||
armor = 30f;
|
armor = 30f;
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ public class UnitTypes implements ContentList{
|
|||||||
maxVelocity = 1.7f;
|
maxVelocity = 1.7f;
|
||||||
range = 40f;
|
range = 40f;
|
||||||
health = 45;
|
health = 45;
|
||||||
|
hitsize = 4f;
|
||||||
|
mass = 0.1f;
|
||||||
weapon = Weapons.droneBlaster;
|
weapon = Weapons.droneBlaster;
|
||||||
trailColor = Color.valueOf("ffd37f");
|
trailColor = Color.valueOf("ffd37f");
|
||||||
}
|
}
|
||||||
@@ -84,6 +86,7 @@ public class UnitTypes implements ContentList{
|
|||||||
speed = 0.3f;
|
speed = 0.3f;
|
||||||
maxVelocity = 1.9f;
|
maxVelocity = 1.9f;
|
||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
|
mass = 1.5f;
|
||||||
weapon = Weapons.chainBlaster;
|
weapon = Weapons.chainBlaster;
|
||||||
isFlying = true;
|
isFlying = true;
|
||||||
health = 70;
|
health = 70;
|
||||||
|
|||||||
@@ -190,8 +190,8 @@ public class TurretBlocks extends BlockList implements ContentList{
|
|||||||
cyclone = new ItemTurret("cyclone"){{
|
cyclone = new ItemTurret("cyclone"){{
|
||||||
ammoTypes = new AmmoType[]{AmmoTypes.flakExplosive, AmmoTypes.flakPlastic, AmmoTypes.flakSurge};
|
ammoTypes = new AmmoType[]{AmmoTypes.flakExplosive, AmmoTypes.flakPlastic, AmmoTypes.flakSurge};
|
||||||
xRand = 4f;
|
xRand = 4f;
|
||||||
reload = 10f;
|
reload = 8f;
|
||||||
range = 140f;
|
range = 145f;
|
||||||
size = 3;
|
size = 3;
|
||||||
recoil = 3f;
|
recoil = 3f;
|
||||||
rotatespeed = 10f;
|
rotatespeed = 10f;
|
||||||
|
|||||||
@@ -206,8 +206,8 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
velocity.limit(getMaxVelocity()).scl(status.getSpeedMultiplier());
|
velocity.limit(getMaxVelocity()).scl(status.getSpeedMultiplier());
|
||||||
|
|
||||||
if(isFlying()){
|
if(isFlying()){
|
||||||
x += velocity.x / getMass() * Timers.delta();
|
x += velocity.x * Timers.delta();
|
||||||
y += velocity.y / getMass() * Timers.delta();
|
y += velocity.y * Timers.delta();
|
||||||
}else{
|
}else{
|
||||||
boolean onLiquid = floor.isLiquid;
|
boolean onLiquid = floor.isLiquid;
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
|||||||
bullet.type = type;
|
bullet.type = type;
|
||||||
bullet.lifeScl = lifetimeScl;
|
bullet.lifeScl = lifetimeScl;
|
||||||
|
|
||||||
bullet.set(x, y);
|
bullet.set(x - bullet.velocity.x * Timers.delta(), y - bullet.velocity.y * Timers.delta());
|
||||||
bullet.add();
|
bullet.add();
|
||||||
|
|
||||||
return bullet;
|
return bullet;
|
||||||
@@ -192,7 +192,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
|||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
if(type.hitTiles && collidesTiles() && !supressCollision && initialized){
|
if(type.hitTiles && collidesTiles() && !supressCollision && initialized){
|
||||||
world.raycastEach(world.toTile(x), world.toTile(y), world.toTile(x + velocity.x), world.toTile(y + velocity.y), (x, y) -> {
|
world.raycastEach(world.toTile(lastPosition().x), world.toTile(lastPosition().y), world.toTile(x), world.toTile(y), (x, y) -> {
|
||||||
|
|
||||||
Tile tile = world.tile(x, y);
|
Tile tile = world.tile(x, y);
|
||||||
if(tile == null) return false;
|
if(tile == null) return false;
|
||||||
|
|||||||
@@ -125,6 +125,10 @@ public abstract class GroundUnit extends BaseUnit{
|
|||||||
rotation = Mathf.slerpDelta(rotation, velocity.angle(), type.rotatespeed);
|
rotation = Mathf.slerpDelta(rotation, velocity.angle(), type.rotatespeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!velocity.isZero()){
|
||||||
|
baseRotation = Mathf.slerpDelta(baseRotation, velocity.angle(), 0.05f);
|
||||||
|
}
|
||||||
|
|
||||||
if(stuckTime < 1f){
|
if(stuckTime < 1f){
|
||||||
walkTime += Timers.delta();
|
walkTime += Timers.delta();
|
||||||
}
|
}
|
||||||
@@ -268,10 +272,7 @@ public abstract class GroundUnit extends BaseUnit{
|
|||||||
|
|
||||||
if(tile == targetTile) return;
|
if(tile == targetTile) return;
|
||||||
|
|
||||||
vec.trns(baseRotation, type.speed);
|
velocity.add(vec.trns(angleTo(targetTile), type.speed));
|
||||||
|
|
||||||
baseRotation = Mathf.slerpDelta(baseRotation, angleTo(targetTile), 0.05f);
|
|
||||||
velocity.add(vec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void moveAwayFromCore(){
|
protected void moveAwayFromCore(){
|
||||||
@@ -292,9 +293,6 @@ public abstract class GroundUnit extends BaseUnit{
|
|||||||
|
|
||||||
if(tile == targetTile || core == null || distanceTo(core) < 90f) return;
|
if(tile == targetTile || core == null || distanceTo(core) < 90f) return;
|
||||||
|
|
||||||
vec.trns(baseRotation, type.speed);
|
velocity.add(vec.trns(angleTo(targetTile), type.speed));
|
||||||
|
|
||||||
baseRotation = Mathf.slerpDelta(baseRotation, angleTo(targetTile), 0.05f);
|
|
||||||
velocity.add(vec);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class Mech extends UnlockableContent{
|
|||||||
|
|
||||||
public boolean flying;
|
public boolean flying;
|
||||||
public float speed = 1.1f;
|
public float speed = 1.1f;
|
||||||
public float maxSpeed = 1.1f;
|
public float maxSpeed = 10f;
|
||||||
public float boostSpeed = 0.75f;
|
public float boostSpeed = 0.75f;
|
||||||
public float drag = 0.4f;
|
public float drag = 0.4f;
|
||||||
public float mass = 1f;
|
public float mass = 1f;
|
||||||
|
|||||||
Reference in New Issue
Block a user