Пример #1
0
        protected override void OnExecute(ConnectorIn input)
        {
            var m = Math.Min(TimeWarp.fetch.warpRates.Length - 1, Math.Max(1, In("Multiplier").AsInt()) - 1);

            TimeWarp.SetRate(m, true);
            ExecuteNext();
        }
Пример #2
0
 protected override void OnExecute(ConnectorIn input)
 {
     ExecuteNext();
     ExecuteNext(DefaultExecName + "2");
     ExecuteNext(DefaultExecName + "3");
     ExecuteNext(DefaultExecName + "4");
 }
Пример #3
0
        protected override void OnExecute(ConnectorIn input)
        {
            var on = In("On").AsBool();

            Vessel.ActionGroups.SetGroup(KSPActionGroup.Gear, on);
            ExecuteNext();
        }
Пример #4
0
        protected override void OnExecute(ConnectorIn input)
        {
            ExecuteNext();

            var a = In("A").AsDouble();
            var b = In("B").AsDouble();

            if (a < b)
            {
                ExecuteNext("<");
            }
            if (a <= b)
            {
                ExecuteNext("<=");
            }
            if (a == b)
            {
                ExecuteNext("==");
            }
            if (a >= b)
            {
                ExecuteNext(">=");
            }
            if (a > b)
            {
                ExecuteNext(">");
            }
        }
Пример #5
0
        protected override void OnExecute(ConnectorIn input)
        {
            var on = In("On").AsBool();

            SASController.RCSEnabled = on;
            ExecuteNext();
        }
Пример #6
0
 protected override void OnExecute(ConnectorIn input)
 {
     if (lastAction == Math.Round(In("Action id").AsDouble()))
     {
         ExecuteNext();
     }
 }
Пример #7
0
 protected override void OnExecute(ConnectorIn input)
 {
     if (OnExecuted != null)
     {
         OnExecuted(input.Name);
     }
 }
Пример #8
0
 protected override void OnExecute(ConnectorIn input)
 {
     if (triggerTimes.Count < maxEntries)
     {
         double d = In("Delay").AsDouble();
         triggerTimes.Add(Planetarium.GetUniversalTime() + d);
         Out("Active", true);
     }
 }
Пример #9
0
 internal void In(string name, Type t, bool allowMultipleConnections = false)
 {
     name = name.Trim();
     if (!inputs.ContainsKey(name))
     {
         var connector = new ConnectorIn(t, name, t.IsValueType ? Activator.CreateInstance(t) : null, allowMultipleConnections);
         connector.Init(this);
         inputs.Add(name, connector);
     }
 }
Пример #10
0
 protected override void OnExecute(ConnectorIn input)
 {
     if (input == In("Reset"))
     {
         count = 0;
     }
     else
     {
         count++;
     }
     ExecuteNext();
 }
Пример #11
0
 protected override void OnExecute(ConnectorIn input)
 {
     if (input == In("Enable"))
     {
         KSPOperatingSystem.AddWatchedValue(this, DisplayValue);
         ExecuteNext("OnEnable");
     }
     else
     {
         OnDestroy();
         ExecuteNext("OnDisable");
     }
 }
Пример #12
0
        protected override void OnExecute(ConnectorIn input)
        {
            bool isTrue = In("Input").AsBool();

            //Log.Write("Checking branch: " + isTrue);
            ExecuteNext();
            if (isTrue)
            {
                ExecuteNext("True");
            }
            else
            {
                ExecuteNext("False");
            }
        }
Пример #13
0
 public virtual void Execute(ConnectorIn input)
 {
     LastExecution = Time.time;
     //Log.Write(this.GetType() + " executing");
     try
     {
         RequestInputUpdates();
         OnExecute(input);
     }
     catch (Exception e)
     {
         Log.Write("Node " + this.GetType() + " execution threw exception. Removing node. Exception: " + e.Message);
         //Program.RemoveNode(this);
         RequestRemoval();
     }
 }
Пример #14
0
        protected override void OnExecute(ConnectorIn input)
        {
            //get target vector(navball)
            Vector3 v = In("Forward").AsVector3().GetVec3().normalized;
            //create rotation
            Quaternion rot  = Quaternion.LookRotation(v, Vector3.up) * Quaternion.Euler(90, 0, 0);
            Quaternion roll = Quaternion.identity;

            //keep absolute roll ?

            roll = Quaternion.AngleAxis(In("Roll").AsFloat(), v);

            rot = roll * rot;
            //apply sas target
            SASController.SASTarget = VesselController.ReferenceToWorld(rot, VesselController.FrameOfReference.Navball);
            ExecuteNext();
        }
Пример #15
0
        protected override void OnExecute(ConnectorIn input)
        {
            bool down = In("Down").AsBool();

            if (down != wasDown)
            {
                wasDown    = down;
                canTrigger = false;
            }
            double v = In("Value").AsDouble();

            if (canTrigger)
            {
                double t = In("TriggerAt").AsDouble();
                if (down)
                {
                    if (lastValue > t)
                    {
                        if (v <= t)
                        {
                            ExecuteNext();
                        }
                    }
                }
                else
                {
                    if (lastValue < t)
                    {
                        if (v >= t)
                        {
                            ExecuteNext();
                        }
                    }
                }
            }
            else
            {
                canTrigger = true;
            }
            lastValue = v;
        }
Пример #16
0
 protected override void OnExecute(ConnectorIn input)
 {
     if (input == In(DefaultExecName))
     {
         if (enabled)
         {
             ExecuteNext();
         }
     }
     else if (!enabled)
     {
         if (input == In("Enable"))
         {
             ExecuteNext("OnEnable");
             enabled = true;
         }
     }
     else if (input == In("Disable"))
     {
         ExecuteNext("OnDisable");
         enabled = false;
     }
 }
Пример #17
0
 protected override void OnExecute(ConnectorIn input)
 {
     if (Vessel.currentStage > 0)
     {
         if (!Vessel.Landed || In("IgnoreLanded").AsBool())
         {
             double maxFuelInStage = Vessel.CurrentStageFuelMax(DefaultResources.LiquidFuel, DefaultResources.Oxidizer, DefaultResources.SolidFuel);
             if (maxFuelInStage > 0)
             {
                 if (!Vessel.CurrentStageHasFuel())
                 {
                     if (!hasTriggered)
                     {
                         hasTriggered = true;
                         ExecuteNext();
                     }
                 }
                 else
                 {
                     hasTriggered = false;
                 }
             }
             else
             {
                 hasTriggered = false;
             }
         }
         else
         {
             hasTriggered = false;
         }
     }
     else
     {
         hasTriggered = false;
     }
 }
Пример #18
0
        protected override void OnExecute(ConnectorIn input)
        {
            //get target vector(navball)
            Vector3 v = In("Forward").AsVector3().GetVec3().normalized;
            //create rotation
            Quaternion rot  = Quaternion.LookRotation(v, Vector3.up) * Quaternion.Euler(90, 0, 0);
            Quaternion roll = Quaternion.identity;
            //keep absolute roll ?
            //get navball horizontal angles
            float angleC = Mathf.Atan2(VesselController.NavballHeading.z, VesselController.NavballHeading.x);

            float angleT = Mathf.Atan2(v.z, v.x);

            //delta of angles
            float d = Mathf.DeltaAngle(angleC, angleT) * Mathf.Rad2Deg;

            //add delta to current angle
            roll = Quaternion.AngleAxis((float)VesselController.Roll + d, v);

            rot = roll * rot;
            //apply sas target
            SASController.SASTarget = VesselController.ReferenceToWorld(rot, VesselController.FrameOfReference.Navball);
            ExecuteNext();
        }
Пример #19
0
 protected virtual void OnExecute(ConnectorIn input)
 {
     ExecuteNext();
 }
Пример #20
0
 protected override void OnExecute(ConnectorIn input)
 {
     FlightInputHandler.state.mainThrottle = Mathf.Min(1, Mathf.Max(0, In("Throttle").AsFloat()));
     ExecuteNext();
 }
Пример #21
0
 protected override void OnExecute(ConnectorIn input)
 {
     Vessel.ActionGroups.SetGroup(SelectedGroup(), In("Set").AsBool());
     ExecuteNext();
 }
Пример #22
0
 protected override void OnExecute(ConnectorIn input)
 {
     SASController.SASControllerStrength = In("Strength").AsFloat();
     ExecuteNext();
 }
Пример #23
0
 protected override void OnExecute(ConnectorIn input)
 {
     Variable.Value = In("Set").Get <T>();
     //Log.Write(this.GetType() + " getting value " + Variable.Value + " as " + typeof(T));
     ExecuteNext();
 }
Пример #24
0
 protected override void OnExecute(ConnectorIn input)
 {
     Vessel.ctrlState.yaw = (float)In("Yaw").AsDouble();
     ExecuteNext();
 }
Пример #25
0
 public override void Execute(ConnectorIn input)
 {
     LastExecution = Time.time;
     subRoutineInstance.EntryNode.Execute(input);
 }
Пример #26
0
 protected override void OnExecute(ConnectorIn input)
 { 
     ExecuteNext(input.Name); 
 }
Пример #27
0
 protected override void OnExecute(ConnectorIn input)
 {
     Staging.ActivateNextStage();
     ExecuteNext();
 }
Пример #28
0
 protected override void OnExecute(ConnectorIn input)
 {
     SASController.SASControlEnabled = In("Enabled").AsBool();
     ExecuteNext();
 }
Пример #29
0
 protected override void OnExecute(ConnectorIn input)
 {
     Vessel.ctrlState.wheelSteer = (float)In("Steer").AsDouble();
     ExecuteNext();
 }