Skip to content

Commit

Permalink
Reduced SRB failure rate a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
severedsolo committed Feb 1, 2019
1 parent 0852064 commit d393d0a
Show file tree
Hide file tree
Showing 4 changed files with 4,899 additions and 5,669 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
MODULE
{
name = SRBFailureModule
baseChanceOfFailure = 0.6
baseChanceOfFailure = 0.5
expectedLifetime = 5
}
}
7 changes: 3 additions & 4 deletions OhScrap/BaseFailureModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ private void Start()
//Initialise the Failure Module.
GameEvents.onLaunch.Add(OnLaunch);
if (launched || HighLogic.LoadedSceneIsEditor) Initialise();
if (isSRB && vessel.speed <8) ActivateFailures();
}

private void OnLaunch(EventReport data)
Expand Down Expand Up @@ -118,13 +117,12 @@ private void OnSYTrackerUpdated(IEnumerable<InventoryPart> data)

private void ActivateFailures()
{
if(KRASHWrapper.simulationActive()) return;
if (KRASHWrapper.simulationActive()) return;
launched = true;
Initialise();
UPFMUtils.instance.testedParts.Add(SYP.ID);
if (HighLogic.LoadedScene == GameScenes.FLIGHT && isSRB && FailureAllowed() && UPFMUtils.instance._randomiser.NextDouble() < chanceOfFailure) InvokeRepeating("FailPart", 0.01f, 0.01f);
}

// This is where we "initialise" the failure module and get everything ready
public void Initialise()
{
Expand Down Expand Up @@ -224,8 +222,9 @@ private void FixedUpdate()
}
}

private void OnDestroy()
private void OnDisable()
{
GameEvents.onLaunch.Remove(OnLaunch);
if (ScrapYardEvents.OnSYTrackerUpdated != null) ScrapYardEvents.OnSYTrackerUpdated.Remove(OnSYTrackerUpdated);
if (ScrapYardEvents.OnSYInventoryAppliedToVessel != null) ScrapYardEvents.OnSYInventoryAppliedToVessel.Remove(OnSYInventoryAppliedToVessel);
}
Expand Down
Loading

0 comments on commit d393d0a

Please sign in to comment.