push project up sabs assets

This commit is contained in:
2026-08-07 02:50:54 -05:00
parent 71b666c683
commit f5d6c640ae
131 changed files with 4604 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
class_name Ball8 extends BaseMode
func reap_ball(ball: Node3D) -> void:
balls_reaped.append(ball.name)
if ball.name == "08_ball":
# TODO: 8 ball must not be be destroyed. Handle rule...
pass
ball_state[ball.name] = not ball_state[ball.name]
func process_ball(ball: Node3D) -> void:
balls_sunk.append(ball.name)
if ball.name == "08_ball":
# TODO: 8 ball must be sunk last. Handle rule...
pass
ball_state[ball.name] = not ball_state[ball.name]
func handle_switch_user() -> void:
push_warning("Balls reaped: ", balls_reaped.size())
push_warning("Balls sunk: ", balls_sunk.size())
if not balls_reaped.is_empty():
# TODO: Handle points, etc
balls_reaped.clear()
if balls_sunk.is_empty():
Globals.game_state.switch_active_player()
return
# TODO: Handle points, etc
# Globals.multiplayer_data.current_turn_player_id
balls_sunk.clear()

View File

@@ -0,0 +1 @@
uid://bruauynfkrqvv

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://b6hjxh7luqvj8"]
[ext_resource type="Script" uid="uid://bruauynfkrqvv" path="res://controllers/game/modes/8_ball.gd" id="1_6i6et"]
[node name="8-ball" type="Node"]
script = ExtResource("1_6i6et")

View File

@@ -0,0 +1 @@
class_name Ball9 extends BaseMode

View File

@@ -0,0 +1 @@
uid://da6061q2oytcw

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://cej6o2ix55hu6"]
[ext_resource type="Script" uid="uid://da6061q2oytcw" path="res://controllers/game/modes/9_ball.gd" id="1_4m6hi"]
[node name="9-ball" type="Node"]
script = ExtResource("1_4m6hi")

View File

@@ -0,0 +1,29 @@
class_name BaseMode extends Node
# NOTE: The ball's queue_free is called higher up and after game mode handles
# the ball. Never call it in a given game mode. A game mode should handle
# these signals to handle game related rules regarding ball sinks.
var ball_state := generate_ball_state()
var balls_sunk := []
var balls_reaped := []
var STATE: Dictionary = {
"sunk": false
}
func generate_ball_state() -> Dictionary:
var state := {}
for i in range(1, 16):
state["%02d_ball" % i] = STATE
return state
func reap_ball(_ball: Node3D) -> void:
assert(false, "This method needs to be overridden...")
func process_ball(_ball: Node3D) -> void:
assert(false, "This method needs to be overridden...")
func handle_switch_user() -> void:
assert(false, "This method needs to be overridden...")

View File

@@ -0,0 +1 @@
uid://m2mab84reiuq

View File

@@ -0,0 +1,28 @@
class_name GameManager extends GamManagerMultiplayer
func _ready() -> void:
setup_signals()
setup_multiplayer()
func setup_signals() -> void:
Globals.game_state.balls_stopped_moving.connect(_balls_stopped_moving)
Globals.game_state.process_ball.connect(_process_ball)
Globals.game_state.reap_ball.connect(_reap_ball)
func _process_ball(ball: Node3D) -> void:
if ball.name == "white_ball":
# NOTE: Signal to reset 'white_ball' to 'white_ball_marker' global_pos
Globals.game_state.white_ball_sunk.emit()
return
mode.process_ball(ball)
rpc("reap_ball", str(ball.get_path()))
func _reap_ball(ball: Node3D) -> void:
if ball.name == "white_ball":
Globals.game_state.white_ball_needs_hard_reset.emit()
return
mode.reap_ball(ball)
rpc("reap_ball", str(ball.get_path()))

View File

@@ -0,0 +1 @@
uid://csrolkxqgy5cj

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bw7f8kunlxd2"]
[ext_resource type="Script" uid="uid://csrolkxqgy5cj" path="res://controllers/game/modes/game_manager.gd" id="1_pwtrd"]
[node name="game_manager" type="Node"]
script = ExtResource("1_pwtrd")

View File

@@ -0,0 +1,25 @@
class_name GamManagerBase extends Node
@export var mode: BaseMode
@onready var pool_table_manager: PoolTableManager = $"../pool_table_manager"
func _balls_stopped_moving() -> void:
if pool_table_manager.white_ball_sunk or pool_table_manager.white_ball_hard_sunk:
pool_table_manager.initial_white_ball_start()
if pool_table_manager.white_ball_hard_sunk:
pool_table_manager.balls.white_ball.set_visible(true)
mode.handle_switch_user()
return
pool_table_manager.align_to_white_ball()
mode.handle_switch_user()
func set_mode(game_mode) -> void:
mode = Globals.game_data.GameMode.get(game_mode).new()
mode.generate_ball_state()

View File

@@ -0,0 +1 @@
uid://cigjgffk40ppg

View File

@@ -0,0 +1,17 @@
class_name GamManagerMultiplayer extends GamManagerBase
func setup_multiplayer() -> void:
if not Globals.multiplayer_data.is_multiplayer_active: return
if multiplayer.is_server(): return
Globals.game_state.balls_stopped_moving.disconnect(_balls_stopped_moving)
@rpc("authority", "call_local", "reliable")
func reap_ball(ball_pth: String) -> void:
var ball = get_node(ball_pth)
push_warning("Ball sunk: ", ball_pth)
Globals.multiplayer_data.remove_tracking_of_ball( ball_pth )
ball.queue_free()

View File

@@ -0,0 +1 @@
uid://mq80ifv83gcx

View File

@@ -0,0 +1,35 @@
class_name Snooker extends BaseMode
func reap_ball(ball: Node3D) -> void:
balls_reaped.append(ball.name)
if ball.name == "08_ball":
# TODO: 8 ball must not be be destroyed. Handle rule...
pass
ball_state[ball.name] = not ball_state[ball.name]
func process_ball(ball: Node3D) -> void:
balls_sunk.append(ball.name)
if ball.name == "08_ball":
# TODO: 8 ball must be sunk last. Handle rule...
pass
ball_state[ball.name] = not ball_state[ball.name]
func handle_switch_user() -> void:
push_warning("Balls reaped: ", balls_reaped.size())
push_warning("Balls sunk: ", balls_sunk.size())
if not balls_reaped.is_empty():
# TODO: Handle points, etc
balls_reaped.clear()
if balls_sunk.is_empty():
Globals.game_state.switch_active_player()
return
# TODO: Handle points, etc
# Globals.multiplayer_data.current_turn_player_id
balls_sunk.clear()

View File

@@ -0,0 +1 @@
uid://cnjaupry2q5aj

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bh05rdwspf87c"]
[ext_resource type="Script" uid="uid://cnjaupry2q5aj" path="res://controllers/game/modes/snooker.gd" id="1_yq5ii"]
[node name="snooker" type="Node"]
script = ExtResource("1_yq5ii")