Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Remove ability to blueprint enemy ships while in survival mode #534

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions Sources/Sandbox.Game/Game/Entities/Cube/MyCubeBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down