diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2025-01-05 16:54:36 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2025-01-05 16:54:36 +0100 |
commit | 35b0f811f23f029110373798b19d9d0895d907f0 (patch) | |
tree | 2e4906a992c2569fa0f89dbe0f079010a734cc41 /network | |
parent | e08a29e73ea4f7e6d78e8e7f5a6e7033dbc1f542 (diff) |
next commit
Diffstat (limited to 'network')
-rw-r--r-- | network/server.gd | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/network/server.gd b/network/server.gd index 8b41b4f..3b3b9cd 100644 --- a/network/server.gd +++ b/network/server.gd @@ -3,6 +3,8 @@ class_name Server signal received_packet(packet: Packet) +var received_packets: Dictionary # [int, Array[Packet]] + var host: String var port: int var peer: StreamPeerTCP = StreamPeerTCP.new() @@ -38,7 +40,11 @@ func listen() -> void: prints("Upcoming Length:", packet_length.decode_u16(0), "for =>") var packet = packet_type.from_bytes(raw_packet) - + + if not received_packets.has(header): + received_packets[header] = [] + received_packets[header].append(packet) + received_packet.emit(packet) var display_header = raw_packet.slice(0, 2) |