Extensive netcode changes, bugfixes

This commit is contained in:
Anuken
2018-06-29 14:13:31 -04:00
parent 3898602f0e
commit b4151a256b
20 changed files with 411 additions and 187 deletions

View File

@@ -6,7 +6,6 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.gen.CallEntity;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.input.PlaceUtils.NormalizeDrawResult;
import io.anuke.mindustry.input.PlaceUtils.NormalizeResult;
@@ -140,7 +139,7 @@ public class DesktopInput extends InputHandler{
}
if(player.isShooting && !canShoot()){
CallEntity.setShooting(false);
player.isShooting = false;
}
if(isPlacing()){
@@ -207,7 +206,7 @@ public class DesktopInput extends InputHandler{
//only begin shooting if there's no cursor event
if(!tileTapped(cursor) && !tryTapPlayer(worldx, worldy) && player.getPlaceQueue().size == 0 && !droppingItem &&
!tryBeginMine(cursor) && player.getMineTile() == null){
CallEntity.setShooting(true);
player.isShooting = true;
}
}
}else if(button == Buttons.RIGHT){ //right = begin breaking
@@ -229,7 +228,7 @@ public class DesktopInput extends InputHandler{
@Override
public boolean touchUp (int screenX, int screenY, int pointer, int button) {
if(button == Buttons.LEFT){
CallEntity.setShooting(false);
player.isShooting = false;
}
if(player.isDead() || state.is(State.menu) || ui.hasDialog()) return false;

View File

@@ -265,11 +265,6 @@ public abstract class InputHandler extends InputAdapter{
player.addBuildRequest(new BuildRequest(tile.x, tile.y));
}
@Remote(targets = Loc.client, called = Loc.both, in = In.entities)
public static void setShooting(Player player, boolean on){
player.isShooting = on;
}
@Remote(targets = Loc.both, called = Loc.server, in = In.entities)
public static void dropItem(Player player, float angle){
if(Net.server() && !player.inventory.hasItem()){
@@ -332,6 +327,7 @@ public abstract class InputHandler extends InputAdapter{
@Remote(targets = Loc.both, called = Loc.server, forward = true, in = In.blocks)
public static void onTileTapped(Player player, Tile tile){
if(tile == null || player == null) return;
tile.block().tapped(tile, player);
}