Skip to content

Update weapdraw.lua#214

Open
zhivotnoya wants to merge 7 commits intoqbcore-framework:mainfrom
zhivotnoya:zhivotnoya-patch-2
Open

Update weapdraw.lua#214
zhivotnoya wants to merge 7 commits intoqbcore-framework:mainfrom
zhivotnoya:zhivotnoya-patch-2

Conversation

@zhivotnoya
Copy link

Changed code from cumbersome check code, to just checking for variant and switching to opposite. Also makes it easier to implement new holsters if others are added to EUP by simply putting variants in config file and not having to add to logic code.

Describe Pull request
Code was changed to facilitate checking variant pairs from new config.lua. Then simply switching the componentID based on the current componentID. So in the config, as an example, I have:

[205] = 204 -- Full to empty
[204] = 205 -- Empty to full

This way you can simply edit the config and not have to change the cumbersome logic in weapdraw.lua.

If your PR is to fix an issue mention that issue here

Questions (please complete the following information):

  • Have you personally loaded this code into an updated qbcore project and checked all it's functionality? [yes/no] (Be honest) yes
  • Does your code fit the style guidelines? [yes/no] yes
  • Does your PR fit the contribution guidelines? [yes/no] yes

Changed code from cumbersome check code, to just checking for variant and switching to opposite.  Also makes it easier to implement new holsters if others are added to EUP by simply putting variants in config file and not having to add to logic code.
@zhivotnoya
Copy link
Author

I'll go thru and remove the variables that aren't needed any longer. I'm checking my code now.

Removed some unused variables.
Fixed canfire variable never getting called by removing it.
Had to put it back in (canFire)
@zhivotnoya
Copy link
Author

Fixed all linting errors.

Added animation checks to (hopefully) prevent player getting stuck in holster/unholster animation loops.
removed function isPlayingAnim as it was unused and unnecessary.
removed other unused/unaccessed variables. Must appease the linting Gods. :)
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.

1 participant