Files
Billiards/scenes/data_bridge/game_data.gd
itdominator e3bdb21cd2 feat(game): add free ball mode and improve ball state handling
* add Free Ball game mode and lobby selection
* refactor base mode ball state tracking for reaped/sunk balls
* add player ownership tracking and colored-ball support
* add initial 9-ball mode implementation
* update 8-ball and snooker modes to use base ball handling
* replicate ball linear velocity for multiplayer synchronization
* improve ball collision sound propagation and physics settings
* reenable game music and initialize game signals
* improve lobby input focus and mode selection behavior
* adjust cue impulse origin and default game mode
2026-08-10 21:22:52 -05:00

59 lines
1.1 KiB
GDScript

class_name GameData extends Node
var client1: int
var client2: int
var player_id: String = ""
var game_address: String = "0.0.0.0"
var game_port: int = 8080
var game_mode: String = "freeball"
enum PlayerType {
Player1,
Player2
}
enum GameModeType {
BALL_8,
BALL_9,
SNOOKER,
FREE_BALL
}
const MATCH_TYPES: Dictionary = {
"8ball": GameModeType.BALL_8,
"9ball": GameModeType.BALL_9,
"snooker": GameModeType.SNOOKER,
"freeball": GameModeType.FREE_BALL
}
var GameMode: Dictionary = {
GameModeType.BALL_8: Ball8,
GameModeType.BALL_9: Ball9,
GameModeType.SNOOKER: Snooker,
GameModeType.FREE_BALL: FreeBall
}
var SelectedGameMode: GameModeType = GameModeType.FREE_BALL
func _init() -> void:
Globals.game_data = self
@rpc("authority", "reliable")
func set_game_address(address: String) -> void:
game_address = address
@rpc("authority", "reliable")
func set_game_port(port: String) -> void:
game_port = int(port)
func set_game_mode(mode: String) -> void:
SelectedGameMode = MATCH_TYPES[mode]
func set_player_id(is_player_1: bool) -> void:
player_id = "Player 1" if is_player_1 else "Player 2"