Skip to content

Commit

Permalink
Merge pull request #23 from BobPalmer/DEVELOP
Browse files Browse the repository at this point in the history
Fixed lag with warp engine
  • Loading branch information
BobPalmer committed Jan 19, 2016
2 parents 6f7966c + 3249437 commit 8fa90b1
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
0.3.2 - 2016.01.18
------------------
Fixed an issue with warp drive performance

0.3.1 - 2015.11.09
------------------
Recompile for KSP 1.0.5

0.3.0 - 2015.10.16
-------------------
Recompile for KSP 1.0.4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"NAME":"USI Alcubierre Drive",
"URL":"https://raw.githubusercontent.com/BobPalmer/WarpDrive/master/GameData/UmbraSpaceIndustries/WarpDrive/WarpDrive.version",
"URL":"https://raw.githubusercontent.com/BobPalmer/WarpDrive/master/FOR_RELEASE/GameData/UmbraSpaceIndustries/WarpDrive/WarpDrive.version",
"DOWNLOAD":"https://github.com/BobPalmer/WarpDrive/releases",
"GITHUB":{
"USERNAME":"BobPalmer",
Expand All @@ -10,22 +10,22 @@
"VERSION":{
"MAJOR":0,
"MINOR":3,
"PATCH":0,
"PATCH":2,
"BUILD":0
},
"KSP_VERSION":{
"MAJOR":1,
"MINOR":0,
"PATCH":4
"PATCH":5
},
"KSP_VERSION_MIN":{
"MAJOR":1,
"MINOR":0,
"PATCH":0
"PATCH":5
},
"KSP_VERSION_MAX":{
"MAJOR":1,
"MINOR":0,
"PATCH":4
"PATCH":5
}
}
Binary file not shown.
65 changes: 35 additions & 30 deletions Source/WarpEngine/WarpEngine/USI_ModuleWarpEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ public override void OnStart(StartState state)

private ModuleEngines eModule;
private GameObject warpBubble;

private Krakensbane krakensbane;
public override void OnAwake()
{
eModule = part.FindModuleImplementing<ModuleEngines>();
krakensbane = (Krakensbane)FindObjectOfType(typeof(Krakensbane));
editorBubble = FindEditorWarpBubble();

foreach (var gobj in GameObject.FindGameObjectsWithTag("Icon_Hidden"))
Expand Down Expand Up @@ -190,7 +191,8 @@ private void SetPartState(bool stiffenJoints)
{
if (stiffenJoints)
{
//Stiffen Joints
print("Stiffening");
//Stiffen Joints
_shipParts = new List<ShipInfo>();
foreach (var vp in vessel.parts)
{
Expand All @@ -212,7 +214,8 @@ private void SetPartState(bool stiffenJoints)

else
{
//Stop vessel
print("Unstiffening");
//Stop vessel
vessel.rigidbody.AddTorque(-vessel.rigidbody.angularVelocity);
//Reset part state
if (_shipParts != null)
Expand Down Expand Up @@ -252,36 +255,39 @@ public void FixedUpdate()
{
try
{
if (vessel == null || _state == StartState.Editor) return;
if (IsDeployed != eModule.getIgnitionState)
{
IsDeployed = eModule.getIgnitionState;
CheckBubbleDeployment(3);
SetPartState(eModule.getIgnitionState);
}
if (vessel == null || _state == StartState.Editor)
return;

if (IsDeployed != eModule.getIgnitionState)
{
IsDeployed = eModule.getIgnitionState;
CheckBubbleDeployment(3);
SetPartState(eModule.getIgnitionState);
}

if (IsDeployed)
{
//Failsafe
if (!CheckAltitude())
{
eModule.Shutdown();
return;
}

//Snip parts
DecoupleBubbleParts();

//OH NO FLAMEOUT!
if (eModule.flameout)
{
BubbleCollapse(eModule.currentThrottle);
FlightInputHandler.state.mainThrottle = 0;
IsDeployed = false;
return;
}

PlayWarpAnimation(eModule.currentThrottle);
if (!CheckAltitude())
{
eModule.Shutdown();
return;
}

//Snip parts
DecoupleBubbleParts();

//OH NO FLAMEOUT!
if (eModule.flameout)
{
print("Flameout");
BubbleCollapse(eModule.currentThrottle);
FlightInputHandler.state.mainThrottle = 0;
IsDeployed = false;
return;
}

PlayWarpAnimation(eModule.currentThrottle);

//Start by adding in our subluminal speed which is exponential
double lowerThrottle = (Math.Min(eModule.currentThrottle, SUBLIGHT_THROTTLE) * SUBLIGHT_MULT);
Expand Down Expand Up @@ -327,7 +333,6 @@ public void FixedUpdate()
{
// Translate through space on the back of a Kraken!
Vector3d ps = vessel.transform.position + (transform.up*(float) distance);
Krakensbane krakensbane = (Krakensbane)FindObjectOfType(typeof(Krakensbane));
krakensbane.setOffset(ps);
//AngularMomentum Block
if (AMConservationMode == true)
Expand Down

0 comments on commit 8fa90b1

Please sign in to comment.