Multiplayer bugfixes
This commit is contained in:
@@ -221,7 +221,7 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
|
||||
if(Core.input.keyRelease(Binding.select)){
|
||||
isShooting = false;
|
||||
player.shooting = false;
|
||||
}
|
||||
|
||||
if(state.isGame() && Core.input.keyTap(Binding.minimap) && !scene.hasDialog() && !(scene.getKeyboardFocus() instanceof TextField)){
|
||||
@@ -248,8 +248,8 @@ public class DesktopInput extends InputHandler{
|
||||
mode = none;
|
||||
}
|
||||
|
||||
if(isShooting && !canShoot()){
|
||||
isShooting = false;
|
||||
if(player.shooting && !canShoot()){
|
||||
player.shooting = false;
|
||||
}
|
||||
|
||||
if(isPlacing() && player.isBuilder()){
|
||||
@@ -464,10 +464,10 @@ public class DesktopInput extends InputHandler{
|
||||
//only begin shooting if there's no cursor event
|
||||
if(!tileTapped(selected.build) && !tryTapPlayer(Core.input.mouseWorld().x, Core.input.mouseWorld().y) && (player.builder().plans().size == 0 || !player.builder().isBuilding()) && !droppingItem &&
|
||||
!tryBeginMine(selected) && player.miner().mineTile() == null && !Core.scene.hasKeyboard()){
|
||||
isShooting = shouldShoot;
|
||||
player.shooting = shouldShoot;
|
||||
}
|
||||
}else if(!Core.scene.hasKeyboard()){ //if it's out of bounds, shooting is just fine
|
||||
isShooting = shouldShoot;
|
||||
player.shooting = shouldShoot;
|
||||
}
|
||||
}else if(Core.input.keyTap(Binding.deselect) && isPlacing()){
|
||||
block = null;
|
||||
@@ -575,7 +575,7 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
movement.set(xa, ya).nor().scl(speed);
|
||||
float mouseAngle = Angles.mouseAngle(unit.x(), unit.y());
|
||||
boolean aimCursor = omni && isShooting && unit.type().hasWeapons() && unit.type().faceTarget && !boosted && unit.type().rotateShooting;
|
||||
boolean aimCursor = omni && player.shooting && unit.type().hasWeapons() && unit.type().faceTarget && !boosted && unit.type().rotateShooting;
|
||||
|
||||
if(aimCursor){
|
||||
unit.lookAt(mouseAngle);
|
||||
@@ -595,10 +595,11 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
|
||||
unit.aim(unit.type().faceTarget ? Core.input.mouseWorld() : Tmp.v1.trns(unit.rotation(), Core.input.mouseWorld().dst(unit)).add(unit.x(), unit.y()));
|
||||
unit.controlWeapons(true, isShooting && !boosted);
|
||||
unit.controlWeapons(true, player.shooting && !boosted);
|
||||
|
||||
isBoosting = Core.input.keyDown(Binding.boost) && !movement.isZero();
|
||||
player.boosting(isBoosting);
|
||||
player.boosting = Core.input.keyDown(Binding.boost) && !movement.isZero();
|
||||
player.mouseX = unit.aimX();
|
||||
player.mouseY = unit.aimY();
|
||||
|
||||
//TODO netsync this
|
||||
if(unit instanceof Payloadc){
|
||||
|
||||
@@ -58,7 +58,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
public int rotation;
|
||||
public boolean droppingItem;
|
||||
public Group uiGroup;
|
||||
public boolean isShooting, isBuilding = true, buildWasAutoPaused = false, isBoosting = false;
|
||||
public boolean isBuilding = true, buildWasAutoPaused = false;
|
||||
public @Nullable UnitType controlledType;
|
||||
|
||||
protected @Nullable Schematic lastSchematic;
|
||||
@@ -249,7 +249,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
public void update(){
|
||||
player.typing(ui.chatfrag.shown());
|
||||
player.typing = ui.chatfrag.shown();
|
||||
|
||||
if(player.isBuilder()){
|
||||
player.builder().building(isBuilding);
|
||||
|
||||
@@ -454,7 +454,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
lastLineY = tileY;
|
||||
}else if(!tryTapPlayer(worldx, worldy) && Core.settings.getBool("keyboard")){
|
||||
//shoot on touch down when in keyboard mode
|
||||
isShooting = true;
|
||||
player.shooting = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,11 +589,11 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
if(Core.settings.getBool("keyboard")){
|
||||
if(Core.input.keyRelease(Binding.select)){
|
||||
isShooting = false;
|
||||
player.shooting = false;
|
||||
}
|
||||
|
||||
if(isShooting && !canShoot()){
|
||||
isShooting = false;
|
||||
if(player.shooting && !canShoot()){
|
||||
player.shooting = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user