Commit Graph
100 Commits
Author SHA1 Message Date
Linden c3726ed924 tweak(interface/menu): SetNuiFocusKeepInput
Default to allow input; disable with "disableInput = true" during registration.
2022-08-09 07:42:20 +10:00
Linden 2e77817c41 refactor(interface/menu): set openMenu to reference menu data, not id
No need to index registeredMenus[openMenu] repeatedly.
2022-08-08 17:54:50 +10:00
Linden 245af3df41 refactor(callback): types 2022-08-08 17:16:57 +10:00
Linden 101d94392b refactor(client/interface): micro-optimise menu callbacks
Remove short-lived objects and set local refs to the openMenu to reduce table-lookups.
2022-08-05 00:58:19 +10:00
Linden f122c6e3ea feat(imports): getNearbyPlayers 2022-08-05 00:45:10 +10:00
Linden c662368cd4 fix(client/interface): changeSelected args 2022-08-04 15:04:49 +02:00
Linden 28003c942d fix(client/streaming): invalid print argument 2022-08-04 02:05:09 +10:00
Linden 93fc595030 fix(client/streaming): timeout 2022-08-04 01:32:54 +10:00
Linden 1b05f87c8e tweak(client/streaming): rewrite
Was going to split into separate imports, then
remembered why I didn't in the first place.
Improved annotations.
Changed timeout into a for loop, and increase default to 500 ticks.
Less variable reassignments.
Allow functions to be called outside threads, but will not check if the
request was successful (has loaded).
2022-08-03 22:58:50 +10:00
Linden a45584ac78 Revert "feat(imports): loadAnimDict"
This reverts commit 77fb9cf637.
2022-08-03 21:57:03 +10:00
Linden 77fb9cf637 feat(imports): loadAnimDict 2022-08-03 17:27:58 +10:00
Linden 68a6352be4 feat(imports): getClosestPlayer 2022-08-03 17:26:51 +10:00
Linden ee12035a50 feat(imports): raycast module
Just lib.raycast.cam for now.
2022-08-03 17:22:45 +10:00
Linden d16b3dda06 chore: bump version 2022-07-29 03:09:33 +10:00
Linden 1679510ac9 refactor(resource/cache): remove getVehicle method
Keep it in the thread for simplicity.
2022-07-29 01:12:11 +10:00
Linden 7838a3cfe4 refactor(init): cache handling
lib.onCache serves as a helper to setup cache event listeners.
Removed _cache table and index method.
Only apply metatable to client-side cache (nothing exists on server yet).
When cache is indexed, setup an event handler for the key.
Remove some ox_core/ox_groups specific code (unused).
Remove the updateCache event, and interval.
2022-07-28 23:13:19 +10:00
Linden 39d5bbae3d refactor(resource/cache): new cache event
Rather than sending a bulk update of cache, trigger different events for
each key.
2022-07-28 23:09:23 +10:00
Linden ef6f780028 tweak(resource/version): currentVersion validation
Check currentVersion is valid before performing HttpRequest, and
print a message when failing.
2022-07-28 22:05:16 +10:00
Linden 9096bd36e8 fix(cache/client): change vehicle getter
GetVehiclePedIsIn isn't working with the latest build. Use GetVehiclePedIsUsing instead.
Removed an unused cached value (coords).
Removed the num iterator used for cache:getVehicle to slow its frequency.
2022-07-28 09:32:44 +10:00
Linden 8111ffadd0 fix(fxmanifest): oal-flag
Changed in a recent commit. Since oal hasn't been working for 3 months,
it may result in some errors for internal modules (i.e. vehicleProperties).
2022-07-27 09:39:49 +10:00
Linden 9bc37b461d tweak(vehicleProperties): allow local entities
Local entities (not networked) would fail the check for NetworkGetEntityOwner.
Also fix the error messages, which referenced the wrong variable.
2022-07-09 03:41:25 +10:00
Linden 770ae6396e relicense to LGPLv3
Allows resources importing ox_lib to ignore the "same license" condition.
Does not apply to snippets copied from ox_lib into other resources.
2022-07-05 05:17:52 +10:00
Linden 893ec8bb00 feat(vehicleProperties): extra settings
Includes some minor fixes.
2022-06-30 07:44:51 +10:00
Linden d33df54f0e tweak(zones): store distance to zone center
Should make sphere "zones" nearly 1:1 with the points api.
Distance added for polygons too for consistency and some use-cases,
but generally only worthwhile for smaller zones.
2022-06-26 12:30:25 +10:00
Linden 6c83adfda8 fix(locale): always assign a table to dict
Prevent indexing nil when no locales exist for a resource.
2022-06-24 09:10:37 +10:00
Linden b1056c1246 tweak(vehicleProperties): return true on success 2022-06-19 14:06:59 +10:00
Linden 130ea5d17e refactor(init): lib.notify server function
Client handler attempts to translate the notification if locales are loaded.
2022-06-19 13:36:11 +10:00
Linden e95ae858df fix(callback): handle external resource events
Calling registered callback events in another resource should respond to
the invoking resource.
2022-06-19 13:08:28 +10:00
Linden f406cebcc8 refactor(version/server): reliable resource name check
So people can rename resources and pretend they're custom made, without getting an error.
2022-06-15 00:22:03 +10:00
Linden 76fcc007c4 feat(callback): client callback
Allow the client to listen for and respond to server requests.
Basically just copy-paste and swap the two.
2022-06-09 05:18:05 +10:00
Linden c85e9032f9 refactor(callback): rewrite
Register a single net event to handle callback responses (per resource).
Previous implementation registered new events for each callback.
2022-06-09 04:43:37 +10:00
Linden 6d0f915b00 chore: update version 2022-06-03 15:11:19 +10:00
Linden 962e735d6f feat(getCore/server): hasGroup method 2022-05-30 15:43:42 +10:00
Linden 2599d2ed80 feat(getCore/server): initialise player module and add getter 2022-05-29 10:33:41 +10:00
Linden 734a6cdc81 refactor(getCore/client): instantiate player
Previously handled by the player module.
2022-05-29 10:33:41 +10:00
Linden eb54fc4675 refactor(player/client): set CPlayer.__index as a function
Match server implementation.
2022-05-29 10:33:41 +10:00
Linden 04beaf1b5a feat(player): add server methods 2022-05-29 10:33:41 +10:00
Linden 8aa9ebf41d refactor(player/client): create player instance at init
And minor fixes.
2022-05-28 21:30:17 +10:00
Linden 32709db3cb refactor(getCore/shared): adjust ox_core imports 2022-05-28 21:28:23 +10:00
Linden 3bb946001b refactor(init): separate global and local cache
Store temporary data in the _cache local, separate from the global cache.

This allows constants and other values to be added, rather than being
wiped every minute.
2022-05-25 13:28:19 +10:00
Linden df94633998 tweak(interface/progress): invBusy state
For ox_inventory. Also removed an used table.
2022-05-24 15:13:17 +10:00
Linden 84867900eb fix(zones): zone.inside should not depend on zone.onEnter 2022-05-18 01:46:58 +10:00
Linden f24c4f7821 Merge pull request #23 from hyprell/patch-1
Update progress.lua
2022-05-16 04:20:07 +10:00
Linden 6fb57eff49 fix(vehicleProperties): store correct extra values 2022-05-14 17:14:49 +10:00
Linden 139ae0701b refactor(getCore/client): clean up hasGroup method and return values 2022-05-12 07:44:29 +10:00
Linden 4575b5e02a refactor(player): simplify
Was planning to support checking other user playerdata, but will
require much more planning to implement properly.
2022-05-12 07:41:12 +10:00
Linden 5d1f6019c7 feat(getCore/client): load and extend player class 2022-05-12 01:55:21 +10:00
Linden df8115ea8c feat(player/client): player class and methods
Provide a couple of helper methods (more to come).
2022-05-12 01:55:06 +10:00
Linden ef4ca56889 refactor(init): return a stub for imports with no return
Modules that define globals or directly add several functions to the
lib namespace currently need to return empty functions (i.e. locales).
2022-05-12 00:02:25 +10:00
Linden bc6a6c7a0a fix: include locales in release workflow 2022-05-10 17:48:44 +10:00
Linden 7a4745c0da chore(zones): adjust debug rgba 2022-05-10 15:29:07 +10:00
Linden 55bfa7ca3d refactor(zones): global Zones 2022-05-07 11:47:39 +10:00
Linden ce3f916c42 refactor(zones): centroid -> coords
While centroid is a more accurate term, coords is a little simpler when
writing it a million times.
Prefer to use a single term (sphere was using coords) to simplify API.
2022-05-07 11:19:27 +10:00
Linden 91f52d12c1 refactor(client/locale): send GlobalState.locales to ui 2022-05-06 16:38:36 +10:00
Linden d4b5e0402c refactor(server/locale): get array of valid locales 2022-05-06 16:37:36 +10:00
Linden f6b2df0e75 refactor(locale): default locale 2022-05-06 16:00:40 +10:00
Linden 5f80c55c31 tweak(web/textui): change box style 2022-05-06 15:33:11 +10:00
Linden d3718622cf feat(zones): sphere zone
It's just a distance check and works exactly like lib.points, with some
minor API changes for consistency.
2022-05-06 14:28:45 +10:00
Linden 4555fa0a22 refactor(zones): call zone:contains instead of zone.polygon:contains
Added this function earlier but forgot to include thickness, so
it didn't work.
2022-05-06 14:26:56 +10:00
Linden 96eabf5592 refactor(imports/getCore): set constants and use new import files 2022-05-04 06:33:32 +10:00
Linden c5bdaaafe8 refactor(imports/getCore): create import files for esx and qb 2022-05-04 06:33:32 +10:00
Linden a3f38723e3 refactor(getCore): rename loadFramework, tweaks
ESX imports are limited to an event and getSharedObject export.
In the future I want to introduce some generic functions to simplify
cross-framework compatibility
when working with player, accounts, inventories, and groups (jobs/gangs).
2022-05-01 22:51:59 +10:00
Linden 8bcae1937b tweak(init): store service and name in lib
lib.name for 'ox_lib', and service or 'client' or 'server'.
2022-05-01 22:47:34 +10:00
Linden 48728f0241 feat(locales): include some locales
Partial, and google translated just for the sake of setting an example.
Also renamed many of the language codes where the extra characters are
redundant (i.e. fr-FR, de-DE).
2022-04-30 05:04:15 +10:00
Linden 031cccd886 fix(locale): server hotload and "external" kvp
External kvp's don't exist for the server, so we have to export the proper language.
2022-04-29 16:53:24 +10:00
Linden 8af19bae42 feat: locale system 2022-04-29 05:56:41 +10:00
Linden fee2950a35 feat(resource): throw an error if the UI is not built 2022-04-29 03:02:28 +10:00
Linden f6216af1ae refactor: rename lualib variable and move clipboard export 2022-04-29 03:02:06 +10:00
Linden c7bab9b47f fix(zones): debug functions should not be global 2022-04-29 02:01:51 +10:00
Linden 634dd747b7 refactor(zones): assign X directly and store triangles as matrices 2022-04-29 02:01:17 +10:00
Linden 754ae1bd8d refactor(zones): use array table structure when creating triangles 2022-04-29 01:50:31 +10:00
Linden 247b9916e1 refactor(zones): rename variables and minor perf
Set box vertices and poly triangles once during creation (with debug).
2022-04-29 01:38:01 +10:00
Linden cfffcee577 feat(zones): debugBox draw lines on edges
It's an abomination until Doka works his magic.
2022-04-27 17:13:26 +10:00
Linden 5dce90682f refactor(zones): reduce value reassignments 2022-04-27 17:11:36 +10:00
Linden fc3e5d6339 feat(zones): add contains method to zones
Reduces number of table lookups for micro-optimisation.
zone:contains(coords) is also a bit nicer than zone.polygon:contains(coords).
2022-04-27 17:09:32 +10:00
Linden a340c83e1a perf(zones): assign inside count and index to local
Reduce number of times the inside table needs to be indexed or have length checked.
Also assign debug zones to table without having to be inside the zone.
2022-04-27 17:07:24 +10:00
Linden cc770ada64 refactor(zones): change new to poly, default box rotation 2022-04-27 10:33:18 +10:00
Linden f651a91bf6 perf(zones): debug
Iterate polygon userdata directly, instead of creating a new table each frame.
2022-04-25 21:51:03 +10:00
Linden 94a460903d refactor(zones): perf, args, and insideZone
lib.zones.new should take a single argument containing all
data related to the new zone, then append new fields to the table.
No need for a distance check and 'nearby', instead check if player
is inside the polygon.
Use a function ref instead of closures for debug (drawPolygon).
2022-04-25 21:33:56 +10:00
Linden bf792004e9 fix(interface/progress): check for data.disable.move 2022-04-25 13:31:59 +10:00
Linden 3443475cc0 fix(loadFramework): call correct function after load 2022-04-22 15:33:22 +10:00
Linden d70fa5de82 fix(loadFramework): catch error during load 2022-04-22 15:29:20 +10:00
Linden 8c448db68d refactor(loadFramework): determine target based on resource state
Easier to work with out-the-box.
2022-04-22 15:28:24 +10:00
Linden 26fe012b55 refactor(interface/progress): disable controls
Last implementation was basically copied over from ox_inventory which used
the control actions wrapper; somewhat pointless in this case.
2022-04-22 14:32:40 +10:00
Linden 155dc617f8 refactor(points): support single argument for lib.points.new 2022-04-21 15:18:50 +10:00
Linden 877409486f refactor(resource/cache): remove commented code
Probably won't use this, but if I do then I'll add it when appropriate.
2022-04-21 15:09:42 +10:00
Linden 4464b0ec57 ci(release): create release workflow 2022-04-19 09:53:55 +10:00
Linden 84ad4abcca refactor(resource/version): checkDependency optional print and return
Send 'true' to match old behaviour (print message, return nil).
New behaviour has no output unless sending a third argument.
2022-04-19 01:09:22 +10:00
Linden f4e0739b04 fix(interface/textui): localise input 2022-04-18 23:30:58 +10:00
Linden e7ede94866 fix(points): remove tick value when clearing interval 2022-04-18 23:18:39 +10:00
Linden 65a5bab623 perf(points): use interval for on-frame thread 2022-04-14 14:50:27 +00:00
Linden 9a3b17029f refactor(resource/interface): keymapping and multi-prop support
Prop data should support a single table or an array for multiple
props.
2022-04-14 13:47:56 +00:00
Linden aaab5798c0 feat(resource/interface): progressActive and cancelprogress command 2022-04-14 13:11:51 +00:00
Linden 0a21924d39 feat(points): get closest point 2022-04-14 11:08:56 +00:00
Linden 21e0edd115 feat(points): remove points 2022-04-14 10:58:17 +00:00
Linden 7ea609ae91 Merge branch 'master' of https://github.com/overextended/ox_lib 2022-04-14 06:45:55 +00:00
Linden 0227bd11a6 feat(resource/interface): progress bar 2022-04-14 06:45:48 +00:00
Linden c7dafe56cd tweak(resource/cache): playerId, serverId, and micro 2022-04-14 06:44:34 +00:00
Linden 760f18653d tweak(resource/interface): register net event for lib.notify 2022-04-11 04:59:21 +00:00
Linden 1ac844f20a tweak(init): store serverId 2022-04-11 04:59:01 +00:00