init dialogue and progressbar bananza

Added dialogue system initial upload. Some modifications needed but good default.

Standardized input and output for progressbar. Accepts ox and qb (progressbar)
This commit is contained in:
gononono64 committed 2025-02-21 11:02:18 -06:00
1 parent df5dd4ffa4
commit 58782dfcd0
24 files changed
+12762 -89

No files matched your search

+111 -54
View File
@@ -1,60 +1,117 @@
if BridgeClientConfig.ProgressBar ~= "qb" then return end
Progressbar = {}
-- if BridgeClientConfig.ProgressBar ~= "qb" then return end
-- Progressbar = {}
local function convertOxToQB(disabledTable, animTable)
local repackedTable = { disabled = {}, animations = {}}
for _, v in pairs(disabledTable) do
if v.move then
repackedTable.disabled.disableMovement = v.move
end
if v.car then
repackedTable.disabled.disableCarMovement = v.car
end
if v.combat then
repackedTable.disabled.disableCombat = v.combat
end
if v.mouse then
repackedTable.disabled.disableMouse = v.mouse
end
end
for _, v in pairs(animTable) do
if v.dict then
repackedTable.animations.animDict = v.animDict
end
if v.clip then
repackedTable.animations.anim = v.anim
end
end
return repackedTable
end
-- local function convertOxToQB(disabledTable, animTable)
-- local repackedTable = { disabled = {}, animations = {}}
-- for _, v in pairs(disabledTable) do
-- if v.move then
-- repackedTable.disabled.disableMovement = v.move
-- end
-- if v.car then
-- repackedTable.disabled.disableCarMovement = v.car
-- end
-- if v.combat then
-- repackedTable.disabled.disableCombat = v.combat
-- end
-- if v.mouse then
-- repackedTable.disabled.disableMouse = v.mouse
-- end
-- end
-- for _, v in pairs(animTable) do
-- if v.dict then
-- repackedTable.animations.animDict = v.animDict
-- end
-- if v.clip then
-- repackedTable.animations.anim = v.anim
-- end
-- end
-- return repackedTable
-- end
Progressbar.StartProgressBar = function(time, label, whiledead, cancancel, disable, animTable, successAction, canceledAction)
local runTime = time or 10000
local textLabel = label or "Doing something"
local deadBool = whiledead or false
local cancelBool = cancancel or false
local success = successAction or function() Prints.Debug("Success") end
local canceled = canceledAction or function() Prints.Debug("Cancelled") end
local repackedTable = convertOxToQB(disable, animTable)
exports['progressbar']:Progress({
name = textLabel,
duration = runTime,
label = textLabel,
useWhileDead = deadBool,
canCancel = cancelBool,
controlDisables = repackedTable.disabled,
animation = repackedTable.animations,
-- Progressbar.StartProgressBar = function(time, label, whiledead, cancancel, disable, animTable, successAction, canceledAction)
-- local runTime = time or 10000
-- local textLabel = label or "Doing something"
-- local deadBool = whiledead or false
-- local cancelBool = cancancel or false
-- local success = successAction or function() Prints.Debug("Success") end
-- local canceled = canceledAction or function() Prints.Debug("Cancelled") end
-- local repackedTable = convertOxToQB(disable, animTable)
-- exports['progressbar']:Progress({
-- name = textLabel,
-- duration = runTime,
-- label = textLabel,
-- useWhileDead = deadBool,
-- canCancel = cancelBool,
-- controlDisables = repackedTable.disabled,
-- animation = repackedTable.animations,
-- prop = {},
-- propTwo = {}
-- }, function(cancelled)
-- if not cancelled then
-- success()
-- else
-- canceled()
-- end
-- end)
-- end
-- Progressbar.IsProgressBarActive = function()
-- return exports["progressbar"]:isDoingSomething()
-- end
if GetResourceState('progressbar') ~= 'started' or (BridgeClientConfig.ProgressBarSystem ~= "qb" and BridgeClientConfig.ProgressBarSystem ~= "auto") then return end
ProgressBar = ProgressBar or {}
local function convertFromOx(options)
if not options then return options end
return {
name = options.label,
duration = options.duration,
label = options.label,
useWhileDead = options.useWhileDead,
canCancel = options.canCancel,
controlDisables = {
disableMovement = options.disable?.move,
disableCarMovement = options.disable?.car,
disableMouse = options.disable?.mouse,
disableCombat = options.disable?.combat
},
animation = {
animDict = options.anim?.dict,
anim = options.anim?.clip
},
prop = {},
propTwo = {}
}, function(cancelled)
if not cancelled then
success()
else
canceled()
end
end)
}
end
Progressbar.IsProgressBarActive = function()
return exports["progressbar"]:isDoingSomething()
end
function ProgressBar.Open(options, cb, qbFormat)
if not exports['progressbar'] then return false end
if not qbFormat then
options = convertFromOx(options)
end
exports['progressbar']:Progress(options, cb)
end
-- Example usage:
RegisterCommand("progressbar", function()
ProgressBar.Open({
duration = 5000,
label = "Searching",
disable = {
move = true,
combat = true
},
anim = {
dict = "anim@amb@clubhouse@tutorial@bkr_tut_ig3@",
clip = "machinic_loop_mechandplayer"
}
}, function(cancelled)
print(cancelled and "Cancelled" or "Complete")
end)
end)