Skip to content

Commit

Permalink
Fix #445: don't auto-detect hatches for airlocks if there's already a…
Browse files Browse the repository at this point in the history
… hatch connected to it
  • Loading branch information
JonnyOThan committed Oct 21, 2024
1 parent ba1ba3a commit 70f3215
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions FreeIva/InternalModules/InternalModuleFreeIva.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ void OnLoad_Finalize()
Part part = ModuleFreeIva.GetPartPrefabForInternal(internalModel.internalName);

List<FreeIvaHatch> hatches = new List<FreeIvaHatch>();
List<string> boundAirlockNames = new List<string>();

foreach (var prop in internalModel.props)
{
Expand All @@ -505,6 +506,11 @@ void OnLoad_Finalize()
{
var hatchConfig = prop.GetComponent<HatchConfig>();

if (hatch.airlockName != string.Empty)
{
boundAirlockNames.Add(hatch.airlockName);
}

if (hatchConfig != null || hatch.cutoutTargetTransformName != string.Empty)
{
AddPropCut(hatch);
Expand Down Expand Up @@ -576,6 +582,8 @@ void OnLoad_Finalize()
float bestDistanceSquared = 1; // we're pretty generous with positioning (compared to attachnodes) because these don't need to line up perfectly
FreeIvaHatch bestHatch = null;

if (boundAirlockNames.Contains(airlockNames[airlockIndex])) continue;

foreach (var hatch in hatches)
{
if (hatch.airlockName != string.Empty) continue;
Expand Down

0 comments on commit 70f3215

Please sign in to comment.