예제 #1
0
        private void GetFilteredItems(Vector3D epiCenter, double rangeCap, double dirYield)
        {
            _warHeadCubeHits.Clear();
            _warHeadGridShapes.Clear();
            var myCubeList = new List <MyEntity>();

            foreach (var grid in _warHeadGridHits)
            {
                var invSqrDist = UtilsStatic.InverseSqrDist(epiCenter, grid.PositionComp.WorldAABB.Center, rangeCap);
                var damage     = (uint)(dirYield * invSqrDist) * 5;
                var gridAabb   = grid.PositionComp.WorldAABB;
                var sphere     = CustomCollision.NewObbClosestTriCorners(grid, epiCenter);

                grid.Hierarchy.QueryAABB(ref gridAabb, myCubeList);
                _warHeadGridShapes.Add(grid, new WarHeadHit(sphere, damage));
            }

            for (int i = 0; i < myCubeList.Count; i++)
            {
                var myEntity = myCubeList[i];
                var myCube   = myEntity as MyCubeBlock;

                if (myCube == null || myCube.MarkedForClose)
                {
                    continue;
                }
                if ((myCube is IMyThrust || myCube is IMyUserControllableGun || myCube is IMyUpgradeModule) && myCube.IsFunctional && myCube.IsWorking)
                {
                    _warHeadCubeHits.Add(myCube);
                }
            }
            if (Enforced.Debug >= 2)
            {
                Log.Line($"[ComputeEmpBlast] AllFat:{myCubeList.Count} - TrimmedFat:{_warHeadCubeHits.Count}");
            }
        }