diff --git a/SERVERLIST.md b/SERVERLIST.md index 5d3c0370c5..659daddfb8 100644 --- a/SERVERLIST.md +++ b/SERVERLIST.md @@ -8,7 +8,7 @@ You may want to add your server to this list. The steps for getting this done ar 1. **Ensure your server is properly moderated.** For the most part, this applies to survival servers, but PvP servers can be affected as well. You'll need to either hire some moderators, or make use of (currently non-existent) anti-grief and anti-curse plugins. *Consider enabling a rate limit:* `config messageRateLimit 2` will make it so that players can only send messages every 2 seconds, for example. -2. **Set an aproppriate MOTD, name and description.** This is set with `config `. "Aproppriate" means that: +2. **Set an approppriate MOTD, name and description.** This is set with `config `. "Approppriate" means that: - Your name or description must reflect the type of server you're hosting. Since new players may be exposed to the server list early on, put in a phrase like "Co-op survival" or "PvP" so players know what they're getting into. Yes, this is also displayed in the server mode info text, but having extra info in the name doesn't hurt. - Make sure players know where to refer to for server support. It should be fairly clear that the server owner is not me, but you. diff --git a/desktop/src/mindustry/desktop/DesktopLauncher.java b/desktop/src/mindustry/desktop/DesktopLauncher.java index b09894e521..0ada554894 100644 --- a/desktop/src/mindustry/desktop/DesktopLauncher.java +++ b/desktop/src/mindustry/desktop/DesktopLauncher.java @@ -243,36 +243,65 @@ public class DesktopLauncher extends ClientLauncher{ @Override public void updateRPC(){ - if(!useDiscord) return; + //if we're using neither discord nor steam, do no work + if(!useDiscord && !steam) return; - DiscordRichPresence presence = new DiscordRichPresence(); + //common elements they each share + boolean inGame = !state.is(State.menu); + String gameMapWithWave = "Unknown Map"; + String gameMode = ""; + String gamePlayersSuffix = ""; + String uiState = ""; - if(!state.is(State.menu)){ - String map = world.getMap() == null ? "Unknown Map" : world.isZone() ? world.getZone().localizedName : Strings.capitalize(world.getMap().name()); - String mode = state.rules.pvp ? "PvP" : state.rules.attackMode ? "Attack" : "Survival"; - String players = net.active() && playerGroup.size() > 1 ? " | " + playerGroup.size() + " Players" : ""; - - presence.state = mode + players; - - if(!state.rules.waves){ - presence.details = map; - }else{ - presence.details = map + " | Wave " + state.wave; - presence.largeImageText = "Wave " + state.wave; + if(inGame){ + if(world.getMap() != null){ + gameMapWithWave = world.isZone() ? world.getZone().localizedName : Strings.capitalize(world.getMap().name()); + } + if(state.rules.waves){ + gameMapWithWave += " | Wave " + state.wave; + } + gameMode = state.rules.pvp ? "PvP" : state.rules.attackMode ? "Attack" : "Survival"; + if(net.active() && playerGroup.size() > 1){ + gamePlayersSuffix = " | " + playerGroup.size() + " Players"; } }else{ if(ui.editor != null && ui.editor.isShown()){ - presence.state = "In Editor"; + uiState = "In Editor"; }else if(ui.deploy != null && ui.deploy.isShown()){ - presence.state = "In Launch Selection"; + uiState = "In Launch Selection"; }else{ - presence.state = "In Menu"; + uiState = "In Menu"; } } - presence.largeImageKey = "logo"; + if(useDiscord){ + DiscordRichPresence presence = new DiscordRichPresence(); - DiscordRPC.INSTANCE.Discord_UpdatePresence(presence); + if(inGame){ + presence.state = gameMode + gamePlayersSuffix; + presence.details = gameMapWithWave; + if(state.rules.waves){ + presence.largeImageText = "Wave " + state.wave; + } + }else{ + presence.state = uiState; + } + + presence.largeImageKey = "logo"; + + DiscordRPC.INSTANCE.Discord_UpdatePresence(presence); + } + + if(steam){ + //Steam mostly just expects us to give it a nice string, but it apparently expects "steam_display" to always be a loc token, so I've uploaded this one which just passes through 'steam_status' raw. + SVars.net.friends.setRichPresence("steam_display", "#steam_status_raw"); + + if(inGame){ + SVars.net.friends.setRichPresence("steam_status", gameMapWithWave); + }else{ + SVars.net.friends.setRichPresence("steam_status", uiState); + } + } } @Override