From 35b0f811f23f029110373798b19d9d0895d907f0 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 5 Jan 2025 16:54:36 +0100 Subject: next commit --- network/server.gd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'network/server.gd') 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) -- cgit v1.2.3