ox_target icon indicating copy to clipboard operation
ox_target copied to clipboard

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

Open Moozdzn opened this issue 1 year ago • 4 comments

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

Moozdzn avatar Apr 11 '24 13:04 Moozdzn

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.

thelindat avatar Apr 11 '24 13:04 thelindat

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

Moozdzn avatar Apr 11 '24 13:04 Moozdzn

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.

thelindat avatar Apr 11 '24 13:04 thelindat

~~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 avatar Apr 11 '24 13:04 Moozdzn