Project Zomboid

Project Zomboid

Mutie's Context Menu Icons
ㄥㄖ尺乇 19. okt. 2024 kl. 12:38
Making the mod more versatile
You can make a new helper function that can look for a partial string match instead of being the exact context menu option by creating this function:

require "ISUI/ISContextMenu";

function ISContextMenu:getOptionFromStringIncluded(name)
ㅤfor i, v in ipairs(self.options) do
ㅤㅤif string.find(string.lower(name), string.lower(v.name), 1, true) then
ㅤㅤㅤreturn v
ㅤㅤend
ㅤend
end


Then, some context menu options can be set like this:

require("MutiesContextMenuIcons/HelperFunctions");

MutiesContextMenuIcons.Options["Rename"] = "media/ui/icons/redrawn/small/Rename.png";


So it'll just see if the options include the word "Rename" and apply the icon. I think this would make things easier
Sidst redigeret af ㄥㄖ尺乇; 19. okt. 2024 kl. 13:01
< >
Viser 1-3 af 3 kommentarer
ㄥㄖ尺乇 19. okt. 2024 kl. 23:48 
Made a mod for this:
Context Menu Icon MANIA

Feel free to check out the code. I reckoned the best way to apply the icon is to hook into addOption and make a separate object of options (Partial Match vs Exact Match)

And I made it so some can have a partial match, i.e. allowing in-between strings to exist but adding the same icon if a context option says "Remove [x] from [y]"
Sidst redigeret af ㄥㄖ尺乇; 20. okt. 2024 kl. 17:16
Mutie  [udvikler] 19. dec. 2024 kl. 10:42 
I like this approach, and I'd like to write it up in my own way and add it to the community library[github.com] Chuck is building, if you don't mind.
ㄥㄖ尺乇 3. jan. kl. 13:26 
That sounds awesome!

I should mention one caveat to this is that translations will need to be made manually. Maybe we could find a way around that, though
< >
Viser 1-3 af 3 kommentarer
Per side: 1530 50