blob: c3a9713ead3bf4465c9df89b16bc0034aec49abb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
extends Node3D
func _ready() -> void:
# add player
var map_server_login_success_packet: MapServerLoginSuccessPacket = Network.map_server.received_packets[MapServerLoginSuccessPacket.HEADER][0]
var initial_player_position: Vector2 = map_server_login_success_packet.get_position()
var player = preload("res://entities/player.tscn").instantiate()
player.position = Vector3(initial_player_position.x, 0, initial_player_position.y)
add_child(player)
# listen to packets
Network.map_server.received_packet.connect(func(packet: Packet):
if packet is ChangeMapPacket:
player.position.x = packet.get_position().x
player.position.z = packet.get_position().y
)
# play audio
for node: AudioStreamPlayer3D in find_children("se_*"):
node.play()
# add HUD TODO: add all HUD as HUD scene
var chat_window = preload("res://ui/chat_window.tscn").instantiate()
add_child(chat_window)
# TODO: load map.
# TODO: whatever else needs to be loaded after converting from rsw
var map_loaded_packet := MapLoadedPacket.new()
Network.map_server.send(map_loaded_packet)
# TODO: check which map server packets to send next
|