Skip to content
This repository was archived by the owner on Sep 15, 2024. It is now read-only.

Commit ad535d9

Browse files
debug stuff
1 parent 5cfe121 commit ad535d9

2 files changed

Lines changed: 12 additions & 23 deletions

File tree

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,25 @@
11
using GodotModules.Netcode.Client;
2+
using GodotModules.Netcode.Server;
23
using System.Collections.Generic;
4+
using System.Linq;
5+
using Game;
36

47
namespace GodotModules
58
{
69
public class CommandDebug : Command
710
{
8-
public CommandDebug() => Aliases = new string[] { "d" };
11+
public CommandDebug() => Aliases = new string[] { "x" };
912

1013
public override void Run(string[] args)
1114
{
12-
var info = new string[] {
13-
$"Username: {GameManager.Options.OnlineUsername}",
14-
$"Id: {ENetClient.PeerId}"
15-
};
16-
17-
Utils.Log(info.Print());
18-
19-
var players = SceneLobby.GetPlayers();
20-
21-
if (players == null)
15+
if (args.Length == 0)
2216
return;
2317

24-
Utils.Log("Players in Lobby: " + players.Count);
25-
foreach (var pair in players)
26-
{
27-
var id = pair.Key;
28-
29-
var player = pair.Value;
30-
31-
var username = player.Username;
32-
var ready = player.Ready;
18+
if (!int.TryParse(args[0], out int result))
19+
return;
3320

34-
Utils.Log($"{id} {username} {ready}");
35-
}
21+
SceneGame.Test = result;
22+
Utils.Log("updated test to " + result);
3623
}
3724
}
3825
}

Scripts/Scenes/Game/SceneGame.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public override void _Ready()
5151
}
5252
}
5353

54+
public static int Test = 100;
55+
5456
public static void UpdatePlayerPositions(Dictionary<uint, Vector2> playerPositions)
5557
{
5658
if (SceneManager.ActiveScene != "Game")
@@ -63,7 +65,7 @@ public static void UpdatePlayerPositions(Dictionary<uint, Vector2> playerPositio
6365
if (pair.Key == GameClient.PeerId)
6466
{
6567
GD.Print("CLIENT: " + player.Position);
66-
if (player.Position.DistanceSquaredTo(pair.Value) > 250)
68+
if (player.Position.DistanceTo(pair.Value) > Test)
6769
player.Position = pair.Value;
6870
}
6971
else

0 commit comments

Comments
 (0)