major refactor(game-modes): centralize scoring and turn handling

* Move common ball recording, scoring, and turn-switching logic into `BaseMode`
* Add hooks for mode-specific ball handling and turn behavior
* Simplify 8-ball and 9-ball modes to use `LastBallMode`
* Update Snooker to use the new ball-processing hooks
* Remove duplicated scoring and turn-management code
This commit is contained in:
2026-08-13 00:16:09 -05:00
parent 7be84d8591
commit 409680b94a
8 changed files with 126 additions and 240 deletions

View File

@@ -0,0 +1,16 @@
class_name LastBallMode extends BaseMode
@export var final_ball_name: String = ""
func on_ball_reaped(ball: Node3D) -> void:
if ball.name == final_ball_name:
ball_states[ball.name]["is_foul"] = true
func on_ball_sunk(ball: Node3D) -> void:
if ball.name == final_ball_name:
ball_states[ball.name]["is_foul"] = true
func process_win_condition() -> void:
pass