refactor(esx_lib): move streaming/scaleform/points/interactions/game/onesync helpers into the lib#1789
Open
ASTROWwwW wants to merge 9 commits into
Open
Conversation
Integrated fixes during the move: - monotonic handle counter (handleCount) instead of count+1; no handle collision after a point is removed - unified single proximity loop: per-frame inside() plus a 500ms enter/leave scan, adaptive Wait(next(insidePoints) and 0 or 500), replacing the previous two separate loops - emptiness detected via next() instead of # on a sparse-keyed table Non-portable substitutions documented: - ESX.PlayerData.ped -> PlayerPedId() (ESX.PlayerData is not available in the lib VM) - GetGameTimer() used to gate the 500ms scan within the single loop
…perties to xLib Integrated fix during the move: - spawnVehicle uses the computed isNetworked for the network-id/migrate guard, fixing the original that branched on the raw networked argument modSmokeEnabled preserved as-is in get/setVehicleProperties (flagged: the set path toggles mod 20 without applying a smoke color, matching legacy behavior). Non-portable substitution documented: - ESX.PlayerData.ped -> PlayerPedId() (ESX.PlayerData is not available in the lib VM)
Moved getPlayersInArea / getClosestPlayer / getPedsInArea / getObjectsInArea / getVehiclesInArea / getClosestPed / getClosestObject / getClosestVehicle to xLib; es_extended re-exposes them through server compat shims. Flagged: getNearbyPlayers iterates ESX.Players (es_extended server state), which is not portable across the lib boundary - the lib relies on that global being present at call time.
ab6ef8b to
88a8839
Compare
3 tasks
Adds a generic xLib.cache (ped, vehicle, seat, weapon, coords) modelled on ox_lib cache and framework agnostic, and rewires es_extended to source ped and weapon from it which removes the per-frame ped poll. The vehicle enter/exit state machine and every esx: event are kept unchanged through a thin glue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Moves seven client/server helper modules out of
es_extendedinto the shared lib (esx_lib/xLib), and re-exposes every moved API through compat shims so existing resources keep working unchanged. Continues the lib refactor already merged on this branch (raycast, entity).Modules moved (one commit each, conventional commits):
streaming— request helpers (model, texture dict, ptfx, anim set/dict, weapon asset)scaleform— freemode message / breaking news / popup warning / traffic movie + utilspoints+Pointclassinteractionsgame— spawn / pool / closest / area helpers + vehicle properties get/setonesync— area/closest query helpers (server)callback— gate ownership logs behind a debug convarMotivation
Centralize reusable runtime helpers in the lib so they are available to every resource without depending on
es_extendedinternals, cut duplication, and keepes_extendedfocused on framework logic. Aligns with the ongoing effort to consolidate on the lib.Implementation Details
Each module follows the same pattern: a new file under
esx_lib/imports/<module>/, the oldes_extendedsource removed (forgame, the inlineESX.Game.*definitions are removed fromclient/functions.lua), and a compat shim added so the existingESX.*API still resolves.Back-compat (no consumer-facing breakage):
compat.luare-mapsESX.Streaming.*,ESX.Scaleform.*,ESX.Game.*(spawn/pool/closest/area + vehicle properties),ESX.CreatePointInternal/ESX.RemovePointInternal/ESX.HidePointInternal/StartPointsLoop/ESX.Point, andESX.RegisterInteraction/ESX.RemoveInteraction/ESX.GetInteractKeyto theirxLib.*equivalents.compat.luare-mapsESX.OneSync.GetPlayersInArea/GetClosestPlayer/GetPedsInArea/GetObjectsInArea/GetVehiclesInArea/GetClosestPed/GetClosestObject/GetClosestVehicle.ESX.OneSync.Spawn*andESX.Game.Utils.DrawText3Dintentionally stay ines_extended(not moved).fxmanifest.luano longer loads the removed client modules;imports.luano longer loads thePointclass import. Compat files load after the lib import, so the shims resolve at load time and all internal call-sites remain covered.Fixes integrated during the move:
points: monotonic handle counter (no handle collision after a point is removed); unified single proximity loop — per-frameinside()plus a 500ms enter/leave scan viaWait(next(insidePoints) and 0 or 500), replacing the previous two separate loops; emptiness detected vianext()instead of#on a sparse-keyed table.game:spawnVehicleuses the computedisNetworkedfor the network-id/migrate guard, fixing the original that branched on the rawnetworkedargument.Flagged (kept as-is / out of scope):
modSmokeEnabledis preserved as-is inget/setVehicleProperties(legacy behavior kept, not changed).onesyncgetNearbyPlayersstill readsESX.Players(es_extended server state); it relies on that global being present at call time — portability across the lib boundary is flagged for review.validateModelissue in theverifypath was noticed but left untouched here (out of scope for this PR).Coordination: these
points/interactions/onesyncchanges supersede the corresponding fixes that were removed from #1787 (agreed). #1787 now carries only the security/robustness fixes; the module moves and their integrated fixes live here.Usage Example
PR Checklist