Skip to content

Commit

Permalink
cleanup/refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumMalice committed Jul 16, 2024
1 parent c4f9307 commit 7d722ad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 33 deletions.
6 changes: 3 additions & 3 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ if GetResourceState('ox_inventory') == 'started' then
if not ox_inv then print(msg_inv) return end
end

local Class = require 'modules.handler'
---@class Handler : OxClass
local Handler = require 'modules.handler'
local Settings = lib.load('data.vehicle')
local Handler = nil

local function startThreads(vehicle)
if not vehicle then return end
Expand Down Expand Up @@ -164,6 +164,6 @@ lib.callback.register('vehiclehandler:basicfix', function(fixtype)
end)

CreateThread(function()
Handler = Class:new()
Handler = Handler:new()
startThreads(cache.vehicle)
end)
21 changes: 7 additions & 14 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@ lua54 'yes'
name 'vehiclehandler'
description 'Collision/damage handling for FiveM.'
author 'QuantumMalice'
version '1.1.2'
version '1.2.0'

files {
'data/*.lua',
'modules/handler.lua',
'data/progress.lua',
'data/vehicle.lua',
'modules/handler.lua'
}

shared_scripts {
'@ox_lib/init.lua',
}

client_scripts {
'client.lua',
}

server_scripts {
'server.lua',
}
shared_script '@ox_lib/init.lua'
client_script 'client.lua'
server_script 'server.lua'
20 changes: 4 additions & 16 deletions server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ if GetResourceState('ox_inventory') == 'started' then

exports('cleaningkit', function(event, item, inventory, slot, data)
if event == 'usingItem' then
local src = inventory.id
if not src then return false end

local success = lib.callback.await('vehiclehandler:basicwash', src)
local success = lib.callback.await('vehiclehandler:basicwash', inventory.id)
if success then return end

return false
Expand All @@ -21,10 +18,7 @@ if GetResourceState('ox_inventory') == 'started' then

exports('tirekit', function(event, item, inventory, slot, data)
if event == 'usingItem' then
local src = inventory.id
if not src then return false end

local success = lib.callback.await('vehiclehandler:basicfix', src, 'tirekit')
local success = lib.callback.await('vehiclehandler:basicfix', inventory.id, 'tirekit')
if success then return end

return false
Expand All @@ -33,10 +27,7 @@ if GetResourceState('ox_inventory') == 'started' then

exports('repairkit', function(event, item, inventory, slot, data)
if event == 'usingItem' then
local src = inventory.id
if not src then return false end

local success = lib.callback.await('vehiclehandler:basicfix', src, 'smallkit')
local success = lib.callback.await('vehiclehandler:basicfix', inventory.id, 'smallkit')
if success then return end

return false
Expand All @@ -45,10 +36,7 @@ if GetResourceState('ox_inventory') == 'started' then

exports('advancedrepairkit', function(event, item, inventory, slot, data)
if event == 'usingItem' then
local src = inventory.id
if not src then return false end

local success = lib.callback.await('vehiclehandler:basicfix', src, 'bigkit')
local success = lib.callback.await('vehiclehandler:basicfix', inventory.id, 'bigkit')
if success then return end

return false
Expand Down

0 comments on commit 7d722ad

Please sign in to comment.