1
Fork 0
mirror of https://github.com/Steffo99/nanogolf.git synced 2024-11-21 15:44:21 +00:00

Fix server not starting

This commit is contained in:
Steffo 2024-02-27 04:51:01 +01:00
parent 095d252999
commit d54b981e25
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
3 changed files with 21 additions and 17 deletions

View file

@ -37,7 +37,7 @@ func init_server_game(server_port: int):
push_error(error)
return
scene_tree.set_multiplayer(multiplayer, ^"/root/Main/Server")
scene_tree.set_multiplayer(smp, ^"/root/Main/Server")
smp.set_multiplayer_peer(peer)
func deinit_server_game():
@ -79,7 +79,7 @@ func _ready():
func _on_hosting_confirmed(player_name: String, player_color: Color, server_port: int):
deinit_main_menu()
init_server_game(server_port)
init_client_game(player_name, player_color, "127.0.0.1", server_port)
# init_client_game(player_name, player_color, "127.0.0.1", server_port)
func _on_connecting_confirmed(player_name: String, player_color: Color, server_address: String, server_port: int):
deinit_main_menu()

View file

@ -32,17 +32,3 @@ var player_color: Color = Color.WHITE
## This player's score, with an item per hole played.
var strokes_per_hole: Array[int] = []
func _ready():
replication_config = SceneReplicationConfig.new()
replication_config.add_property(^".:peer_id")
replication_config.property_set_replication_mode(^".:peer_id", SceneReplicationConfig.ReplicationMode.REPLICATION_MODE_ON_CHANGE)
replication_config.add_property(^".:peer_connected")
replication_config.property_set_replication_mode(^".:peer_connected", SceneReplicationConfig.ReplicationMode.REPLICATION_MODE_ON_CHANGE)
replication_config.add_property(^".:player_name")
replication_config.property_set_replication_mode(^".:player_name", SceneReplicationConfig.ReplicationMode.REPLICATION_MODE_ON_CHANGE)
replication_config.add_property(^".:player_color")
replication_config.property_set_replication_mode(^".:player_color", SceneReplicationConfig.ReplicationMode.REPLICATION_MODE_ON_CHANGE)
replication_config.add_property(^".:strokes_per_hole")
replication_config.property_set_replication_mode(^".:strokes_per_hole", SceneReplicationConfig.ReplicationMode.REPLICATION_MODE_ON_CHANGE)

View file

@ -1,7 +1,25 @@
[gd_scene load_steps=2 format=3 uid="uid://drccgvtcng3ju"]
[gd_scene load_steps=3 format=3 uid="uid://drccgvtcng3ju"]
[ext_resource type="Script" path="res://scenes/single_player_tracker.gd" id="1_jwlkv"]
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_aosye"]
properties/0/path = NodePath(".:peer_id")
properties/0/spawn = true
properties/0/replication_mode = 2
properties/1/path = NodePath(".:peer_connected")
properties/1/spawn = true
properties/1/replication_mode = 2
properties/2/path = NodePath(".:player_name")
properties/2/spawn = true
properties/2/replication_mode = 2
properties/3/path = NodePath(".:player_color")
properties/3/spawn = true
properties/3/replication_mode = 2
properties/4/path = NodePath(".:strokes_per_hole")
properties/4/spawn = true
properties/4/replication_mode = 2
[node name="SinglePlayerTracker" type="MultiplayerSynchronizer"]
root_path = NodePath(".")
replication_config = SubResource("SceneReplicationConfig_aosye")
script = ExtResource("1_jwlkv")