Since you can already disable the playerlist via gServerSettings.enablePlayerList, there was only one step to making #175 possible, that being allowing lua to detect if the playerlist was attempting to be opened, as outlined by Isaac.
I'm not fond of the implementation done here, however I couldn't think of a better implementation. Firstly, I create a global variable, gAttemptingToOpenPlayerlist. I create that variable in djui_panel_playerlist.c and define it in the corresponding .h file (could use a different location, since it isn't used in that c file). Then, in smlua_misc_utils.c, I create a function called djui_attempting_to_open_playerlist that just returns gAttemptingToOpenPlayerlist. This variable is set in the djui_interactable_on_key_down and djui_interactable_on_key_up functions, where the playerlist visibility is also set.
Ideally there'd be a way I can detect what input is being pressed when the function djui_attempting_to_open_playerlist is being called, however I didn't find a way.
With this function, it's pretty easy to do what #175 was aiming to do. By first disabling the playerlist using gServerSettings.enablePlayerList, you can simply check if djui_attempting_to_open_playerlist is true. If it is, show the playerlist.
Resolves #175
Since you can already disable the playerlist via
gServerSettings.enablePlayerList
, there was only one step to making #175 possible, that being allowing lua to detect if the playerlist was attempting to be opened, as outlined by Isaac.I'm not fond of the implementation done here, however I couldn't think of a better implementation. Firstly, I create a global variable,
gAttemptingToOpenPlayerlist
. I create that variable indjui_panel_playerlist.c
and define it in the corresponding .h file (could use a different location, since it isn't used in that c file). Then, insmlua_misc_utils.c
, I create a function calleddjui_attempting_to_open_playerlist
that just returnsgAttemptingToOpenPlayerlist
. This variable is set in thedjui_interactable_on_key_down
anddjui_interactable_on_key_up
functions, where the playerlist visibility is also set.Ideally there'd be a way I can detect what input is being pressed when the function
djui_attempting_to_open_playerlist
is being called, however I didn't find a way.With this function, it's pretty easy to do what #175 was aiming to do. By first disabling the playerlist using
gServerSettings.enablePlayerList
, you can simply check ifdjui_attempting_to_open_playerlist
is true. If it is, show the playerlist.