示例#1
0
        /// <summary>
        /// Retrieves a set of custom block actions.
        /// </summary>
        private void GetScrollableActions()
        {
            if (SubtypeId.UsesSubtype(TBlockSubtypes.MechanicalConnection))
            {
                BlockAction.GetMechActions(this, blockMembers);
            }

            if (SubtypeId.UsesSubtype(TBlockSubtypes.Door))
            {
                BlockAction.GetDoorActions(this, blockMembers);
            }

            if (SubtypeId.UsesSubtype(TBlockSubtypes.Warhead))
            {
                BlockAction.GetWarheadActions(this, blockMembers);
            }

            if (SubtypeId.UsesSubtype(TBlockSubtypes.LandingGear))
            {
                BlockAction.GetGearActions(this, blockMembers);
            }

            if (SubtypeId.UsesSubtype(TBlockSubtypes.Connector))
            {
                BlockAction.GetConnectorActions(this, blockMembers);
            }

            if (SubtypeId.UsesSubtype(TBlockSubtypes.Programmable))
            {
                BlockAction.GetProgrammableBlockActions(this, blockMembers);
            }

            if (SubtypeId.UsesSubtype(TBlockSubtypes.Timer))
            {
                BlockAction.GetTimerActions(this, blockMembers);
            }
        }
示例#2
0
        internal static void BuildStructureFromCubic(MyObjectBuilder_CubeGrid entity, CubeType[][][] cubic, bool fillObject, SubtypeId blockType, SubtypeId slopeBlockType, SubtypeId cornerBlockType, SubtypeId inverseCornerBlockType)
        {
            var xCount = cubic.Length;
            var yCount = cubic[0].Length;
            var zCount = cubic[0][0].Length;

            for (var x = 0; x < xCount; x++)
            {
                for (var y = 0; y < yCount; y++)
                {
                    for (var z = 0; z < zCount; z++)
                    {
                        if ((cubic[x][y][z] != CubeType.None && cubic[x][y][z] != CubeType.Interior) ||
                            (cubic[x][y][z] == CubeType.Interior && fillObject))
                        {
                            MyObjectBuilder_CubeBlock newCube;
                            entity.CubeBlocks.Add(newCube = new MyObjectBuilder_CubeBlock());

                            if (cubic[x][y][z].ToString().StartsWith("Cube"))
                            {
                                newCube.SubtypeName = blockType.ToString();
                            }
                            else if (cubic[x][y][z].ToString().StartsWith("Slope"))
                            {
                                newCube.SubtypeName = slopeBlockType.ToString();
                            }
                            else if (cubic[x][y][z].ToString().StartsWith("NormalCorner"))
                            {
                                newCube.SubtypeName = cornerBlockType.ToString();
                            }
                            else if (cubic[x][y][z].ToString().StartsWith("InverseCorner"))
                            {
                                newCube.SubtypeName = inverseCornerBlockType.ToString();
                            }
                            else if (cubic[x][y][z] == CubeType.Interior && fillObject)
                            {
                                newCube.SubtypeName = blockType.ToString();
                                cubic[x][y][z] = CubeType.Cube;
                            }

                            newCube.EntityId = 0;
                            newCube.BlockOrientation = GetCubeOrientation(cubic[x][y][z]);
                            newCube.Min = new Vector3I(x, y, z);
                        }
                    }
                }
            }
        }