Use window created by context menu for view requests (#3213)

* Use window created by context menu for view requests

Prevents creating a ghost DFrame that lingers eternally every time the View Requests button is pressed

* Fix View Request menu duplication

* Fix linter warnings

---------

Co-authored-by: github-is-garbage <github-is-garbage@users.noreply.github.com>
Co-authored-by: Redox <git@redox.to>
This commit is contained in:
github-is-garbage 2024-12-10 17:28:04 -05:00 committed by GitHub
parent 254aa69180
commit 43fc8dd827
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,19 +31,19 @@ end)
list.Set("DesktopWindows", "WireExpression2_ViewRequestMenu", {
title = "View Requests",
icon = "beer/wiremod/gate_e2", -- Use whatever icon you want here, I just picked my favourite out of the available E2 ones
onewindow = true,
init = function(icon, window)
local container = vgui.Create("DFrame")
container:SetTitle("Expression 2 View Requests")
window:SetTitle("Expression 2 View Requests")
container:SetSize(ScrW() * 0.3, ScrH() * 0.6)
container:SetSizable(true)
container:SetMinWidth(ScrW() * 0.1)
container:SetMinHeight(ScrH() * 0.2)
window:SetSize(ScrW() * 0.3, ScrH() * 0.6)
window:SetSizable(true)
window:SetMinWidth(ScrW() * 0.1)
window:SetMinHeight(ScrH() * 0.2)
container:Center()
container:MakePopup()
window:Center()
local reqList = vgui.Create("DListView", container)
local reqList = vgui.Create("DListView", window)
reqList:Dock(FILL)
reqList:SetMultiSelect(false)
@ -99,7 +99,7 @@ list.Set("DesktopWindows", "WireExpression2_ViewRequestMenu", {
end
mnu:AddOption("Accept Once", function()
local confirm = Derma_Query(
Derma_Query(
"Are you SURE you want "..line.initiator:Nick().." to have complete access to the code in your chip '"..viewRequests[line.initiator][line.chip].name.."'?\nThis means they are able to steal and redistribute it, so you should only do this if you are certain you can trust them",
"Confirm",
"Yes", function()
@ -113,7 +113,7 @@ list.Set("DesktopWindows", "WireExpression2_ViewRequestMenu", {
)
end)
mnu:AddOption("Accept Always", function()
local confirm = Derma_Query(
Derma_Query(
"Are you SURE you want "..line.initiator:Nick().." to have complete access to the code in your chip '"..viewRequests[line.initiator][line.chip].name.."' for the duration the chip entity exists?\nThis means they are able to steal and redistribute it, as well as view any modifications you make to the chip, so you should only do this if you are certain you can trust them",
"Confirm",
"Yes", function()