Skip to content

Commit

Permalink
set pilots default center in competition
Browse files Browse the repository at this point in the history
  • Loading branch information
BahamutoD committed Feb 19, 2016
1 parent 0029467 commit f160241
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions BahaTurret/BDATargetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,8 @@ IEnumerator CompetitionModeRoutine(float distance)
aLeader.CommandFlyTo(aDestination);
bLeader.CommandFlyTo(bDestination);

Vector3 centerGPS = VectorUtils.WorldPositionToGeoCoords(center, FlightGlobals.currentMainBody);

//wait till everyone is in position
bool waiting = true;
while(waiting)
Expand Down Expand Up @@ -1039,6 +1041,8 @@ IEnumerator CompetitionModeRoutine(float distance)

//release command
p.ReleaseCommand();
p.defaultOrbitCoords = centerGPS;

}
}
competitionStatus = "Competition starting! Good luck!";
Expand Down
7 changes: 5 additions & 2 deletions BahaTurret/BDModulePilotAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Transform velocityTransform

public MissileFire weaponManager;


[KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Default Alt."),
UI_FloatRange(minValue = 500f, maxValue = 8500f, stepIncrement = 25f, scene = UI_Scene.All)]
public float defaultAltitude = 1500;
Expand Down Expand Up @@ -154,7 +155,7 @@ public float MaxLiftAcceleration
LineRenderer lr;
Vector3 flyingToPosition;

Vector3d defaultOrbitCoords;
public Vector3d defaultOrbitCoords;

//speed controller
BDAirspeedControl speedController;
Expand Down Expand Up @@ -943,7 +944,7 @@ void FlyToPosition(FlightCtrlState s, Vector3 targetPosition)

//roll
Vector3 currentRoll = -vesselTransform.forward;
float rollUp = (steerMode == SteerModes.Aiming ? 5f : 22f);
float rollUp = (steerMode == SteerModes.Aiming ? 5f : 10f);
if(steerMode == SteerModes.NormalFlight)
{
rollUp += (1 - finalMaxSteer) * 10f;
Expand All @@ -968,6 +969,8 @@ void FlyToPosition(FlightCtrlState s, Vector3 targetPosition)
//
}



void FlyExtend(FlightCtrlState s, Vector3 tPosition)
{
if(weaponManager)
Expand Down
Binary file modified BahaTurret/bin/Release/BahaTurret.dll
Binary file not shown.
Binary file modified BahaTurret/obj/x86/Release/BahaTurret.dll
Binary file not shown.

0 comments on commit f160241

Please sign in to comment.