-
Notifications
You must be signed in to change notification settings - Fork 30
Command arguments overhaul #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.2-stable
Are you sure you want to change the base?
Conversation
Final string arguments no longer require quotes surrounding them Added character type
|
With the latest commit we've moved parsing arguments from We also have a decision to make, if we update the default commands to use the new argument system any Also added |
…t free bit position. (this may fail when we hit 32 types, possibly cause stack overflow or halt) Any final argument can be typed without quotes now, not just strings. Chatbox modification to make it work Fixed the help menu to actually display syntax. Changed all commands in sh_commands.lua to use it (not yet plugin commands) Now arguments can be a single value instead of table, and also arguments can have multiple types accepted, like in the case of /charunban (we could expand this to more commands later)
|
With the latest commit we've switched from the pow2 calc to just iterating over the bits to find the next free bit position when adding types. Any final argument can be typed without quotes now, not just strings. Chatbox updated to make that and syntax work. (temporary, will overhaul chatbox completely at a later date) Changed all commands in sh_commands.lua to use new the argument system (not yet plugin commands) Now command arguments list can be a single value instead of table, and also arguments can have multiple types accepted, like in the case of /charunban (we could expand this to more commands later). |
…ing it all up. Change what nut.type returns Change target.getPlayer into a type check for /charunban
to just a table, and then implement functions for and/or. Change where types "resolve" any value into their own type, instead of being in assert it will now be a different function.
|
With the latest commit we've changed from using bitwise operations for managing types to now shoving types into a table, the implementation for and/or is now a little more convoluted but should still be manage-able. (I didn't like the 32bit limit that comes with operating on bits like that) New functions:
and Assertion as been cleaned up to only implement actual "assertion" and not changing any values, that functionality, for "resolving" any value (most likely a command argument string) into the certain type has been put into the type's table as a new function added with Resolve function's should be like this: |
Same for the getChar in character type.
Change nut.util.findPlayer to use the player type resolve instead. If an argument is set to nut.type.optional only it won't show in the syntax and will always count as a success to resolve. Resolves made a table on the type with unique identifiers per resolve, so you could add have more resolves per type now.
|
Latest commit: Change all remaining commands to use new argument system. Also fixes some bugs that default commands had, I'm sure there's more. |
First steps to a command arguments overhaul, this will be an active draft PR. Just getting it started for now.
The goals of this are mainly to make it simpler to create commands/arguments and know what to expect in the onRun function, it should automatically check the input arguments when running the command to see if they match the commands arguments list and replace any input arguments if needed (see how nut.type.player returns a findPlayer call and if it's successful it gets sent on to the onRun)
The basics seem to work as of right now (replaced /roll and /pm to test optional and required arguments) but I still think we could setup a new system that automatically generates more scoped/specific net.* messages for every command.
Probably should also come up with a way to make any nut.type.string argument that is final in the command's argument list not require quotes surrounding it.
This also implements a basic "type" library, could be expanded upon and/or used elsewhere in the framework.
Until this is in a better spot I think getting CAMI in should be looked at first, and also any temporary fixes that may be needed first until we finish this up.