From 89ccda1523c9d7f961cb44cf2ec0fd6398834db0 Mon Sep 17 00:00:00 2001 From: patrick_pluto Date: Fri, 2 Aug 2024 22:30:30 +0200 Subject: [PATCH] Computer Fixing --- export_presets.cfg | 16 ++++++++-------- scripts/computer.gd | 4 +++- scripts/server.gd | 15 ++++++++++++++- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/export_presets.cfg b/export_presets.cfg index c26707d..2bfbc26 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -1,6 +1,6 @@ [preset.0] -name="Windows Desktop" +name="Windows x86_64" platform="Windows Desktop" runnable=true dedicated_server=false @@ -8,7 +8,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../Desktop/64.exe" +export_path="../Desktop/Exports/win64/x86_64.exe" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false @@ -63,7 +63,7 @@ Remove-Item -Recurse -Force '{temp_dir}'" [preset.1] -name="Windows Desktop 2" +name="Windows x86_32" platform="Windows Desktop" runnable=false dedicated_server=false @@ -71,7 +71,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../Desktop/32.exe" +export_path="../Desktop/Exports/win32/x86_32.exe" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false @@ -126,7 +126,7 @@ Remove-Item -Recurse -Force '{temp_dir}'" [preset.2] -name="Linux/X11" +name="Linux/X11 x86_64" platform="Linux/X11" runnable=true dedicated_server=false @@ -134,7 +134,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../Desktop/linux.x86_64" +export_path="../Desktop/Exports/linux64/linux.x86_64" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false @@ -166,7 +166,7 @@ rm -rf \"{temp_dir}\"" [preset.3] -name="Linux/X11 2" +name="Linux/X11 x86_32" platform="Linux/X11" runnable=false dedicated_server=false @@ -174,7 +174,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../Desktop/linux.x86_32" +export_path="../Desktop/Exports/linux32/linux.x86_32" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false diff --git a/scripts/computer.gd b/scripts/computer.gd index 1b20a86..dcab8ea 100644 --- a/scripts/computer.gd +++ b/scripts/computer.gd @@ -11,7 +11,9 @@ func _ready(): Game.computers += 1 func _on_computer_tick_timeout(): - current += (pc_occupied[0] + pc_occupied[1] + pc_occupied[2]) + if multiplayer.is_server(): + current += (pc_occupied[0] + pc_occupied[1] + pc_occupied[2]) + Server.sync_computers.rpc(name, current) if current >= TARGET: current = "Complete" $computer_tick.stop() diff --git a/scripts/server.gd b/scripts/server.gd index eddc124..c3b8e31 100644 --- a/scripts/server.gd +++ b/scripts/server.gd @@ -31,10 +31,17 @@ func create_game(): @rpc("any_peer", "call_remote", "reliable") func send_playerinfo(name, id): if multiplayer.is_server(): + var done = 0 players[id] = name label = get_tree().root.get_node("create/player_list/list") + label.text = "" for w in players: - label.text = str(label.text +"\n" + players[w]) + if done == 1: + label.text = str(label.text +"\n" + players[w]) + else: + label.text = players[w] + done = 1 + @rpc("authority", "call_local", "reliable") func start_game(server_players): @@ -55,3 +62,9 @@ func sync_player(node_name, position, rotation): var current_character = get_tree().root.get_node("./"+node_name) current_character.position = position current_character.rotation = rotation + +@rpc("authority", "call_local", "reliable") +func sync_computers(node_name, current): + var current_character = get_tree().root.get_node("./map/"+node_name) + print(current_character) + current_character.current = current