Align patterns better around what UI components are. Move script related controllers to scripts folder

This commit is contained in:
2026-08-15 14:33:53 -05:00
parent 27411ea5fa
commit 2b196455b2
57 changed files with 128 additions and 60 deletions

View File

@@ -0,0 +1,44 @@
class_name Snooker extends BaseMode
# NOTE: The game is sometimes played with fewer red balls- commonly 6 or 10.
# Normally, 15 red balls (1 point) and 6 balls of different colors:
# yellow (2 points), green (3), brown (4), blue (5), pink (6), black (7).
const COLORED_BALLS := {
"yellow_ball": 2, "green_ball": 3, "brown_ball": 4,
"blue_ball": 5, "pink_ball": 6, "black_ball": 7,
}
func _init() -> void:
pass
func generate_ball_states() -> Dictionary:
var state: Dictionary = {}
for ball_name in COLORED_BALLS:
state[ball_name] = BALL_STATE.duplicate_deep()
state[ball_name]["points"] = COLORED_BALLS[ball_name]
for i: int in range(1, 16):
var ball_name := "%02d_ball" % i
state[ball_name] = BALL_STATE.duplicate_deep()
state[ball_name]["points"] = 1
return state
func on_ball_reaped(ball: Node3D) -> void:
if ball.name in COLORED_BALLS:
ball_states[ball.name]["is_foul"] = true
func on_ball_sunk(ball: Node3D) -> void:
if ball.name in COLORED_BALLS:
# TODO: Check whether a red ball has been sunk first.
ball_states[ball.name]["is_foul"] = true
func score_sunk_balls() -> bool:
return true
func process_win_condition() -> String:
return super()