Core unit "de-dock" improvements
This commit is contained in:
@@ -3622,7 +3622,8 @@ public class Blocks{
|
|||||||
size = 3;
|
size = 3;
|
||||||
reloadTime = 130f;
|
reloadTime = 130f;
|
||||||
chargeTime = 90f;
|
chargeTime = 90f;
|
||||||
range = 300f;
|
//TODO 500 or 400? does it need to be better than the standard mass driver?
|
||||||
|
range = 400f;
|
||||||
maxPayloadSize = 2.5f;
|
maxPayloadSize = 2.5f;
|
||||||
consumes.power(2f);
|
consumes.power(2f);
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -492,10 +492,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
public static void unitClear(Player player){
|
public static void unitClear(Player player){
|
||||||
if(player == null) return;
|
if(player == null) return;
|
||||||
|
|
||||||
//TODO test this in multiplayer
|
if(!player.dead() && !player.unit().spawnedByCore){
|
||||||
if(!player.dead() && !player.unit().spawnedByCore && player.unit().dockedType != null && player.unit().dockedType.coreUnitDock){
|
|
||||||
//TODO respawn ON the unit, with an animation?
|
|
||||||
var docked = player.unit().dockedType;
|
var docked = player.unit().dockedType;
|
||||||
|
|
||||||
|
//get best core unit type as approximation
|
||||||
if(docked == null){
|
if(docked == null){
|
||||||
var closest = player.bestCore();
|
var closest = player.bestCore();
|
||||||
if(closest != null){
|
if(closest != null){
|
||||||
@@ -503,13 +503,20 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(docked != null){
|
//respawn if necessary
|
||||||
|
if(docked != null && docked.coreUnitDock){
|
||||||
//TODO animation, etc
|
//TODO animation, etc
|
||||||
Fx.spawn.at(player);
|
Fx.spawn.at(player);
|
||||||
|
|
||||||
if(!net.client()){
|
if(!net.client()){
|
||||||
Unit unit = docked.create(player.team());
|
Unit unit = docked.create(player.team());
|
||||||
unit.set(player.unit());
|
unit.set(player.unit());
|
||||||
|
//translate backwards so it doesn't spawn stuck in the unit
|
||||||
|
if(player.unit().isFlying() && unit.type.flying){
|
||||||
|
Tmp.v1.trns(player.unit().rotation + 180f, player.unit().hitSize / 2f + unit.hitSize / 2f);
|
||||||
|
unit.x += Tmp.v1.x;
|
||||||
|
unit.y += Tmp.v1.y;
|
||||||
|
}
|
||||||
unit.rotation(player.unit().rotation);
|
unit.rotation(player.unit().rotation);
|
||||||
//unit.impulse(0f, -3f);
|
//unit.impulse(0f, -3f);
|
||||||
//TODO should there be an impulse?
|
//TODO should there be an impulse?
|
||||||
@@ -518,6 +525,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
unit.add();
|
unit.add();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//skip standard respawn code
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user