Added network sub threads

This commit is contained in:
Eduard Urbach 2024-02-19 16:03:08 +01:00
parent 54f2b9c686
commit f7209d2164
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
3 changed files with 10 additions and 1 deletions

View File

@ -46,6 +46,9 @@ ui = NodePath("UI")
[node name="Client" type="Node" parent="."]
unique_name_in_owner = true
process_mode = 3
process_thread_group = 2
process_thread_group_order = 0
process_thread_messages = 0
script = ExtResource("2_8hxcx")
[node name="Ping" type="Node" parent="Client"]
@ -98,6 +101,9 @@ script = ExtResource("10_y3len")
packet_type = 20
[node name="Statistics" type="Timer" parent="Client"]
process_thread_group = 1
process_thread_group_order = 0
process_thread_messages = 0
autostart = true
[node name="World" type="Node3D" parent="."]

View File

@ -10,5 +10,8 @@ func _ready():
enemy = owner
func _process(_delta):
if !Global.player:
return
var direction := (Global.player.global_position - enemy.global_position).normalized()
direction_changed.emit(direction)

View File

@ -21,5 +21,5 @@ func handle_packet(packet: PackedByteArray):
push_warning("Unknown packet type %d" % type)
return
handler.handle_packet(packet.slice(1))
handler.handle_packet.call_deferred(packet.slice(1))
download += packet.size()