100 Commits
Author SHA1 Message Date
Linden 924fe23431 chore: add NOTICE.md 2025-03-29 22:02:36 +11:00
Linden cc6aed591f chore: adjust links 2025-03-29 21:46:58 +11:00
Linden 9946bf9c04 chore: add CONTRIBUTING.md 2025-03-29 21:15:21 +11:00
Linden fb2225e373 chore: add copyright notices to each file
Some people accidentally, mistakenly, and without any malicious intent forget to attribute code from this resource to its source. This change will hopefully assist people, so that they do not make that mistake again.
2025-03-18 18:46:09 +11:00
Linden f0df7ab696 refactor(web/fetchNui): fetch stub
Just a naive way to patch some common exploits.
2025-03-18 16:55:04 +11:00
Linden ff2e765b60 fix(points): store all points within range in nearbyZones
Previously this only stored points with the nearby
method.
2025-03-18 05:36:57 +11:00
Linden 8509867abd refactor(callback/client): require source in response handler 2025-03-18 02:39:41 +11:00
Linden 6fcb83101f refactor(init): attempt to catch module errors from invalid installs
Since people continue to drag and drop updates
without clearing old files, then spend days or weeks
complaining about script errors.
2025-03-18 02:29:31 +11:00
Linden 621c11f22b refactor(callbacks): don't error when attempting to override an event
Throwing an error here will break some scripts, and
rather than fix their misuse many creators suggest downgrading ox_lib instead. Was technically breaking
anyway, even if kind of necessary.
2025-03-16 03:50:32 +11:00
Linden 87818b3710 fix(package/callback): format setValidCallback event name 2025-03-16 03:41:34 +11:00
Linden b20130c998 fix(zones): ensure nearbyZones always updates 2025-03-14 15:25:28 +11:00
Linden 28729d7403 fix(grid): only returned cached grid entries if filter matches
Look into optimisations in the future.
2025-03-14 11:19:15 +11:00
Linden 4d8af3c31e fix(zones): update zone distance when checking contains
todo: consume caffeine
2025-03-14 10:11:08 +11:00
Linden ae02b74878 fix(zones): correct contains check 2025-03-14 10:02:37 +11:00
Linden 34fb03d783 fix(zones): don't trigger onEnter on grid change 2025-03-13 21:14:19 +11:00
Linden 4188bd2596 feat(zones): add getNearbyZones 2025-03-13 19:31:21 +11:00
Linden 0b9f6e0cce refactor(grid): use an array to store nearby entries 2025-03-13 19:28:57 +11:00
Linden 5fb16444e6 refactor(client/progress): minor adjustment to duration check 2025-03-13 18:58:44 +11:00
Linden 39ec1d3df5 feat(points): utilise the grid system 2025-03-10 16:42:00 +11:00
Linden 5a18b7e2d5 fix(grid): clear cached entries on change 2025-03-10 16:28:23 +11:00
Linden caa9ed1d97 fix(zones): filter grid entries for zones 2025-03-10 14:28:29 +11:00
Linden 29f207edf9 feat(grid): add filtering to getNearbyEntries 2025-03-10 14:28:06 +11:00
Linden 105a079c09 feat(zones): utilise the grid system
This probably works, even.
2025-03-10 12:30:00 +11:00
Linden 534b1ab435 feat(grid): add a grid system
Based on mkafrin's grid used by PolyZone's ComboZones.
2025-03-10 12:29:14 +11:00
Linden 9e7750b3ba refactor(zones): improve types 2025-03-10 12:02:45 +11:00
Linden 9135e65009 refactor(zones): move to shared module 2025-03-10 11:52:20 +11:00
Linden c9b7c375ee refactor(array): add generic to class type 2025-03-10 11:51:48 +11:00
Linden 12ef8e542f fix(client/progress): check duration 2025-03-10 11:50:00 +11:00
Linden cbca5b7951 fix(scaleform): missing types 2025-02-08 18:02:14 +11:00
Linden aa2f761a34 fix(scaleform): invalid private property access
Adds an isDrawing and draw method to scaleforms.
So technically a feature I guess.
2025-02-08 13:14:51 +11:00
Linden b726faea2d feat(callback): implement callback validation
Prevent callbacks from being overwritten by other resources.
Throw an immediate error if the callback does not exist.
2025-02-03 15:41:58 +11:00
Linden 189306d5aa fix(array): Array.from string delimiter 2025-01-29 08:02:06 +11:00
Linden 6a24f9b971 fix(array): format error message 2025-01-29 07:13:16 +11:00
Linden 45b045a37e feat(array): additional methods 2025-01-29 06:54:06 +11:00
Linden d0a0f34018 fix(timer): set initial value of triggerOnEnd to true 2025-01-28 06:47:48 +11:00
Linden 769fa35f38 fix(timer): redefine local function as method
The previous commit added a private property, but they
cannot be set outside of class methods. Added an error
when starting a running timer, too.
2025-01-26 05:20:23 +11:00
Linden 8af94a7194 feat(class): allow private to be redefined
Allows self.private to defined as a new table, allowing it to
remain empty without being removed after instantiation.

Resolves #696.
2025-01-26 04:05:29 +11:00
Linden 0192fd015b fix(array): indexOf return value 2025-01-21 11:33:15 +11:00
Linden 728d20c079 fix(timer): re-enable onEnd after stopping a timer
Resolves #667.
2025-01-20 02:24:00 +11:00
Linden 99fb752d30 fix(callback): support __call metatables as cb function
Resolves #668.
2025-01-20 02:10:09 +11:00
Linden 356e560a5d fix(client/zones): use arrays for temporary zone tables
Resolves #682.
2025-01-20 02:04:21 +11:00
Linden aebef6d7de feat(web): wrap app in errorboundary
Prevents the app from failing on render errors as mentioned
in #675. More to come..
2024-12-06 17:25:34 +11:00
Linden d4bb2ab7b3 fix(table): regression in contains
Other changes are just whitespace.
2024-10-16 09:08:18 +11:00
Linden 4596e4319c refactor(init): move global declarations 2024-10-14 17:36:24 +11:00
Linden cba4b85a29 fix(callback/js): match callback timeout to lua 2024-10-06 03:28:28 +11:00
Linden e61febf7de refactor(streaming): change error message and default timeout 2024-10-06 03:25:17 +11:00
Linden a2a7114986 feat(array): add additional array class methods
- merge now supports merging multiple arrays.
- added includes, map, reverse, toReversed.
2024-10-01 18:53:05 +10:00
Linden e1c1647343 fix(package): specify side-effects and do not bundle output 2024-09-16 18:34:55 +10:00
Linden 133a9905b2 Revert "refactor(streamingRequest): wait 10 years for assets to load"
This reverts commit 03db59cce5.
This was sarcasm btw. I still hate you people.
2024-08-13 14:12:42 +10:00
Linden 6b12831817 feat(cache): send oldValue to onCache
Internally handle the cache events to prevent race conditions
and resolve #618.
Improved types.
2024-08-13 14:11:27 +10:00
Linden 03db59cce5 refactor(streamingRequest): wait 10 years for assets to load
Helps with issue #630 by waiting for assets to become available.

Enjoy the random side-effects this will lead to, like vehicles suddenly
loading 20 minutes after you requested the asset and then teleporting
you into them.

This is clearly the only solution.
2024-08-13 12:47:39 +10:00
Linden e10e8af0de refactor(class): change type returned by lib.class
Return a new type named after the class, rather than OxClass.
We still can't use class generics (i.e. OxClass<`T`>), so classes
still need to be declared (e.g. ---@class Person : OxClass).

Also removed the experimental warning.
2024-07-26 15:23:43 +10:00
Linden 026d3de4ef refactor(array): typing issue
Assigning a variable to a class seems to break private/protected
access with LLS. Revert this in the future if fixed.
2024-07-26 15:21:09 +10:00
Linden e0f6f47cc7 refactor(client/vehicleProperties): check for tutorial session 2024-07-14 16:35:27 +10:00
Linden c45aa0d893 feat(vehicleProperties): add statebag handler and server setter 2024-07-13 00:25:30 +10:00
Linden d51a1167fd fix(client/requestModel): use IsModelInnCdimage to validate model
Resolves #596.
If it breaks something, maybe try using both.
2024-07-01 12:21:26 +10:00
Linden 45b9560a44 fix(init/cache): allow setting false cached value
Resolves #605.
2024-07-01 12:17:50 +10:00
Linden 6368c2c6fd fix(client/zones): remove thread when setting initial debug state
Resolves #605.
2024-07-01 12:16:31 +10:00
Linden 54b7701c36 refactor(class): disable experimental warning for internal modules
This warning is only important for 3rd party users.
2024-06-01 21:45:17 +10:00
Linden c59b675efa Revert "fix(imports/logger): loki indexing for varargs (#583)"
This reverts commit 7e67b57e2d.
2024-05-30 22:54:50 +10:00
Linden 2909cb5db6 refactor(callback): warn if callback function is nil/false
Between the headache of people misusing callbacks
and people complaining about third-party resources
that misused them, I would rather just shut them up.

I'll just deprecate this crap at some point anyway.
2024-05-23 09:41:24 +10:00
Linden f0009f0bc8 refactor(callback): assertions
Both client and server callbacks will check if "cb" is a function, to
reduce the number of people using callbacks as a replacement for
events.

Server->client callbacks will now check if the target playerId exists,
as people apparently use it for unintended values (i.e. -1).
2024-05-22 16:36:22 +10:00
Linden a40be54a9e refactor(callback): increase default timeout 2024-05-21 05:50:06 +10:00
Linden c2efb22e38 refactor(class): mark mixins.new as protected 2024-05-19 15:33:16 +10:00
Linden 9a2a911b2a fix(streamingRequest): remove @package annotation
Annoying warnings.
2024-05-19 14:37:31 +10:00
Linden 8b0359071b fix(math): torgba types and alpha value 2024-05-14 19:21:47 +10:00
Linden 0b13a56071 fix(package/locale): sync behaviour with Lua 2024-05-14 18:19:26 +10:00
Linden 7ada4c253a chore(fxmanifest): remove comments 2024-05-08 08:40:53 +10:00
Linden ae005e73eb fix(math): math.interp return type should be T 2024-05-08 05:47:40 +10:00
Linden 858a94e7ec feat(math): expose interpolate function as math.interp 2024-05-08 05:46:57 +10:00
Linden 43905bdd62 feat(interface/alert): support dialog timeout
closeAlertDialog will now error if a reason is passed.
Added timeout param to alertDialog.
Resolves #522.
2024-05-08 05:23:27 +10:00
Linden b1cb2142f0 feat(raycast): add fromCoords method 2024-05-08 05:00:33 +10:00
Linden 2166b076da feat(callback): add timeout to callback events
Should help when people await broken or unregistered events.
Defaults to 60 seconds, adjusted with convar ox:callbackTimeout.
2024-05-03 15:49:33 +10:00
Linden 55d9ed1709 refactor(settings): safeGetKvp
If the kvp has an unexpected type for whatever reason, clear it.
2024-04-22 14:46:02 +10:00
Linden 196440250b fix(settings): swapped variable order
Locale was moved.
2024-04-21 01:54:40 +10:00
Linden b9452f9248 refactor(client/vehicleProperties): return true if client owns entity
Technically closer to the previous behaviour.
2024-04-20 10:28:21 +10:00
Linden 3df183653d feat(settings): ox:userLocales convar 2024-04-20 07:07:11 +10:00
Linden 3959f76aae refactor(timer): adjust module return and types 2024-04-20 06:55:56 +10:00
Linden b6632ad789 refactor(locale): merge locales with english definitions
Also sync some recent changes in the TS module.
2024-04-20 06:42:28 +10:00
Linden 58021e70fd refactor(client/vehicleProperties): remove entity owner check
May revert - let's see what happens.
2024-04-20 05:58:32 +10:00
Linden 18f8e89cb4 feat(array): isArray method 2024-04-19 03:09:39 +10:00
Linden dcdfe6e442 fix(class): private access in method calls
Maybe there's better ways, but if it works..?
2024-04-18 23:19:09 +10:00
Linden 56267448ce feat(imports/client): playAnim 2024-04-18 02:13:22 +10:00
Linden fb5bd87dc2 refactor(streaming): bump default timeout
There's no point trying to argue with people who rely on
faulty behaviour and race conditions.
2024-04-18 01:28:11 +10:00
Linden 3fc84398f6 refactor(settings): reset saved locales 2024-04-17 21:12:20 +10:00
Linden 97365df94f refactor(streamingRequest): mention unreleased assets
Since 90% of FiveM developers do not release unused assets,
many people are starting to complain when streaming fails.
2024-04-16 14:25:50 +10:00
Linden b2008ed804 feat(array): reduce method 2024-04-16 14:15:25 +10:00
Linden 01770187bc refactor(locale): set default locale in settings 2024-04-16 05:33:35 +10:00
Linden 6de82c3d6e feat(array): array class 2024-04-13 11:15:30 +10:00
Linden 774da8f755 fix(class): use rawset during instantiation
If classes use a __newindex method it may lead to unexpected behaviour.
2024-04-13 11:15:30 +10:00
Linden 468a4d820f feat(settings): notification position 2024-04-12 09:45:49 +10:00
Linden 3e66dccb4b fix(init): prevent loading multiple instances of ox_lib
Resolves #545.
2024-04-11 15:03:41 +10:00
Linden e0e2bcfd45 fix(fxmanifest): don't load require as shared_script
This will get loaded internally.
2024-04-11 14:55:51 +10:00
Linden fffdcd9999 fix(require/loadJson): correct path for json files 2024-04-09 20:02:35 +10:00
Linden e476736761 feat(server): triggerClientEvent with multi-target support
Since that once fivem PR is forever pending review.
2024-04-06 20:00:33 +11:00
Linden 1dd9bd3e86 chore: add gitignore to forcibly keep cache directories
Since people (or terrible GSPs) keep blocking any directory
named cache no matter where it exists by default.
2024-04-06 16:58:59 +11:00
Linden 1ff845a451 refactor(require): cleanup and improve debug info 2024-04-06 15:59:26 +11:00
Linden 56b99a7657 refactor(require): improve module resolution and debugging info
- Improved error messages.
- Include checked file paths on failed module resolution.
- Moved repeated code into separate functions.
- Workaround for incorrect "circular-dependency" error.
- Added additional package.path "./?/init.lua".
- Added support for package.searchers.
2024-04-05 21:53:48 +11:00
Linden 77c34b8699 feat(settings): toggle notification audio 2024-04-03 14:58:35 +11:00
Linden dbbb4b6563 refactor(notify): minor cleanup for notification audio 2024-04-03 14:56:08 +11:00