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: allow resources to retrieve the invoking resource of commands #3012

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Mycroft-Studios
Copy link

Goal of this PR

The goal of this PR is quite simple: allow resources to see which resource, registered which command.
This goal, was mainly sparked by a suggestion in txAdmin:

In txAdmin menu, under Resources tab, It would be useful to view all the registered commands under each script in a dropdown

How is this PR achieving the goal

This PR achieves this by:

  • storing the invoking resource from REGISTER_COMMAND in the Command Object
  • Allowing that data to be accessed from the existing native: GetRegisteredCommands
  • Adds a Brand new Native: GET_RESOURCE_COMMANDS, that allows resources to retrieve the command list, from specific resources, allowing for much cleaner code.
  • All internal commands, such as convars, are marked as internal for the resource.

This PR applies to the following area(s)

FiveM, RedM, Server, Natives

Successfully tested on

Platforms: Windows

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

@github-actions github-actions bot added the RedM Issues/PRs related to RedM label Dec 17, 2024
@Mycroft-Studios Mycroft-Studios changed the title feat: allow invoking resource for commands, to be read feat: allow resources to retrieve the invoking resource of commands Dec 17, 2024
@github-actions github-actions bot added the triage Needs a preliminary assessment to determine the urgency and required action label Dec 17, 2024
@github-actions github-actions bot added invalid Requires changes before it's considered valid and can be (re)triaged and removed triage Needs a preliminary assessment to determine the urgency and required action labels Dec 17, 2024
adjusted `getResource` to `GetResourceName` and `fromResource` to `MatchResourceName`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Requires changes before it's considered valid and can be (re)triaged RedM Issues/PRs related to RedM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants