Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into external/feature/burn-…
Browse files Browse the repository at this point in the history
…planner
  • Loading branch information
al2me6 committed Jan 3, 2022
2 parents cbb838b + 98a238f commit 05dbf78
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
30 changes: 17 additions & 13 deletions TestFlightCore/TestFlightCore/TestFlight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public override string ToString()
public static PartFlightData FromString(string str)
{
// String format is
// partName:scope,data,0 scope,data scope,data,0 scope,data,0
// partName:scope,data,0 scope,data scope,data,0 scope,data,0
PartFlightData newData = null;
if (str.IndexOf(':') > -1)
{
Expand Down Expand Up @@ -222,7 +222,7 @@ internal override void Awake()
{
DestroyImmediate(Instance.gameObject);
}

Instance = this;
base.Awake();
StartCoroutine("ConnectToScenario");
Expand Down Expand Up @@ -268,6 +268,10 @@ internal override void OnDestroy()
{
Instance = null;
}

GameEvents.onVesselWasModified.Remove(VesselWasModified);
GameEvents.onVesselCreate.Remove(VesselCreated);
GameEvents.onVesselDestroy.Remove(VesselDestroyed);
}

void VesselDestroyed(Vessel vessel)
Expand All @@ -280,7 +284,7 @@ void VesselCreated(Vessel vessel)
{
Log($"Vessel Created {vessel.vesselName}");
if (masterStatus.ContainsKey(vessel.id)) return;

InitializeParts(vessel);
AddVesselToMasterStatusDisplay(vessel);
}
Expand All @@ -299,15 +303,15 @@ void AddVesselToMasterStatusDisplay(Vessel vessel)
masterStatusItem.vesselName = vessel.GetName();
masterStatusItem.allPartsStatus = new List<PartStatus>();
masterStatus.Add(vessel.id, masterStatusItem);

var parts = vessel.Parts;
for (var j = 0; j < parts.Count; j++)
{
var partCores = parts[j].gameObject.GetComponents<TestFlightCore>();
foreach (var core in partCores)
{
if (!core.TestFlightEnabled) continue;

PartStatus partStatus = new PartStatus();
partStatus.lastSeen = currentUTC;
partStatus.flightCore = core;
Expand Down Expand Up @@ -403,16 +407,16 @@ internal override void Update()
InitializeParts(FlightGlobals.ActiveVessel);
AddVesselToMasterStatusDisplay(FlightGlobals.ActiveVessel);
}

UpdateVesselInMasterStatusDisplay(FlightGlobals.ActiveVessel);
}

}


[KSPScenario(ScenarioCreationOptions.AddToAllGames,
[KSPScenario(ScenarioCreationOptions.AddToAllGames,
new GameScenes[]
{
{
GameScenes.FLIGHT,
GameScenes.EDITOR,
GameScenes.SPACECENTER,
Expand Down Expand Up @@ -642,7 +646,7 @@ private void decodeRawSaveData()
{
if (String.IsNullOrEmpty(rawSaveData))
return;

string[] propertyGroups = rawSaveData.Split(new char[1]{ ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string propertyGroup in propertyGroups)
{
Expand Down Expand Up @@ -679,7 +683,7 @@ internal static String _AssemblyLocation
internal static String _AssemblyFolder
{ get { return System.IO.Path.GetDirectoryName(_AssemblyLocation); } }

#endregion
#endregion


public override void OnAwake()
Expand Down Expand Up @@ -728,7 +732,7 @@ public void Start()
RandomGenerator = new System.Random();
}

isReady = true;
isReady = true;
}

private void OnDestroy()
Expand Down Expand Up @@ -933,7 +937,7 @@ public override void OnLoad(ConfigNode node)
}
if (bodySettings != null)
bodySettings.Load();

InitDataStore();
if (node.HasValue("saveData"))
rawSaveData = node.GetValue("saveData");
Expand Down Expand Up @@ -1004,4 +1008,4 @@ public override void OnSave(ConfigNode node)
}
}
}
}
}
2 changes: 1 addition & 1 deletion TestFlightFailure_IgnitionFail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public override void DoFailure()

if (multiplier > float.Epsilon)
{
FlightLogger.eventLog.Add($"[{met}] {core.Title} failed: Ignition Failure. {(float)(part.dynamicPressurekPa * 1000d)}Pa dynamic pressure cased a {(1f-multiplier) * 100f}% reduction in normal ignition reliability.");
FlightLogger.eventLog.Add($"[{met}] {core.Title} failed: Ignition Failure. {(float)(part.dynamicPressurekPa * 1000d)}Pa dynamic pressure caused a {(1f-multiplier) * 100f}% reduction in normal ignition reliability.");
}
else
{
Expand Down

0 comments on commit 05dbf78

Please sign in to comment.