mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-12-22 22:24:13 +07:00
Retain build plans when switching units
This commit is contained in:
parent
b5021afa8c
commit
0d5869aad9
@ -98,7 +98,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
public BuildPlan bplan = new BuildPlan();
|
||||
public Seq<BuildPlan> linePlans = new Seq<>();
|
||||
public Seq<BuildPlan> selectPlans = new Seq<>(BuildPlan.class);
|
||||
public @Nullable Queue<BuildPlan> lastPlans;
|
||||
public Queue<BuildPlan> lastPlans = new Queue<>();
|
||||
public @Nullable Unit lastUnit;
|
||||
|
||||
//for RTS controls
|
||||
public Seq<Unit> selectedUnits = new Seq<>();
|
||||
@ -812,14 +813,19 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
if(player.isBuilder()){
|
||||
if(lastPlans != null && player.unit().plans != lastPlans && player.unit().plans.size == 0){
|
||||
if(player.unit() != lastUnit && player.unit().plans.size <= 1){
|
||||
for(var plan : lastPlans){
|
||||
player.unit().plans.addLast(plan);
|
||||
}
|
||||
}
|
||||
lastPlans = player.unit().plans;
|
||||
lastPlans.clear();
|
||||
for(var plan : player.unit().plans){
|
||||
lastPlans.addLast(plan);
|
||||
}
|
||||
}
|
||||
|
||||
lastUnit = player.unit();
|
||||
|
||||
playerPlanTree.clear();
|
||||
if(!player.dead()){
|
||||
player.unit().plans.each(playerPlanTree::insert);
|
||||
|
Loading…
Reference in New Issue
Block a user