private bool Stage_Build()
 {
     Module.Debug("Build stage for {0}/{1}", m_cell, Seed.Seed);
     m_grids = GridCreator.RemapAndBuild(m_construction);
     if (m_grids != null)
     {
         Module.Debug("Build stage success for {0}/{1}", m_cell, Seed.Seed);
         if (!IsMarkedForRemoval)
         {
             return(true);
         }
     }
     else
     {
         Module.Warning("Build stage failed for {0}/{1}", m_cell, Seed.Seed);
     }
     m_component = null;
     return(false);
 }
 public bool GenerateFromSeedAndRemap(ProceduralConstructionSeed seed, ref ProceduralConstruction construction, out ConstructionCopy grids, int?roomCount = null)
 {
     grids = null;
     try
     {
         if (!GenerateFromSeed(seed, ref construction, roomCount))
         {
             Log(MyLogSeverity.Debug, "Failed to generate from seed");
             return(false);
         }
         var watch = new Stopwatch();
         watch.Restart();
         grids = GridCreator.RemapAndBuild(construction);
         Log(MyLogSeverity.Debug, "Added {0} rooms in {1}", construction.Rooms.Count(), watch.Elapsed);
         return(true);
     }
     catch (Exception e)
     {
         Log(MyLogSeverity.Error, "Failed to generate station.\n{0}", e.ToString());
         return(false);
     }
 }
        private string ProcessDebugPart(CommandFeedback feedback, string partName)
        {
            var part = m_partManager.FirstOrDefault(test => test.Prefab.Id.SubtypeName.ToLower().Contains(partName.ToLower()));

            if (part == null)
            {
                return("Unable to find part with name \"" + partName + "\"");
            }
            var position = MyAPIGateway.Session.Camera.Position + MyAPIGateway.Session.Camera.WorldMatrix.Forward * 100;
            var seed     = new ProceduralConstructionSeed(new ProceduralFactionSeed("dummy", 0), new Vector4D(position, 0.5), null, 0);

            MyAPIGateway.Parallel.Start(() =>
            {
                var construction = new ProceduralConstruction(RootLogger, seed);
                var room         = new ProceduralRoom();
                room.Init(new MatrixI(Base6Directions.Direction.Forward, Base6Directions.Direction.Up), part);
                construction.AddRoom(room);
                var remapper = new RoomRemapper(RootLogger)
                {
                    DebugRoomColors = true
                };
                var grids = GridCreator.RemapAndBuild(construction, remapper);
                if (grids == null)
                {
                    return;
                }
                MyAPIGateway.Utilities.InvokeOnGameThread(() =>
                {
                    var component = grids.SpawnAsync();
                    if (component != null)
                    {
                        component.ForceDebugDraw = true;
                    }
                });
            });
            return(null);
        }