public override void OnStart(PartModule.StartState state) { definitionMegajoule = PartResourceLibrary.Instance.GetDefinition(ResourceManager.FNRESOURCE_MEGAJOULES); try { attachedRCS = this.part.FindModuleImplementing <ModuleRCS>(); attachedModuleRCSFX = attachedRCS as FNModuleRCSFX; if (!isInitialised) { precisionFactorLimiter = attachedRCS.precisionFactor * 100; fullThrustMinLimiter = attachedRCS.fullThrustMin * 100; useThrotleEnabled = attachedRCS.useThrottle; fullThrustEnabled = attachedRCS.fullThrust; useLeverEnabled = attachedRCS.useLever; } if (attachedModuleRCSFX != null) { attachedModuleRCSFX.Fields["RCS"].guiActive = true; attachedModuleRCSFX.Fields["enableYaw"].guiActive = true; attachedModuleRCSFX.Fields["enablePitch"].guiActive = true; attachedModuleRCSFX.Fields["enableRoll"].guiActive = true; attachedModuleRCSFX.Fields["enableX"].guiActive = true; attachedModuleRCSFX.Fields["enableY"].guiActive = true; attachedModuleRCSFX.Fields["enableZ"].guiActive = true; } attachedRCS.precisionFactor = precisionFactorLimiter / 100; attachedRCS.fullThrustMin = fullThrustMinLimiter / 100; attachedRCS.useThrottle = useThrotleEnabled; attachedRCS.fullThrust = fullThrustEnabled; attachedRCS.useLever = useLeverEnabled; // old legacy stuff if (baseThrust == 0 && maxThrust > 0) { baseThrust = maxThrust; } if (partMass == 0) { partMass = part.mass; } if (String.IsNullOrEmpty(displayName)) { displayName = part.partInfo.title; } String[] resources_to_supply = { ResourceManager.FNRESOURCE_WASTEHEAT }; this.resources_to_supply = resources_to_supply; oldThrustLimiter = thrustLimiter; oldPowerEnabled = powerEnabled; //efficiencyModifier = g0 * 0.5 / 1000 / efficiency; efficiencyStr = (efficiency * 100).ToString() + "%"; if (!String.IsNullOrEmpty(AnimationName)) { rcsStates = SetUpAnimation(AnimationName, this.part); } // initialize propellant _propellants = ElectricEnginePropellant.GetPropellantsEngineForType(type); delayedVerificationPropellant = true; // find correct fuel mode index if (!String.IsNullOrEmpty(fuel_mode_name)) { Debug.Log("[KSPI] - ElectricRCSController OnStart loaded fuelmode " + fuel_mode_name); Current_propellant = _propellants.FirstOrDefault(p => p.PropellantName == fuel_mode_name); } if (Current_propellant != null && _propellants.Contains(Current_propellant)) { fuel_mode = _propellants.IndexOf(Current_propellant); Debug.Log("[KSPI] - ElectricRCSController OnStart index of fuelmode " + Current_propellant.PropellantGUIName + " = " + fuel_mode); } base.OnStart(state); Fields["electricalPowerConsumptionStr"].guiActive = showConsumption; } catch (Exception e) { Debug.LogError("[KSPI] - ElectricRCSController OnStart Error: " + e.Message); throw; } }
public override void OnStart(PartModule.StartState state) { try { attachedRCS = this.part.FindModuleImplementing<ModuleRCS>(); attachedModuleRCSFX = attachedRCS as FNModuleRCSFX; if (!isInitialised) { if (attachedModuleRCSFX != null) { useLeverEnabled = attachedModuleRCSFX.useLever; precisionFactorLimiter = attachedModuleRCSFX.precisionFactor * 100; fullThrustMinLimiter = attachedModuleRCSFX.fullThrustMin * 100; fullThrustEnabled = attachedModuleRCSFX.fullThrust; useThrotleEnabled = attachedModuleRCSFX.useThrottle; } } if (attachedModuleRCSFX != null) { attachedModuleRCSFX.Fields["RCS"].guiActive = true; attachedModuleRCSFX.Fields["enableYaw"].guiActive = true; attachedModuleRCSFX.Fields["enablePitch"].guiActive = true; attachedModuleRCSFX.Fields["enableRoll"].guiActive = true; attachedModuleRCSFX.Fields["enableX"].guiActive = true; attachedModuleRCSFX.Fields["enableY"].guiActive = true; attachedModuleRCSFX.Fields["enableZ"].guiActive = true; attachedModuleRCSFX.fullThrust = fullThrustEnabled; attachedModuleRCSFX.fullThrustMin = fullThrustMinLimiter / 100; attachedModuleRCSFX.useLever = useLeverEnabled; attachedModuleRCSFX.precisionFactor = precisionFactorLimiter / 100; } // old legacy stuff if (baseThrust == 0 && maxThrust > 0) baseThrust = maxThrust; if (partMass == 0) partMass = part.mass; if (String.IsNullOrEmpty(displayName)) displayName = part.partInfo.title; String[] resources_to_supply = { FNResourceManager.FNRESOURCE_WASTEHEAT }; this.resources_to_supply = resources_to_supply; oldThrustLimiter = thrustLimiter; oldPowerEnabled = powerEnabled; efficencyModifier = (float)g0 * 0.5f / 1000.0f / efficency; efficencyStr = (efficency * 100).ToString() + "%"; if (!String.IsNullOrEmpty(AnimationName)) rcsStates = SetUpAnimation(AnimationName, this.part); // initialize propellant _propellants = ElectricEnginePropellant.GetPropellantsEngineForType(type); delayedVerificationPropellant = true; // find correct fuel mode index if (!String.IsNullOrEmpty(fuel_mode_name)) { Debug.Log("ElectricRCSController OnStart loaded fuelmode " + fuel_mode_name); Current_propellant = _propellants.FirstOrDefault(p => p.PropellantName == fuel_mode_name); } if (Current_propellant != null && _propellants.Contains(Current_propellant)) { fuel_mode = _propellants.IndexOf(Current_propellant); Debug.Log("ElectricRCSController OnStart index of fuelmode " + Current_propellant.PropellantGUIName + " = " + fuel_mode); } base.OnStart(state); Fields["electricalPowerConsumptionStr"].guiActive = showConsumption; } catch (Exception e) { Debug.LogError("ElectricRCSController OnStart Error: " + e.Message); throw; } }