Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Spawn Menu Customization #2142

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

Zaurzo
Copy link
Contributor

@Zaurzo Zaurzo commented Oct 31, 2024

This pull request aims to add more customization to the spawn menu.

Sub category headers for NPCs, Weapons, Entities, and Vehicles

This adds SubCategory to the ENT and SWEP structs.

Example
spawnmenu_headers
(This pull request does not add these headers to any of the default NPC categories. This is just a demonstration.)

Ability to easily add options to the right click menu for Content Icons and Spawn Icons

Adds two hooks and one function to achieve this:

  • GetOpenDermaMenus() function
  • OnContentIconOpenMenu hook
  • OnSpawnIconOpenMenu hook

Example
Code:

hook.Add('OnContentIconOpenMenu', 'CopyName', function(icon, menu)
    if icon:GetContentType() ~= 'npc' then return end

    menu:AddOption('Copy Name', function()
        SetClipboardText(language.GetPhrase(icon.m_NiceName))
    end):SetIcon( "icon16/page_copy.png" )
end)

Output:
spawnmenu_copy

Custom spawn list ordering for NPCs, Weapons, Entities, and Vehicles

This adds SpawnListOrder to the ENT and SWEP structs. This determines the order in which the icons will be created in. This mixes well with the default alphabetical ordering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant