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
This commit is contained in:
@@ -7,7 +7,7 @@ var player_id: String = ""
|
||||
|
||||
var game_address: String = "0.0.0.0"
|
||||
var game_port: int = 8080
|
||||
var game_mode: String = "snooker"
|
||||
var game_mode: String = "freeball"
|
||||
|
||||
enum PlayerType {
|
||||
Player1,
|
||||
@@ -17,22 +17,25 @@ enum PlayerType {
|
||||
enum GameModeType {
|
||||
BALL_8,
|
||||
BALL_9,
|
||||
SNOOKER
|
||||
SNOOKER,
|
||||
FREE_BALL
|
||||
}
|
||||
|
||||
const MATCH_TYPES: Dictionary = {
|
||||
"8ball": GameModeType.BALL_8,
|
||||
"9ball": GameModeType.BALL_9,
|
||||
"snooker": GameModeType.SNOOKER
|
||||
"snooker": GameModeType.SNOOKER,
|
||||
"freeball": GameModeType.FREE_BALL
|
||||
}
|
||||
|
||||
var GameMode: Dictionary = {
|
||||
GameModeType.BALL_8: Ball8,
|
||||
GameModeType.BALL_9: Ball9,
|
||||
GameModeType.SNOOKER: Snooker
|
||||
GameModeType.SNOOKER: Snooker,
|
||||
GameModeType.FREE_BALL: FreeBall
|
||||
}
|
||||
|
||||
var SelectedGameMode: GameModeType = GameModeType.SNOOKER
|
||||
var SelectedGameMode: GameModeType = GameModeType.FREE_BALL
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
|
||||
@@ -104,11 +104,13 @@ func set_tracking_of_cue(path: String) -> void:
|
||||
func set_tracking_of_ball(path: String) -> void:
|
||||
path = str(path).trim_prefix(str(multiplayer_synchronizer.root_path) + "/")
|
||||
|
||||
var position_pth = NodePath( path + ":position" )
|
||||
var rotation_pth = NodePath( path + ":rotation" )
|
||||
var position_pth = NodePath( path + ":position" )
|
||||
var rotation_pth = NodePath( path + ":rotation" )
|
||||
var linear_velocity_pth = NodePath( path + ":linear_velocity" )
|
||||
|
||||
synchronizer_config.add_property(position_pth)
|
||||
synchronizer_config.add_property(rotation_pth)
|
||||
synchronizer_config.add_property(linear_velocity_pth)
|
||||
|
||||
synchronizer_config.property_set_replication_mode(
|
||||
position_pth, SceneReplicationConfig.REPLICATION_MODE_ON_CHANGE
|
||||
@@ -116,14 +118,20 @@ func set_tracking_of_ball(path: String) -> void:
|
||||
synchronizer_config.property_set_replication_mode(
|
||||
rotation_pth, SceneReplicationConfig.REPLICATION_MODE_ON_CHANGE
|
||||
)
|
||||
synchronizer_config.property_set_replication_mode(
|
||||
linear_velocity_pth, SceneReplicationConfig.REPLICATION_MODE_ON_CHANGE
|
||||
)
|
||||
|
||||
func remove_tracking_of_ball(path: String) -> void:
|
||||
path = str(path).trim_prefix(str(multiplayer_synchronizer.root_path) + "/")
|
||||
|
||||
var position_pth = NodePath(path + ":position")
|
||||
var rotation_pth = NodePath(path + ":rotation")
|
||||
var position_pth = NodePath( path + ":position" )
|
||||
var rotation_pth = NodePath( path + ":rotation" )
|
||||
var linear_velocity_pth = NodePath( path + ":linear_velocity" )
|
||||
|
||||
if synchronizer_config.has_property(position_pth):
|
||||
synchronizer_config.remove_property(position_pth)
|
||||
if synchronizer_config.has_property(rotation_pth):
|
||||
synchronizer_config.remove_property(rotation_pth)
|
||||
if synchronizer_config.has_property(linear_velocity_pth):
|
||||
synchronizer_config.remove_property(linear_velocity_pth)
|
||||
|
||||
Reference in New Issue
Block a user