diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 5336de4725..7668cdfa49 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -89,7 +89,15 @@ public class Control implements ApplicationListener{ }); Events.on(WorldLoadEvent.class, event -> { - Core.app.post(() -> Core.app.post(() -> Core.camera.position.set(player))); + Core.app.post(() -> Core.app.post(() -> { + if(Net.active() && player.getClosestCore() != null){ + //set to closest core since that's where the player will probably respawn; prevents camera jumps + Core.camera.position.set(player.getClosestCore()); + }else{ + //locally, set to player position since respawning occurs immediately + Core.camera.position.set(player); + } + })); }); Events.on(ResetEvent.class, event -> { diff --git a/core/src/io/anuke/mindustry/entities/type/Player.java b/core/src/io/anuke/mindustry/entities/type/Player.java index 8c7769c8e0..3b38f68390 100644 --- a/core/src/io/anuke/mindustry/entities/type/Player.java +++ b/core/src/io/anuke/mindustry/entities/type/Player.java @@ -794,10 +794,12 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{ if(spawner != null && spawner.isValid()){ spawner.updateSpawning(this); }else if(!netServer.isWaitingForPlayers()){ - if(lastSpawner != null && lastSpawner.isValid()){ - this.spawner = lastSpawner; - }else if(getClosestCore() != null){ - this.spawner = (SpawnerTrait)getClosestCore(); + if(!Net.client()){ + if(lastSpawner != null && lastSpawner.isValid()){ + this.spawner = lastSpawner; + }else if(getClosestCore() != null){ + this.spawner = (SpawnerTrait)getClosestCore(); + } } }else if(getClosestCore() != null){ set(getClosestCore().getX(), getClosestCore().getY()); @@ -898,12 +900,13 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{ }else{ mining = world.tile(mine); isBoosting = boosting; - Tile tile = world.tile(spawner); - if(tile != null && tile.entity instanceof SpawnerTrait){ - this.spawner = (SpawnerTrait)tile.entity; - }else{ - this.spawner = null; - } + } + + Tile tile = world.tile(spawner); + if(tile != null && tile.entity instanceof SpawnerTrait){ + this.spawner = (SpawnerTrait)tile.entity; + }else{ + this.spawner = null; } } diff --git a/core/src/io/anuke/mindustry/net/NetworkIO.java b/core/src/io/anuke/mindustry/net/NetworkIO.java index 19ca66cf53..2239a20f05 100644 --- a/core/src/io/anuke/mindustry/net/NetworkIO.java +++ b/core/src/io/anuke/mindustry/net/NetworkIO.java @@ -1,6 +1,5 @@ package io.anuke.mindustry.net; -import io.anuke.arc.Core; import io.anuke.arc.collection.ObjectMap; import io.anuke.arc.collection.ObjectMap.Entry; import io.anuke.arc.util.Time; @@ -122,10 +121,6 @@ public class NetworkIO{ for(int j = 0; j < cores; j++){ state.teams.get(team).cores.add(world.tile(stream.readInt())); } - - if(team == player.getTeam() && cores > 0){ - Core.camera.position.set(state.teams.get(team).cores.first().drawx(), state.teams.get(team).cores.first().drawy()); - } } }catch(IOException e){