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: rename config value to be clearer as to the behavior #105

Merged
merged 3 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ local function findKeys(vehicleModel, vehicleClass, plate, vehicle)
combat = true,
}
}) then
if math.random() <= vehicleConfig.findKeysChance[vehicle] then
if math.random() <= vehicleConfig.findKeysChance then
TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', plate)
return true
else
Expand Down Expand Up @@ -118,7 +118,7 @@ local function showHotwiringLabel(vehicle)
-- Hotwiring while in vehicle, also keeps engine off for vehicles you don't own keys to
if not isVehicleAccessible and cache.seat == -1 then
local isVehicleRunning = GetIsVehicleEngineRunning(vehicle)
if config.keepVehicleRunning and isVehicleRunning then
if config.getKeysWhenEngineIsRunning and isVehicleRunning then
TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', plate)
else
SetVehicleNeedsToBeHotwired(vehicle, false)
Expand Down
3 changes: 1 addition & 2 deletions config/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ local defaultHoldupAnim = { dict = 'mp_am_hold_up', clip = 'holdup_victim_20s' }
return {
vehicleMaximumLockingDistance = 5.0, -- Minimum distance for vehicle locking

-- Lockpick Settings
keepVehicleRunning = true,
getKeysWhenEngineIsRunning = true, -- when enabled, gives keys to a player who doesn't have them if they enter the driver seat when the engine is running

-- Carjack Settings
carjackEnable = true, -- Enables the ability to carjack pedestrian vehicles, stealing them by pointing a weapon at them
Expand Down
2 changes: 1 addition & 1 deletion shared/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function public.getVehicleConfig(vehicle)
local model = GetEntityModel(vehicle)
local filteredConfig = {
modelConfig = config.vehicles.models[model],
categoryConfig = config.vehicles.categories[VEHICLES[model].category],
categoryConfig = config.vehicles.categories[VEHICLES[model]?.category],
typeConfig = config.vehicles.types[GetVehicleType(vehicle)],
defaultConfig = config.vehicles.default
}
Expand Down
6 changes: 3 additions & 3 deletions types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
---@field carjackingImmune? boolean
---@field lockpickImmune? boolean
---@field shared? boolean
---@field removeNormalLockpickChance number ratio
---@field removeAdvancedLockpickChance number ratio
---@field findKeysChance number ratio
---@field removeNormalLockpickChance? number ratio
---@field removeAdvancedLockpickChance? number ratio
---@field findKeysChance? number ratio