Generic way to handle console commands
complete
T
Timmy
- Console commands:
Currently there is no "real" command system like gmod's ConVars.
It would be great to have a built-in command registration feature that let anyone add any commands to their script without using the
Console
events, like:[Server/Client].RegisterConsoleCommand
This function could take those arguments:
- [1] Command name
- [2] Callback function, which would have as params the arguments passed after the command (separated by spaces in the command)
- [3] Optionnal command description
This way the game could keep track of all the commands, and display the complete list when the "help" command is sent to the console.
Another upside of this system would be some utility functions that return the table of registered commands, which would be useful if you want to make a custom help interface for example.
- Autocomplete:
For ease of use, an autocompleter would be great to suggest registered commands that match the current text entry
- Console variables:
Kinda related to console commands, this could be really usefull in some cases, here's a good exemple:
GTNardy
complete
GTNardy
planned
F
Falaxir
For the list of console command on the user side, i think maybe we could use a similar system with discord slash command (since also, it may be possible to have duplicate commands ?).
So only packages that have registered cvars will have their picture and a list of the commands associated. We could also add some auto completes features such as if it is an action with a player, list avalible players, ...
But this means that the console API must be really complete, maybe a bit too much to allow any kind of flexibility. This will need some reflexion, but i like the idea of a CVAR on the API if it allows us to be more flexible of how it can be implemented on the user side.
Robert
For the variables:
Maybe move the defining part to the "Package.toml"?
Setting.Set("NAME", "VALUE")
Setting.Get("NAME")
Setting.Subscribe("NAME", function(name, value) end) ?
Setting.GetDefault("NAME")
T
Timmy
Robert: Duplicate of what I said i the testers channel, but imo it's better to keep it all lua side since i don't see the upside of having the var definition it in the package config file