void ENDURANCE::clbkPostStep(double simt, double simdt, double mjd)
{
//---------------------------------------------------------------------------
// ProcessUniversalMMu
// Here the routine that detect if someone entered the ship (eva or transfer)
// No need to manage anything here all is automatic, crew is added to your ship, ship's weight is updated,
// and UMmu vessel is automatically deleted from Orbiter. You may just look the return
// code to see if someone entered and display wathewer message on panel or other.
// notice it's FPS friendly, function process only 4 time per second not each frame
// and return immediately if airlock closed or no Ummu is detected in vincinity.
int ReturnCode = Crew.ProcessUniversalMMu();
switch (ReturnCode)
{
case UMMU_TRANSFERED_TO_OUR_SHIP:
SendHudMessage("%s \"%s\" aged %i was transfered to our ship",
Crew.GetCrewMiscIdByName(Crew.GetLastEnteredCrewName()), Crew.GetLastEnteredCrewName()
, Crew.GetCrewAgeByName(Crew.GetLastEnteredCrewName()));
break;
case UMMU_RETURNED_TO_OUR_SHIP:
SendHudMessage("%s \"%s\" aged %i entered into our ship",
Crew.GetCrewMiscIdByName(Crew.GetLastEnteredCrewName()),
Crew.GetLastEnteredCrewName(), Crew.GetCrewAgeByName(Crew.GetLastEnteredCrewName()));
break;
}
if ( GroundContact() )
{
// we check vertical speed
//int I;
VECTOR3 vHorizonAirspeedVector = { 0 };
GetHorizonAirspeedVector(vHorizonAirspeedVector);
double VertSpeed = vHorizonAirspeedVector.y;
if (VertSpeed < -3)
{
// we touched ground with more than -3 m/s, sorry dude, time to kill you all :(
//for(I=0;I<Crew.GetCrewTotalNumber();I++)
//{
// Crew.SetCrewMemberPulseBySlotNumber(I,0); // set cardiac pulse to zero
// }
// strcpy(SendHudMessage(),"Oooh no ! Crash - All crew aboard killed");
}
// TIPS: the vertical speed is often reset to zero when there is ground contact
// this may bug somewhat the death of your crew.
// to have an accurate VertSpeed at touchdown I recommand to record it at very END
// of timestep and use this "old" value. The next frame you'll have the vertspeed value
// of *last frame* just before the crash (GroundContact). This ensure an accurate
// verticalspeed value. (keep this value in your vessel class and don't forget to
// initialize it at zero in setclasscap)
}
//sprintf(oapiDebugString(),"anim %2.2f",GEAR_proc);
//---------------------------------------------------------------------------
// WarnUserUMMUNotInstalled - IMPORTANT helper
// Put here this function and users will be automatically warned if they don't have
// UMMU installed or if it's outdated. Warning text duration is 20 seconds and text is:
// [AddonName] require "Universal MMU" ver 2.0 or higher. Download at www.orbiter.dansteph.com (message countdown in seconds)
// an additonal "your version of UMMU is outdated" is displayed the last 5 seconds if they have version lower than 2.0
Crew.WarnUserUMMUNotInstalled("ENDURANCE");
// THIS IS FOR ADDING CREW SEE PDF doc "Allow user to add crew to your ship
// without scenery editor"
AddUMmuToVessel();
if (this->viewController->IsFocused())
sprintf_s(oapiDebugString(), 255, "%s : %s", viewController->station()->name.c_str(), viewController->view()->name.c_str());
for (int i = 1; i < 17; i++) {
APbeacon[i].active = false;
}
for (int i = 1; i < 17; i++) {
Cbeacon[i].active = false;
}
if (0 < PODSel && PODSel < 17) APbeacon[PODSel].active = true;//turns on selected bay
if (PODSel == 1){
SendHudMessage("Rack 1 Selected");
if (CARGO1_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO1_status == RACK_RAISING) {
if (CARGO1_proc > 0.0) CARGO1_proc = max(0.0, CARGO1_proc - da);
else CARGO1_status = RACK_UP;
}
else {
if (CARGO1_proc < 1.0) CARGO1_proc = min(1.0, CARGO1_proc + da);
else CARGO1_status = RACK_DOWN;
}
if (CARGO1_status == RACK_UP)SendHudMessage("Rack 1 Extended");
if (CARGO1_status == RACK_DOWN)SendHudMessage("Rack 1 Retracted");
}
}
Cbeacon[PODSel].active = true;
CARGO1_pos.z = CARGO1_INT_POS - (CARGO1_proc * 5);
SetAttachmentParams(CARGO1, CARGO1_pos, _V(0, 1, 0), _V(0, 0, -1));
Cbeaconpos[1].x = CARGO1_pos.x;
Cbeaconpos[1].y = CARGO1_pos.y;
Cbeaconpos[1].z = CARGO1_pos.z;
//cargo2
if (PODSel == 2){
SendHudMessage("Rack 2 Selected");
if (CARGO2_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO2_status == RACK_RAISING) {
if (CARGO2_proc > 0.0) CARGO2_proc = max(0.0, CARGO2_proc - da);
else CARGO2_status = RACK_UP;
}
else {
if (CARGO2_proc < 1.0) CARGO2_proc = min(1.0, CARGO2_proc + da);
else CARGO2_status = RACK_DOWN;
}
if (CARGO2_status == RACK_UP)SendHudMessage("Rack 2 Extended");
if (CARGO2_status == RACK_DOWN)SendHudMessage("Rack 2 Retracted");
}
}
CARGO2_pos.z = CARGO2_INT_POS - (CARGO2_proc * 5);
SetAttachmentParams(CARGO2, CARGO2_pos, _V(0, 1, 0), _V(0, 0, -1));
Cbeaconpos[2].x = CARGO2_pos.x;
Cbeaconpos[2].y = CARGO2_pos.y;
Cbeaconpos[2].z = CARGO2_pos.z;
//cargo3
if (PODSel == 3){
SendHudMessage("Rack 3 Selected");
if (CARGO3_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO3_status == RACK_RAISING) {
if (CARGO3_proc > 0.0) CARGO3_proc = max(0.0, CARGO3_proc - da);
else CARGO3_status = RACK_UP;
}
else {
if (CARGO3_proc < 1.0) CARGO3_proc = min(1.0, CARGO3_proc + da);
else CARGO3_status = RACK_DOWN;
}
if (CARGO3_status == RACK_UP)SendHudMessage("Rack 3 Extended");
if (CARGO3_status == RACK_DOWN)SendHudMessage("Rack 3 Retracted");
}
}
CARGO3_pos.z = CARGO3_INT_POS - (CARGO3_proc * 5);
SetAttachmentParams(CARGO3, CARGO3_pos, _V(-.866, -.5, 0), _V(0, 0, -1));
Cbeaconpos[3].x = CARGO3_pos.x;
Cbeaconpos[3].y = CARGO3_pos.y;
Cbeaconpos[3].z = CARGO3_pos.z;
// //cargo4
if (PODSel == 4){
SendHudMessage("Rack 4 Selected");
if (CARGO4_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO4_status == RACK_RAISING) {
if (CARGO4_proc > 0.0) CARGO4_proc = max(0.0, CARGO4_proc - da);
else CARGO4_status = RACK_UP;
}
else {
if (CARGO4_proc < 1.0) CARGO4_proc = min(1.0, CARGO4_proc + da);
else CARGO4_status = RACK_DOWN;
}
if (CARGO4_status == RACK_UP)SendHudMessage("Rack 4 Extended");
if (CARGO4_status == RACK_DOWN)SendHudMessage("Rack 4 Retracted");
}
}
CARGO4_pos.z = CARGO4_INT_POS - (CARGO4_proc * 5);
SetAttachmentParams(CARGO4, CARGO4_pos, _V(-.866, -.5, 0), _V(0, 0, -1));
Cbeaconpos[4].x = CARGO4_pos.x;
Cbeaconpos[4].y = CARGO4_pos.y;
Cbeaconpos[4].z = CARGO4_pos.z;
//cargo4
if (PODSel == 5){
SendHudMessage("Rack 5 Selected");
if (CARGO5_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO5_status == RACK_RAISING) {
if (CARGO5_proc > 0.0) CARGO5_proc = max(0.0, CARGO5_proc - da);
else CARGO5_status = RACK_UP;
}
else {
if (CARGO5_proc < 1.0) CARGO5_proc = min(1.0, CARGO5_proc + da);
else CARGO5_status = RACK_DOWN;
}
if (CARGO5_status == RACK_UP)SendHudMessage("Rack 5 Extended");
if (CARGO5_status == RACK_DOWN)SendHudMessage("Rack 5 Retracted");
}
}
CARGO5_pos.z = CARGO5_INT_POS - (CARGO5_proc * 5);
SetAttachmentParams(CARGO5, CARGO5_pos, _V(-1, 0, 0), _V(0, 0, -1));
Cbeaconpos[5].x = CARGO5_pos.x;
Cbeaconpos[5].y = CARGO5_pos.y;
Cbeaconpos[5].z = CARGO5_pos.z;
//cargo6
if (PODSel == 6){
SendHudMessage("Rack 6 Selected");
if (CARGO6_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO6_status == RACK_RAISING) {
if (CARGO6_proc > 0.0) CARGO6_proc = max(0.0, CARGO6_proc - da);
else CARGO6_status = RACK_UP;
}
else {
if (CARGO6_proc < 1.0) CARGO6_proc = min(1.0, CARGO6_proc + da);
else CARGO6_status = RACK_DOWN;
}
if (CARGO6_status == RACK_UP)SendHudMessage("Rack 6 Extended");
if (CARGO6_status == RACK_DOWN)SendHudMessage("Rack 6 Retracted");
}
}
CARGO6_pos.z = CARGO6_INT_POS - (CARGO6_proc * 5);
SetAttachmentParams(CARGO6, CARGO6_pos, _V(-1, 0, 0), _V(0, 0, -1));
Cbeaconpos[6].x = CARGO6_pos.x;
Cbeaconpos[6].y = CARGO6_pos.y;
Cbeaconpos[6].z = CARGO6_pos.z;
//cargo6
if (PODSel == 7){
SendHudMessage("Rack 7 Selected");
if (CARGO7_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO7_status == RACK_RAISING) {
if (CARGO7_proc > 0.0) CARGO7_proc = max(0.0, CARGO7_proc - da);
else CARGO7_status = RACK_UP;
}
else {
if (CARGO7_proc < 1.0) CARGO7_proc = min(1.0, CARGO7_proc + da);
else CARGO7_status = RACK_DOWN;
}
if (CARGO7_status == RACK_UP)SendHudMessage("Rack 7 Extended");
if (CARGO7_status == RACK_DOWN)SendHudMessage("Rack 7 Retracted");
}
}
CARGO7_pos.z = CARGO7_INT_POS - (CARGO7_proc * 5);
SetAttachmentParams(CARGO7, CARGO7_pos, _V(-.866, .5, 0), _V(0, 0, -1));
Cbeaconpos[7].x = CARGO7_pos.x;
Cbeaconpos[7].y = CARGO7_pos.y;
Cbeaconpos[7].z = CARGO7_pos.z;
//cargo8
if (PODSel == 8){
SendHudMessage("Rack 8 Selected");
if (CARGO8_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO8_status == RACK_RAISING) {
if (CARGO8_proc > 0.0) CARGO8_proc = max(0.0, CARGO8_proc - da);
else CARGO8_status = RACK_UP;
}
else {
if (CARGO8_proc < 1.0) CARGO8_proc = min(1.0, CARGO8_proc + da);
else CARGO8_status = RACK_DOWN;
}
if (CARGO8_status == RACK_UP)SendHudMessage("Rack 8 Extended");
if (CARGO8_status == RACK_DOWN)SendHudMessage("Rack 8 Retracted");
}
}
CARGO8_pos.z = CARGO8_INT_POS - (CARGO8_proc * 5);
SetAttachmentParams(CARGO8, CARGO8_pos, _V(-.866, .5, 0), _V(0, 0, -1));
Cbeaconpos[8].x = CARGO8_pos.x;
Cbeaconpos[8].y = CARGO8_pos.y;
Cbeaconpos[8].z = CARGO8_pos.z;
//cargo9
if (PODSel == 9){
SendHudMessage("Rack 9 Selected");
if (CARGO9_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO9_status == RACK_RAISING) {
if (CARGO9_proc > 0.0) CARGO9_proc = max(0.0, CARGO9_proc - da);
else CARGO9_status = RACK_UP;
}
else {
if (CARGO9_proc < 1.0) CARGO9_proc = min(1.0, CARGO9_proc + da);
else CARGO9_status = RACK_DOWN;
}
if (CARGO9_status == RACK_UP)SendHudMessage("Rack 9 Extended");
if (CARGO9_status == RACK_DOWN)SendHudMessage("Rack 9 Retracted");
}
}
CARGO9_pos.z = CARGO9_INT_POS - (CARGO9_proc * 5);
SetAttachmentParams(CARGO9, CARGO9_pos, _V(0, 1, 0), _V(0, 0, -1));
Cbeaconpos[9].x = CARGO9_pos.x;
Cbeaconpos[9].y = CARGO9_pos.y;
Cbeaconpos[9].z = CARGO9_pos.z;
//cargo10
if (PODSel == 10){
SendHudMessage("Rack 10 Selected");
if (CARGO10_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO10_status == RACK_RAISING) {
if (CARGO10_proc > 0.0) CARGO10_proc = max(0.0, CARGO10_proc - da);
else CARGO10_status = RACK_UP;
}
else {
if (CARGO10_proc < 1.0) CARGO10_proc = min(1.0, CARGO10_proc + da);
else CARGO10_status = RACK_DOWN;
}
if (CARGO10_status == RACK_UP)SendHudMessage("Rack 10 Extended");
if (CARGO10_status == RACK_DOWN)SendHudMessage("Rack 10 Retracted");
}
}
CARGO10_pos.z = CARGO10_INT_POS - (CARGO10_proc * 5);
SetAttachmentParams(CARGO10, CARGO10_pos, _V(0, 1, 0), _V(0, 0, -1));
Cbeaconpos[10].x = CARGO10_pos.x;
Cbeaconpos[10].y = CARGO10_pos.y;
Cbeaconpos[10].z = CARGO10_pos.z;
//cargo11
if (PODSel == 11){
SendHudMessage("Rack 11 Selected");
if (CARGO11_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO11_status == RACK_RAISING) {
if (CARGO11_proc > 0.0) CARGO11_proc = max(0.0, CARGO11_proc - da);
else CARGO11_status = RACK_UP;
}
else {
if (CARGO11_proc < 1.0) CARGO11_proc = min(1.0, CARGO11_proc + da);
else CARGO11_status = RACK_DOWN;
}
if (CARGO11_status == RACK_UP)SendHudMessage("Rack 11 Extended");
if (CARGO11_status == RACK_DOWN)SendHudMessage("Rack 11 Retracted");
}
}
CARGO11_pos.z = CARGO11_INT_POS - (CARGO11_proc * 5);
SetAttachmentParams(CARGO11, CARGO11_pos, _V(.866, .5, 0), _V(0, 0, -1));
Cbeaconpos[11].x = CARGO11_pos.x;
Cbeaconpos[11].y = CARGO11_pos.y;
Cbeaconpos[11].z = CARGO11_pos.z;
//cargo12
if (PODSel == 12){
SendHudMessage("Rack 12 Selected");
if (CARGO12_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO12_status == RACK_RAISING) {
if (CARGO12_proc > 0.0) CARGO12_proc = max(0.0, CARGO12_proc - da);
else CARGO12_status = RACK_UP;
}
else {
if (CARGO12_proc < 1.0) CARGO12_proc = min(1.0, CARGO12_proc + da);
else CARGO12_status = RACK_DOWN;
}
if (CARGO12_status == RACK_UP)SendHudMessage("Rack 12 Extended");
if (CARGO12_status == RACK_DOWN)SendHudMessage("Rack 12 Retracted");
}
}
CARGO12_pos.z = CARGO12_INT_POS - (CARGO12_proc * 5);
SetAttachmentParams(CARGO12, CARGO12_pos, _V(.866, .5, 0), _V(0, 0, -1));
Cbeaconpos[12].x = CARGO12_pos.x;
Cbeaconpos[12].y = CARGO12_pos.y;
Cbeaconpos[12].z = CARGO12_pos.z;
//cargo13
if (PODSel == 13){
SendHudMessage("Rack 13 Selected");
if (CARGO13_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO13_status == RACK_RAISING) {
if (CARGO13_proc > 0.0) CARGO13_proc = max(0.0, CARGO13_proc - da);
else CARGO13_status = RACK_UP;
}
else {
if (CARGO13_proc < 1.0) CARGO13_proc = min(1.0, CARGO13_proc + da);
else CARGO13_status = RACK_DOWN;
}
if (CARGO13_status == RACK_UP)SendHudMessage("Rack 13 Extended");
if (CARGO13_status == RACK_DOWN)SendHudMessage("Rack 13 Retracted");
}
}
CARGO13_pos.z = CARGO13_INT_POS - (CARGO13_proc * 5);
SetAttachmentParams(CARGO13, CARGO13_pos, _V(1, 0, 0), _V(0, 0, -1));
Cbeaconpos[13].x = CARGO13_pos.x;
Cbeaconpos[13].y = CARGO13_pos.y;
Cbeaconpos[13].z = CARGO13_pos.z;
//cargo14
if (PODSel == 14){
SendHudMessage("Rack 14 Selected");
if (CARGO14_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO14_status == RACK_RAISING) {
if (CARGO14_proc > 0.0) CARGO14_proc = max(0.0, CARGO14_proc - da);
else CARGO14_status = RACK_UP;
}
else {
if (CARGO14_proc < 1.0) CARGO14_proc = min(1.0, CARGO14_proc + da);
else CARGO14_status = RACK_DOWN;
}
if (CARGO14_status == RACK_UP)SendHudMessage("Rack 14 Extended");
if (CARGO14_status == RACK_DOWN)SendHudMessage("Rack 14 Retracted");
}
}
CARGO14_pos.z = CARGO14_INT_POS - (CARGO14_proc * 5);
SetAttachmentParams(CARGO14, CARGO14_pos, _V(1, 0, 0), _V(0, 0, -1));
Cbeaconpos[14].x = CARGO14_pos.x;
Cbeaconpos[14].y = CARGO14_pos.y;
Cbeaconpos[14].z = CARGO14_pos.z;
//cargo15
if (PODSel == 15){
SendHudMessage("Rack 15 Selected");
if (CARGO15_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO15_status == RACK_RAISING) {
if (CARGO15_proc > 0.0) CARGO15_proc = max(0.0, CARGO15_proc - da);
else CARGO15_status = RACK_UP;
}
else {
if (CARGO15_proc < 1.0) CARGO15_proc = min(1.0, CARGO15_proc + da);
else CARGO15_status = RACK_DOWN;
}
if (CARGO15_status == RACK_UP)SendHudMessage("Rack 15 Extended");
if (CARGO15_status == RACK_DOWN)SendHudMessage("Rack 15 Retracted");
}
}
CARGO15_pos.z = CARGO15_INT_POS - (CARGO15_proc * 5);
SetAttachmentParams(CARGO15, CARGO15_pos, _V(.866, -.5, 0), _V(0, 0, -1));
Cbeaconpos[15].x = CARGO15_pos.x;
Cbeaconpos[15].y = CARGO15_pos.y;
Cbeaconpos[15].z = CARGO15_pos.z;
//cargo6
if (PODSel == 16){
SendHudMessage("Rack 16 Selected");
if (CARGO16_status >= RACK_RAISING) {
double da = simdt * .1;
if (CARGO16_status == RACK_RAISING) {
if (CARGO16_proc > 0.0) CARGO16_proc = max(0.0, CARGO16_proc - da);
else CARGO16_status = RACK_UP;
}
else {
if (CARGO16_proc < 1.0) CARGO16_proc = min(1.0, CARGO16_proc + da);
else CARGO16_status = RACK_DOWN;
}
if (CARGO16_status == RACK_UP)SendHudMessage("Rack 16 Extended");
if (CARGO16_status == RACK_DOWN)SendHudMessage("Rack 16 Retracted");
}
}
CARGO16_pos.z = CARGO16_INT_POS - (CARGO16_proc * 5);
SetAttachmentParams(CARGO16, CARGO16_pos, _V(.866, -.5, 0), _V(0, 0, -1));
Cbeaconpos[16].x = CARGO16_pos.x;
Cbeaconpos[16].y = CARGO16_pos.y;
Cbeaconpos[16].z = CARGO16_pos.z;
}