2026-08-07 02:50:54 -05:00
|
|
|
class_name Ball8 extends BaseMode
|
|
|
|
|
|
|
|
|
|
|
2026-08-11 23:59:30 -05:00
|
|
|
func _init() -> void:
|
|
|
|
|
pass
|
|
|
|
|
|
2026-08-07 02:50:54 -05:00
|
|
|
func reap_ball(ball: Node3D) -> void:
|
2026-08-10 21:22:52 -05:00
|
|
|
super(ball)
|
|
|
|
|
|
2026-08-07 02:50:54 -05:00
|
|
|
if ball.name == "08_ball":
|
|
|
|
|
# TODO: 8 ball must not be be destroyed. Handle rule...
|
2026-08-12 22:14:03 -05:00
|
|
|
ball_states[ball.name]["is_foul"] = true
|
2026-08-07 02:50:54 -05:00
|
|
|
|
|
|
|
|
func process_ball(ball: Node3D) -> void:
|
2026-08-10 21:22:52 -05:00
|
|
|
super(ball)
|
|
|
|
|
|
2026-08-07 02:50:54 -05:00
|
|
|
if ball.name == "08_ball":
|
|
|
|
|
# TODO: 8 ball must be sunk last. Handle rule...
|
2026-08-12 22:14:03 -05:00
|
|
|
ball_states[ball.name]["is_foul"] = true
|
2026-08-07 02:50:54 -05:00
|
|
|
|
|
|
|
|
func handle_switch_user() -> void:
|
2026-08-10 21:22:52 -05:00
|
|
|
push_warning("Balls reaped: ", balls_reaped.size() )
|
|
|
|
|
push_warning("Balls sunk: ", balls_sunk.size() )
|
2026-08-12 22:14:03 -05:00
|
|
|
var switch_player: bool = true
|
2026-08-07 02:50:54 -05:00
|
|
|
|
|
|
|
|
if not balls_reaped.is_empty():
|
2026-08-12 22:14:03 -05:00
|
|
|
for ball_name in balls_reaped:
|
|
|
|
|
ball_states[ball_name]["points"] = -ball_states[ball_name]["points"]
|
|
|
|
|
|
2026-08-07 02:50:54 -05:00
|
|
|
balls_reaped.clear()
|
|
|
|
|
|
2026-08-12 22:14:03 -05:00
|
|
|
if not balls_sunk.is_empty():
|
|
|
|
|
# TODO: Handle points, etc, insure 8-ball not sunk unless last
|
|
|
|
|
# Insure we process stripped vs solid ball and apropriate points accordingly
|
|
|
|
|
# ball_states[ball.name]["is_foul"] = true
|
|
|
|
|
|
|
|
|
|
switch_player = false
|
|
|
|
|
balls_sunk.clear()
|
|
|
|
|
|
|
|
|
|
if ball_states_finalized():
|
|
|
|
|
process_win_condition()
|
2026-08-07 02:50:54 -05:00
|
|
|
return
|
|
|
|
|
|
2026-08-12 22:14:03 -05:00
|
|
|
if switch_player:
|
|
|
|
|
Globals.game_state.switch_active_player()
|
|
|
|
|
turn_count += 1
|
|
|
|
|
else:
|
|
|
|
|
turn_count += 1
|
2026-08-07 02:50:54 -05:00
|
|
|
|
2026-08-12 22:14:03 -05:00
|
|
|
func process_win_condition() -> void:
|
|
|
|
|
pass
|