Esempio n. 1
0
        public ConstructionCopy(ProceduralRoom room, RoomRemapper remapper = null)
        {
            Logger = room.Owner.Logger.Root().CreateProxy(GetType().Name);
            var i = room.Part.PrimaryGrid;
            var o = new MyObjectBuilder_CubeGrid
            {
                GridSizeEnum           = i.GridSizeEnum,
                IsStatic               = true,
                DampenersEnabled       = true,
                Handbrake              = true,
                DisplayName            = room.Owner.Seed.Name,
                DestructibleBlocks     = true,
                IsRespawnGrid          = false,
                Editable               = true,
                PersistentFlags        = MyPersistentEntityFlags2.Enabled | MyPersistentEntityFlags2.InScene | MyPersistentEntityFlags2.CastShadows,
                PositionAndOrientation = new MyPositionAndOrientation(GridCreator.WorldTransformFor(room.Owner))
            };

            BoundingBox = BoundingBoxD.CreateInvalid();

            Construction = room.Owner;
            PrimaryGrid  = o;
            AuxGrids     = new List <MyObjectBuilder_CubeGrid>();
            m_remapper   = remapper ?? new RoomRemapper(Logger.Root());

            var iwatch = new Stopwatch();

            m_remapper.Remap(room, this);
            Logger.Debug("Added room {3} of {0} blocks with {1} aux grids in {2}", room.Part.PrimaryGrid.CubeBlocks.Count, room.Part.Prefab.CubeGrids.Length - 1, iwatch.Elapsed, room.Part.Name);
        }
Esempio n. 2
0
        public static ConstructionCopy RemapAndBuild(ProceduralConstruction construction, RoomRemapper remapper = null)
        {
            ConstructionCopy grids = null;

            foreach (var room in construction.Rooms)
            {
                if (grids == null)
                {
                    grids = new ConstructionCopy(room, remapper);
                }
                else
                {
                    grids.AppendRoom(room);
                }
            }
            return(grids);
        }