feat(game): add free ball mode and improve ball state handling

* add Free Ball game mode and lobby selection
* refactor base mode ball state tracking for reaped/sunk balls
* add player ownership tracking and colored-ball support
* add initial 9-ball mode implementation
* update 8-ball and snooker modes to use base ball handling
* replicate ball linear velocity for multiplayer synchronization
* improve ball collision sound propagation and physics settings
* reenable game music and initialize game signals
* improve lobby input focus and mode selection behavior
* adjust cue impulse origin and default game mode
This commit is contained in:
2026-08-10 21:22:52 -05:00
parent 26dcfe0d1b
commit e3bdb21cd2
19 changed files with 234 additions and 62 deletions

View File

@@ -4,6 +4,8 @@ class_name Lobby extends LobbyBase
func _ready() -> void:
setup_signals()
host_address_input.grab_focus()
func _exit_tree() -> void:
# TODO: Maybe no longer needed...
if Globals.multiplayer_data.is_multiplayer_active: return
@@ -38,6 +40,7 @@ func _on_receive_match_list(matches_list: Array) -> void:
_create_match_entry(match_entry)
client.lobby_fully_connected = true
new_match_name_input.grab_focus()
func _on_match_list_entry_activated(match_id: String) -> void:
for match_entry in match_list.get_children():
@@ -48,6 +51,8 @@ func _on_match_list_entry_activated(match_id: String) -> void:
match_entry.join_bttn.text = "Delete"
match_entry.join_bttn.visible = true
match_create_vbox.visible = false
match_search_input.visible = false
match_search_bttn.visible = false
match_entry.join_bttn.pressed.disconnect(_join_match)
match_entry.join_bttn.pressed.connect(
@@ -62,8 +67,11 @@ func _on_match_list_entry_removed(match_id: String) -> void:
push_warning("Client: Removed Match List Entry...", match_id)
if active_match && (match_id == active_match.match_id):
active_match = null
match_create_vbox.visible = true
active_match = null
match_create_vbox.visible = true
match_search_input.visible = true
match_search_bttn.visible = false
new_match_name_input.grab_focus()
for match_entry in match_list.get_children():
if not active_match:

View File

@@ -10,6 +10,23 @@ script = ExtResource("1_hhiik")
[node name="ui" parent="." instance=ExtResource("2_lqt48")]
[node name="host_address_input" parent="ui/body/left_body/server_host_hbox" index="1"]
context_menu_enabled = false
select_all_on_focus = true
[node name="host_port_range" parent="ui/body/left_body/server_host_hbox" index="2"]
select_all_on_focus = true
[node name="match_search_input" parent="ui/body/left_body/search_vbox/search_hbox" index="0"]
context_menu_enabled = false
[node name="right_body" parent="ui/body" index="1"]
visible = false
[node name="new_match_name_input" parent="ui/body/right_body/create_match_hbox" index="0"]
context_menu_enabled = false
select_all_on_focus = true
[node name="rpc_signals" type="Node" parent="."]
script = ExtResource("3_rurl6")
@@ -24,5 +41,6 @@ script = ExtResource("4_glu7g")
[connection signal="pressed" from="ui/body/right_body/vbox/8ball" to="." method="_on_mode_bttn_pressed" flags=18]
[connection signal="pressed" from="ui/body/right_body/vbox/9ball" to="." method="_on_mode_bttn_pressed" flags=18]
[connection signal="pressed" from="ui/body/right_body/vbox/snooker" to="." method="_on_mode_bttn_pressed" flags=18]
[connection signal="pressed" from="ui/body/right_body/vbox/free_ball" to="." method="_on_mode_bttn_pressed" flags=18]
[editable path="ui"]

View File

@@ -10,6 +10,7 @@ const MATCH_ENTRY = preload("res://scenes/screens/lobb
@onready var search_vbox: VBoxContainer = $ui/body/left_body/search_vbox
@onready var match_search_input: LineEdit = $ui/body/left_body/search_vbox/search_hbox/match_search_input
@onready var match_search_bttn: Button = $ui/body/left_body/search_vbox/search_hbox/match_search_bttn
@onready var match_list: VBoxContainer = $ui/body/left_body/search_vbox/scroll_container/match_list
@onready var match_create_vbox: VBoxContainer = $ui/body/right_body
@@ -18,7 +19,7 @@ const MATCH_ENTRY = preload("res://scenes/screens/lobb
@onready var rpc_signals: Node = $rpc_signals
@onready var client: LobbyClient = $client
var active_mode: String = "snooker"
var active_mode: String = "freeball"
var active_match: HBoxContainer = null
@@ -56,8 +57,7 @@ func _on_match_create_bttn_pressed() -> void:
"type": active_mode
}
#MessageBus.emit_request.rpc_id(1, "match_list_add_entry", match_entry)
MessageBus.emit_request.rpc("match_list_add_entry", match_entry)
func _on_mode_bttn_pressed(button: Button) -> void:
active_mode = button.text.remove_chars("-").to_lower()
active_mode = button.name.remove_chars("_").to_lower()