Skip to content

Commit

Permalink
Added temporary client debug status methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Dec 21, 2021
1 parent 51fe07d commit 24420c4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions core/src/mindustry/core/NetServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,34 @@ public static void onDisconnect(Player player, String reason){
player.con.hasDisconnected = true;
}

//these functions are for debugging only, and will be removed!

@Remote(targets = Loc.client, variants = Variant.one)
public static void requestDebugStatus(Player player){
int flags =
(player.con.hasDisconnected ? 1 : 0) |
(player.con.hasConnected ? 2 : 0) |
(player.isAdded() ? 4 : 0) |
(player.con.hasBegunConnecting ? 8 : 0);

Call.debugStatusClient(player.con, flags);
Call.debugStatusClientUnreliable(player.con, flags);
}

@Remote(variants = Variant.both, priority = PacketPriority.high)
public static void debugStatusClient(int value){
Log.info("[RELIABLE] Debug status received. disconnected = @, connected = @, added = @, begunConnecting = @",
(value & 1) != 0, (value & 2) != 0, (value & 4) != 0, (value & 8) != 0
);
}

@Remote(variants = Variant.both, priority = PacketPriority.high, unreliable = true)
public static void debugStatusClientUnreliable(int value){
Log.info("[UNRELIABLE] Debug status received. disconnected = @, connected = @, added = @, begunConnecting = @",
(value & 1) != 0, (value & 2) != 0, (value & 4) != 0, (value & 8) != 0
);
}

@Remote(targets = Loc.client)
public static void serverPacketReliable(Player player, String type, String contents){
if(netServer.customPacketHandlers.containsKey(type)){
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ android.useAndroidX=true
#used for slow jitpack builds; TODO see if this actually works
org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000
archash=00d1f312
archash=0370ef92e5

0 comments on commit 24420c4

Please sign in to comment.