From c0ad3a0fa74708a24e653fe390483e2f9598db2e Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 15 Jun 2022 14:37:25 -0400 Subject: [PATCH] Made maxTargetDistance accurate and added targetColliderRadius --- NewHorizons/Builder/General/RFVolumeBuilder.cs | 6 ++++-- NewHorizons/External/Modules/ReferenceFrameModule.cs | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Builder/General/RFVolumeBuilder.cs b/NewHorizons/Builder/General/RFVolumeBuilder.cs index 178234e4..1d4815a9 100644 --- a/NewHorizons/Builder/General/RFVolumeBuilder.cs +++ b/NewHorizons/Builder/General/RFVolumeBuilder.cs @@ -15,6 +15,7 @@ namespace NewHorizons.Builder.General var SC = rfGO.AddComponent(); SC.isTrigger = true; + // This radius ends up being set by min and max collider radius on the RFV but we set it anyway because why fix what aint broke SC.radius = sphereOfInfluence * 2; var RFV = rfGO.AddComponent(); @@ -23,7 +24,8 @@ namespace NewHorizons.Builder.General var RV = new ReferenceFrame(owrb); RV._minSuitTargetDistance = minTargetDistance; - RV._maxTargetDistance = 0; + // The game raycasts to 100km, but if the target is farther than this max distance it ignores it + RV._maxTargetDistance = module.maxTargetDistance; RV._autopilotArrivalDistance = 2.0f * sphereOfInfluence; RV._autoAlignmentDistance = sphereOfInfluence * 1.5f; @@ -35,7 +37,7 @@ namespace NewHorizons.Builder.General RFV._referenceFrame = RV; RFV._minColliderRadius = minTargetDistance; - RFV._maxColliderRadius = module.maxTargetDistance > -1 ? module.maxTargetDistance : sphereOfInfluence * 2f; + RFV._maxColliderRadius = module.targetColliderRadius > 0 ? module.targetColliderRadius : sphereOfInfluence * 2f; RFV._isPrimaryVolume = true; RFV._isCloseRangeVolume = false; diff --git a/NewHorizons/External/Modules/ReferenceFrameModule.cs b/NewHorizons/External/Modules/ReferenceFrameModule.cs index 793bb5f0..88adda68 100644 --- a/NewHorizons/External/Modules/ReferenceFrameModule.cs +++ b/NewHorizons/External/Modules/ReferenceFrameModule.cs @@ -16,7 +16,7 @@ namespace NewHorizons.External.Modules public bool hideInMap; /// - /// Radius of the brackets that show up when you target this. Defaults to the sphereOfInfluence. + /// Radius of the brackets that show up when you target this. Defaults to the sphere of influence. /// [DefaultValue(-1)] public float bracketRadius = -1; @@ -26,8 +26,13 @@ namespace NewHorizons.External.Modules public bool targetWhenClose; /// - /// The maximum distance that the reference frame can be targeted from. Defaults to double the sphereOfInfluence. + /// The maximum distance that the reference frame can be targeted from. Defaults to 100km and cannot be greater than that. /// - [DefaultValue(-1)] public float maxTargetDistance = -1; + public float maxTargetDistance; // If it's less than or equal to zero the game makes it 100km + + /// + /// The radius of the sphere around the planet which you can click on to target it. Defaults to twice the sphere of influence. + /// + public float targetColliderRadius; } } \ No newline at end of file