1
0
Fork 0
forked from Simnation/Main
Main/resources/[standalone]/fmLib/modules/cl_overrides.lua

55 lines
1.5 KiB
Lua
Raw Normal View History

2025-06-07 08:51:21 +02:00
---@diagnostic disable: need-check-nil
---@param props fmProgressProps | nil
function OverrideProgress(props)
local promise = promise.new()
if MOVHUD then
local actions = {
duration = props.time,
label = props.label,
canCancel = props.canCancel,
controlDisables = {
disableMovement = props.disable.move,
disableCarMovement = props.disable.car,
disableMouse = props.disable.mouse,
disableCombat = props.disable.combat,
},
}
if props.anim then
actions.animation = {
animDict = props.anim.dict,
anim = props.anim.anim,
flags = props.anim.flag,
}
elseif props.scenario then
actions.animation = {
task = props.scenario.name
}
end
if props.prop then
actions.prop = {
model = props.prop.model,
bone = props.prop.bone,
coords = props.prop.position,
rotation = props.prop.rotation,
}
end
MOVHUD:StartProgress(actions, nil, nil, function(wasCanceled)
promise:resolve(wasCanceled)
end)
return true, not Citizen.Await(promise)
end
end
function StopOverrideProgress()
if MOVHUD then
MOVHUD:StopProgress()
return true
end
return false
end