Ejemplo n.º 1
0
        private void grid_OnBlockRemoved(IMySlimBlock slim)
        {
            using (lock_cellPositions.AcquireExclusiveUsing())
            {
                if (slim.FatBlock is IMyDoor && ((MyCubeBlock)slim.FatBlock).Subparts.Count != 0)
                {
                    LargeDoors.Remove((MyCubeBlock)slim.FatBlock);
                    return;
                }

                // some cells may not be occupied
                slim.ForEachCell(cell => {
                    CellPositions.Remove(cell);
                    return(false);
                });
            }
        }
Ejemplo n.º 2
0
        private void Add(IMySlimBlock slim)
        {
            bool checkLocal;

            if (slim.FatBlock != null)
            {
                if (slim.FatBlock is IMyDoor && ((MyCubeBlock)slim.FatBlock).Subparts.Count != 0)
                {
                    LargeDoors.Add((MyCubeBlock)slim.FatBlock);
                    return;
                }

                checkLocal = slim.FatBlock is IMyMotorStator || slim.FatBlock is IMyPistonBase;
            }
            else
            {
                checkLocal = false;
            }

            slim.ForEachCell(cell => {
                if (checkLocal)
                {
                    // for piston base and stator, cell may not actually be inside local AABB
                    // if this is done for doors, they would always be treated as open
                    // other blocks have not been tested
                    Vector3 positionBlock = Vector3.Transform(slim.CubeGrid.GridIntegerToWorld(cell), slim.FatBlock.WorldMatrixNormalizedInv);

                    if (slim.FatBlock.LocalAABB.Contains(positionBlock) == ContainmentType.Disjoint)
                    {
                        return(false);
                    }
                }

                CellPositions.Add(cell);
                return(false);
            });
        }
Ejemplo n.º 3
0
        private void grid_OnBlockRemoved(IMySlimBlock slim)
        {
            using (lock_cellPositions.AcquireExclusiveUsing())
            {
                if (slim.FatBlock is IMyDoor && ((MyCubeBlock)slim.FatBlock).Subparts.Count != 0)
                {
                    LargeDoors.Remove((MyCubeBlock)slim.FatBlock);
                    return;
                }

                // some cells may not be occupied
                slim.ForEachCell(cell => {
                    CellPositions.Remove(cell);
                    return false;
                });
            }
        }
Ejemplo n.º 4
0
        private void Add(IMySlimBlock slim)
        {
            bool checkLocal;
            if (slim.FatBlock != null)
            {
                if (slim.FatBlock is IMyDoor && ((MyCubeBlock)slim.FatBlock).Subparts.Count != 0)
                {
                    LargeDoors.Add((MyCubeBlock)slim.FatBlock);
                    return;
                }

                checkLocal = slim.FatBlock is IMyMotorStator || slim.FatBlock is IMyPistonBase;
            }
            else
                checkLocal = false;

            slim.ForEachCell(cell => {
                if (checkLocal)
                {
                    // for piston base and stator, cell may not actually be inside local AABB
                    // if this is done for doors, they would always be treated as open
                    // other blocks have not been tested
                    Vector3 positionBlock = Vector3.Transform(slim.CubeGrid.GridIntegerToWorld(cell), slim.FatBlock.WorldMatrixNormalizedInv);

                    if (slim.FatBlock.LocalAABB.Contains(positionBlock) == ContainmentType.Disjoint)
                        return false;
                }

                CellPositions.Add(cell);
                return false;
            });
        }
Ejemplo n.º 5
0
 private void grid_OnBlockRemoved(IMySlimBlock slim)
 {
     using (lock_cellPositions.AcquireExclusiveUsing())
         slim.ForEachCell(cell => {
             CellPositions.Remove(cell);
             return false;
         });
 }
Ejemplo n.º 6
0
        private void Add(IMySlimBlock slim)
        {
            //IMyDoor asDoor = slim.FatBlock as IMyDoor;
            //if (asDoor != null)
            //{
            //	return;
            //}

            slim.ForEachCell(cell => {
                CellPositions.Add(cell);
                return false;
            });
        }