Made maxTargetDistance accurate and added targetColliderRadius

This commit is contained in:
Nick 2022-06-15 14:37:25 -04:00
parent e833512bda
commit c0ad3a0fa7
2 changed files with 12 additions and 5 deletions

View File

@ -15,6 +15,7 @@ namespace NewHorizons.Builder.General
var SC = rfGO.AddComponent<SphereCollider>(); var SC = rfGO.AddComponent<SphereCollider>();
SC.isTrigger = true; 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; SC.radius = sphereOfInfluence * 2;
var RFV = rfGO.AddComponent<ReferenceFrameVolume>(); var RFV = rfGO.AddComponent<ReferenceFrameVolume>();
@ -23,7 +24,8 @@ namespace NewHorizons.Builder.General
var RV = new ReferenceFrame(owrb); var RV = new ReferenceFrame(owrb);
RV._minSuitTargetDistance = minTargetDistance; 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._autopilotArrivalDistance = 2.0f * sphereOfInfluence;
RV._autoAlignmentDistance = sphereOfInfluence * 1.5f; RV._autoAlignmentDistance = sphereOfInfluence * 1.5f;
@ -35,7 +37,7 @@ namespace NewHorizons.Builder.General
RFV._referenceFrame = RV; RFV._referenceFrame = RV;
RFV._minColliderRadius = minTargetDistance; 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._isPrimaryVolume = true;
RFV._isCloseRangeVolume = false; RFV._isCloseRangeVolume = false;

View File

@ -16,7 +16,7 @@ namespace NewHorizons.External.Modules
public bool hideInMap; public bool hideInMap;
/// <summary> /// <summary>
/// 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.
/// </summary> /// </summary>
[DefaultValue(-1)] public float bracketRadius = -1; [DefaultValue(-1)] public float bracketRadius = -1;
@ -26,8 +26,13 @@ namespace NewHorizons.External.Modules
public bool targetWhenClose; public bool targetWhenClose;
/// <summary> /// <summary>
/// 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.
/// </summary> /// </summary>
[DefaultValue(-1)] public float maxTargetDistance = -1; public float maxTargetDistance; // If it's less than or equal to zero the game makes it 100km
/// <summary>
/// The radius of the sphere around the planet which you can click on to target it. Defaults to twice the sphere of influence.
/// </summary>
public float targetColliderRadius;
} }
} }