Skip to content

Commit

Permalink
-Fixed bug with timer still running with player in cockpit
Browse files Browse the repository at this point in the history
  • Loading branch information
chessmaster42 committed Aug 18, 2014
1 parent bb4bda3 commit dafb829
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions WarpDrivePlugin/WarpEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,11 @@ public void Update()
Vector3 velocity = (Vector3)Parent.LinearVelocity;
float speed = velocity.Length();

if (m_isStartingWarp && IsPlayerInCockpit())
{
m_warpRequest = DateTime.Now;
}

if (m_isStartingWarp && speed > Core._SpeedThreshold && !IsPlayerInCockpit())
{
m_isCountdownRunning = true;
Expand Down Expand Up @@ -584,6 +589,7 @@ protected void Warp()
try
{
m_isStartingWarp = false;
m_isCountdownRunning = false;

if (SandboxGameAssemblyWrapper.IsDebugging)
LogManager.APILog.WriteLineAndConsole("WarpDrivePlugin - Ship '" + Parent.Name + "' is attempting to warp ...");
Expand Down Expand Up @@ -672,7 +678,7 @@ protected void SlowDown()

Vector3 velocity = (Vector3)Parent.LinearVelocity;
float speed = velocity.Length();
if (speed < 10)
if (speed < 5)
{
if (SandboxGameAssemblyWrapper.IsDebugging)
LogManager.APILog.WriteLineAndConsole("WarpDrivePlugin - Ship '" + Parent.Name + "' is back at normal speed!");
Expand Down Expand Up @@ -715,8 +721,8 @@ protected bool IsPlayerInCockpit()
CockpitEntity cockpit = (CockpitEntity)cubeBlock;
if (cockpit.Pilot != null && !cockpit.IsPassengerSeat)
{
if (SandboxGameAssemblyWrapper.IsDebugging)
LogManager.APILog.WriteLineAndConsole("WarpDrivePlugin - Ship '" + Parent.Name + "' cannot warp, player '" + cockpit.Pilot.DisplayName + "' is in a cockpit!");
//if (SandboxGameAssemblyWrapper.IsDebugging)
//LogManager.APILog.WriteLineAndConsole("WarpDrivePlugin - Ship '" + Parent.Name + "' cannot warp, player '" + cockpit.Pilot.DisplayName + "' is in a cockpit!");

isPlayerInCockpit = true;
break;
Expand Down

0 comments on commit dafb829

Please sign in to comment.