mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-25 07:08:07 +07:00
/sync command
This commit is contained in:
@ -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);
|
||||
|
@ -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(){
|
||||
|
@ -2,6 +2,8 @@ package io.anuke.mindustry.server;
|
||||
|
||||
|
||||
import io.anuke.arc.backends.headless.HeadlessApplication;
|
||||
import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.core.*;
|
||||
import io.anuke.mindustry.net.*;
|
||||
|
||||
public class ServerLauncher{
|
||||
@ -10,6 +12,7 @@ public class ServerLauncher{
|
||||
try{
|
||||
Net.setClientProvider(new ArcNetClient());
|
||||
Net.setServerProvider(new ArcNetServer());
|
||||
Vars.platform = new Platform(){};
|
||||
new HeadlessApplication(new MindustryServer(args), null, throwable -> CrashSender.send(throwable, f -> {}));
|
||||
}catch(Throwable t){
|
||||
CrashSender.send(t, f -> {});
|
||||
|
Reference in New Issue
Block a user