multiple changes

- use default icons
- dont break spawn menu if icon convars are blank
- dont create a dedicated tab for themer
This commit is contained in:
edshot99 2024-07-10 16:12:57 -05:00
parent a1c373aeb0
commit 2916415c79
2 changed files with 36 additions and 19 deletions

View File

@ -9,11 +9,11 @@ local themer_spawnlist_icons = CreateClientConVar("themer_spawnlist_icons", "0",
local themer_icon_spawnlists = CreateClientConVar("themer_icon_spawnlists", "icon16/application_view_tile.png", true)
local themer_icon_weapons = CreateClientConVar("themer_icon_weapons", "icon16/gun.png", true)
local themer_icon_ents = CreateClientConVar("themer_icon_ents", "icon16/bricks.png", true)
local themer_icon_npcs = CreateClientConVar("themer_icon_npcs", "icon16/group.png", true)
local themer_icon_npcs = CreateClientConVar("themer_icon_npcs", "icon16/monkey.png", true)
local themer_icon_cars = CreateClientConVar("themer_icon_cars", "icon16/car.png", true)
local themer_icon_pp = CreateClientConVar("themer_icon_pp", "icon16/image.png", true)
local themer_icon_dupes = CreateClientConVar("themer_icon_dupes", "icon16/brick_link.png", true)
local themer_icon_saves = CreateClientConVar("themer_icon_saves", "icon16/disk.png", true)
local themer_icon_pp = CreateClientConVar("themer_icon_pp", "icon16/picture.png", true)
local themer_icon_dupes = CreateClientConVar("themer_icon_dupes", "icon16/control_repeat_blue.png", true)
local themer_icon_saves = CreateClientConVar("themer_icon_saves", "icon16/disk_multiple.png", true)
-- }}}
include("themer/iconbrowser.lua")
@ -165,6 +165,31 @@ hook.Add("SpawnMenuOpen", "Themer.IconHack", function()
end
end
if themer_icon_spawnlists:GetString() == "" then
themer_icon_spawnlists:SetString("icon16/application_view_tile.png")
end
if themer_icon_weapons:GetString() == "" then
themer_icon_weapons:SetString("icon16/gun.png")
end
if themer_icon_ents:GetString() == "" then
themer_icon_ents:SetString("icon16/bricks.png")
end
if themer_icon_npcs:GetString() == "" then
themer_icon_npcs:SetString("icon16/monkey.png")
end
if themer_icon_cars:GetString() == "" then
themer_icon_cars:SetString("icon16/car.png")
end
if themer_icon_pp:GetString() == "" then
themer_icon_pp:SetString("icon16/picture.png")
end
if themer_icon_dupes:GetString() == "" then
themer_icon_dupes:SetString("icon16/control_repeat_blue.png")
end
if themer_icon_saves:GetString() == "" then
themer_icon_saves:SetString("icon16/disk_multiple.png")
end
local SpawnTabs = g_SpawnMenu.CreateMenu.Items
for _, tab in ipairs(SpawnTabs) do
if tab.Name == "#spawnmenu.content_tab" then
@ -196,7 +221,7 @@ hook.Add("SpawnMenuOpen", "Themer.IconHack", function()
end
if tab.Name == "#spawnmenu.category.npcs" then
tab.Tab.Image:SetImage(Material(themer_icon_npcs:GetString()):IsError() and "icon16/group.png" or themer_icon_npcs:GetString())
tab.Tab.Image:SetImage(Material(themer_icon_npcs:GetString()):IsError() and "icon16/monkey.png" or themer_icon_npcs:GetString())
end
if tab.Name == "#spawnmenu.category.vehicles" then
@ -204,15 +229,15 @@ hook.Add("SpawnMenuOpen", "Themer.IconHack", function()
end
if tab.Name == "#spawnmenu.category.postprocess" then
tab.Tab.Image:SetImage(Material(themer_icon_pp:GetString()):IsError() and "icon16/image.png" or themer_icon_pp:GetString())
tab.Tab.Image:SetImage(Material(themer_icon_pp:GetString()):IsError() and "icon16/picture.png" or themer_icon_pp:GetString())
end
if tab.Name == "#spawnmenu.category.dupes" then
tab.Tab.Image:SetImage(Material(themer_icon_dupes:GetString()):IsError() and "icon16/brick_link.png" or themer_icon_dupes:GetString())
tab.Tab.Image:SetImage(Material(themer_icon_dupes:GetString()):IsError() and "icon16/control_repeat_blue.png" or themer_icon_dupes:GetString())
end
if tab.Name == "#spawnmenu.category.saves" then
tab.Tab.Image:SetImage(Material(themer_icon_saves:GetString()):IsError() and "icon16/disk.png" or themer_icon_saves:GetString())
tab.Tab.Image:SetImage(Material(themer_icon_saves:GetString()):IsError() and "icon16/disk_multiple.png" or themer_icon_saves:GetString())
end
end
end)

View File

@ -169,17 +169,9 @@ local function About(panel)
end
hook.Add("PopulateToolMenu", "Themer.ToolMenu", function()
spawnmenu.AddToolMenuOption("Theming", "Theming", "Theme Options", "Theme Options", "", "", MakeMenu)
spawnmenu.AddToolMenuOption("Theming", "Theming", "\xe2\x80\x8bIcons", "\xe2\x80\x8bIcons", "", "", IconSettings)
spawnmenu.AddToolMenuOption("Theming", "Theming", "\xe2\x80\x8b\xe2\x80\x8bAbout", "\xe2\x80\x8b\xe2\x80\x8bAbout", "", "", About)
for _, tab in ipairs(spawnmenu.GetTools()) do
if tab.Name == "Theming" then
tab.Icon = "icon16/palette.png"
elseif tab.Name == "Utilities" and themer_options_gear:GetBool() then
tab.Icon = "icon16/cog.png"
end
end
spawnmenu.AddToolMenuOption("Options","Themer","ThemerTheming","Theme Options","","",MakeMenu)
spawnmenu.AddToolMenuOption("Options","Themer","ThemerConfiguration","Icons","","",IconSettings)
spawnmenu.AddToolMenuOption("Options","Themer","ThemerMisc","About","","",About)
end)
-- External Settings Menu