From d2b89c9d5c49e3b9e8b3370be6a42258ef9542a9 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 26 Jan 2025 19:19:36 +0100 Subject: [PATCH] WIP: Make it possible to change server address --- scenes/utils/Menu.tscn | 6 ++++++ scenes/utils/menu.gd | 5 ++--- scenes/weapon/bullet.tscn | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scenes/utils/Menu.tscn b/scenes/utils/Menu.tscn index 500f7b5..e33b4cf 100644 --- a/scenes/utils/Menu.tscn +++ b/scenes/utils/Menu.tscn @@ -35,6 +35,12 @@ offset_right = 224.0 offset_bottom = 220.0 text = "Join" +[node name="TextEdit" type="TextEdit" parent="."] +layout_mode = 0 +offset_right = 8.0 +offset_bottom = 8.0 +text = "127.0.0.1" + [connection signal="player_connected" from="." to="." method="_on_player_connected"] [connection signal="player_disconnected" from="." to="." method="_on_player_disconnected"] [connection signal="server_disconnected" from="." to="." method="_on_server_disconnected"] diff --git a/scenes/utils/menu.gd b/scenes/utils/menu.gd index afe50cd..29dbb6a 100644 --- a/scenes/utils/menu.gd +++ b/scenes/utils/menu.gd @@ -10,7 +10,7 @@ signal server_disconnected const PORT = 7000 const DEFAULT_SERVER_IP = "127.0.0.1" # IPv4 localhost const MAX_CONNECTIONS = 20 - +@onready var address_input: TextEdit = $TextEdit var players = {} var my_random_number = RandomNumberGenerator.new().randf_range(-2.0, 2.0) var player_info = {"name": str(my_random_number)} @@ -25,8 +25,7 @@ func _ready() -> void: multiplayer.server_disconnected.connect(_on_server_disconnected) func join_game(address = ""): - if address.is_empty(): - address = DEFAULT_SERVER_IP + address = address_input.text var peer = ENetMultiplayerPeer.new() var error = peer.create_client(address, PORT) if error: diff --git a/scenes/weapon/bullet.tscn b/scenes/weapon/bullet.tscn index 7ca6c76..04a7909 100644 --- a/scenes/weapon/bullet.tscn +++ b/scenes/weapon/bullet.tscn @@ -37,6 +37,9 @@ properties/0/replication_mode = 1 properties/1/path = NodePath(".:rotation") properties/1/spawn = true properties/1/replication_mode = 1 +properties/2/path = NodePath(".:rotation_order") +properties/2/spawn = true +properties/2/replication_mode = 1 [node name="Bullet" type="Node3D"] transform = Transform3D(20, 0, 0, 0, 20, 0, 0, 0, 20, 0, 0, 0)