Skip to content

Commit

Permalink
Bug fixes and clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Angel-125 committed Sep 14, 2017
1 parent a7c76b4 commit aa14fcc
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 204 deletions.
3 changes: 3 additions & 0 deletions BreakablePartModules/ModuleBreakableEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ protected void debugLog(string message)
protected virtual void onThrottleUpDown(bool isThrottleUp)
{
if (EngineIsRunning)
{
debugLog("onThrottleUpDown thinks engine is running. Performing quality check...");
qualityControl.PerformQualityCheck();
}
}

public override void OnStart(StartState state)
Expand Down
24 changes: 12 additions & 12 deletions BreakablePartModules/ModuleBreakableFuelTank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,6 @@ protected void debugLog(string message)
Debug.Log("[" + this.ClassName + "] - " + message);
}

public void Destroy()
{
GameEvents.onPartResourceNonemptyFull.Remove(onPartResourceNonemptyFull);
GameEvents.onPartResourceNonemptyEmpty.Remove(onPartResourceNonemptyEmpty);
GameEvents.onPartResourceFlowStateChange.Remove(onFlowStateChanged);
qualityControl.onUpdateSettings -= onUpdateSettings;
qualityControl.onPartBroken -= OnPartBroken;
qualityControl.onPartFixed -= OnPartFixed;
}

protected void onUpdateSettings(BaseQualityControl moduleQualityControl)
{
Events["CreateSmallLeak"].guiActive = BARISScenario.showDebug;
Expand Down Expand Up @@ -157,8 +147,18 @@ public override void OnStart(StartState state)
BARISScenario.Instance.onTimeTickEvent += leakTimeTick;

GameEvents.onPartResourceFlowStateChange.Add(onFlowStateChanged);
GameEvents.onPartResourceNonemptyEmpty.Add(onPartResourceNonemptyEmpty);
GameEvents.onPartResourceNonemptyFull.Add(onPartResourceNonemptyFull);
// GameEvents.onPartResourceNonemptyEmpty.Add(onPartResourceNonemptyEmpty);
// GameEvents.onPartResourceNonemptyFull.Add(onPartResourceNonemptyFull);
}

public void Destroy()
{
// GameEvents.onPartResourceNonemptyFull.Remove(onPartResourceNonemptyFull);
// GameEvents.onPartResourceNonemptyEmpty.Remove(onPartResourceNonemptyEmpty);
GameEvents.onPartResourceFlowStateChange.Remove(onFlowStateChanged);
qualityControl.onUpdateSettings -= onUpdateSettings;
qualityControl.onPartBroken -= OnPartBroken;
qualityControl.onPartFixed -= OnPartFixed;
}
#endregion

Expand Down
2 changes: 1 addition & 1 deletion GameData/WildBlueIndustries/000BARIS/BARIS.version
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"MAJOR":1,
"MINOR":3,
"PATCH":9
"BUILD":2
"BUILD":3
},
"KSP_VERSION":
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,36 @@
//The ModuleBreakableXXX MODULE entry is always added after the part module that it monitors. For instance,
//ModuleBreakableEngine appears in the config file after ModuleEngines and ModuleEnginesFX.

@PART[*]:HAS[!MODULE[ModuleCommand],!RESOURCE[ElectricCharge],!MODULE[ModuleBreakableFuelTank],@RESOURCE[*]]:FOR[BARIS]
@PART[*]:HAS[!RESOURCE[ElectricCharge],!RESOURCE[Ablator],!MODULE[ModuleBreakableFuelTank],@RESOURCE[*]]:FOR[BARIS]
{
MODULE
{
name = ModuleBreakableFuelTank
}
}

@PART[*]:HAS[!RESOURCE[ElectricCharge],!MODULE[ModuleBreakableFuelTank],@RESOURCE[Ablator]]:FOR[BARIS]
{
MODULE
{
name = ModuleBreakableFuelTank
smallLeakMessage = is cracked and starting to chip!
mediumLeakMessage = is starting to crumble!
largeLeakMessage = has several cracks and is crumbling!
}
}

@PART[*]:HAS[!MODULE[ModuleBreakableFuelTank],@RESOURCE[ElectricCharge]]:FOR[BARIS]
{
MODULE
{
name = ModuleBreakableFuelTank
smallLeakMessage = has a short that's causing a power drain!
mediumLeakMessage = is shorting out!
largeLeakMessage = is overheating and sparking!
}
}
@PART[*]:HAS[@MODULE[ModuleEngines],!MODULE[ModuleBreakableEngine]]:FOR[BARIS]
{
MODULE
Expand All @@ -28,7 +50,7 @@
}
}
@PART[*]:HAS[@MODULE[ModuleReactionWheel],!MODULE[ModuleCommand],!MODULE[ModuleBreakableSAS]]:FOR[BARIS]
@PART[*]:HAS[@MODULE[ModuleReactionWheel],!MODULE[ModuleBreakableSAS]]:FOR[BARIS]
{
MODULE
{
Expand All @@ -37,7 +59,7 @@
}
}
@PART[*]:HAS[@MODULE[ModuleRCS],!MODULE[ModuleCommand],!MODULE[ModuleBreakableRCS]]:FOR[BARIS]
@PART[*]:HAS[@MODULE[ModuleRCS],!MODULE[ModuleBreakableRCS]]:FOR[BARIS]
{
MODULE
{
Expand All @@ -46,7 +68,7 @@
}
}
@PART[*]:HAS[@MODULE[ModuleRCSFX],!MODULE[ModuleCommand],!MODULE[ModuleBreakableRCS]]:FOR[BARIS]
@PART[*]:HAS[@MODULE[ModuleRCSFX],!MODULE[ModuleBreakableRCS]]:FOR[BARIS]
{
MODULE
{
Expand All @@ -55,7 +77,7 @@
}
}
@PART[*]:HAS[@MODULE[ModuleDataTransmitter],!MODULE[ModuleCommand],!MODULE[ModuleBreakableTransmitter]]:FOR[BARIS]
@PART[*]:HAS[@MODULE[ModuleDataTransmitter],!MODULE[ModuleBreakableTransmitter]]:FOR[BARIS]
{
MODULE
{
Expand Down
11 changes: 11 additions & 0 deletions GameData/WildBlueIndustries/000BARIS/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ NOTE: ModuleManager is REQUIRED.

---REVISION HISTORY---

1.3.9.3 PRE-RELEASE
- Removed quality checks that happened when a fuel tank was emptied or filled to capacity- it was causing spam upon vehicle load.
- Timers are now reset when you activate or deactivate BARIS to prevent reliability check spamming when you leave BARIS off in your save for long periods of in-game time.
- In the options screen, clarified that any part that stores resources, not just fuel tanks, can spring leaks and fail.
- Add ability to customize the ModuleBreakableFuelTank leak messages.
- Parts with the Ablator resource now have more appropriate resource leak messages.
- Added option to allow command pods, cockpits, and probe cores to fail. If unchecked, they will never fail.
- Added option to allow parts to fail if they have crew capacity. If unchecked, a part with crew capacity will never fail.
- Command pods, cockpits, and probe cores are no longer excluded from part failures- unless they're not allowed to fail.
- Experimental: Parts with ElectricCharge can now fail.

1.3.9.2 PRE-RELEASE
- Removed overall vessel reliability check that was set up during launch; it wasn't doing much except causing people to complain that their launches failed near the end of their flight to orbit.
- Fixed vessel modified spam that occurs when you attempt to modify a vessel after it has been integrated.
Expand Down
2 changes: 1 addition & 1 deletion QualityModules/ModuleQualityControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public override void PerformQualityCheck()
{
if (!BARISScenario.partsCanBreak)
{
debugLog("Quality check skipped, parts can't break.");
debugLog(this.part.partInfo.title + ": Quality check skipped, parts can't break.");
return;
}

Expand Down
13 changes: 13 additions & 0 deletions SettingsAndScenario/BARISScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,10 @@ public override void OnLoad(ConfigNode node)
//Load the constant values.
loadConstants();

//BARIS enabled state
if (node.HasValue("partsCanBreak"))
partsCanBreak = bool.Parse(node.GetValue("partsCanBreak"));

//Cached quality results
if (node.HasNode("EVENTRESULT"))
{
Expand Down Expand Up @@ -796,6 +800,9 @@ public override void OnSave(ConfigNode node)
debugLog("OnSave called");
base.OnSave(node);

//BARIS enabled state
node.AddValue("partsCanBreak", partsCanBreak);

//Cached quality modifiers
foreach (BARISEventResult eventResult in cachedQualityModifiers)
{
Expand Down Expand Up @@ -952,6 +959,10 @@ protected void onKSCFacilityUpgraded(UpgradeableFacility facility, int level)
protected void onGameSettingsApplied()
{
SecondsPerDay = GameSettings.KERBIN_TIME == true ? QualityCheckIntervalKerbin : QualityCheckIntervalEarth;
if (BARISSettings.PartsCanBreak != partsCanBreak)
{
lastUpdateTime = Planetarium.GetUniversalTime();
}
partsCanBreak = BARISSettings.PartsCanBreak;
showDebug = BARISSettings.DebugMode;
checksPerDay = BARISSettings.ChecksPerDay;
Expand Down Expand Up @@ -1914,6 +1925,8 @@ public static string GetConditionSummary(double currentMTBF, double maxMTBF, int
/// <param name="timewarpPenalty">If reliability checks were skipped due to high timewarp, then the checks can incur a penalty. This is the penalty to apply.</param>
public void PerformReliabilityChecks(int timewarpPenalty = 0)
{
debugLog("PerformReliabilityChecks called");

//Clean the caches
cleanQualityCaches();
focusVesselView.flightGlobalIndexes.Clear();
Expand Down
1 change: 0 additions & 1 deletion obj/Debug/BARIS.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ C:\Projects\KSP\WildBlueIndustries\BARIS\bin\Debug\UnityEngine.xml
C:\Projects\KSP\WildBlueIndustries\BARIS\obj\Debug\BARIS.csprojResolveAssemblyReference.cache
C:\Projects\KSP\WildBlueIndustries\BARIS\obj\Debug\BARIS.dll
C:\Projects\KSP\WildBlueIndustries\BARIS\obj\Debug\BARIS.pdb
C:\Projects\KSP\WildBlueIndustries\BARIS\bin\Debug\xmldoc2md.xml

0 comments on commit aa14fcc

Please sign in to comment.