Skip to content

Commit

Permalink
refactor: rename config value to be clearer as to the behavior (#105)
Browse files Browse the repository at this point in the history
* refactor: rename config value to be clearer as to the behavior

* fix nil check

* fix: using number not table
  • Loading branch information
Manason authored Aug 25, 2024
1 parent a796ad6 commit d799808
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,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

0 comments on commit d799808

Please sign in to comment.