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

refactor: feat: ! Refactoring and describing the lockpickDoor function moved to client/functions.lua #43

Merged
merged 3 commits into from
Apr 19, 2024

Conversation

artur-michalak
Copy link
Contributor

@artur-michalak artur-michalak commented Apr 10, 2024

Description

The lockpickDoor, attemptPoliceAlert, isBlacklistedWeapon, isBlacklistedVehicle functions and their helper functions have been moved to clients/functions.lua

These can be used in main.lua using import, inspired by ox_target

local functions = require 'client.functions'
local lockpickDoor, attemptPoliceAlert, isBlacklistedWeapon, isBlacklistedVehicle in functions

Some conditions have been added to enable the usage of the lock pick.

When opened, the distance between the vehicle and the player's ped gets checked.

Previously, opening the lock on trucks was done in the middle of the vehicle. Now you just have to approach the driver's door.

Used statebag to hold information about the lock.

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.

BREAKING CHANGE:
In the statebag of the vehicle there is a saved information on whether it has been opened with a lock pick.

Copy link
Contributor

@Manason Manason left a comment

Choose a reason for hiding this comment

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

Skimmed through things. Seems like an improvement.

@Manason
Copy link
Contributor

Manason commented Apr 16, 2024

Looks like there are some conflicts. Should have probably merged yours first. Sorry :(

@artur-michalak
Copy link
Contributor Author

I will resolve conflicts soon

Comment on lines +16 to -7
function public.isCloseToCoords(coord1, coord2, distance)
return #(coord1 - coord2) < distance
end
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like an unnecessary abstraction

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function was already in the code. It improves readability a little bit, which is why I started using it.


--[[ Manifest ]]--
dependencies {
'ox_lib',
Copy link
Contributor

Choose a reason for hiding this comment

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

This will make it so if you restart ox_lib, then this resource will be stopped. Is that the desired behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are a few lib.callbacks in the script, so without ox_lib it may throw errors

@Manason Manason merged commit b623ac8 into Qbox-project:main Apr 19, 2024
0 of 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.

2 participants