Skip to content

Commit

Permalink
refactor: split config and organization
Browse files Browse the repository at this point in the history
* refactor: split config and organize

* fix: few linting errors
  • Loading branch information
mafewtm authored Dec 9, 2023
1 parent d4541a5 commit 00a0643
Show file tree
Hide file tree
Showing 13 changed files with 973 additions and 1,084 deletions.
69 changes: 0 additions & 69 deletions cl_config.lua

This file was deleted.

56 changes: 29 additions & 27 deletions client/doors.lua
Original file line number Diff line number Diff line change
@@ -1,58 +1,60 @@
local sharedConfig = require 'config.shared'

RegisterNetEvent('qb-bankrobbery:client:ClearTimeoutDoors', function()
Config.DoorlockAction(4, true)
local PaletoObject = GetClosestObjectOfType(Config.BigBanks["paleto"]["coords"]["x"], Config.BigBanks["paleto"]["coords"]["y"], Config.BigBanks["paleto"]["coords"]["z"], 5.0, Config.BigBanks["paleto"]["object"], false, false, false)
--Config.DoorlockAction(4, true)
local PaletoObject = GetClosestObjectOfType(sharedConfig.bigBanks["paleto"]["coords"]["x"], sharedConfig.bigBanks["paleto"]["coords"]["y"], sharedConfig.bigBanks["paleto"]["coords"]["z"], 5.0, sharedConfig.bigBanks["paleto"]["object"], false, false, false)
if PaletoObject ~= 0 then
SetEntityHeading(PaletoObject, Config.BigBanks["paleto"]["heading"].closed)
SetEntityHeading(PaletoObject, sharedConfig.bigBanks["paleto"]["heading"].closed)
end
local object = GetClosestObjectOfType(Config.BigBanks["pacific"]["coords"][2]["x"], Config.BigBanks["pacific"]["coords"][2]["y"], Config.BigBanks["pacific"]["coords"][2]["z"], 20.0, Config.BigBanks["pacific"]["object"], false, false, false)
local object = GetClosestObjectOfType(sharedConfig.bigBanks["pacific"]["coords"][2]["x"], sharedConfig.bigBanks["pacific"]["coords"][2]["y"], sharedConfig.bigBanks["pacific"]["coords"][2]["z"], 20.0, sharedConfig.bigBanks["pacific"]["object"], false, false, false)
if object ~= 0 then
SetEntityHeading(object, Config.BigBanks["pacific"]["heading"].closed)
SetEntityHeading(object, sharedConfig.bigBanks["pacific"]["heading"].closed)
end
for k in pairs(Config.BigBanks["pacific"]["lockers"]) do
Config.BigBanks["pacific"]["lockers"][k]["isBusy"] = false
Config.BigBanks["pacific"]["lockers"][k]["isOpened"] = false
for k in pairs(sharedConfig.bigBanks["pacific"]["lockers"]) do
sharedConfig.bigBanks["pacific"]["lockers"][k]["isBusy"] = false
sharedConfig.bigBanks["pacific"]["lockers"][k]["isOpened"] = false
end
for k in pairs(Config.BigBanks["paleto"]["lockers"]) do
Config.BigBanks["paleto"]["lockers"][k]["isBusy"] = false
Config.BigBanks["paleto"]["lockers"][k]["isOpened"] = false
for k in pairs(sharedConfig.bigBanks["paleto"]["lockers"]) do
sharedConfig.bigBanks["paleto"]["lockers"][k]["isBusy"] = false
sharedConfig.bigBanks["paleto"]["lockers"][k]["isOpened"] = false
end
Config.BigBanks["paleto"]["isOpened"] = false
Config.BigBanks["pacific"]["isOpened"] = false
sharedConfig.bigBanks["paleto"]["isOpened"] = false
sharedConfig.bigBanks["pacific"]["isOpened"] = false
end)

CreateThread(function()
while true do
local ped = PlayerPedId()
local pos = GetEntityCoords(ped)
local PaletoDist = #(pos - Config.BigBanks["paleto"]["coords"])
local PacificDist = #(pos - Config.BigBanks["pacific"]["coords"][2])
local PaletoDist = #(pos - sharedConfig.bigBanks["paleto"]["coords"])
local PacificDist = #(pos - sharedConfig.bigBanks["pacific"]["coords"][2])
if PaletoDist < 15 then
if Config.BigBanks["paleto"]["isOpened"] then
Config.DoorlockAction(4, false)
local object = GetClosestObjectOfType(Config.BigBanks["paleto"]["coords"]["x"], Config.BigBanks["paleto"]["coords"]["y"], Config.BigBanks["paleto"]["coords"]["z"], 5.0, Config.BigBanks["paleto"]["object"], false, false, false)
if sharedConfig.bigBanks["paleto"]["isOpened"] then
--Config.DoorlockAction(4, false)
local object = GetClosestObjectOfType(sharedConfig.bigBanks["paleto"]["coords"]["x"], sharedConfig.bigBanks["paleto"]["coords"]["y"], sharedConfig.bigBanks["paleto"]["coords"]["z"], 5.0, sharedConfig.bigBanks["paleto"]["object"], false, false, false)
if object ~= 0 then
SetEntityHeading(object, Config.BigBanks["paleto"]["heading"].open)
SetEntityHeading(object, sharedConfig.bigBanks["paleto"]["heading"].open)
end
else
Config.DoorlockAction(4, true)
local object = GetClosestObjectOfType(Config.BigBanks["paleto"]["coords"]["x"], Config.BigBanks["paleto"]["coords"]["y"], Config.BigBanks["paleto"]["coords"]["z"], 5.0, Config.BigBanks["paleto"]["object"], false, false, false)
--Config.DoorlockAction(4, true)
local object = GetClosestObjectOfType(sharedConfig.bigBanks["paleto"]["coords"]["x"], sharedConfig.bigBanks["paleto"]["coords"]["y"], sharedConfig.bigBanks["paleto"]["coords"]["z"], 5.0, sharedConfig.bigBanks["paleto"]["object"], false, false, false)
if object ~= 0 then
SetEntityHeading(object, Config.BigBanks["paleto"]["heading"].closed)
SetEntityHeading(object, sharedConfig.bigBanks["paleto"]["heading"].closed)
end
end
end

-- Pacific Check
if PacificDist < 50 then
if Config.BigBanks["pacific"]["isOpened"] then
local object = GetClosestObjectOfType(Config.BigBanks["pacific"]["coords"][2]["x"], Config.BigBanks["pacific"]["coords"][2]["y"], Config.BigBanks["pacific"]["coords"][2]["z"], 20.0, Config.BigBanks["pacific"]["object"], false, false, false)
if sharedConfig.bigBanks["pacific"]["isOpened"] then
local object = GetClosestObjectOfType(sharedConfig.bigBanks["pacific"]["coords"][2]["x"], sharedConfig.bigBanks["pacific"]["coords"][2]["y"], sharedConfig.bigBanks["pacific"]["coords"][2]["z"], 20.0, sharedConfig.bigBanks["pacific"]["object"], false, false, false)
if object ~= 0 then
SetEntityHeading(object, Config.BigBanks["pacific"]["heading"].open)
SetEntityHeading(object, sharedConfig.bigBanks["pacific"]["heading"].open)
end
else
local object = GetClosestObjectOfType(Config.BigBanks["pacific"]["coords"][2]["x"], Config.BigBanks["pacific"]["coords"][2]["y"], Config.BigBanks["pacific"]["coords"][2]["z"], 20.0, Config.BigBanks["pacific"]["object"], false, false, false)
local object = GetClosestObjectOfType(sharedConfig.bigBanks["pacific"]["coords"][2]["x"], sharedConfig.bigBanks["pacific"]["coords"][2]["y"], sharedConfig.bigBanks["pacific"]["coords"][2]["z"], 20.0, sharedConfig.bigBanks["pacific"]["object"], false, false, false)
if object ~= 0 then
SetEntityHeading(object, Config.BigBanks["pacific"]["heading"].closed)
SetEntityHeading(object, sharedConfig.bigBanks["pacific"]["heading"].closed)
end
end
end
Expand Down
Loading

0 comments on commit 00a0643

Please sign in to comment.