summaryrefslogtreecommitdiff
path: root/network/server.gd
diff options
context:
space:
mode:
Diffstat (limited to 'network/server.gd')
-rw-r--r--network/server.gd8
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)