Ejemplo n.º 1
0
        public override bool ConnectionAllowed(ref Vector3I otherBlockPos, ref Vector3I faceNormal, MyCubeBlockDefinition def)
        {
            if (this.MountPoints == null)
            {
                return(true);
            }
            Vector3I           pos         = (Vector3I)(base.Position + faceNormal);
            MySlimBlock        cubeBlock   = base.CubeGrid.GetCubeBlock(pos);
            MyBlockOrientation orientation = (cubeBlock == null) ? MyBlockOrientation.Identity : cubeBlock.Orientation;
            Vector3I           position    = base.Position;

            this.m_mpCache.Clear();
            if ((cubeBlock != null) && (cubeBlock.FatBlock is MyFracturedBlock))
            {
                this.m_mpCache.AddRange((cubeBlock.FatBlock as MyFracturedBlock).MountPoints);
            }
            else if ((cubeBlock != null) && (cubeBlock.FatBlock is MyCompoundCubeBlock))
            {
                List <MyCubeBlockDefinition.MountPoint> outMountPoints = new List <MyCubeBlockDefinition.MountPoint>();
                foreach (MySlimBlock block2 in (cubeBlock.FatBlock as MyCompoundCubeBlock).GetBlocks())
                {
                    MyCubeBlockDefinition.MountPoint[] buildProgressModelMountPoints = block2.BlockDefinition.GetBuildProgressModelMountPoints(block2.BuildLevelRatio);
                    MyCubeGrid.TransformMountPoints(outMountPoints, block2.BlockDefinition, buildProgressModelMountPoints, ref block2.Orientation);
                    this.m_mpCache.AddRange(outMountPoints);
                }
            }
            else if (cubeBlock != null)
            {
                MyCubeBlockDefinition.MountPoint[] buildProgressModelMountPoints = def.GetBuildProgressModelMountPoints(cubeBlock.BuildLevelRatio);
                MyCubeGrid.TransformMountPoints(this.m_mpCache, def, buildProgressModelMountPoints, ref orientation);
            }
            return(MyCubeGrid.CheckMountPointsForSide(this.MountPoints, ref base.SlimBlock.Orientation, ref position, base.BlockDefinition.Id, ref faceNormal, this.m_mpCache, ref orientation, ref pos, def.Id));
        }
Ejemplo n.º 2
0
        public override bool ConnectionAllowed(ref Vector3I otherBlockPos, ref Vector3I faceNormal, MyCubeBlockDefinition def)
        {
            if (MountPoints == null)
            {
                return(true);
            }
            var otherPos = Position + faceNormal;
            var other    = CubeGrid.GetCubeBlock(otherPos);
            MyBlockOrientation or;

            if (other != null)
            {
                or = other.Orientation;
            }
            else
            {
                or = MyBlockOrientation.Identity;
            }
            var position = Position;

            m_mpCache.Clear();
            if (other != null && other.FatBlock is MyFracturedBlock)
            {
                m_mpCache.AddRange((other.FatBlock as MyFracturedBlock).MountPoints);
            }
            else
            {
                if (other != null && other.FatBlock is MyCompoundCubeBlock)
                {
                    var lst = new List <MyCubeBlockDefinition.MountPoint>();
                    foreach (var b in (other.FatBlock as MyCompoundCubeBlock).GetBlocks())
                    {
                        var mountPoints = b.BlockDefinition.GetBuildProgressModelMountPoints(b.BuildLevelRatio);
                        MyCubeGrid.TransformMountPoints(lst, b.BlockDefinition, mountPoints, ref b.Orientation);
                        m_mpCache.AddRange(lst);
                    }
                }
                else if (other != null)
                {
                    var mountPoints = def.GetBuildProgressModelMountPoints(other.BuildLevelRatio);
                    MyCubeGrid.TransformMountPoints(m_mpCache, def, mountPoints, ref or);
                }
            }
            return(MyCubeGrid.CheckMountPointsForSide(MountPoints, ref SlimBlock.Orientation, ref position, BlockDefinition.Id, ref faceNormal, m_mpCache,
                                                      ref or, ref otherPos, def.Id));
        }