2024-01-26 21:45:26 +00:00
|
|
|
extends PacketHandler
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
%PlayerAdd.main_player_spawned.connect(on_main_player_spawned)
|
|
|
|
|
|
|
|
func on_main_player_spawned(player: Player):
|
|
|
|
player.jumped.connect(on_jump)
|
|
|
|
|
|
|
|
func on_jump():
|
|
|
|
var buffer := StreamPeerBuffer.new()
|
|
|
|
buffer.put_8(PacketHandler.Packet.PLAYER_JUMP)
|
|
|
|
%Client.send(buffer.data_array)
|
|
|
|
|
2024-01-29 22:16:06 +00:00
|
|
|
func handle_packet(data: PackedByteArray):
|
2024-01-26 21:45:26 +00:00
|
|
|
var player_id := data.get_string_from_ascii()
|
2024-01-28 18:18:16 +00:00
|
|
|
var player := Global.players.get_player(player_id)
|
2024-01-26 21:45:26 +00:00
|
|
|
player.jump()
|