Minor bugfix

This commit is contained in:
Anuken
2021-06-03 16:01:51 -04:00
parent c674b5c256
commit 9cd482d389
2 changed files with 2 additions and 2 deletions

View File

@@ -390,7 +390,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
player.clearUnit();
//make sure it's AI controlled, so players can't overwrite each other
}else if(unit.isAI() && unit.team == player.team() && !unit.dead){
if(net.client()){
if(net.client() && player.isLocal()){
player.justSwitchFrom = player.unit();
player.justSwitchTo = unit;
}
@@ -467,7 +467,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
//only reset the controlled type and control a unit after the timer runs out
//essentially, this means the client waits for 1 second after controlling something before trying to control something else automatically
if(!player.dead() && (recentRespawnTimer -= Time.delta / 60f) <= 0f){
if(!player.dead() && (recentRespawnTimer -= Time.delta / 60f) <= 0f && player.justSwitchFrom != player.unit()){
controlledType = player.unit().type;
}