protected new void Start() { phl = PartHighlighter.CreatePartHighlighter(); if (phl == false) { return; } highlightID = phl.CreateHighlightList(); if (highlightID < 0) { return; } if (this.vessel != null) { InitAllPartResources(); } else { Log.Info("PWBVesselModule.Start, vessel: null"); } UpdateHighlightColors(); GameEvents.OnGameSettingsApplied.Add(UpdateHighlightColors); base.Start(); }
public override void OnAwake() { Log.Info("FailureModule.OnAwake"); if (phl == null) { phl = PartHighlighter.CreatePartHighlighter(); } if (vesselHighlightDict == null) { vesselHighlightDict = new Dictionary <Guid, int>(); } }
protected void Start() { phl = PartHighlighter.CreatePartHighlighter(); if (phl == false) { return; } highlightID = phl.CreateHighlightList(); if (highlightID < 0) { return; } phl.AddPartToHighlight(highlightID, this.part); UpdateColors(); GameEvents.OnGameSettingsApplied.Add(UpdateColors); }
public void OnEnable() { PartHighlighter.instance = this; this.mainCamera = Camera.main; }
public void Start() { Log.Info("Start"); part.RestoreVariant(); #if false SetThrustCurve(grainName, null); #endif Events["TriggerEngineFailureEvent"].active = HighLogic.CurrentGame.Parameters.CustomParams <MSSRB_1>().devMode; Actions["TriggerEngineFailureAction"].active = HighLogic.CurrentGame.Parameters.CustomParams <MSSRB_1>().devMode; #if false foreach (var e in Events) { Log.Info("Event: " + e.name + ", guiName = " + e.guiName); } foreach (var a in Actions) { Log.Info("Action: " + a.name + ", guiName: " + a.guiName); } foreach (var f in Fields) { Log.Info("Field: " + f.name + ", guiName: " + f.guiName); } #endif Fields["independentThrottle"].guiActive = Fields["independentThrottle"].guiActiveEditor = false; Fields["thrustPercentage"].guiActive = Fields["thrustPercentage"].guiActiveEditor = false; origAtmosphereCurve = atmosphereCurve; PartResourceDefinition prd = PartResourceLibrary.Instance.GetDefinition(ModSegSRBs.Propellant); density = prd.density; densityInverse = 1.0 / prd.density; fuelFlowMultiplier = densityInverse * Planetarium.fetch.fixedDeltaTime; phl = PartHighlighter.CreatePartHighlighter(); if (phl) { highlightID = phl.CreateHighlightList(); } if (highlightID >= 0) { UpdateHighlightColors(); } PartModuleList pml = part.Modules; if (pml.Contains("MSSRB_Fuel_Segment")) { MSSRB_Fuel_Segment moduleFuelSegment = pml["MSSRB_Fuel_Segment"] as MSSRB_Fuel_Segment; part.segmentWidth = moduleFuelSegment.part.segmentWidth; } else { Log.Info("MSSRB_Engine, missing MSSRB_Fuel_Segment"); } foreach (var p in propellants) { if (p.name == ModSegSRBs.BurnablePropellant) { break; } burnablePropIndx++; } foreach (var p in propellants) { if (p.name == ModSegSRBs.Propellant) { break; } propIndx++; } ModSegSRBs.GetExtraInfo(part.baseVariant, ref part.segmentHeight, ref part.segmentWidth); switch (HighLogic.LoadedScene) { case GameScenes.EDITOR: GameEvents.onEditorPartPicked.Add(onEditorPartPicked); GameEvents.onEditorPartPlaced.Add(onEditorPartPlaced); GameEvents.onEditorPartDeleted.Add(onEditorPartDeleted); GameEvents.onVariantApplied.Add(onEditorVariantApplied); ScheduleSegmentUpdate("Start"); break; case GameScenes.FLIGHT: failureChance = HighLogic.CurrentGame.Parameters.CustomParams <MSSRB_1>().failureChance; if (this.vessel.situation <= Vessel.Situations.PRELAUNCH) { UpdateSegments(); foreach (var s in segments) { /* PartModuleList */ pml = s.part.Modules; MSSRB_Fuel_Segment moduleFuelSegment = pml["MSSRB_Fuel_Segment"] as MSSRB_Fuel_Segment; PartResourceList prl = s.part.Resources; if (prl.Contains(ModSegSRBs.Propellant)) { //Log.Info("Segment: " + s.part.partInfo.title + " contains Propellant"); prl[ModSegSRBs.Propellant].amount = moduleFuelSegment.MaxSolidFuel(); } if (prl.Contains(ModSegSRBs.BurnablePropellant)) { prl[ModSegSRBs.BurnablePropellant].amount = 0; //prl[ModSegSRBs.BurnablePropellant].amount = moduleFuelSegment.MaxSolidFuel(); //Log.Info("Segment: " + s.part.partInfo.title + " contains BurnablePropellant"); } } } break; } // switch }