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(modules): lib #309

Merged
merged 2 commits into from
Jan 9, 2024
Merged

feat(modules): lib #309

merged 2 commits into from
Jan 9, 2024

Conversation

D4isDAVID
Copy link
Member

Description

Implements a new Qbox library as per #301.
All functions have been tested except for audio & statebag related functions.
Most functions have been refactored a bit, so the code should be reviewed.

Usage of the library and the deprecation of the utils module will come in following PRs.

Shared Functions

  • GetCoordsFromEntity => not carried over (feels useless)
  • GetPlate => qbx.getVehiclePlate (removed a nil check)
  • CommaValue => not carried over (lib.math.groupdigits exists in ox_lib)
  • string.split => not carried over (string.strsplit exists in CfxLua 5.4)
  • string.trim => qbx.string.trim (removed a nil check and an unneeded return value)
  • string.firstToUpper => qbx.string.capitalize (ditto)
  • math.round => qbx.math.round
  • RandomLetter => not carried over (lib.string.random exists in ox_lib)
  • RandomNumber => not carried over (ditto)
  • RandomNumberOrLetter => not carried over (ditto)
  • GenerateRandomPlate => qbx.generateRandomPlate (pattern param is now optional)
  • MapTableBySubfield => qbx.table.mapBySubfield
  • GetCardinalDirection => qbx.getCardinalDirection (converted from client-only to shared, art was added to the docs because I thought it would be funny, altho keeping this one is questionable)

Server Functions

  • SpawnVehicle => qbx.spawnVehicle (now with table params)
  • KickWithReason => not carried over (it isn't being used)
  • IsLicenseInUse => not carried over (it is only ever used in playerConnecting)

Client Functions

  • DrawText2D => qbx.drawText2d (now with table params)
  • DrawText3D => qbx.drawText3d (now with table params)
  • GetEntityAndNetIdFromBagName => qbx.getEntityAndNetIdFromBagName
  • EntityStateHandler => qbx.entityStateHandler
  • PlayAnim => not carried over (unused, by us at least)
  • GetEntities => not carried over (either unused at all or used without ignoreList)
  • GetVehicles => not carried over (ditto)
  • GetObjects => not carried over (ditto)
  • GetPeds => not carried over (ditto)
  • GetPickups => not carried over (ditto)
  • GetPlayersInScope => not carried over (ditto)
  • GetClosestEntity => not carried over (lib.getClosest... functions exist in ox_lib)
  • GetClosestPed => not carried over (lib.getClosestPed exists in ox_lib)
  • GetClosestVehicle => not carried over (lib.getClosestVehicle exists in ox_lib)
  • GetClosestObject => not carried over (lib.getClosestObject exists in ox_lib)
  • DeleteVehicle => qbx.deleteVehicle (the one that started it all)
  • GetClosestObject => not carried over (lib.getClosestPlayer exists in ox_lib)
  • GetPlayersFromCoords => not carried over (lib.getNearbyPlayers exists in ox_lib)
  • GetClosestBone => not carried over (unused from my understanding)
  • GetBoneDistance => not carried over (ditto)
  • AttachProp => not carried over (ditto)
  • GetVehicleDisplayName => qbx.getVehicleDisplayName
  • GetVehicleMakeName => qbx.getVehicleMakeName
  • IsVehicleSpawnClear => not carried over (lib.getNearbyVehicles exists in ox_lib)
  • StartParticleAtCoord => not carried over (unused from my understanding)
  • StartParticleOnEntity => not carried over (ditto)
  • GetStreetNameAtCoords => qbx.getStreetName (keeping this one is questionable)
  • GetZoneAtCoords => qbx.getZoneName (ditto)
  • GetCurrentTime => not carried over (unused and feels useless)
  • GetGroundZCoord => not carried over (feels useless)
  • ClearAllVehicleExtras => qbx.resetVehicleExtras (not sure about keeping extras functions but policejob uses one of them)
  • ChangeVehicleExtra => qbx.setVehicleExtra (ditto)
  • SetVehicleExtras => qbx.setVehicleExtras (ditto)
  • MaleNoGloves => qbx.armsWithoutGloves.male (table is now frozen to modification)
  • FemaleNoGloves => qbx.armsWithoutGloves.female (ditto)
  • IsWearingGloves => qbx.isWearingGloves
  • LoadAudioBank => qbx.loadAudioBank
  • PlayAudio => qbx.playAudio (now with table params)

Checklist

  • I have personally loaded this code into an updated Qbox project and checked all of its functionality.
  • My pull request fits the contribution guidelines & code conventions.

modules/lib.lua Show resolved Hide resolved
@mafewtm mafewtm merged commit 3deb18e into main Jan 9, 2024
4 checks passed
@Manason Manason deleted the feature/lib branch January 10, 2024 01:39
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.

None yet

3 participants