Skip to content

Commit

Permalink
Science Rebalance Test
Browse files Browse the repository at this point in the history
  • Loading branch information
icedown committed Sep 21, 2016
1 parent 2a57e79 commit f2d265d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CactEye2/CactEye2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@
<Compile Include="CactEyeAPI.cs" />
<Compile Include="CactEyeWideField.cs" />
<Compile Include="CactEyeConfigMenu.cs" />
<Compile Include="CactEyeScienceProgressionBlocker.cs" />
<Compile Include="RBWrapper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TelescopeMenu.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy /Y "$(TargetDir)$(TargetFileName)" "$(SolutionDir)CactEyeOptics\GameData\CactEye\Plugins\$(TargetFileName)"
copy /Y "$(TargetDir)$(TargetFileName)" "C:\Development\Kerbal Space Program\GameData\CactEye\Plugins\$(TargetFileName)"</PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
43 changes: 37 additions & 6 deletions CactEye2/CactEyeWideField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public override string DoScience(Vector3 TargetPosition, float scienceMultiplier
{

float SciencePoints = 0f;
float ScienceAdjustedCap = 0f;
float ScienceAvailableCap = 0f;
string TargetName = Target.name;
ScienceExperiment WideFieldExperiment;
ScienceSubject WideFieldSubject;
Expand All @@ -95,22 +97,51 @@ public override string DoScience(Vector3 TargetPosition, float scienceMultiplier
CelestialBody parentBody;


ExperimentID = "CactEyePlanetary" + TargetName;
ExperimentID = "CactEyePlanetary";
try
{
WideFieldExperiment = ResearchAndDevelopment.GetExperiment(ExperimentID);
WideFieldSubject = ResearchAndDevelopment.GetExperimentSubject(WideFieldExperiment, ExperimentSituations.InSpaceHigh, Home, "");
WideFieldSubject = ResearchAndDevelopment.GetExperimentSubject(WideFieldExperiment, ExperimentSituations.InSpaceHigh, vessel.mainBody, "VisualObservation" + Target.name);
WideFieldSubject.title = "CactEye Visual Planetary Observation of " + Target.name;
SciencePoints = WideFieldExperiment.baseValue * WideFieldExperiment.dataScale * maxScience * scienceMultiplier;
if (CactEyeConfig.DebugMode)
{
Debug.Log("CactEye 2: SciencePoints: " + SciencePoints.ToString());
Debug.Log("Cacteye 2: SciencePoints: " + SciencePoints);
Debug.Log("Cacteye 2: Current Science: " + WideFieldSubject.science);
Debug.Log("Cacteye 2: Current Cap: " + WideFieldSubject.scienceCap);
Debug.Log("Cacteye 2: ScienceValue: " + WideFieldSubject.scientificValue);
Debug.Log("Cacteye 2: SubjectValue: " + ResearchAndDevelopment.GetSubjectValue(SciencePoints, WideFieldSubject));
Debug.Log("Cacteye 2: RnDScienceValue: " + ResearchAndDevelopment.GetScienceValue(SciencePoints, WideFieldSubject, 1.0f));
Debug.Log("Cacteye 2: RnDReferenceDataValue: " + ResearchAndDevelopment.GetReferenceDataValue(SciencePoints, WideFieldSubject));

}
//Modify Science cap and points gathered based on telescope and processor
ScienceAdjustedCap = WideFieldExperiment.scienceCap * WideFieldExperiment.dataScale * maxScience * scienceMultiplier;

//Since it's not clear how KSP figures science points, reverse engineer based off of what this will return.
ScienceAvailableCap = ScienceAdjustedCap - ((SciencePoints / ResearchAndDevelopment.GetScienceValue(SciencePoints, WideFieldSubject, 1.0f)) * WideFieldSubject.science);
if (CactEyeConfig.DebugMode)
{
Debug.Log("Cacteye 2: Adjusted Cap: " + ScienceAdjustedCap);
Debug.Log("Cacteye 2: Available Cap: " + ScienceAvailableCap);
}
if (ScienceAvailableCap < 0)
{
ScienceAvailableCap = 0;
}
if (SciencePoints > ScienceAvailableCap)
{
SciencePoints = ScienceAvailableCap;
}


if (CactEyeConfig.DebugMode)
{
Debug.Log("CactEye 2: SciencePoints: " + SciencePoints.ToString());
}

//Different scopes have different multipliers for the science gains.
// SciencePoints *= scienceMultiplier;

ScienceData Data = new ScienceData(SciencePoints, 1f, 0f, WideFieldSubject.id, Type + " " + TargetName + " Observation");
ScienceData Data = new ScienceData(SciencePoints, 1f, 0f, WideFieldSubject.id, WideFieldSubject.title);
StoredData.Add(Data);
ReviewData(Data, Screenshot);
if (RBWrapper.APIRBReady)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ MODULE
{
name = CactEyeWideField
Type = Wide Field Camera 1
maxScience = 0.10
maxScience = 0.25
consumeRate = 2.0
MinimumFOV = 0.01
// ExperimentID = CactEyePlanetary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ MODULE
{
name = CactEyeWideField
Type = Wide Field Camera 2
maxScience = 0.30
maxScience = 0.5
consumeRate = 6.0
MinimumFOV = 0.005
// ExperimentID = CactEyePlanetary
Expand Down
4 changes: 2 additions & 2 deletions CactEyeOptics/GameData/CactEye/Resources/ScienceDefs.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ EXPERIMENT_DEFINITION
{
id = CactEyePlanetary
title = Wide Field Visual Camera Observation
baseValue = 16
scienceCap = 24
baseValue = 64
scienceCap = 96
dataScale = 4
requireAtmosphere = False
situationMask = 32
Expand Down
2 changes: 1 addition & 1 deletion CactEyeOptics/GameData/CactEye/Resources/settings.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CactEye2
{
DebugMode = False
DebugMode = True
SunDamage = True
GyroDecay = True
AsteroidSpawner = True
Expand Down
Binary file added Releases/CactEyeOptics1.1.3.8Pre.zip
Binary file not shown.

0 comments on commit f2d265d

Please sign in to comment.