mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-13 04:42:07 -08:00
spgashfetiti
This commit is contained in:
parent
dc51afdc60
commit
552dc254da
3 changed files with 32 additions and 14 deletions
|
|
@ -58,7 +58,7 @@ public class PausedDialog extends FloatingDialog{
|
|||
cont.row();
|
||||
|
||||
cont.addButton("$hostserver", () -> {
|
||||
if(net.active() && steam){
|
||||
if(net.server() && steam){
|
||||
platform.inviteFriends();
|
||||
}else{
|
||||
if(steam){
|
||||
|
|
@ -67,7 +67,7 @@ public class PausedDialog extends FloatingDialog{
|
|||
ui.host.show();
|
||||
}
|
||||
}
|
||||
}).disabled(b -> net.active() && !steam).colspan(2).width(dw * 2 + 20f).update(e -> e.setText(net.active() && steam && net.server() ? "$invitefriends" : "$hostserver"));
|
||||
}).disabled(b -> !((steam && net.server()) || !net.active())).colspan(2).width(dw * 2 + 20f).update(e -> e.setText(net.server() && steam ? "$invitefriends" : "$hostserver"));
|
||||
}
|
||||
|
||||
cont.row();
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ public class DesktopLauncher extends ClientLauncher{
|
|||
SVars.user = new SUser();
|
||||
|
||||
Events.on(ClientLoadEvent.class, event -> {
|
||||
player.name = "ffmpeg";//SVars.net.friends.getPersonaName();
|
||||
player.name = SVars.net.friends.getPersonaName();
|
||||
Core.settings.defaults("name", SVars.net.friends.getPersonaName());
|
||||
Core.settings.put("name", player.name);
|
||||
Core.settings.save();
|
||||
|
|
|
|||
|
|
@ -61,20 +61,31 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||
|
||||
if(net.server()){
|
||||
SteamConnection con = steamConnections.get(fromID);
|
||||
//accept users on request
|
||||
if(con == null){
|
||||
con = new SteamConnection(from);
|
||||
Connect c = new Connect();
|
||||
c.addressTCP = "steam:" + from.getAccountID();
|
||||
try{
|
||||
//accept users on request
|
||||
if(con == null){
|
||||
con = new SteamConnection(from);
|
||||
Connect c = new Connect();
|
||||
c.addressTCP = "steam:" + from.getAccountID();
|
||||
|
||||
Log.info("&bRecieved connection: {0}", c.addressTCP);
|
||||
Log.info("&bRecieved connection: {0}", c.addressTCP);
|
||||
|
||||
steamConnections.put(from.getAccountID(), con);
|
||||
connections.add(con);
|
||||
net.handleServerReceived(con, c);
|
||||
steamConnections.put(from.getAccountID(), con);
|
||||
connections.add(con);
|
||||
net.handleServerReceived(con, c);
|
||||
}
|
||||
|
||||
net.handleServerReceived(con, output);
|
||||
}catch(RuntimeException e){
|
||||
if(e.getCause() instanceof ValidateException){
|
||||
ValidateException v = (ValidateException)e.getCause();
|
||||
Log.err("Validation failed: {0} ({1})", v.player.name, v.getMessage());
|
||||
}else{
|
||||
Log.err(e);
|
||||
}
|
||||
}catch(Exception e){
|
||||
Log.err(e);
|
||||
}
|
||||
|
||||
net.handleServerReceived(con, output);
|
||||
}else if(currentServer != null && fromID == currentServer.getAccountID()){
|
||||
net.handleClientReceived(output);
|
||||
}
|
||||
|
|
@ -169,6 +180,8 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||
public void hostServer(int port) throws IOException{
|
||||
provider.hostServer(port);
|
||||
smat.createLobby(Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly, 16);
|
||||
|
||||
Core.app.post(() -> Core.app.post(() -> Core.app.post(() -> Log.info("Server: {0}\nClient: {1}\nActive: {2}", net.server(), net.client(), net.active()))));
|
||||
}
|
||||
|
||||
public void updateLobby(){
|
||||
|
|
@ -237,6 +250,8 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||
currentLobby = steamIDLobby;
|
||||
currentServer = smat.getLobbyOwner(steamIDLobby);
|
||||
|
||||
Log.info("Connect to {0}");
|
||||
|
||||
if(joinCallback != null){
|
||||
joinCallback.run();
|
||||
joinCallback = null;
|
||||
|
|
@ -247,6 +262,8 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||
|
||||
net.setClientConnected();
|
||||
net.handleClientReceived(con);
|
||||
|
||||
Core.app.post(() -> Core.app.post(() -> Core.app.post(() -> Log.info("Server: {0}\nClient: {1}\nActive: {2}", net.server(), net.client(), net.active()))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -421,6 +438,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||
public SteamConnection(SteamID sid){
|
||||
super(sid.getAccountID() + "");
|
||||
this.sid = sid;
|
||||
Log.info("Create STEAM client {0}", sid.getAccountID());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue