Skip to content

feat(es_extended/client/imports/point.lua): Merge module into imports#1612

Closed
feelfreetofee wants to merge 7 commits intoesx-framework:devfrom
feelfreetofee:dev
Closed

feat(es_extended/client/imports/point.lua): Merge module into imports#1612
feelfreetofee wants to merge 7 commits intoesx-framework:devfrom
feelfreetofee:dev

Conversation

@feelfreetofee
Copy link
Copy Markdown
Contributor

@feelfreetofee feelfreetofee commented Feb 13, 2025

Description

The module is now exclusively imported.

Motivation

The development team has chosen to restrict the module's scope to the importing resource

Implementation Details

I have implemented two separate threads to manage point detection efficiently:

Main Thread:

  • Runs every 500ms.
  • Starts when at least one point is registered and stops when the last point is deleted.
  • Checks if the player enters or leaves any points.

Nearby Thread:

  • Starts when the player gets close to any point for the first time.
  • Runs every frame and stops when there are no more nearby points.
  • Calls the inside method when the player is within range of a point.

This setup ensures that the main thread runs intermittently to save resources, only activating when necessary.
The nearby thread runs at full speed only when the player is near relevant points, ensuring responsive interactions.

Usage Example

local pointObject = ESX.Point:new({
   coords = vector3(0, 0, 70),
   distance = 10
})

function pointObject:enter()
   print('Hello World!')
end

function pointObject:inside(distance)
   DrawMarker(1, self.coords.x, self.coords.y, self.coords.z, 0, 0, 0, 0, 0, 0, 2, 2, 1, 255, 255, 255, 151)
   if distance <= 2 then
      ESX.ShowHelpNotification(('Hello World #%d'):format(self.handle), true)
   end
end

function pointObject:leave()
   print('Bye World!')
end

PR Checklist

  • My commit messages and PR title follow the Conventional Commits standard.
  • My changes have been tested locally and function as expected.
  • My PR does not introduce any breaking changes.
  • I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

The point module now only runs in the script that uses it
Removed since the core is not related to the module anymore
…layer coordinates

The code was using ```PlayerObject:GetCoords()``` when it should be ```GetEntityCoords(ESX.PlayerData.ped)```
- Corrected the usage of "ESX.Table.SizeOf"
- Added argument to Wait
- remove unused and repeated loop variable "handle"
- renamed loop variable  "point" to "nearbyPoints" since there's already a point variable in the closure
- Removed trailing space
I do this mainly for the linter, a single space doesn't scare me
@Kenshiin13
Copy link
Copy Markdown
Contributor

As discussed, this will become obsolete with the next update. I'm really sorry for the time that has been dedicated for this!

@Kenshiin13 Kenshiin13 closed this May 5, 2025
@github-project-automation github-project-automation bot moved this from In-Development to Recycle Bin in ESX Roadmap May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Recycle Bin

Development

Successfully merging this pull request may close these issues.

3 participants