Visual server respawning fix
This commit is contained in:
@@ -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 -> {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user