示例#1
0
        private bool FieldShapeBlocked()
        {
            ModulatorGridComponent modComp;

            MyGrid.Components.TryGet(out modComp);
            if (ShieldComp.Modulator == null || ShieldComp.Modulator.ModSet.Settings.ModulateVoxels || Session.Enforced.DisableVoxelSupport == 1)
            {
                return(false);
            }

            var pruneSphere = new BoundingSphereD(DetectionCenter, BoundingRange);
            var pruneList   = new List <MyVoxelBase>();

            MyGamePruningStructure.GetAllVoxelMapsInSphere(ref pruneSphere, pruneList);

            if (pruneList.Count == 0)
            {
                return(false);
            }
            MobileUpdate();
            Icosphere.ReturnPhysicsVerts(DetectMatrixOutside, ShieldComp.PhysicsOutsideLow);
            foreach (var voxel in pruneList)
            {
                if (voxel.RootVoxel == null || voxel != voxel.RootVoxel)
                {
                    continue;
                }
                if (!CustomCollision.VoxelContact(ShieldComp.PhysicsOutsideLow, voxel))
                {
                    continue;
                }

                Shield.Enabled             = false;
                DsState.State.FieldBlocked = true;
                DsState.State.Message      = true;
                if (Session.Enforced.Debug == 3)
                {
                    Log.Line($"Field blocked: - ShieldId [{Shield.EntityId}]");
                }
                return(true);
            }
            DsState.State.FieldBlocked = false;
            return(false);
        }