/// <summary> /// Adds the room to the construction and clears the open list of invalid entries. /// </summary> /// <param name="room"></param> private void CommitRoom(ProceduralRoom room) { // Add to the construction m_construction.AddRoom(room); foreach (var mount in room.MountPoints) { var attach = mount.AttachedTo; if (attach == null) { m_openMountPoints.Enqueue(mount); continue; } // Clear the open list of invalid entries foreach (var other in m_possibleRooms[mount]) { other.InFactor--; if (other.InFactor == 0) { m_openRooms.Remove(other.Key); } } m_possibleRooms.Remove(mount); } m_openRooms.Remove(new RoomKey(room.Transform, room.Part)); }
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); }