示例#1
0
        /// <summary>
        /// prevents the mother ship from loosing antigrav after beam down
        /// </summary>
        private void DontFallOnMyHead()
        {
            if (FlightGlobals.ActiveVessel.id != this.vessel.id)
            {
                // only one instance should run this code..
                return;
            }
            //////////////////////////////////
            //// START keep impulse vessels floating
            //////////////////////////////////
            foreach (KeyValuePair <string, ImpulseVesselType> pair in man.getImpulseVesselList())
            {
                man.ImpulseVesselList[pair.Value.pid].is_active_vessel = false;

                if (pair.Value.is_gravity_enabled && !man.ImpulseVesselList[pair.Value.pid].is_active_vessel)
                {
                    Vector3 geeVector = FlightGlobals.getGeeForceAtPosition(pair.Value.v.findWorldCenterOfMass());
                    grav.CancelG2(pair.Value.v, geeVector, man);

                    if (man.ImpulseVesselList[pair.Value.pid].is_fullHalt_enabled)
                    {
                        grav.FullHalt(pair.Value.v, true);
                        man.ImpulseVesselList[pair.Value.pid].is_holdspeed_enabled = false;
                        man.ImpulseVesselList[pair.Value.pid].is_pilotMode_enabled = false;
                    }

                    // Freeze in place if requested
                    if (man.ImpulseVesselList[pair.Value.pid].is_MakeSlowToSave_enabled && man.ImpulseVesselList[pair.Value.pid].is_fullHalt_enabled)
                    {
                        grav.makeSlowToSave(pair.Value.v, true, makeStationarySpeedClamp);
                    }

                    Utilities.CalculatePowerConsumption(Powerstats, pair.Value.v, true, false, false, 1, 1, 0, 0, 0);
                }
            }
            //////////////////////////////////
            //// END keep impulse vessels floating
            //////////////////////////////////
        }
示例#2
0
        private void LinkUp_Helm()
        {
            if (this.ShipConnected != null)
            {
                //Debug.Log("ImpulseDrive: Tricorder LinkUp_Helm begin ");

                GUILayout.BeginVertical();
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical(GUILayout.Width(30), GUILayout.Height(30));
                GUILayout.Label(" ");
                GUILayout.EndVertical();

                GUILayout.BeginVertical(GUILayout.Width(30), GUILayout.Height(30));
                if (GUILayout.RepeatButton("↑"))
                {
                    grav.AddNewForce_ffwd_back(10, this.ShipConnected);
                }
                GUILayout.EndVertical();

                GUILayout.BeginVertical(GUILayout.Width(30), GUILayout.Height(30));
                if (GUILayout.RepeatButton("U"))
                {
                    grav.AddNewForce_up_down(10, this.ShipConnected);
                }
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical(GUILayout.Width(30), GUILayout.Height(30));
                if (GUILayout.RepeatButton("←"))
                {
                    grav.AddNewForce_left_right(-10, this.ShipConnected);
                }
                GUILayout.EndVertical();

                GUILayout.BeginVertical(GUILayout.Width(30), GUILayout.Height(30));
                if (GUILayout.RepeatButton("S"))
                {
                    grav.FullHalt(ShipConnected, true);
                }
                GUILayout.EndVertical();

                GUILayout.BeginVertical(GUILayout.Width(30), GUILayout.Height(30));
                if (GUILayout.RepeatButton("→"))
                {
                    grav.AddNewForce_left_right(10, this.ShipConnected);
                }
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical(GUILayout.Width(30), GUILayout.Height(30));
                GUILayout.Label(" ");
                GUILayout.EndVertical();

                GUILayout.BeginVertical(GUILayout.Width(30), GUILayout.Height(30));
                if (GUILayout.RepeatButton("↓"))
                {
                    grav.AddNewForce_ffwd_back(-10, this.ShipConnected);
                }
                GUILayout.EndVertical();

                GUILayout.BeginVertical(GUILayout.Width(30), GUILayout.Height(30));
                if (GUILayout.RepeatButton("D"))
                {
                    grav.AddNewForce_up_down(-10, this.ShipConnected);
                }
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();


                //Debug.Log("ImpulseDrive: Tricorder LinkUp_Helm done ");
            }
            else
            {
                GUILayout.Label("ShipConnected == null ");
            }
        }