Skip to content

Commit

Permalink
Update functionality of custom ground stations against CommNet settin…
Browse files Browse the repository at this point in the history
…g of enabling ground stations (undo commit bddb651)
  • Loading branch information
KSP-TaxiService committed Jul 8, 2020
1 parent a212c7a commit ae0b0c4
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions src/CommNetConstellation/CommNetLayer/CNCCommNetHome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,17 +389,27 @@ protected void regenerateFrequencyArray(List<short> list)
/// </summary>
protected void refresh()
{
if (this.comm == null)
{
if (!HighLogic.CurrentGame.Parameters.CustomParams<CommNetParams>().enableGroundStations)
{
CNCLog.Verbose("Ground station '{0}': CommNet option of enabling ground stations is disabled", this.ID);
}
else
{
CNCLog.Verbose("Ground station '{0}': Null CommNode, likely due to a third-party CommNet mod", this.ID);
}
return;
}

// Obtain Tech Level of Tracking Station in KCS
if (this.isKSC)
{
this.TechLevel = (short)((2 * ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.TrackingStation)) + 1);
}

// Update power of ground station
if (this.comm != null)
{
this.comm.antennaRelay.Update(GetDSNRange(this.TechLevel), GameVariables.Instance.GetDSNRangeCurve(), false);
}
this.comm.antennaRelay.Update(GetDSNRange(this.TechLevel), GameVariables.Instance.GetDSNRangeCurve(), false);

// Generate ground station information
stationInfoString = (this.TechLevel == 0) ? "Build a ground station" :
Expand All @@ -412,21 +422,7 @@ protected void refresh()
stationTexture = CNCCommNetHome.getGroundStationTexture(this.TechLevel);

// Update position on celestial body
if (this.comm != null)
{
if (this.body != null)
{
this.comm.precisePosition = this.body.GetWorldSurfacePosition(this.latitude, this.longitude, this.altitude);
}
else
{
CNCLog.Verbose("Body of CommNetHome is null");
}
}
else
{
CNCLog.Verbose("CommNode of CommNetHome is null, likely due to a third-party CommNet mod");
}
this.comm.precisePosition = this.body.GetWorldSurfacePosition(this.latitude, this.longitude, this.altitude);
}

/// <summary>
Expand Down

0 comments on commit ae0b0c4

Please sign in to comment.