diff --git a/Sources/Sandbox.Game/Game/Entities/Cube/MyCubeBuilder.cs b/Sources/Sandbox.Game/Game/Entities/Cube/MyCubeBuilder.cs index 9eed5b5b12..648db4e071 100644 --- a/Sources/Sandbox.Game/Game/Entities/Cube/MyCubeBuilder.cs +++ b/Sources/Sandbox.Game/Game/Entities/Cube/MyCubeBuilder.cs @@ -1742,20 +1742,40 @@ public bool HandleGameInput() { MySessionComponentVoxelHand.Static.Enabled = false; var copiedGrid = MyCubeGrid.GetTargetGrid(); - if (!MyInput.Static.IsAnyShiftKeyPressed()) - m_clipboard.CopyGroup(copiedGrid, MyInput.Static.IsAnyAltKeyPressed() ? GridLinkTypeEnum.Physical : GridLinkTypeEnum.Logical); - else - m_clipboard.CopyGrid(copiedGrid); + Boolean ownerInplayerFaction = false; + var faction = MySession.Static.Factions.TryGetPlayerFaction(MySession.Static.LocalPlayerId); + for (int i = 0; i < copiedGrid.BigOwners.Count; i++ ) + { + if (faction != null) + { + if (MySession.Static.Factions.TryGetPlayerFaction(copiedGrid.BigOwners[i]) == faction) + { + ownerInplayerFaction = true; + break; + } + } + else + { + break; + } + } + if (copiedGrid.BigOwners.Contains(MySession.Static.LocalPlayerId) || ownerInplayerFaction || !MySession.Static.SurvivalMode || copiedGrid.BigOwners.Count == 0) //If player owns ship, or owner is in players faction, or in creative mode or ship is neutral + { + if (!MyInput.Static.IsAnyShiftKeyPressed()) + m_clipboard.CopyGroup(copiedGrid, MyInput.Static.IsAnyAltKeyPressed() ? GridLinkTypeEnum.Physical : GridLinkTypeEnum.Logical); + else + m_clipboard.CopyGrid(copiedGrid); - UpdatePasteNotification(MyCommonTexts.CubeBuilderPasteNotification); + UpdatePasteNotification(MyCommonTexts.CubeBuilderPasteNotification); - var blueprintScreen = new MyGuiBlueprintScreen(m_clipboard); - if (copiedGrid != null) - { - blueprintScreen.CreateFromClipboard(true); + var blueprintScreen = new MyGuiBlueprintScreen(m_clipboard); + if (copiedGrid != null) + { + blueprintScreen.CreateFromClipboard(true); + } + m_clipboard.Deactivate(); + MyGuiSandbox.AddScreen(blueprintScreen); } - m_clipboard.Deactivate(); - MyGuiSandbox.AddScreen(blueprintScreen); } return true; }