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(); }
protected override void OnExecute(ConnectorIn input) { ExecuteNext(); ExecuteNext(DefaultExecName + "2"); ExecuteNext(DefaultExecName + "3"); ExecuteNext(DefaultExecName + "4"); }
protected override void OnExecute(ConnectorIn input) { var on = In("On").AsBool(); Vessel.ActionGroups.SetGroup(KSPActionGroup.Gear, on); ExecuteNext(); }
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(">"); } }
protected override void OnExecute(ConnectorIn input) { var on = In("On").AsBool(); SASController.RCSEnabled = on; ExecuteNext(); }
protected override void OnExecute(ConnectorIn input) { if (lastAction == Math.Round(In("Action id").AsDouble())) { ExecuteNext(); } }
protected override void OnExecute(ConnectorIn input) { if (OnExecuted != null) { OnExecuted(input.Name); } }
protected override void OnExecute(ConnectorIn input) { if (triggerTimes.Count < maxEntries) { double d = In("Delay").AsDouble(); triggerTimes.Add(Planetarium.GetUniversalTime() + d); Out("Active", true); } }
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); } }
protected override void OnExecute(ConnectorIn input) { if (input == In("Reset")) { count = 0; } else { count++; } ExecuteNext(); }
protected override void OnExecute(ConnectorIn input) { if (input == In("Enable")) { KSPOperatingSystem.AddWatchedValue(this, DisplayValue); ExecuteNext("OnEnable"); } else { OnDestroy(); ExecuteNext("OnDisable"); } }
protected override void OnExecute(ConnectorIn input) { bool isTrue = In("Input").AsBool(); //Log.Write("Checking branch: " + isTrue); ExecuteNext(); if (isTrue) { ExecuteNext("True"); } else { ExecuteNext("False"); } }
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(); } }
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(); }
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; }
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; } }
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; } }
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(); }
protected virtual void OnExecute(ConnectorIn input) { ExecuteNext(); }
protected override void OnExecute(ConnectorIn input) { FlightInputHandler.state.mainThrottle = Mathf.Min(1, Mathf.Max(0, In("Throttle").AsFloat())); ExecuteNext(); }
protected override void OnExecute(ConnectorIn input) { Vessel.ActionGroups.SetGroup(SelectedGroup(), In("Set").AsBool()); ExecuteNext(); }
protected override void OnExecute(ConnectorIn input) { SASController.SASControllerStrength = In("Strength").AsFloat(); ExecuteNext(); }
protected override void OnExecute(ConnectorIn input) { Variable.Value = In("Set").Get <T>(); //Log.Write(this.GetType() + " getting value " + Variable.Value + " as " + typeof(T)); ExecuteNext(); }
protected override void OnExecute(ConnectorIn input) { Vessel.ctrlState.yaw = (float)In("Yaw").AsDouble(); ExecuteNext(); }
public override void Execute(ConnectorIn input) { LastExecution = Time.time; subRoutineInstance.EntryNode.Execute(input); }
protected override void OnExecute(ConnectorIn input) { ExecuteNext(input.Name); }
protected override void OnExecute(ConnectorIn input) { Staging.ActivateNextStage(); ExecuteNext(); }
protected override void OnExecute(ConnectorIn input) { SASController.SASControlEnabled = In("Enabled").AsBool(); ExecuteNext(); }
protected override void OnExecute(ConnectorIn input) { Vessel.ctrlState.wheelSteer = (float)In("Steer").AsDouble(); ExecuteNext(); }