/sync command

This commit is contained in:
Anuken
2019-08-31 10:14:26 -04:00
parent 3414026828
commit 5f361413bb
3 changed files with 13 additions and 1 deletions

View File

@@ -66,7 +66,7 @@ public class Control implements ApplicationListener, Loadable{
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());
Core.camera.position.set(player.isDead() ? player.getClosestCore() : player);
}else{
//locally, set to player position since respawning occurs immediately
Core.camera.position.set(player);

View File

@@ -320,6 +320,15 @@ public class NetServer implements ApplicationListener{
}
}
});
clientCommands.<Player>register("sync", "Re-synchronize world state.", (args, player) -> {
if(player.isLocal){
player.sendMessage("[scarlet]Re-synchronizing as the host is pointless.");
}else{
Call.onWorldDataBegin(player.con.id);
netServer.sendWorldData(player, player.con.id);
}
});
}
public int votesRequired(){