public override void OnStart(StartState state) { base.OnStart(state); originalLocalVesselControl = localVesselControlState; originalModuleState = moduleState; foreach (BaseEvent baseEvent in Events) { baseEvent.active = false; } foreach (BaseField field in Fields) { field.guiActive = false; field.guiActiveEditor = false; } CheckPartialControl(); if (debugMode) { Events["TogglePartialControl"].active = true; Events["TogglePartialControl"].guiActive = true; } }
public void UpdateNetwork() { if (partialControlEnabled) { controlState = VesselControlState.Partial; this.part.vessel.maxControlLevel = Vessel.ControlLevel.PARTIAL_MANNED; } else { controlState = VesselControlState.Full; this.part.vessel.maxControlLevel = Vessel.ControlLevel.FULL; } }
public void OnPreAutopilotUpdate(FlightCtrlState s) { if (!Valid) { return; } //initialize systems VSL.PreUpdateState(s); State = TCAState.Disabled; if (CFG.Enabled) { State = TCAState.Enabled; localControlState = VesselControlState.None; if (!VSL.Info.ElectricChargeAvailible) { if (VSL.Controls.WarpToTime > 0) { VSL.Controls.AbortWarp(); } return; } localControlState = VesselControlState.ProbePartial; SetState(TCAState.HaveEC); ClearFrameState(); //update VSL VSL.UpdatePhysics(); if (VSL.Engines.Check()) { SetState(TCAState.HaveActiveEngines); } Actions["onActionUpdate"].actionGroup = VSL.Engines.ActionGroups; VSL.UpdateCommons(); VSL.UpdateOnPlanetStats(); //update modules ModulePipeline.ForEach(m => m.OnFixedUpdate()); VSL.OnModulesUpdated(); } }
public void FixedUpdate() { if (VSL == null) { return; } //initialize systems VSL.UpdateState(); State = TCAState.Disabled; if (!CFG.Enabled) { return; } State = TCAState.Enabled; localControlState = VesselControlState.None; if (!VSL.Info.ElectricChargeAvailible) { if (VSL.Controls.WarpToTime > 0) { VSL.Controls.AbortWarp(); } return; } localControlState = VesselControlState.ProbePartial; SetState(TCAState.HaveEC); ClearFrameState(); //update VSL VSL.UpdatePhysics(); if (VSL.Engines.Check()) { SetState(TCAState.HaveActiveEngines); } Actions["onActionUpdate"].actionGroup = VSL.Engines.ActionGroups; VSL.UpdateCommons(); VSL.UpdateOnPlanetStats(); //update modules ModulePipeline.ForEach(m => m.OnFixedUpdate()); VSL.OnModulesUpdated(); //handle engines VSL.Engines.Tune(); if (VSL.Engines.NumActive > 0) { //:preset manual limits for translation if needed if (VSL.Controls.ManualTranslationSwitch.On) { ENG.PresetLimitsForTranslation(VSL.Engines.Active.Manual, VSL.Controls.ManualTranslation); if (CFG.VSCIsActive) { ENG.LimitInDirection(VSL.Engines.Active.Manual, VSL.Physics.UpL); } } //:optimize limits for steering ENG.PresetLimitsForTranslation(VSL.Engines.Active.Maneuver, VSL.Controls.Translation); ENG.Steer(); } RCS.Steer(); VSL.Engines.SetControls(); VSL.FinalUpdate(); #if DEBUG TEST.OnFixedUpdate(); #endif }