Skip to content

Commit

Permalink
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Source/ModuleNoEVA.cs
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ namespace RP0
public class ModuleNoEVA : PartModule
{
protected List<Collider> airlocks = new List<Collider>();
protected Transform airlock = null;
public override string GetInfo()
{
return "Cannot EVA from this part. Can still exit when landed on Earth or flying at low (20km) altitude.";
@@ -23,10 +24,15 @@ public override void OnAwake()
foreach (var c in part.GetComponentsInChildren<Collider>())
if (c.gameObject.tag == "Airlock")
airlocks.Add(c);

airlock = part.airlock;
}

protected void FixedUpdate()
{
if (!HighLogic.LoadedSceneIsFlight || vessel == null || vessel.mainBody == null || airlocks == null)
return;

bool evaOK = vessel.mainBody == Planetarium.fetch.Home &&
(vessel.situation == Vessel.Situations.LANDED
|| vessel.situation == Vessel.Situations.PRELAUNCH
@@ -46,6 +52,16 @@ protected void FixedUpdate()
c.gameObject.tag = "Untagged";
}
}

if (evaOK)
{
if (part.airlock != airlock)
part.airlock = airlock;
}
else
{
part.airlock = null;
}
}
}
}

0 comments on commit bccafb5

Please sign in to comment.