15 lines
290 B
GDScript
15 lines
290 B
GDScript
extends PacketHandler
|
|
|
|
func _ready():
|
|
%Server.set_handler(Packet.PING, self)
|
|
|
|
func handle_packet(data: PackedByteArray, peer: PacketPeer):
|
|
var buffer := StreamPeerBuffer.new()
|
|
buffer.put_8(Packet.PING)
|
|
|
|
if data.size() > 0:
|
|
buffer.put_8(data[0])
|
|
|
|
peer.put_packet(buffer.data_array)
|
|
|