Hawkbar minor fixes (#575)

<!-- Be sure to reference the existing issue if it exists -->
## Bug fixes
- Fixed NullReferenceException when spawning vessels with physics
- Fixed SpawnDialogue API method always creating a remote trigger
This commit is contained in:
Will Corby 2023-04-18 19:40:25 -07:00 committed by GitHub
commit 6a1900b746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -145,6 +145,7 @@ namespace NewHorizons.Handlers
var hasParentBody = !string.IsNullOrEmpty(system.Config.Vessel?.vesselSpawn?.parentBody);
var hasPhysics = system.Config.Vessel?.hasPhysics ?? !hasParentBody;
var planetGO = hasParentBody ? vesselObject.transform.parent.gameObject : null;
if (hasPhysics)
{
@ -167,8 +168,6 @@ namespace NewHorizons.Handlers
var attachWarpExitToVessel = system.Config.Vessel?.warpExit?.attachToVessel ?? false;
var warpExitParent = vesselWarpController._targetWarpPlatform.transform.parent;
var planetGO = hasPhysics ? vesselObject.transform.parent.gameObject : null;
var warpExit = GeneralPropBuilder.MakeFromExisting(vesselWarpController._targetWarpPlatform.gameObject, planetGO, null, system.Config.Vessel?.warpExit, parentOverride: attachWarpExitToVessel ? warpExitParent : null);
if (attachWarpExitToVessel)
{

View File

@ -206,11 +206,11 @@ namespace NewHorizons
radius = radius,
range = range,
xmlFile = xmlFile,
remoteTrigger = new RemoteTriggerInfo()
remoteTrigger = remoteTriggerRadius > 0f ? new RemoteTriggerInfo()
{
position = null,
radius = remoteTriggerRadius,
},
} : null,
};
return DialogueBuilder.Make(root, null, info, mod);