public static MyObjectBuilder_CubeGrid CloneGrid(MyObjectBuilder_CubeGrid src) { return((MyObjectBuilder_CubeGrid)src.Clone()); // MyObjectBuilder_CubeGrid val; // if (gridCache.TryGetValue(src, out val)) return val; // return gridCache[src] = (MyObjectBuilder_CubeGrid) src.Clone(); }
public override MyObjectBuilder_CubeBlock GetObjectBuilderCubeBlock(bool copy = false) { MyObjectBuilder_ProjectorBase objectBuilder = (MyObjectBuilder_ProjectorBase)base.GetObjectBuilderCubeBlock(copy); if (m_clipboard != null && m_clipboard.CopiedGrids != null && m_clipboard.CopiedGrids.Count > 0 && m_originalGridBuilder != null) { if (copy) { var clone = (MyObjectBuilder_CubeGrid)m_originalGridBuilder.Clone(); MyEntities.RemapObjectBuilder(clone); objectBuilder.ProjectedGrid = clone; } else { objectBuilder.ProjectedGrid = m_originalGridBuilder; } objectBuilder.ProjectionOffset = m_projectionOffset; objectBuilder.ProjectionRotation = m_projectionRotation; objectBuilder.KeepProjection = m_keepProjection; } else { if (objectBuilder.ProjectedGrid == null && m_savedProjection != null && CubeGrid.Projector == null) { objectBuilder.ProjectedGrid = m_savedProjection; objectBuilder.ProjectionOffset = m_projectionOffset; objectBuilder.ProjectionRotation = m_projectionRotation; objectBuilder.KeepProjection = m_keepProjection; } else { objectBuilder.ProjectedGrid = null; } } objectBuilder.ShowOnlyBuildable = m_showOnlyBuildable; objectBuilder.InstantBuildingEnabled = m_instantBuildingEnabled; objectBuilder.MaxNumberOfProjections = m_maxNumberOfProjections; objectBuilder.MaxNumberOfBlocks = m_maxNumberOfBlocksPerProjection; objectBuilder.ProjectionsRemaining = m_projectionsRemaining; objectBuilder.GetOwnershipFromProjector = m_getOwnershipFromProjector; return(objectBuilder); }
internal void SetNewBlueprint(MyObjectBuilder_CubeGrid gridBuilder) { m_originalGridBuilder = gridBuilder; var clone = (MyObjectBuilder_CubeGrid)gridBuilder.Clone(); MyEntities.RemapObjectBuilder(clone); m_clipboard.ProcessCubeGrid(clone); m_clipboard.SetGridFromBuilder(clone, Vector3.Zero, 0f); if (m_instantBuildingEnabled) { ResetRotation(); var boundingBox = clone.CalculateBoundingBox(); // Add 1 to get the center out of the bounds and another 1 for a gap m_projectionOffset.Y = Math.Abs((int)(boundingBox.Min.Y / MyDefinitionManager.Static.GetCubeSize(clone.GridSizeEnum))) + 2; } InitializeClipboard(); }
public override void UpdateOnceBeforeFrame() { base.UpdateOnceBeforeFrame(); //Only create projections from real projectors if (CubeGrid.Physics != null && m_savedProjection != null) { var clone = (MyObjectBuilder_CubeGrid)m_savedProjection.Clone(); MyEntities.RemapObjectBuilder(clone); m_clipboard.ProcessCubeGrid(clone); m_clipboard.SetGridFromBuilder(clone, Vector3.Zero, 0f); m_originalGridBuilder = m_savedProjection; m_savedProjection = null; InitializeClipboard(); //This will just issue the request //It will only remove it only if conditions are not met a few frames later RequestRemoveProjection(); } UpdateEmissivity(); }
internal void SetNewBlueprint(MyObjectBuilder_CubeGrid gridBuilder) { m_originalGridBuilder = gridBuilder; var clone = (MyObjectBuilder_CubeGrid)gridBuilder.Clone(); MyEntities.RemapObjectBuilder(clone); m_clipboard.ProcessCubeGrid(clone); m_clipboard.SetGridFromBuilder(clone, Vector3.Zero, 0f); if (m_instantBuildingEnabled) { ResetRotation(); var boundingBox = clone.CalculateBoundingBox(); // Add 1 to get the center out of the bounds and another 1 for a gap m_projectionOffset.Y = Math.Abs((int)(boundingBox.Min.Y / MyDefinitionManager.Static.GetCubeSize(clone.GridSizeEnum))) + 2; } InitializeClipboard(); }