Skip to content
This repository has been archived by the owner on Oct 26, 2020. It is now read-only.

Commit

Permalink
Fix some issues with the part variable feature. Now seems to be worki…
Browse files Browse the repository at this point in the history
…ng as expected. Nearly ready for release.
  • Loading branch information
magico13 committed May 8, 2016
1 parent 8ca0666 commit 412efd0
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 4 deletions.
15 changes: 13 additions & 2 deletions GameData/KerbalConstructionTime/KCT_Presets/UpFree.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ KCT_Preset
UpgradeFundsFormula = -1
UpgradeScienceFormula = -1
ResearchFormula = [R]^2/86400
EffectivePartFormula = min([c]/([I] + ([B]*([U]+1))), [c])
ProceduralPartFormula = (([C]-[A]) + ([A]*10/max([I],1))) / max([B]*([U]+1),1)
EffectivePartFormula = min([c]/([I] + ([B]*([U]+1)))*[MV]*[PV], [c])
ProceduralPartFormula = (([C]-[A]) + ([A]*10/max([I],1))) / max([B]*([U]+1),1) *[MV]*[PV]
BPFormula = ([E]^(1/2))*2000*[O]
KSCUpgradeFormula = ([C]^(1/2))*1000*[O]
ReconditioningFormula = min([M]*[O]*[E], [X])*abs([RE]-[S])
Expand All @@ -50,4 +50,15 @@ KCT_Preset
RolloutCostFormula = 0
NewLaunchPadCostFormula = 100000*([N]^3)
}
KCT_Preset_Part_Variables
{
Part_Variables
{
//partName = multiplier
}
Module_Variables
{
//moduleName = multiplier
}
}
}
11 changes: 11 additions & 0 deletions GameData/KerbalConstructionTime/KCT_Presets/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,15 @@ KCT_Preset
RolloutCostFormula = 0
NewLaunchPadCostFormula = 100000*([N]^3)
}
KCT_Preset_Part_Variables
{
Part_Variables
{
//partName = multiplier
}
Module_Variables
{
//moduleName = multiplier
}
}
}
11 changes: 11 additions & 0 deletions GameData/KerbalConstructionTime/KCT_Presets/rlowtech.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,15 @@ KCT_Preset
MaxReconditioning = 16
RolloutReconSplit = 0.25
}
KCT_Preset_Part_Variables
{
Part_Variables
{
//partName = multiplier
}
Module_Variables
{
//moduleName = multiplier
}
}
}
5 changes: 3 additions & 2 deletions Kerbal_Construction_Time/KCT_PresetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public KCT_Preset(KCT_Preset Source)
ConfigNode.LoadObjectFromConfig(generalSettings, Source.generalSettings.AsConfigNode());
ConfigNode.LoadObjectFromConfig(timeSettings, Source.timeSettings.AsConfigNode());
ConfigNode.LoadObjectFromConfig(formulaSettings, Source.formulaSettings.AsConfigNode());
partVariables.FromConfigNode(Source.partVariables.ToConfigNode());
partVariables.FromConfigNode(Source.partVariables.AsConfigNode());
}

public ConfigNode AsConfigNode()
Expand All @@ -302,6 +302,7 @@ public ConfigNode AsConfigNode()
node.AddNode(generalSettings.AsConfigNode());
node.AddNode(timeSettings.AsConfigNode());
node.AddNode(formulaSettings.AsConfigNode());
node.AddNode(partVariables.AsConfigNode());
return node;
}

Expand Down Expand Up @@ -415,7 +416,7 @@ private Dictionary<string, double> NodeToDictionary(ConfigNode node)
return dict;
}

public ConfigNode ToConfigNode()
public ConfigNode AsConfigNode()
{
ConfigNode node = new ConfigNode("KCT_Preset_Part_Variables");
node.AddNode(DictionaryToNode(Part_Variables, "Part_Variables"));
Expand Down
14 changes: 14 additions & 0 deletions Kerbal_Construction_Time/KerbalConstructionTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,12 @@ private void EditorRecalculation()
public static bool moved = false;
private static bool updateChecked = false;
private static int failedLvlChecks = 0;
//private static double elapsedTimer = 0;
//private static double elapsedTicks = 0;
public void FixedUpdate()
{
//System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();

/*
#if DEBUG
if (!updateChecked && KCT_GameStates.settings.CheckForDebugUpdates && !KCT_GameStates.firstStart)
Expand Down Expand Up @@ -593,6 +597,16 @@ public void FixedUpdate()
//print(e.StackTrace);
Debug.LogException(e);
}

/* timer.Stop();
elapsedTimer += timer.Elapsed.TotalMilliseconds;
elapsedTicks++;
if (elapsedTicks >= 60)
{
KCTDebug.Log("Time per update: "+(elapsedTimer/elapsedTicks));
elapsedTicks = 0;
}*/
}

/* private void RecoverToVAB()
Expand Down

0 comments on commit 412efd0

Please sign in to comment.