From 35b0f811f23f029110373798b19d9d0895d907f0 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 5 Jan 2025 16:54:36 +0100 Subject: next commit --- extractor/map.gd | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 extractor/map.gd (limited to 'extractor/map.gd') diff --git a/extractor/map.gd b/extractor/map.gd new file mode 100644 index 0000000..c3a9713 --- /dev/null +++ b/extractor/map.gd @@ -0,0 +1,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 -- cgit v1.2.3