public override void OnStart(StartState state) { base.OnStart(state); part.force_activate(); //setup anim if (!string.IsNullOrEmpty(deployAnimationName)) { hasDeployAnimation = true; deployAnimState = Misc.Misc.SetUpSingleAnimation(deployAnimationName, part); if (state == StartState.Editor) { Events["EditorToggleAnimation"].guiActiveEditor = true; } } if (HighLogic.LoadedSceneIsFlight) { List <ModuleTurret> .Enumerator tur = part.FindModulesImplementing <ModuleTurret>().GetEnumerator(); while (tur.MoveNext()) { if (tur.Current == null) { continue; } if (tur.Current.turretID != turretID) { continue; } turret = tur.Current; break; } tur.Dispose(); attachedRadar = part.FindModuleImplementing <ModuleRadar>(); if (attachedRadar) { hasAttachedRadar = true; } finalTransform = part.FindModelTransform(finalTransformName); UpdateMissileChildren(); if (!autoReturn) { Events["ReturnTurret"].guiActive = true; } } }
public override void OnStart(StartState state) { base.OnStart(state); if (HighLogic.LoadedSceneIsFlight) { myVesselID = vessel.id.ToString(); RadarUtils.SetupResources(); if (string.IsNullOrEmpty(radarName)) { radarName = part.partInfo.title; } linkedToVessels = new List <VesselRadarData>(); signalPersistTime = omnidirectional ? 360 / (scanRotationSpeed + 5) : directionalFieldOfView / (scanRotationSpeed + 5); rwrType = (RadarWarningReceiver.RWRThreatTypes)rwrThreatType; if (rwrType == RadarWarningReceiver.RWRThreatTypes.Sonar) { signalPersistTimeForRwr = RadarUtils.ACTIVE_MISSILE_PING_PERISTS_TIME; } else { signalPersistTimeForRwr = signalPersistTime / 2; } if (rotationTransformName != string.Empty) { rotationTransform = part.FindModelTransform(rotationTransformName); } attemptedLocks = new TargetSignatureData[3]; TargetSignatureData.ResetTSDArray(ref attemptedLocks); lockedTargets = new List <TargetSignatureData>(); referenceTransform = (new GameObject()).transform; referenceTransform.parent = transform; referenceTransform.localPosition = Vector3.zero; List <ModuleTurret> .Enumerator turr = part.FindModulesImplementing <ModuleTurret>().GetEnumerator(); while (turr.MoveNext()) { if (turr.Current == null) { continue; } if (turr.Current.turretID != turretID) { continue; } lockingTurret = turr.Current; break; } turr.Dispose(); //GameEvents.onVesselGoOnRails.Add(OnGoOnRails); //not needed EnsureVesselRadarData(); StartCoroutine(StartUpRoutine()); } else if (HighLogic.LoadedSceneIsEditor) { //Editor only: List <ModuleTurret> .Enumerator tur = part.FindModulesImplementing <ModuleTurret>().GetEnumerator(); while (tur.MoveNext()) { if (tur.Current == null) { continue; } if (tur.Current.turretID != turretID) { continue; } lockingTurret = tur.Current; break; } tur.Dispose(); if (lockingTurret) { lockingTurret.Fields["minPitch"].guiActiveEditor = false; lockingTurret.Fields["maxPitch"].guiActiveEditor = false; lockingTurret.Fields["yawRange"].guiActiveEditor = false; } } // check for not updated legacy part: if ((canScan && (radarMinDistanceDetect == float.MaxValue)) || (canLock && (radarMinDistanceLockTrack == float.MaxValue))) { Debug.Log("[BDArmory]: WARNING: " + part.name + " has legacy definition, missing new radarDetectionCurve and radarLockTrackCurve definitions! Please update for the part to be usable!"); } }
public void Start() { // extension for feature_engagementenvelope InitializeEngagementRange(0, maxTargetingRange); SetupAudio(); if (HighLogic.LoadedSceneIsFlight) { part.force_activate(); aimerTexture = BDArmorySetup.Instance.greenPointCircleTexture; // GameDatabase.Instance.GetTexture("BDArmory/Textures/grayCircle", false); MakeRocketArray(); UpdateRocketScales(); if (shortName == string.Empty) { shortName = part.partInfo.title; } UpdateAudio(); BDArmorySetup.OnVolumeChange += UpdateAudio; gauge = (BDStagingAreaGauge)part.AddModule("BDStagingAreaGauge"); gauge.AmmoName = rocketType; gauge.AudioSource = sfAudioSource; } if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor) { List <ModuleTurret> .Enumerator turr = part.FindModulesImplementing <ModuleTurret>().GetEnumerator(); while (turr.MoveNext()) { if (turr.Current == null) { continue; } if (turr.Current.turretID != turretID) { continue; } turret = turr.Current; targetInTurretView = false; break; } turr.Dispose(); if (turret) { Events["GuiFire"].guiActive = false; Events["Jettison"].guiActive = false; Actions["AGFire"].active = false; if (HighLogic.LoadedSceneIsFlight) { Events["ToggleTurret"].guiActive = true; } } if (!string.IsNullOrEmpty(deployAnimationName)) { deployAnimState = Misc.Misc.SetUpSingleAnimation(deployAnimationName, part); hasDeployAnimation = true; readyToFire = false; } } blastForce = BlastPhysicsUtils.CalculateExplosiveMass(blastRadius); }