예제 #1
0
        private void OnSpawnProjection()
        {
            if (CanSpawnProjection())
            {
                var clone = (MyObjectBuilder_CubeGrid)m_originalGridBuilder.Clone();
                MyEntities.RemapObjectBuilder(clone);

                if (m_getOwnershipFromProjector)
                {
                    foreach (var block in clone.CubeBlocks)
                    {
                        block.Owner     = OwnerId;
                        block.ShareMode = IDModule.ShareMode;
                    }
                }

                m_spawnClipboard.SetGridFromBuilder(clone, Vector3.Zero, 0f);

                m_spawnClipboard.ResetGridOrientation();
                if (!m_spawnClipboard.IsActive)
                {
                    m_spawnClipboard.Activate();
                }
                SetRotation(m_spawnClipboard, m_projectionRotation);
                m_spawnClipboard.Update();
                if (m_spawnClipboard.ActuallyTestPlacement() && m_spawnClipboard.PasteGrid())
                {
                    OnConfirmSpawnProjection();
                }

                m_spawnClipboard.Deactivate();
                m_spawnClipboard.Clear();
            }
        }
예제 #2
0
        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();
        }