Skip to content

Commit

Permalink
Merge pull request BahamutoD#3 from linuxgurugamer/master
Browse files Browse the repository at this point in the history
Fixed bug where KSP now resets all gimbal locks when an engine is sta…
  • Loading branch information
raidernick authored Dec 29, 2017
2 parents a9227bf + 8242cf8 commit 1ae8cc4
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions BDAnimationModules/AnimatedThrust.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ public void GuiToggleGimbal()

}
}


public override void OnStart(PartModule.StartState state)
{


//public override void OnStart(PartModule.StartState state)
void Start()
{
animStates = Utils.SetUpAnimation(ThrustAnimationName, this.part);

foreach(ModuleEngines me in this.part.FindModulesImplementing<ModuleEngines>())
Expand Down Expand Up @@ -86,7 +87,8 @@ public override void OnStart(PartModule.StartState state)

public override void OnUpdate()
{
if(!isEngineFX)
HideGimbalButtons();
if (!isEngineFX)
{
foreach(AnimationState anim in animStates)
{
Expand Down Expand Up @@ -122,13 +124,21 @@ void HideGimbalButtons()
{
foreach(ModuleGimbal mgg in this.part.FindModulesImplementing<ModuleGimbal>())
{
Debug.Log("Disabling gimbal actions");
// Use the first gimbalLock as a flag to see if this has already been done
// Needed because apparently KSP resets all the gimballocks when the engine is ignited
if (!mgg.Fields["gimbalLock"].guiActive)
return;
mgg.Actions["FreeAction"].active = false;
mgg.Actions["LockAction"].active = false;
mgg.Actions["ToggleAction"].active = false;
mgg.Fields["gimbalLock"].guiActive = false;
mgg.Fields["gimbalLock"].guiActiveEditor = false;

mgg.Fields["gimbalLock"].guiActive = false;
mgg.Fields["gimbalLock"].guiActiveEditor = false;

mgg.Fields["gimbalLimiter"].guiActive = false;
mgg.Fields["gimbalLimiter"].guiActiveEditor = false;

//mgg.Events["LockGimbal"].active = false;
//mgg.Events["LockGimbal"].guiActiveEditor = false;
//mgg.Events["FreeGimbal"].active = false;
Expand Down

0 comments on commit 1ae8cc4

Please sign in to comment.