Hi there everybody so I created a new category and I was wondering how would I sort the default tools into my brand new category I created.
It’s all sorted alphabetically
Edit: oh, I understand what you’re asking now. You can’t, at least not in any easy way. Each tool defines its own category. For example:
Remover tool is in the Construction category
Finger Poser is in the Poser category
What you could try to do is change each tool’s category in Lua AFTER they’ve been loaded but BEFORE they’re added to the spawn menu. This would have to be hacky code.
So is there no way to create a new category and say sort the balloon into there?
[editline]15th December 2016[/editline]
Because I see on some DarkRP servers where they have brand new category’s such like “admin tools” and they have some of the custom tools sorted into there. And I think it looks so professional to remove the useless tools and add the custom ones into new categorys
Custom tools can go wherever you want. Existing tools are the hard part. I’ve already said all I can say.
I could go into the existing code for something like the balloon and the TOOL.category = “Construction”
to something like TOOL.category = “Fun” right?
Yes, but that’s a bad idea because if they get updated, one of two things will happen depending on how you changed them: either it will revert back to the original category (“Construction” instead of “Fun”) and you’ll have to change it again, or it won’t be updated at all (and you lose out on the updated functionality or fixes).
Try this instead (untested, you will need to change some of this code):
[lua]hook.Add(“AddToolMenuCategories”, “ChangeDefaultToolsCategories”, function() – AddToolMenuCategories is the last hook run before PopulateToolMenu, where the changes don’t help anymore
for _, tool in pairs(baseclass.Get(“gmod_tool”).Tool) do
– if some condition then…
tool.Category = “Fun”
Would I put this into a new addon in my addons folder or put it somewhere in the tool that I am editing?