Implement per-client randomized menus with MenuShufflePerClient native.#1073
Conversation
|
Would you like to add a native that can change the position of choice for each client? |
|
Yeah that could be added, what's your use case for that though? You mean something like: and then you do |
|
Since I would like to show different clients with different predetermined orders, and a swap will make thing a little bit complicated, a direct call to set all options or a callback like // Assume we have menu has 6 options
Menu menu;
int choice[6];
GetChoiceForClient(client, choice, sizeof(choice)); // return: choice = {2, 1, 0, 4, 5, 3};
menu.SetOptionsPos(client, choice, sizeof(choice));
/*
Vote menu for client:
2
1
0
4
5
3
*/ |
|
That extra native seems out of scope for this PR. |
|
@peace-maker |
|
User tailored menu option order sounds cool. Putting your favorite map to slot 1 should be done by inserting it first and not per client. |
|
In fact, the voting API should have more customizations, or move all the functionality to a SM plugin (like MapChooser) instead of a SM module; but I dont think it is worth it to open a PR for it since right now is more than enough for everyone.
|
|
In my example A0 will be the first item for everyone, since I specified start to be 1 instead of 0. that should put bestmap on top, okaymap as 2nd and the badmaps will be randomized. I use the end param to not randomize the extend option for example, so it is always on number 9. |
|
I don't think this needs to be securely shuffled. Think we can just "shift" the options per client index? if they're client 9 -> shift all elements by 9 on a circular buffer. |
|
Sure but this is barely any more complex, doesn't use much memory and enables setting options to fixed slots per client with the new native. |
65aed6f to
7185be1
Compare
Headline
left a comment
There was a problem hiding this comment.
I'm fine with taking this as-is, looks good to me.
I'll leave it for someone else to 🚢, though.
Good work BotoX!
7185be1 to
8d6f1b4
Compare
BUMPS IMenuManager VERSION
Example: