Allow topmenu config file to sort with subcategories#1757
Allow topmenu config file to sort with subcategories#1757peace-maker merged 2 commits intoalliedmodders:masterfrom PeakKS:master
Conversation
|
Do you have an example plugin that would benefit from this change? |
|
I was working on something a while back where having a separate topmenu config would be completely redundant as all the information was already available in a different KV file used for creating the menu that the config would be sorting. For context, the plugin, the KV that already exists, the redundant top menu sorting file. Plus this does not affect the parsing of already existing top menu configs. |
KyleSanderson
left a comment
There was a problem hiding this comment.
This seems fine to me, just another level if people want it.
|
We should add some documentation for this as well. I guess this is the only place documenting sorting? https://wiki.alliedmods.net/Admin_Menu_Configuration_(SourceMod) |
Not sure if there's a way to just suggest changes on the wiki but does this look okay? Forgot this PR was still open haha. diff --git a/olddocs.txt b/newdocs.txt
index ac4fb66..f6206d2 100644
--- a/olddocs.txt
+++ b/newdocs.txt
@@ -37,5 +37,37 @@ This layout is designed to look similar to Mani Admin Plugin's admin menu.
}
}</pre>
+=Alternate Layout=
+Alternatively instead of "item" keys subkeys can be used, with their signifying the value. It is important to note that topmenu configs are not infinitely recursive, this subkey layout works at the top level but other keys further within will not be a part of the topmenus config. Instead the ability to use these subkeys is intented to allow one config to be used as both a topmenu configuration file and a normal keyvalues file, with all the necessary information inside.
+
+
+<pre>
+"Menu"
+{
+ "PlayerCommands"
+ {
+ "sm_slay"
+ {
+ ...
+ }
+ }
+
+ "ServerCommands"
+ {
+ "sm_map"
+ {
+ ...
+ }
+ }
+
+ "VotingCommands"
+ {
+ "sm_cancelvote"
+ {
+ ...
+ }
+ }
+}</pre>
+
[[Category:SourceMod Documentation]] |
|
You can login to the wiki using your forums account and change it directly. Thank you for writing this up. |
This allows some config files to be reused for sorting a topmenu as well. For example this config could be used both to load the data a plugin needs and to sort a topmenu:
Whereas this config can only be used to sort a topmenu: