Skip to content

Commit

Permalink
Fix access denied notification spam
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachHembree committed Jan 29, 2021
1 parent b85c4f4 commit c1715e9
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,19 @@ private static PropertiesMenu Instance

private BlockData clipboard, pasteBackup;
private Stopwatch peekRefresh;
private readonly IMyHudNotification hudNotification;

private PropertiesMenu() : base(false, true)
{
DrawBoundingBox = false;
EnableWorldDraw = false;

targetGrid = new TerminalGrid();
Target = new PropertyBlock();

hudSpace = new CustomSpaceNode(HudMain.Root) { UpdateMatrixFunc = UpdateHudSpace };
scrollMenu = new BvScrollMenu(hudSpace) { Visible = false };
boundingBox = new BoundingBoard();
hudNotification = MyAPIGateway.Utilities.CreateNotification("", 1000, MyFontEnum.Red);

RichHudCore.LateMessageEntered += MessageHandler;
peekRefresh = new Stopwatch();
Expand Down Expand Up @@ -312,12 +313,14 @@ private bool TryGetTarget()

return true;
}
else if (scrollMenu.MenuMode != ScrollMenuModes.Peek)
else
{
if ((permissions & TerminalPermissionStates.GridUnfriendly) > 0)
MyAPIGateway.Utilities.ShowNotification($"Access denied. Grid unfriendly.", 1000, MyFontEnum.Red);
hudNotification.Text = $"Access denied. Grid unfriendly.";
else
MyAPIGateway.Utilities.ShowNotification("Access denied", 1000, MyFontEnum.Red);
hudNotification.Text = "Access denied";

hudNotification.Show();
}
}
}
Expand Down

0 comments on commit c1715e9

Please sign in to comment.