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(add exports for external data pulling) #158

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

MrNewb
Copy link
Contributor

@MrNewb MrNewb commented Dec 4, 2024

This PR introduces exports that allow external scripts to pull door-related data from the resource. This is particularly useful for external systems that need to find nearby doors, check their status, and interact with them in various ways.

Exports:

  1. exports('GetClosestDoor', function())

    • Purpose: Returns the closest door to the player or any entity.
    • Use Case: Useful for automatic door opening, player proximity checks, or triggering events when a player approaches a door.
  2. exports('GetNearbyDoors', function())

    • Purpose: Provides a list of nearby doors, allowing external resources to check for doors in a given area.
    • Use Case: Can be used for door management systems, NPC behavior, or crafting systems where doors play a role in interactions.
  3. exports('GetDoorList', function())

    • Purpose: Returns a predefined list of all doors in the configuration.
    • Use Case: Useful for administrative tools, debugging, or systems that need to interact with the full set of doors, such as global state updates or door management.
  4. exports('GetDoorStates', function())

    • Purpose: Retrieves the current state of all doors (e.g., open, closed, locked).
    • Use Case: Essential for systems that need to dynamically track or manage door states, such as security systems, lock-and-key systems, or event-driven interactions with doors.

Why This Is Useful:

These exports allow external scripts to easily access door data, enabling more advanced systems and interactions with doors in your game. They simplify integration with other resources, making it easier to build more complex and dynamic gameplay features involving doors.


Additional Information

  • Issue being fixed: (If your PR is fixing an issue, mention the issue here)

Questions

  • Have you personally loaded this code into an updated qbcore project and checked all its functionality?
    [yes] Ran it in a loop.

  • Does your code fit the style guidelines?
    [yes]

  • Does your PR fit the contribution guidelines?
    [yes]

This pr will allow me to pull data externally.
Intended use, external scripts pull this data to find the nearby door, check status, etc
Copy link

@ChristianBDev ChristianBDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding valuable exports that were not in the resource

@GhzGarage GhzGarage merged commit 83cf099 into qbcore-framework:main Dec 4, 2024
2 checks passed
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.

4 participants