public GuidedMissileLauncher(WeaponTargeting weapon) { m_weaponTarget = weapon; m_relayPart = RelayClient.GetOrCreateRelayPart(m_weaponTarget.CubeBlock); this._initialTarget = NoTarget.Instance; MyWeaponBlockDefinition defn = (MyWeaponBlockDefinition)CubeBlock.GetCubeBlockDefinition(); Vector3[] points = new Vector3[3]; Vector3 forwardAdjust = Vector3.Forward * WeaponDescription.GetFor(CubeBlock).MissileSpawnForward; points[0] = CubeBlock.LocalAABB.Min + forwardAdjust; points[1] = CubeBlock.LocalAABB.Max + forwardAdjust; points[2] = CubeBlock.LocalAABB.Min + Vector3.Up * defn.Size.Y * CubeBlock.CubeGrid.GridSize + forwardAdjust; MissileSpawnBox = BoundingBox.CreateFromPoints(points); if (m_weaponTarget.myTurret != null) { Log.TraceLog("original box: " + MissileSpawnBox); MissileSpawnBox.Inflate(CubeBlock.CubeGrid.GridSize * 2f); } Log.TraceLog("MissileSpawnBox: " + MissileSpawnBox); myInventory = ((MyEntity)CubeBlock).GetInventoryBase(0); Registrar.Add(weapon.CubeBlock, this); m_weaponTarget.GuidedLauncher = true; m_gameCooldownTime = TimeSpan.FromSeconds(60d / MyDefinitionManager.Static.GetWeaponDefinition(defn.WeaponDefinitionId).WeaponAmmoDatas[(int)MyAmmoType.Missile].RateOfFire); Log.TraceLog("m_gameCooldownTime: " + m_gameCooldownTime); CubeBlock.AppendingCustomInfo += CubeBlock_AppendingCustomInfo; }
public static bool IsGuidedMissileLauncher(IMyCubeBlock block) { return(block is IMyUserControllableGun && WeaponDescription.GetFor(block).GuidedMissileLauncher); }