Skip to content
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

feat(client/api): Add zones single option support #143

Merged

Conversation

Moozdzn
Copy link
Contributor

@Moozdzn Moozdzn commented Apr 11, 2024

Add single option and option type checks to zones api

This PR addresses the issue where the zones api would not have the same single option support nor do the same options type checks as the functions that use addTarget

Changes Made

  • Moved typeError function to the top of the file
  • Moved the addTarget options type checks into its own checkOptions function at the top of the file
  • Use checkOptions in addPolyZone, addBoxZone, addSphereZone, addTarget

Testing

  • Tested addBoxZone and addModel with:
    • Wrong type, empty table, single option, array of options

@thelindat
Copy link
Member

Not a fix though.

I only added options support because I got sick of people renaming qtarget/qbtarget exports and keeping the format the same. Zones never had that.

@Moozdzn
Copy link
Contributor Author

Moozdzn commented Apr 11, 2024

I wasnt sure if it was a fix or a new feature. went with fix because I thought maybe it got overlooked. For consistency I think it should be supported, but if not then maybe something in the docs mentioning different functionality between zones and entities

@thelindat
Copy link
Member

I don't even think docs mention the hashmap being valid for options arg. Considering the number of numbskulls constantly complaining about such a dumb and well documented thing I don't mind merging but it's really more of a feature.

@Moozdzn Moozdzn changed the title fix(api/zones): Support single option feat(api/zones): Support single option Apr 11, 2024
@Moozdzn
Copy link
Contributor Author

Moozdzn commented Apr 11, 2024

Docs just mention table
Updated the title

Edit: In the options page it does mention array of options but the variable options under each function just say table

@Moozdzn Moozdzn changed the title feat(api/zones): Support single option feat(client/api): Add zones single option support Apr 11, 2024
@thelindat thelindat merged commit cd292c9 into overextended:main May 4, 2024
@Moozdzn Moozdzn deleted the fix(zones)-support-single-option branch May 4, 2024 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants