extends PacketHandler func _ready(): %PlayerAdd.main_player_spawned.connect(on_main_player_spawned) func on_main_player_spawned(player: Player): player.controller.used_skill.connect(on_skill_used) func on_skill_used(slot: int): var buffer := StreamPeerBuffer.new() buffer.put_u8(PacketHandler.Packet.PLAYER_USE_SKILL) buffer.put_u8(slot) %Client.send(buffer.data_array) func handle_packet(data: PackedByteArray): var buffer := StreamPeerBuffer.new() buffer.data_array = data var player_id_length := buffer.get_size() - 1 var player_id := buffer.get_string(player_id_length) var slot := buffer.get_u8() var player := Global.players.get_player(player_id) player.controller.used_skill.emit(slot)