spawnmenu icon

This commit is contained in:
TheOnly8Z 2023-11-22 16:48:32 -08:00
parent b5db9a539a
commit b555464d49
3 changed files with 25 additions and 0 deletions

View File

@ -764,4 +764,25 @@ hook.Add("PopulateToolMenu", "ArcCW_Options", function()
for menu, data in pairs(ArcCW.ClientMenus) do
spawnmenu.AddToolMenuOption("Options", "ArcCW", menu, data.text, "", "", data.func)
end
end)
-- As of 2023-11-12, this feature is only available on dev branch.
-- Won't break anything on release branch though.
list.Set("ContentCategoryIcons", "ArcCW - Ammo", "arccw/icon_16.png")
list.Set("ContentCategoryIcons", "ArcCW - Attachments", "arccw/icon_16.png")
-- Give all categories with ArcCW weapons our icon unless one is already set
local first_populate = true
hook.Add("PopulateWeapons", "ArcCW_ContentCategoryIcons", function()
if !first_populate then return end
for i, wep in pairs(weapons.GetList()) do
local weap = weapons.Get(wep.ClassName)
if weap and weap.ArcCW then
local cat = weap.Category
if cat and !list.HasEntry("ContentCategoryIcons", cat) then
list.Set("ContentCategoryIcons", cat, "arccw/icon_16.png")
end
end
end
first_populate = false
end)

View File

@ -44,6 +44,10 @@ function ArcCW.LoadAttachmentType(att, name)
[att.ShortName] = 1
}
if att.EntityCategory and !list.HasEntry("ContentCategoryIcons", att.EntityCategory) then
list.Set("ContentCategoryIcons", att.EntityCategory, "arccw/icon_16.png")
end
scripted_ents.Register( attent, "acwatt_" .. name )
end

BIN
materials/arccw/icon_16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB