fix: refine game mode state tracking and turn handling
* Centralize ball state generation in `BaseMode` * Track turn count, player, and ball state consistently * Prevent 8-ball, 9-ball, and colored snooker balls from being marked valid when reaped/sunk * Update mode initialization and ball-state assignment * Normalize Free Ball mode node name to `freeball`
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
class_name Ball8 extends BaseMode
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
pass
|
||||
|
||||
func reap_ball(ball: Node3D) -> void:
|
||||
super(ball)
|
||||
|
||||
if ball.name == "08_ball":
|
||||
# TODO: 8 ball must not be be destroyed. Handle rule...
|
||||
ball_state[ball.name]["valid_end"] = false
|
||||
pass
|
||||
|
||||
func process_ball(ball: Node3D) -> void:
|
||||
@@ -13,6 +17,7 @@ func process_ball(ball: Node3D) -> void:
|
||||
|
||||
if ball.name == "08_ball":
|
||||
# TODO: 8 ball must be sunk last. Handle rule...
|
||||
ball_state[ball.name]["valid_end"] = false
|
||||
pass
|
||||
|
||||
func handle_switch_user() -> void:
|
||||
@@ -25,9 +30,11 @@ func handle_switch_user() -> void:
|
||||
|
||||
if balls_sunk.is_empty():
|
||||
Globals.game_state.switch_active_player()
|
||||
turn_count += 1
|
||||
return
|
||||
|
||||
# TODO: Handle points, etc
|
||||
# Globals.multiplayer_data.current_turn_player_id
|
||||
|
||||
balls_sunk.clear()
|
||||
turn_count += 1
|
||||
|
||||
Reference in New Issue
Block a user