Skip to content

Commit

Permalink
Merge pull request #69 from JPLRepo/dev
Browse files Browse the repository at this point in the history
V0.23.3.0
  • Loading branch information
JPLRepo authored Feb 18, 2017
2 parents dc84f71 + 323a6bb commit 12e1136
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 69 deletions.
8 changes: 7 additions & 1 deletion Distribution/GameData/REPOSoftTech/DeepFreeze/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
V0.23.2.0
V0.23.3.0
Fix Kerbalism Integration.
Freeze Tourists!
DeepFreeze stock application button is not shown in flight unless the active vessel has a DeepFreezer part.
Fixed log spam when RPM occlusion fails.
Work-around for integration issue/bug in USI LS.
V0.23.2.0
Compile for KSP 1.2.2
Remove need for RSTKSPEvents and utilize new KSP 1.2.2 GameEvents extension.
Update Community Resource Pack to 0.6.3.0.
Expand Down
10 changes: 5 additions & 5 deletions Source/APIs/DFGameEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ class DFGameEvents
/// Fires when DeepFreeze Completes the Freezing process on a Kerbal.
/// Part is the DeepFreeze Freezer Part and ProtoCrewMember is the Kerbal.
/// </summary>
public static EventData<Part, ProtoCrewMember> onKerbalFrozen = new EventData<Part, ProtoCrewMember>("onKerbalFrozen");
public static EventData<Part, ProtoCrewMember> onKerbalFrozen;// = new EventData<Part, ProtoCrewMember>("onKerbalFrozen");
/// <summary>
/// Fires when DeepFreeze Completes the Thawing process on a Kerbal.
/// Part is the DeepFreeze Freezer Part and ProtoCrewMember is the Kerbal.
/// </summary>
public static EventData<Part, ProtoCrewMember> onKerbalThaw = new EventData<Part, ProtoCrewMember>("onKerbalThaw");
public static EventData<Part, ProtoCrewMember> onKerbalThaw;// = new EventData<Part, ProtoCrewMember>("onKerbalThaw");
/// <summary>
/// Fires when DeepFreeze sets a Kerbal to Comatose Status.
/// Part is the DeepFreeze Freezer Part and ProtoCrewMember is the Kerbal.
/// </summary>
public static EventData<Part, ProtoCrewMember> onKerbalSetComatose = new EventData<Part, ProtoCrewMember>("onKerbalSetComatose");
public static EventData<Part, ProtoCrewMember> onKerbalSetComatose;// = new EventData<Part, ProtoCrewMember>("onKerbalSetComatose");
/// <summary>
/// Fires when DeepFreeze Unsets a Kerbal from Comatose Status.
/// Part is the DeepFreeze Freezer Part and ProtoCrewMember is the Kerbal.
/// </summary>
public static EventData<Part, ProtoCrewMember> onKerbalUnSetComatose = new EventData<Part, ProtoCrewMember>("onKerbalUnSetComatose");
public static EventData<Part, ProtoCrewMember> onKerbalUnSetComatose;// = new EventData<Part, ProtoCrewMember>("onKerbalUnSetComatose");
/// <summary>
/// Fires when DeepFreeze has to Kill a Frozen Kerbal.
/// </summary>
public static EventData<ProtoCrewMember> onFrozenKerbalDied = new EventData<ProtoCrewMember>("onFrozenKerbalDied");
public static EventData<ProtoCrewMember> onFrozenKerbalDied;// = new EventData<ProtoCrewMember>("onFrozenKerbalDied");

}
}
4 changes: 2 additions & 2 deletions Source/APIs/KBWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static Boolean InitKBWrapper()
LogFormatted_DebugOnly("Attempting to Grab KB LS Types...");

//find the base type
KBType = getType("KERBALISM.Kerbalism");
KBType = getType("KERBALISM.API");

if (KBType == null)
{
Expand Down Expand Up @@ -127,7 +127,7 @@ internal KBAPI()
//WORK OUT THE STUFF WE NEED TO HOOK FOR PEOPLE HERE
//Methods
LogFormatted_DebugOnly("Getting hook_DisableKerbal Method");
KBhook_DisableKerbalMethod = KBType.GetMethod("hook_DisableKerbal", BindingFlags.Public | BindingFlags.Static);
KBhook_DisableKerbalMethod = KBType.GetMethod("DisableKerbal", BindingFlags.Public | BindingFlags.Static);
LogFormatted_DebugOnly("Success: " + (KBhook_DisableKerbalMethod != null));
}

Expand Down
6 changes: 4 additions & 2 deletions Source/DFIntMemory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,10 @@ private void ChkUnknownFrozenKerbals()
kerbalInfo.experienceTraitName = enumerator.Current.experienceTrait.Title;
try
{
Utilities.Log("Adding dead unknown kerbal " + enumerator.Current.name + " AKA FROZEN kerbal to DeepFreeze List");
DeepFreeze.Instance.DFgameSettings.KnownFrozenKerbals.Add(enumerator.Current.name, kerbalInfo);
Utilities.Log("Adding dead unknown kerbal " + enumerator.Current.name +
" AKA FROZEN kerbal to DeepFreeze List");
DeepFreeze.Instance.DFgameSettings.KnownFrozenKerbals.Add(enumerator.Current.name,
kerbalInfo);
}
catch (Exception ex)
{
Expand Down
8 changes: 0 additions & 8 deletions Source/DeepFreeze.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,6 @@ internal bool setComatoseKerbal(Part part, ProtoCrewMember crew, ProtoCrewMember

if (!start)
{
if (type == ProtoCrewMember.KerbalType.Crew)
{
KerbalRoster.SetExperienceTrait(crew, "");
}
else
{
KerbalRoster.SetExperienceTrait(crew, "Tourist");
}
crew.RegisterExperienceTraits(part);
DFGameEvents.onKerbalUnSetComatose.Fire(part, crew);
ScreenMessages.PostScreenMessage(
Expand Down
61 changes: 46 additions & 15 deletions Source/DeepFreezeGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,10 @@ private void FixedUpdate()
}
}
}

private void Update()
{
if (Time.timeSinceLevelLoad < 2f) return; //Wait 2 seconds on level load before executing
if (switchNextUpdate)
{
//Jump to vessel code here.
Expand Down Expand Up @@ -197,6 +198,29 @@ private void Update()
}
}
}
if (Useapplauncher == false || !HighLogic.LoadedSceneIsFlight)
{
return;
}
if (DFIntMemory.Instance != null)
{
if (DFIntMemory.Instance.DpFrzrActVsl.Count == 0)
{
DFMenuAppLToolBar.setAppLSceneVisibility(ApplicationLauncher.AppScenes.SPACECENTER |
ApplicationLauncher.AppScenes.SPH |
ApplicationLauncher.AppScenes.VAB |
ApplicationLauncher.AppScenes.TRACKSTATION);
}
else
{
DFMenuAppLToolBar.setAppLSceneVisibility(ApplicationLauncher.AppScenes.SPACECENTER |
ApplicationLauncher.AppScenes.FLIGHT |
ApplicationLauncher.AppScenes.MAPVIEW |
ApplicationLauncher.AppScenes.SPH |
ApplicationLauncher.AppScenes.VAB |
ApplicationLauncher.AppScenes.TRACKSTATION);
}
}
}

#region GUI
Expand Down Expand Up @@ -585,25 +609,32 @@ private void windowDF(int id)
}
foreach (DeepFreezer frzr in DFIntMemory.Instance.DpFrzrActVsl)
{
foreach (ProtoCrewMember crewMember in frzr.part.protoModuleCrew.FindAll(a => a.type == ProtoCrewMember.KerbalType.Crew))
List<ProtoCrewMember> crew = new List<ProtoCrewMember>();
for (int i = 0; i < frzr.part.protoModuleCrew.Count; i++)
{
if (!DeepFreeze.Instance.DFgameSettings.KnownFrozenKerbals.ContainsKey(frzr.part.protoModuleCrew[i].name))
{
crew.Add(frzr.part.protoModuleCrew[i]);
}
}
for (int i =0; i < crew.Count; i++)
{
GUILayout.BeginHorizontal();
GUILayout.Label(crewMember.name, Textures.statusStyle, GUILayout.Width(DFtxtWdthName));
GUILayout.Label(crewMember.experienceTrait.Title, Textures.statusStyle, GUILayout.Width(DFtxtWdthProf));
GUILayout.Label(crew[i].name, Textures.statusStyle, GUILayout.Width(DFtxtWdthName));
GUILayout.Label(crew[i].experienceTrait.Title, Textures.statusStyle, GUILayout.Width(DFtxtWdthProf));
GUILayout.Label(frzr.part.vessel.vesselName, Textures.statusStyle, GUILayout.Width(DFtxtWdthVslN));
if (crewMember.type != ProtoCrewMember.KerbalType.Tourist)

if (frzr.DFIcrewXferFROMActive || frzr.DFIcrewXferTOActive || (DFInstalledMods.IsSMInstalled && frzr.IsCrewXferRunning)
|| frzr.IsFreezeActive || frzr.IsThawActive || (DFInstalledMods.IsRTInstalled && !DFInstalledMods.RTVesselConnected(DFIntMemory.Instance.ActVslID)))
{
if (frzr.DFIcrewXferFROMActive || frzr.DFIcrewXferTOActive || (DFInstalledMods.IsSMInstalled && frzr.IsCrewXferRunning)
|| frzr.IsFreezeActive || frzr.IsThawActive || (DFInstalledMods.IsRTInstalled && !DFInstalledMods.RTVesselConnected(DFIntMemory.Instance.ActVslID)))
{
GUI.enabled = false;
}
if (GUILayout.Button(new GUIContent("Freeze", "Freeze this Kerbal"), GUILayout.Width(50f)))
{
frzr.beginFreezeKerbal(crewMember);
}
GUI.enabled = true;
GUI.enabled = false;
}
if (GUILayout.Button(new GUIContent("Freeze", "Freeze this Kerbal"), GUILayout.Width(50f)))
{
frzr.beginFreezeKerbal(crew[i]);
}
GUI.enabled = true;

GUILayout.EndHorizontal();
}
}
Expand Down
Loading

0 comments on commit 12e1136

Please sign in to comment.