Less messy respawning / Standard starter mech / Bugfixes

This commit is contained in:
Anuken
2019-04-28 10:34:53 -04:00
parent ad13c83f93
commit 4c17b56e28
25 changed files with 2310 additions and 2352 deletions
@@ -52,7 +52,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
public float boostHeat, shootHeat, destructTime;
public boolean achievedFlight;
public Color color = new Color();
public Mech mech;
public Mech mech = Mechs.starter;
public SpawnerTrait spawner, lastSpawner;
public int respawns;
@@ -82,7 +82,6 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
player.dead = true;
player.placeQueue.clear();
player.onDeath();
player.mech = (player.isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
}
@Override
@@ -102,11 +101,18 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
@Override
public void onRespawn(Tile tile){
velocity.setZero();
boostHeat = 1f;
achievedFlight = true;
if(state.rules.limitedRespawns){
respawns--;
}
rotation = 90f;
baseRotation = 90f;
dead = false;
spawner = null;
respawns --;
setNet(tile.drawx(), tile.drawy());
clearItem();
heal();
}
@Override
@@ -118,12 +124,6 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
}
}
@Override
public boolean collidesGrid(int x, int y){
Tile tile = world.tile(x, y);
return !isFlying() || (!mech.flying && tile != null && !tile.block().synthetic() && tile.block().solid);
}
@Override
public float drag(){
return mech.drag;
@@ -519,7 +519,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
if(isDead()){
isBoosting = false;
boostHeat = 0f;
if(respawns!=0){
if(respawns > 0 || !state.rules.limitedRespawns){
updateRespawning();
}
return;
@@ -780,15 +780,11 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
spawner = lastSpawner = null;
health = maxHealth();
boostHeat = drownTime = hitTime = 0f;
mech = getStarterMech();
mech = Mechs.starter;
placeQueue.clear();
respawns = state.rules.respawns;
}
public Mech getStarterMech(){
return (isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
}
public boolean isShooting(){
return isShooting && (!isBoosting || mech.flying);
}
@@ -812,17 +808,13 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
this.spawner = spawner;
this.lastSpawner = spawner;
this.dead = true;
}
public void endRespawning(){
spawner = null;
setNet(spawner.getX(), spawner.getY());
}
//endregion
//region read and write methods
@Override
public boolean isClipped(){
return false;