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 turn_count: int = 1 var player_1_points: int = 0 var player_2_points: int = 0 # NOTE: Kinda a super tracker of balls. Not all entries # generated are used depending on the game type. var ball_state: Dictionary = {} # NOTE: Used to track handoff logic and is cleared after eah switch accordingly. var balls_sunk: Array = [] var balls_reaped: Array = [] # NOTE: Kinda a super tracker of the state of a ball. # Not all entries are used depending on the game type. var BALL_STATE: Dictionary = { "turn": 0, "player": "", "sunk": false, "reaped": false, "valid_end": true, "points": 0, } func _init() -> void: pass func generate_ball_state() -> Dictionary: var state := {} for i: int in range(1, 16): var ball_name = "%02d_ball" % i state[ball_name] = BALL_STATE.duplicate_deep() state[ball_name]["points"] = i return state func which_player() -> String: return \ "Player 1" \ if \ Globals.game_data.client1 == Globals.multiplayer_data.current_turn_player_id \ else \ "Player 2" func reap_ball(ball: Node3D) -> void: balls_reaped.append(ball.name) ball_state[ball.name]["turn"] = turn_count ball_state[ball.name]["player"] = which_player() ball_state[ball.name]["reaped"] = not ball_state[ball.name]["reaped"] func process_ball(ball: Node3D) -> void: balls_sunk.append(ball.name) ball_state[ball.name]["turn"] = turn_count ball_state[ball.name]["player"] = which_player() ball_state[ball.name]["sunk"] = not ball_state[ball.name]["sunk"] func handle_switch_user() -> void: assert(false, "This method needs to be overridden...")