Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions assets/data/approach_test_shot.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"ShotNumber": 13,
"APIversion": "1",
"BallData" : {
"Speed": 81.0547040,
"SpinAxis": 5.7414904 ,
"TotalSpin": 10489.8457 ,
"BackSpin": 10454.7803545724255,
"SideSpin": 699.266167598911,
"HLA": 1.3455228805541992,
"VLA": 30.503028869628906,
"Speed": 105,
"SpinAxis": -1.0,
"TotalSpin": 6825,
"BackSpin": 6825,
"SideSpin": 0,
"HLA": 8.0,
"VLA": 22.41,
"CarryDistance": 0.0
},
"ClubData": {
Expand Down
5 changes: 5 additions & 0 deletions assets/images/icons/bullseye.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions assets/images/icons/bullseye.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://2ffapffda1u3"
path="res://.godot/imported/bullseye.svg-d7457ee00aeb40249f5f68eb51907bc7.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/images/icons/bullseye.svg"
dest_files=["res://.godot/imported/bullseye.svg-d7457ee00aeb40249f5f68eb51907bc7.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
3 changes: 3 additions & 0 deletions assets/images/icons/filter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions assets/images/icons/filter.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://ehyrr7tyubtv"
path="res://.godot/imported/filter.svg-f4660c8a90aaa6fa8c996b02f00ec293.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/images/icons/filter.svg"
dest_files=["res://.godot/imported/filter.svg-f4660c8a90aaa6fa8c996b02f00ec293.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
11 changes: 11 additions & 0 deletions assets/images/icons/scatter_plot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions assets/images/icons/scatter_plot.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dxri4ff4v8525"
path="res://.godot/imported/scatter_plot.svg-f3eac9f6940332025bc06b4f830be6eb.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/images/icons/scatter_plot.svg"
dest_files=["res://.godot/imported/scatter_plot.svg-f3eac9f6940332025bc06b4f830be6eb.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
12 changes: 6 additions & 6 deletions assets/meshes/surface_types.tres

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions courses/RangeCourse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
public partial class RangeCourse : HoleSceneControllerBase
{
private const float YardsToMeters = 1.0f / ShotSetup.YARDS_PER_METER;
private Vector3 _teePoint = GolfBall.START_POSITION;

[ExportGroup("Range Surface")]
[Export] public NodePath SurfaceGridPath { get; set; } = new NodePath("SurfaceGrid");
Expand Down Expand Up @@ -42,6 +43,31 @@ protected override bool ShouldShowCourseMeta()
return false;
}

protected override bool ShouldShowTargetElevation()
{
return false;
}

protected override bool ShouldShowRangeHudControls()
{
return true;
}

protected override int GetRangeTargetMinYards()
{
return 5;
}

protected override int GetRangeTargetMaxYards()
{
return 350;
}

protected override int GetDefaultRangeTargetYards()
{
return 100;
}

protected override bool ShouldShowTracerHistorySetting()
{
return true;
Expand Down Expand Up @@ -72,8 +98,29 @@ protected override bool ShouldClearTracersOnBallReset()
return false;
}

protected override Vector3? ResolveDistanceReferencePoint()
{
int selectedYards = GameplayUi != null ? GameplayUi.GetRangeTargetYardage() : GetDefaultRangeTargetYards();
selectedYards = Mathf.Clamp(selectedYards, GetRangeTargetMinYards(), GetRangeTargetMaxYards());
float meters = selectedYards * YardsToMeters;

return _teePoint + new Vector3(meters, 0.0f, 0.0f);
}

protected override string ResolveShotRecordingClubTag()
{
if (GameplayUi == null)
return RangeClubCatalog.ToFileTag(AppSettings.DefaultRangeDefaultClub);

return GameplayUi.GetRangeSelectedClubFileTag();
}

protected override void OnHoleReadyAfterInit()
{
GolfBall ball = GetNodeOrNull<GolfBall>(BallNodePath);
if (ball != null)
_teePoint = ball.GlobalPosition;

ExtendFairwaySurface();
}

Expand Down
2 changes: 1 addition & 1 deletion courses/range.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ mesh_library = ExtResource("4_surface_library")
cell_size = Vector3(4, 4, 4)
cell_center_y = false
data = {
"cells": PackedInt32Array(15, 65532, 655361, 15, 65533, 655361, 15, 65534, 655361, 15, 65535, 655361, 15, 0, 655361, 15, 1, 655361, 14, 1, 655361, 14, 2, 655361, 15, 2, 655361, 15, 3, 655361, 15, 4, 655361, 14, 3, 655361, 14, 4, 655361, 15, 5, 655361, 14, 5, 655361, 14, 6, 655361, 15, 6, 655361, 14, 0, 655361, 14, 65535, 655361, 14, 65534, 655361, 14, 65533, 655361, 14, 65532, 655361, 16, 65532, 655361, 17, 65532, 655361, 18, 65532, 655361, 19, 65532, 655361, 19, 65533, 655361, 18, 65533, 655361, 17, 65533, 655361, 16, 65533, 655361, 16, 65534, 655361, 17, 65534, 655361, 18, 65534, 655361, 19, 65534, 655361, 18, 65535, 655361, 17, 65535, 655361, 16, 65535, 655361, 19, 65535, 655361, 20, 65535, 655361, 16, 0, 655361, 16, 1, 655361, 16, 2, 655361, 17, 2, 655361, 18, 2, 655361, 17, 1, 655361, 17, 0, 655361, 18, 0, 655361, 19, 0, 655361, 20, 0, 655361, 19, 1, 655361, 18, 1, 655361, 19, 2, 655361, 20, 1, 655361, 16, 6, 655361, 16, 5, 655361, 16, 4, 655361, 16, 3, 655361, 17, 3, 655361, 18, 3, 655361, 19, 3, 655361, 19, 4, 655361, 19, 5, 655361, 19, 6, 655361, 18, 6, 655361, 17, 6, 655361, 17, 5, 655361, 17, 4, 655361, 18, 4, 655361, 18, 5, 655361, 20, 2, 655361, 20, 3, 655361, 20, 4, 655361, 20, 5, 655361, 20, 6, 655361, 20, 65534, 655361, 20, 65533, 655361, 20, 65532, 655361, 20, 65531, 655362, 20, 65530, 655362, 20, 65529, 655362, 20, 65528, 655362, 20, 65527, 655362, 20, 65526, 655362, 19, 65526, 655362, 18, 65526, 655362, 17, 65526, 655362, 16, 65526, 655362, 15, 65526, 655362, 15, 65527, 655362, 16, 65527, 655362, 16, 65528, 655362, 16, 65529, 655362, 16, 65530, 655362, 16, 65531, 655362, 19, 65531, 655362, 18, 65531, 655362, 17, 65531, 655362, 17, 65530, 655362, 17, 65529, 655362, 17, 65528, 655362, 17, 65527, 655362, 18, 65527, 655362, 19, 65527, 655362, 19, 65528, 655362, 19, 65529, 655362, 19, 65530, 655362, 18, 65530, 655362, 18, 65529, 655362, 18, 65528, 655362, 15, 65528, 655362, 15, 65529, 655362, 15, 65530, 655362, 15, 65531, 655362, 14, 65531, 655362, 14, 65530, 655362, 14, 65529, 655362, 14, 65528, 655362, 14, 65527, 655362, 14, 65526, 655362, 14, 7, 655362, 15, 7, 655362, 16, 7, 655362, 17, 7, 655362, 18, 7, 655362, 19, 7, 655362, 20, 7, 655362, 19, 8, 655362, 20, 8, 655362, 19, 9, 655362, 20, 9, 655362, 18, 9, 655362, 17, 9, 655362, 16, 9, 655362, 15, 9, 655362, 14, 9, 655362, 14, 8, 655362, 15, 8, 655362, 16, 8, 655362, 17, 8, 655362, 18, 8, 655362, 20, 10, 655362, 19, 10, 655362, 18, 10, 655362, 17, 10, 655362, 16, 10, 655362, 15, 10, 655362, 14, 10, 655362, 13, 65526, 655362, 13, 65527, 655362, 13, 65528, 655362, 13, 65529, 655362, 13, 65530, 655362, 13, 65531, 655362, 12, 65531, 655362, 11, 65531, 655362, 11, 65530, 655362, 11, 65529, 655362, 11, 65528, 655362, 11, 65527, 655362, 11, 65526, 655362, 12, 65526, 655362, 12, 65527, 655362, 12, 65528, 655362, 12, 65529, 655362, 12, 65530, 655362, 11, 65532, 655362, 11, 65533, 655362, 11, 65534, 655362, 11, 65535, 655362, 11, 0, 655362, 11, 1, 655362, 11, 2, 655362, 11, 3, 655362, 11, 4, 655362, 11, 5, 655362, 11, 6, 655362, 11, 7, 655362, 11, 8, 655362, 11, 9, 655362, 11, 10, 655362, 12, 10, 655362, 13, 10, 655362, 12, 9, 655362, 12, 8, 655362, 12, 7, 655362, 12, 6, 655362, 12, 5, 655362, 12, 4, 655362, 12, 3, 655362, 12, 2, 655362, 12, 1, 655362, 12, 0, 655362, 12, 65535, 655362, 12, 65534, 655362, 12, 65533, 655362, 12, 65532, 655362, 13, 9, 655362, 13, 8, 655362, 13, 7, 655362, 13, 6, 655362, 13, 5, 655362, 13, 4, 655362, 13, 3, 655362, 13, 2, 655362, 13, 1, 655362, 13, 0, 655362, 13, 65535, 655362, 13, 65534, 655362, 13, 65533, 655362, 13, 65532, 655362, 65535, 65531, 1048576, 65535, 65532, 1048576, 65535, 65533, 1048576, 65535, 65534, 1048576, 65535, 65535, 1048576, 65535, 0, 1048576, 65535, 1, 1048576, 65535, 2, 1048576, 65535, 3, 1048576, 65535, 4, 1048576, 65535, 5, 1048576, 65535, 6, 1048576, 65535, 9, 1048576, 65535, 8, 1048576, 65535, 7, 1048576, 65535, 65530, 1048576, 65535, 65529, 1048576, 65535, 65528, 1048576, 65535, 65527, 1048576, 65535, 65526, 1048576, 65534, 65526, 1048576, 65534, 65527, 1048576, 65534, 65528, 1048576, 65534, 65529, 1048576, 65534, 65530, 1048576, 65533, 65530, 1048576, 65533, 65531, 1048576, 65534, 65531, 1048576, 65534, 65532, 1048576, 65534, 65533, 1048576, 65534, 65534, 1048576, 65534, 65535, 1048576, 65534, 0, 1048576, 65534, 1, 1048576, 65533, 2, 1048576, 65533, 3, 1048576, 65534, 3, 1048576, 65534, 2, 1048576, 65534, 4, 1048576, 65534, 5, 1048576, 65534, 6, 1048576, 65534, 7, 1048576, 65534, 8, 1048576, 65534, 9, 1048576, 65533, 9, 1048576, 65533, 8, 1048576, 65533, 7, 1048576, 65533, 6, 1048576, 65533, 5, 1048576, 65533, 4, 1048576, 65533, 1, 1048576, 65533, 0, 1048576, 65533, 65535, 1048576, 65533, 65534, 1048576, 65533, 65533, 1048576, 65533, 65532, 1048576, 65533, 65529, 1048576, 65533, 65528, 1048576, 65533, 65527, 1048576, 65533, 65526, 1048576)
"cells": PackedInt32Array(15, 65532, 655361, 15, 65533, 655361, 15, 65534, 655361, 15, 65535, 655361, 15, 0, 655361, 15, 1, 655361, 14, 1, 655361, 14, 2, 655361, 15, 2, 655361, 15, 3, 655361, 15, 4, 655361, 14, 3, 655361, 14, 4, 655361, 15, 5, 655361, 14, 5, 655361, 14, 6, 655361, 15, 6, 655361, 14, 0, 655361, 14, 65535, 655361, 14, 65534, 655361, 14, 65533, 655361, 14, 65532, 655361, 16, 65532, 655361, 17, 65532, 655361, 18, 65532, 655361, 19, 65532, 655361, 19, 65533, 655361, 18, 65533, 655361, 17, 65533, 655361, 16, 65533, 655361, 16, 65534, 655361, 17, 65534, 655361, 18, 65534, 655361, 19, 65534, 655361, 18, 65535, 655361, 17, 65535, 655361, 16, 65535, 655361, 19, 65535, 655361, 20, 65535, 655361, 16, 0, 655361, 16, 1, 655361, 16, 2, 655361, 17, 2, 655361, 18, 2, 655361, 17, 1, 655361, 17, 0, 655361, 18, 0, 655361, 19, 0, 655361, 20, 0, 655361, 19, 1, 655361, 18, 1, 655361, 19, 2, 655361, 20, 1, 655361, 16, 6, 655361, 16, 5, 655361, 16, 4, 655361, 16, 3, 655361, 17, 3, 655361, 18, 3, 655361, 19, 3, 655361, 19, 4, 655361, 19, 5, 655361, 19, 6, 655361, 18, 6, 655361, 17, 6, 655361, 17, 5, 655361, 17, 4, 655361, 18, 4, 655361, 18, 5, 655361, 20, 2, 655361, 20, 3, 655361, 20, 4, 655361, 20, 5, 655361, 20, 6, 655361, 20, 65534, 655361, 20, 65533, 655361, 20, 65532, 655361, 20, 65531, 655362, 20, 65530, 655362, 20, 65529, 655362, 20, 65528, 655362, 20, 65527, 655362, 20, 65526, 655362, 19, 65526, 655362, 18, 65526, 655362, 17, 65526, 655362, 16, 65526, 655362, 15, 65526, 655362, 15, 65527, 655362, 16, 65527, 655362, 16, 65528, 655362, 16, 65529, 655362, 16, 65530, 655362, 16, 65531, 655362, 19, 65531, 655362, 18, 65531, 655362, 17, 65531, 655362, 17, 65530, 655362, 17, 65529, 655362, 17, 65528, 655362, 17, 65527, 655362, 18, 65527, 655362, 19, 65527, 655362, 19, 65528, 655362, 19, 65529, 655362, 19, 65530, 655362, 18, 65530, 655362, 18, 65529, 655362, 18, 65528, 655362, 15, 65528, 655362, 15, 65529, 655362, 15, 65530, 655362, 15, 65531, 655362, 14, 65531, 655362, 14, 65530, 655362, 14, 65529, 655362, 14, 65528, 655362, 14, 65527, 655362, 14, 65526, 655362, 14, 7, 655362, 15, 7, 655362, 16, 7, 655362, 17, 7, 655362, 18, 7, 655362, 19, 7, 655362, 20, 7, 655362, 19, 8, 655362, 20, 8, 655362, 19, 9, 655362, 20, 9, 655362, 18, 9, 655362, 17, 9, 655362, 16, 9, 655362, 15, 9, 655362, 14, 9, 655362, 14, 8, 655362, 15, 8, 655362, 16, 8, 655362, 17, 8, 655362, 18, 8, 655362, 20, 10, 655362, 19, 10, 655362, 18, 10, 655362, 17, 10, 655362, 16, 10, 655362, 15, 10, 655362, 14, 10, 655362, 13, 65526, 655362, 13, 65527, 655362, 13, 65528, 655362, 13, 65529, 655362, 13, 65530, 655362, 13, 65531, 655362, 12, 65531, 655362, 11, 65531, 655362, 11, 65530, 655362, 11, 65529, 655362, 11, 65528, 655362, 11, 65527, 655362, 11, 65526, 655362, 12, 65526, 655362, 12, 65527, 655362, 12, 65528, 655362, 12, 65529, 655362, 12, 65530, 655362, 11, 65532, 655362, 11, 65533, 655362, 11, 65534, 655362, 11, 65535, 655362, 11, 0, 655362, 11, 1, 655362, 11, 2, 655362, 11, 3, 655362, 11, 4, 655362, 11, 5, 655362, 11, 6, 655362, 11, 7, 655362, 11, 8, 655362, 11, 9, 655362, 11, 10, 655362, 12, 10, 655362, 13, 10, 655362, 12, 9, 655362, 12, 8, 655362, 12, 7, 655362, 12, 6, 655362, 12, 5, 655362, 12, 4, 655362, 12, 3, 655362, 12, 2, 655362, 12, 1, 655362, 12, 0, 655362, 12, 65535, 655362, 12, 65534, 655362, 12, 65533, 655362, 12, 65532, 655362, 13, 9, 655362, 13, 8, 655362, 13, 7, 655362, 13, 6, 655362, 13, 5, 655362, 13, 4, 655362, 13, 3, 655362, 13, 2, 655362, 13, 1, 655362, 13, 0, 655362, 13, 65535, 655362, 13, 65534, 655362, 13, 65533, 655362, 13, 65532, 655362, 65535, 65531, 1048576, 65535, 65532, 1048576, 65535, 65533, 1048576, 65535, 65534, 1048576, 65535, 65535, 1048576, 65535, 0, 1048576, 65535, 1, 1048576, 65535, 2, 1048576, 65535, 3, 1048576, 65535, 4, 1048576, 65535, 5, 1048576, 65535, 6, 1048576, 65535, 9, 1048576, 65535, 8, 1048576, 65535, 7, 1048576, 65535, 65530, 1048576, 65535, 65529, 1048576, 65535, 65528, 1048576, 65535, 65527, 1048576, 65535, 65526, 1048576, 65534, 65526, 1048576, 65534, 65527, 1048576, 65534, 65528, 1048576, 65534, 65529, 1048576, 65534, 65530, 1048576, 65533, 65530, 1048576, 65533, 65531, 1048576, 65534, 65531, 1048576, 65534, 65532, 1048576, 65534, 65533, 1048576, 65534, 65534, 1048576, 65534, 65535, 1048576, 65534, 0, 1048576, 65534, 1, 1048576, 65533, 2, 1048576, 65533, 3, 1048576, 65534, 3, 1048576, 65534, 2, 1048576, 65534, 4, 1048576, 65534, 5, 1048576, 65534, 6, 1048576, 65534, 7, 1048576, 65534, 8, 1048576, 65534, 9, 1048576, 65533, 9, 1048576, 65533, 8, 1048576, 65533, 7, 1048576, 65533, 6, 1048576, 65533, 5, 1048576, 65533, 4, 1048576, 65533, 1, 1048576, 65533, 0, 1048576, 65533, 65535, 1048576, 65533, 65534, 1048576, 65533, 65533, 1048576, 65533, 65532, 1048576, 65533, 65529, 1048576, 65533, 65528, 1048576, 65533, 65527, 1048576, 65533, 65526, 1048576, 0, 0, 2, 1, 0, 2, 2, 0, 2, 3, 0, 2, 4, 0, 2, 5, 0, 2, 6, 0, 2, 7, 0, 2, 8, 0, 2, 9, 0, 2, 10, 0, 2, 0, 65535, 2, 1, 65535, 2, 2, 65535, 2, 3, 65535, 2, 4, 65535, 2, 5, 65535, 2, 6, 65535, 2, 7, 65535, 2, 8, 65535, 2, 9, 65535, 2, 10, 65535, 2, 21, 0, 2, 22, 0, 2, 23, 0, 2, 24, 0, 2, 25, 0, 2, 26, 0, 2, 27, 0, 2, 28, 0, 2, 29, 0, 2, 30, 0, 2, 31, 0, 2, 32, 0, 2, 33, 0, 2, 34, 0, 2, 35, 0, 2, 36, 0, 2, 37, 0, 2, 38, 0, 2, 39, 0, 2, 40, 0, 2, 41, 0, 2, 42, 0, 2, 43, 0, 2, 44, 0, 2, 45, 0, 2, 46, 0, 2, 47, 0, 2, 48, 0, 2, 49, 0, 2, 50, 0, 2, 51, 0, 2, 52, 0, 2, 53, 0, 2, 54, 0, 2, 55, 0, 2, 56, 0, 2, 57, 0, 2, 58, 0, 2, 59, 0, 2, 60, 0, 2, 61, 0, 2, 62, 0, 2, 63, 0, 2, 64, 0, 2, 65, 0, 2, 66, 0, 2, 67, 0, 2, 21, 65535, 2, 22, 65535, 2, 23, 65535, 2, 24, 65535, 2, 25, 65535, 2, 26, 65535, 2, 27, 65535, 2, 28, 65535, 2, 29, 65535, 2, 30, 65535, 2, 31, 65535, 2, 32, 65535, 2, 33, 65535, 2, 34, 65535, 2, 35, 65535, 2, 36, 65535, 2, 37, 65535, 2, 38, 65535, 2, 39, 65535, 2, 40, 65535, 2, 41, 65535, 2, 42, 65535, 2, 43, 65535, 2, 44, 65535, 2, 45, 65535, 2, 46, 65535, 2, 47, 65535, 2, 48, 65535, 2, 49, 65535, 2, 50, 65535, 2, 51, 65535, 2, 52, 65535, 2, 53, 65535, 2, 54, 65535, 2, 55, 65535, 2, 56, 65535, 2, 57, 65535, 2, 58, 65535, 2, 59, 65535, 2, 60, 65535, 2, 61, 65535, 2, 62, 65535, 2, 63, 65535, 2, 64, 65535, 2, 65, 65535, 2, 66, 65535, 2, 67, 65535, 2, 68, 0, 2, 69, 0, 2, 70, 0, 2, 71, 0, 2, 72, 0, 2, 73, 0, 2, 74, 0, 2, 75, 0, 2, 76, 0, 2, 77, 0, 2, 78, 0, 2, 79, 0, 2, 80, 0, 2, 81, 0, 2, 82, 0, 2, 83, 0, 2, 84, 0, 2, 85, 0, 2, 86, 0, 2, 87, 0, 2, 88, 0, 2, 89, 0, 2, 90, 0, 2, 68, 65535, 2, 69, 65535, 2, 70, 65535, 2, 71, 65535, 2, 72, 65535, 2, 73, 65535, 2, 74, 65535, 2, 75, 65535, 2, 76, 65535, 2, 77, 65535, 2, 78, 65535, 2, 79, 65535, 2, 80, 65535, 2, 81, 65535, 2, 82, 65535, 2, 87, 65535, 2, 88, 65535, 2, 86, 65535, 2, 85, 65535, 2, 84, 65535, 2, 83, 65535, 2, 89, 65535, 2, 90, 65535, 2)
}
25 changes: 23 additions & 2 deletions game/ShotRecordingService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using System.Text;
using System.Text.Json;
using Godot;
using Godot.Collections;
Expand Down Expand Up @@ -39,7 +40,7 @@ public override void _ExitTree()
_recordingEnabledSetting.SettingChanged -= OnRecordingEnabledChanged;
}

public void RecordShot(Dictionary ballData)
public void RecordShot(Dictionary ballData, string clubTag = "")
{
if (!_isRecording || ballData == null)
return;
Expand All @@ -50,7 +51,11 @@ public void RecordShot(Dictionary ballData)
_shotCounter++;

var shotJson = BuildShotJson(ballData);
string filePath = Path.Combine(_currentSessionPath, $"shot_{_shotCounter}.json");
string safeClubTag = SanitizeClubTag(clubTag);
string fileName = string.IsNullOrWhiteSpace(safeClubTag)
? $"shot_{_shotCounter}.json"
: $"shot_{safeClubTag}_{_shotCounter}.json";
string filePath = Path.Combine(_currentSessionPath, fileName);

try
{
Expand All @@ -63,6 +68,22 @@ public void RecordShot(Dictionary ballData)
}
}

private static string SanitizeClubTag(string clubTag)
{
if (string.IsNullOrWhiteSpace(clubTag))
return string.Empty;

string lower = clubTag.Trim().ToLowerInvariant();
var builder = new StringBuilder(lower.Length);
foreach (char c in lower)
{
if (char.IsLetterOrDigit(c) || c == '_')
builder.Append(c);
}

return builder.ToString();
}

private void OnRecordingEnabledChanged(Variant value)
{
bool enabled = (bool)value;
Expand Down
Loading
Loading