Skip to content

Commit

Permalink
BETA 3
Browse files Browse the repository at this point in the history
Fixed a bunch of crap.
  • Loading branch information
Raven45 committed Jan 1, 2015
1 parent b8e8cee commit eb74ab9
Show file tree
Hide file tree
Showing 100 changed files with 144 additions and 28 deletions.
30 changes: 30 additions & 0 deletions CactEye 2 BETA 3/CactEye 2 README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
******************Installation Instructions******************
If you are currently using an older version of CactEye, then please delete CactEye from your GameData
folder before installing a new version.

Extract the enclosed files to your GameData folder.

Included is another folder entitled "Compatibility Patch for Distant Object v1.5.1," this is needed
only if you are running Distant Object v1.5.1. The contents of that folder contains a compatibility
patch that makes CactEye 2 fully compatible with Distant Object 1.5.1. If you are not using
Distant Object, then the patch is not needed and will introduce unneccesary log spam.

To install the Compatibility patch for Distant Object Enhancement, extract the contents of the
"Compatibility Patch for Distant Object v1.5.1" folder to your GameData folder.

******************Change Log******************

CactEye 2 BETA 3
-Fixed an issue where running a science experiment with either the "Wide Field Camera 1" or
"Wide Field Camera 2" would produce a "NullReferenceException."
-Fixed an issue where attempting to switch to another processor would grey the GUI out with the error
message that the telescope was out of power, even with full batteries.
-Fixed a "ArgumentOutOfRange" exception that would be thrown while switching to another processor.
-Fixed an issue with both the Wide Field Camera processors and the Asteroid Camera processors where an
incorrect amount of science points would be awarded.

CactEye 2 BETA 2
-Completely rewritten code base for CactEye.
-Completely redesigned GUI for the Telescope controls.
-Asteroid telescopes should no longer be restricted to Kerbin orbit.
-Occulation experiments are not yet available.
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ MODULE
maxScience = 0.10
consumeRate = 2.0
MinimumFOV = 0.01
experimentID = CactEyePlanetary
ExperimentID = CactEyePlanetary
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ MODULE
Type = Wide Field Camera 2
maxScience = 0.30
consumeRate = 6.0
minFOV = 0.005
experimentID = CactEyePlanetary
MinimumFOV = 0.005
ExperimentID = CactEyePlanetary
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file modified CactEye2.v11.suo
Binary file not shown.
2 changes: 1 addition & 1 deletion CactEye2/CactEyeAsteroidProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public override string DoScience(Vector3 TargetPosition, bool IsSmallOptics, flo
SciencePoints *= 0.1f;
}

ScienceData Data = new ScienceData(AsteroidExperiment.baseValue, 1f, 0f, AsteroidSubject.id, Type + " " + TargetName + " Observation");
ScienceData Data = new ScienceData(SciencePoints, 1f, 0f, AsteroidSubject.id, Type + " " + TargetName + " Observation");
StoredData.Add(Data);
ReviewData(Data, Screenshot);
return "";
Expand Down
36 changes: 24 additions & 12 deletions CactEye2/CactEyeWideField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,39 @@ public override string DoScience(Vector3 TargetPosition, bool IsSmallOptics, flo

else
{

float SciencePoints = 0f;
string TargetName = Target.name;
ScienceExperiment WideFieldExperiment = ResearchAndDevelopment.GetExperiment(ExperimentID);
ScienceSubject WideFieldSubject = ResearchAndDevelopment.GetExperimentSubject(WideFieldExperiment, ExperimentSituations.InSpaceHigh, Target, "");
ScienceExperiment WideFieldExperiment;
ScienceSubject WideFieldSubject;

try
{
WideFieldExperiment = ResearchAndDevelopment.GetExperiment(ExperimentID);
WideFieldSubject = ResearchAndDevelopment.GetExperimentSubject(WideFieldExperiment, ExperimentSituations.InSpaceHigh, Target, "");

SciencePoints += WideFieldExperiment.baseValue * WideFieldExperiment.dataScale * maxScience;
SciencePoints += WideFieldExperiment.baseValue * WideFieldExperiment.dataScale * maxScience;

//These two lines cause a bug where the experiment gives an infinite supply of science points.
//WideFieldSubject.scientificValue = 1f;
//WideFieldSubject.science = 0f;
Debug.Log("CactEye 2: SciencePoints: " + SciencePoints.ToString());

Debug.Log("CactEye 2: SciencePoints: " + SciencePoints.ToString());
if (IsSmallOptics)
{
SciencePoints *= 0.1f;
}

if (IsSmallOptics)
ScienceData Data = new ScienceData(SciencePoints, 1f, 0f, WideFieldSubject.id, Type + " " + TargetName + " Observation");
StoredData.Add(Data);
ReviewData(Data, Screenshot);
}

catch (Exception e)
{
SciencePoints *= 0.1f;
Debug.Log("CactEye 2: Excpetion #: Was not able to find Experiment with ExperimentID: " + ExperimentID.ToString());
Debug.Log(e.ToString());

return "An error occurred. Please post on the Official CactEye 2 thread on the Kerbal Forums.";
}

ScienceData Data = new ScienceData(WideFieldExperiment.baseValue, 1f, 0f, WideFieldSubject.id, Type + " " + TargetName + " Observation");
StoredData.Add(Data);
ReviewData(Data, Screenshot);
return "";
}
}
Expand Down
66 changes: 57 additions & 9 deletions CactEye2/TelescopeMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class TelescopeMenu: MonoBehaviour
//private ModuleReactionWheel[] ReactionWheels;
private List<CactEyeProcessor> Processors = new List<CactEyeProcessor>();
private CactEyeProcessor ActiveProcessor;
private int CurrentProcessorIndex = 0;
private List<CactEyeGyro> ReactionWheels = new List<CactEyeGyro>();
private List<float> ReactionWheelPitchTorques = new List<float>();
private List<float> ReactionWheelYawTorques = new List<float>();
Expand Down Expand Up @@ -374,7 +375,17 @@ private void DrawProcessorControls()
{
//DisplayText("Saved screenshot to " + opticsModule.GetTex(true, targetName));
//ActiveProcessor.GenerateScienceReport(TakeScreenshot(ActiveProcessor.GetType()));
Notification = ActiveProcessor.DoScience(GetTargetPos(FlightGlobals.fetch.VesselTarget.GetTransform().position, 500f), false, CameraModule.FieldOfView, CameraModule.TakeScreenshot(ActiveProcessor));
try
{
Notification = ActiveProcessor.DoScience(GetTargetPos(FlightGlobals.fetch.VesselTarget.GetTransform().position, 500f), false, CameraModule.FieldOfView, CameraModule.TakeScreenshot(ActiveProcessor));
}
catch (Exception e)
{
Notification = "An error occured. Please post that you're having this error on the official CactEye 2 thread on the Kerbal Forums.";
Debug.Log("CactEye 2: Exception #: An error occured producing a science report!");
Debug.Log(e.ToString());
}

timer = 0f;
}
}
Expand All @@ -386,13 +397,17 @@ private void DrawProcessorControls()
//Previous button
if (GUI.Button(new Rect(ScopeRect.xMin + ((0.5f * ScopeRect.width) - 72), ScopeRect.yMin + (ScopeRect.height - 48f), 32, 32), Back9Icon))
{
ActiveProcessor.Active = false;
ActiveProcessor = GetPrevious(Processors, ActiveProcessor);
ActiveProcessor.Active = true;
}

//Next Button
if (GUI.Button(new Rect(ScopeRect.xMin + ((0.5f * ScopeRect.width) + 72), ScopeRect.yMin + (ScopeRect.height - 48f), 32, 32), Forward9Icon))
{
ActiveProcessor.Active = false;
ActiveProcessor = GetNext(Processors, ActiveProcessor);
ActiveProcessor.Active = true;
}
}
}
Expand Down Expand Up @@ -467,6 +482,7 @@ private void GetProcessors()
if (Processors.Count<CactEyeProcessor>() > 0)
{
ActiveProcessor = Processors.First<CactEyeProcessor>();
CurrentProcessorIndex = 0;

//if (ActiveProcessor.GetProcessorType().Contains("Wide Field"))
//{
Expand All @@ -492,27 +508,59 @@ private void SetTorgue()
}


private static CactEyeProcessor GetNext<CactEyeProcessor>(IEnumerable<CactEyeProcessor> list, CactEyeProcessor current)
private CactEyeProcessor GetNext(IEnumerable<CactEyeProcessor> list, CactEyeProcessor current)
{
try
{
return list.SkipWhile(x => !x.Equals(current)).Skip(1).First();
//return list.SkipWhile(x => !x.Equals(current)).Skip(1).First();
//lastAgentIDAarhus = agents[ index == -1 ? 0 : index % ( agents.Count - 1 ) ];
if ((CurrentProcessorIndex + 1) < Processors.Count)
{
CurrentProcessorIndex++;
}
else
{
CurrentProcessorIndex = 0;
}

//return Processors[CurrentProcessorIndex == -1 ? 0 : CurrentProcessorIndex % (Processors.Count - 1)];
Debug.Log("CactEye 2: CurrentProcessorIndex: " + CurrentProcessorIndex.ToString());
return Processors[CurrentProcessorIndex];
}
catch
catch (Exception e)
{
return default(CactEyeProcessor);
Debug.Log("CactEye 2: Exception #: Was not able to find the next processor, even though there is one.");
Debug.Log(e.ToString());

return Processors.FirstOrDefault();
}
}

private static CactEyeProcessor GetPrevious<CactEyeProcessor>(IEnumerable<CactEyeProcessor> list, CactEyeProcessor current)
private CactEyeProcessor GetPrevious(IEnumerable<CactEyeProcessor> list, CactEyeProcessor current)
{
try
{
return list.TakeWhile(x => !x.Equals(current)).Last();
//return list.SkipWhile(x => !x.Equals(current)).Skip(1).First();
//lastAgentIDAarhus = agents[ index == -1 ? 0 : index % ( agents.Count - 1 ) ];
if (CurrentProcessorIndex == 0)
{
CurrentProcessorIndex = Processors.Count - 1;
}
else
{
CurrentProcessorIndex--;
}

//return Processors[CurrentProcessorIndex == -1 ? 0 : CurrentProcessorIndex % (Processors.Count - 1)];
Debug.Log("CactEye 2: CurrentProcessorIndex: " + CurrentProcessorIndex.ToString());
return Processors[CurrentProcessorIndex];
}
catch
catch (Exception e)
{
return default(CactEyeProcessor);
Debug.Log("CactEye 2: Exception #: Was not able to find the next processor, even though there is one.");
Debug.Log(e.ToString());

return Processors.FirstOrDefault();
}
}

Expand Down
Binary file modified CactEye2/bin/Release/CactEye2.dll
Binary file not shown.
Binary file modified CactEye2/bin/Release/CactEye2.pdb
Binary file not shown.
Binary file modified CactEye2/obj/Release/CactEye2.dll
Binary file not shown.
Binary file modified CactEye2/obj/Release/CactEye2.pdb
Binary file not shown.
Binary file modified DistantObjectHook/bin/Release/CactEye2.dll
Binary file not shown.
Binary file modified DistantObjectHook/bin/Release/CactEye2.pdb
Binary file not shown.
Binary file modified DistantObjectHook/bin/Release/DistantObjectHook.dll
Binary file not shown.
Binary file modified DistantObjectHook/bin/Release/DistantObjectHook.pdb
Binary file not shown.
Binary file not shown.
Binary file modified DistantObjectHook/obj/Release/DistantObjectHook.dll
Binary file not shown.
Binary file modified DistantObjectHook/obj/Release/DistantObjectHook.pdb
Binary file not shown.
Binary file removed GameData/CactEye/Plugins/CactEye2.dll
Binary file not shown.
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
CactEye
======
******************Installation Instructions******************
If you are currently using an older version of CactEye, then please delete CactEye from your GameData
folder before installing a new version.

CactEye mod for Kerbal Space Program.
Extract the enclosed files to your GameData folder.

Included is another folder entitled "Compatibility Patch for Distant Object v1.5.1," this is needed
only if you are running Distant Object v1.5.1. The contents of that folder contains a compatibility
patch that makes CactEye 2 fully compatible with Distant Object 1.5.1. If you are not using
Distant Object, then the patch is not needed and will introduce unneccesary log spam.

To install the Compatibility patch for Distant Object Enhancement, extract the contents of the
"Compatibility Patch for Distant Object v1.5.1" folder to your GameData folder.

******************Change Log******************

CactEye 2 BETA 3
-Fixed an issue where running a science experiment with either the "Wide Field Camera 1" or
"Wide Field Camera 2" would produce a "NullReferenceException."
-Fixed an issue where attempting to switch to another processor would grey the GUI out with the error
message that the telescope was out of power, even with full batteries.
-Fixed a "ArgumentOutOfRange" exception that would be thrown while switching to another processor.
-Fixed an issue with both the Wide Field Camera processors and the Asteroid Camera processors where an
incorrect amount of science points would be awarded.

CactEye 2 BETA 2
-Completely rewritten code base for CactEye.
-Completely redesigned GUI for the Telescope controls.
-Asteroid telescopes should no longer be restricted to Kerbin orbit.
-Occulation experiments are not yet available.

0 comments on commit eb74ab9

Please sign in to comment.