feat: add MSK Scripts provider integrations
- fuel/msk_fuel: Fuel provider via msk_fuel exports (Get/SetVehicleFuel) - vehiclekey/msk_vehiclekeys: VehicleKey provider (Add/RemovePrimaryKey) - notify/msk_core: config-driven Notify provider via msk_core:Notify - progressbar/msk_core: ProgressBar provider mapping label/duration/anim/disable - settings: whitelist comments for msk_core / msk_fuel / msk_vehiclekeys
This commit is contained in:
1 parent
d9d1a4af00
commit
48c58f45e0
6 files changed
+174
-4
No files matched your search
@@ -0,0 +1,33 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "msk_fuel"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---@description Returns the name of the active fuel resource.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---@description Returns the current fuel level of a vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@return number The vehicle fuel level.
|
||||
Fuel.GetFuel = function(vehicle)
|
||||
if not DoesEntityExist(vehicle) then return 0.0 end
|
||||
return exports.msk_fuel:GetVehicleFuel(vehicle)
|
||||
end
|
||||
|
||||
---@description Sets the fuel level of a vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param fuel number The fuel level to assign.
|
||||
---@param type? string The fuel type, used only in ti_fuel / msk_fuel. (default: nil)
|
||||
---@return nil
|
||||
Fuel.SetFuel = function(vehicle, fuel, type)
|
||||
if not DoesEntityExist(vehicle) then return end
|
||||
exports.msk_fuel:SetVehicleFuel(vehicle, fuel)
|
||||
if type then
|
||||
exports.msk_fuel:SetVehicleFuelType(vehicle, type)
|
||||
end
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -0,0 +1,38 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
Notify = Notify or {}
|
||||
local resourceName = "msk_core"
|
||||
local configValue = BridgeSharedConfig.Notify
|
||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||
|
||||
Notify.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
local Language = Language or Require("modules/locales/shared.lua")
|
||||
local locale = Language.Locale
|
||||
local placeHolderText = locale("Notifications.PlaceholderTitle")
|
||||
|
||||
---DEPRICATED: PLEASE SWITCH TO Notify.SendNotification
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@return nil
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
time = time or 3000
|
||||
return exports.msk_core:Notify(nil, message, _type, time)
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@param props table optional
|
||||
---@return nil
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
if not title then title = placeHolderText end
|
||||
return exports.msk_core:Notify(title, message, _type or "success", time)
|
||||
end
|
||||
|
||||
return Notify
|
||||
@@ -0,0 +1,66 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "msk_core"
|
||||
local configValue = BridgeClientConfig.ProgressBarSystem
|
||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||
|
||||
ProgressBar = ProgressBar or {}
|
||||
|
||||
---Converts bridge/ox-style progress options into the msk_core Progress.Start format.
|
||||
---@param options table
|
||||
---@return table
|
||||
local function convertToMsk(options)
|
||||
options = options or {}
|
||||
|
||||
-- QB exposes animation under .animation.animDict/.anim and disables under .controlDisables
|
||||
local anim = options.anim or options.animation
|
||||
local animation
|
||||
if anim then
|
||||
animation = {
|
||||
dict = anim.dict or anim.animDict,
|
||||
anim = anim.clip or anim.anim,
|
||||
flag = anim.flag or anim.flags or 49,
|
||||
}
|
||||
end
|
||||
|
||||
-- ox uses options.disable.{move,car,combat,mouse}, QB uses options.controlDisables.*
|
||||
local d = options.disable or options.controlDisables or {}
|
||||
local disable = {
|
||||
move = d.move or d.disableMovement,
|
||||
vehicle = d.car or d.disableCarMovement,
|
||||
combat = d.combat or d.disableCombat,
|
||||
mouse = d.mouse or d.disableMouse,
|
||||
}
|
||||
|
||||
return {
|
||||
duration = options.duration,
|
||||
text = options.label or options.text or '',
|
||||
disable = disable,
|
||||
animation = animation,
|
||||
forceOverride = options.forceOverride,
|
||||
}
|
||||
end
|
||||
|
||||
---This will open a progress bar (blocking until it completes).
|
||||
---@param options table
|
||||
---@param cb any optional callback receiving the success boolean
|
||||
---@param isQBInput boolean optional
|
||||
---@return boolean success true if the progress completed without being cancelled
|
||||
function ProgressBar.Open(options, cb, isQBInput)
|
||||
local data = convertToMsk(options)
|
||||
|
||||
-- msk_core Progress.Start blocks for the full duration; if it is interrupted
|
||||
-- it stops early. We treat a fully elapsed bar as success.
|
||||
exports.msk_core:Progressbar(data)
|
||||
|
||||
local active = exports.msk_core:ProgressActive()
|
||||
local success = not active
|
||||
|
||||
if cb then cb(success) end
|
||||
return success
|
||||
end
|
||||
|
||||
ProgressBar.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
return ProgressBar
|
||||
@@ -0,0 +1,33 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "msk_vehiclekeys"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
exports.msk_vehiclekeys:AddPrimaryKey(vehicle)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
exports.msk_vehiclekeys:RemovePrimaryKey(vehicle)
|
||||
end
|
||||
|
||||
VehicleKey.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -1,9 +1,9 @@
|
||||
BridgeClientConfig = {}
|
||||
BridgeClientConfig.InputSystem = "auto" -- [ auto | ox_lib | lation_ui | qb-input ]
|
||||
BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | qb-menu ]
|
||||
BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | ZSX_UIV2 | keep-progressbar | progressbar ]
|
||||
BridgeClientConfig.VehicleKey = "auto" -- [ auto | qb-vehiclekeys | MrNewbVehicleKeys | jaksams_VehiclesKeys | wasabi_carlock | mk_vehiclekeys | qbx_vehiclekeys | qs-vehiclekeys | t1ger_keys | Renewed-Vehiclekeys | mono_carkeys| cd_garage | okokGarage | F_RealCarKeysSystem
|
||||
BridgeClientConfig.Fuel = "auto" -- [ auto | LegacyFuel | ox_fuel | ps-fuel | qs-fuelstations | Renewed-Fuel | ti_fuel | lc_fuel | x-fuel | cdn-fuel | esx-sna-fuel | BigDaddy-Fuel | okokGasStation ]
|
||||
BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | ZSX_UIV2 | keep-progressbar | progressbar | msk_core ]
|
||||
BridgeClientConfig.VehicleKey = "auto" -- [ auto | qb-vehiclekeys | MrNewbVehicleKeys | jaksams_VehiclesKeys | wasabi_carlock | mk_vehiclekeys | qbx_vehiclekeys | qs-vehiclekeys | t1ger_keys | Renewed-Vehiclekeys | mono_carkeys| cd_garage | okokGarage | F_RealCarKeysSystem | msk_vehiclekeys
|
||||
BridgeClientConfig.Fuel = "auto" -- [ auto | LegacyFuel | ox_fuel | ps-fuel | qs-fuelstations | Renewed-Fuel | ti_fuel | lc_fuel | x-fuel | cdn-fuel | esx-sna-fuel | BigDaddy-Fuel | okokGasStation | msk_fuel ]
|
||||
BridgeClientConfig.TargetSystem = "auto" -- [ auto | ox_target | qb-target | sleepless_interact ] -- sleepless is only partially supported and would need another system in place
|
||||
BridgeClientConfig.Debug = false
|
||||
return BridgeClientConfig
|
||||
@@ -1,7 +1,7 @@
|
||||
BridgeSharedConfig = {}
|
||||
BridgeSharedConfig.Lang = "auto" -- Change this to your preferred language (must match the locale file name ex. en or fr etc)
|
||||
BridgeSharedConfig.DebugLevel = 0 -- Change this to your Debug level, 0 for none, 1 for some, 2 for all data
|
||||
BridgeSharedConfig.Notify = "auto" -- [ auto | ox_lib | r_notify | wasabi_notify | lation_ui | ZSX_UIV2 | okokNotify | mythic_notify | pNotify | t-notify | brutal_notify | FL-Notify]
|
||||
BridgeSharedConfig.Notify = "auto" -- [ auto | ox_lib | r_notify | wasabi_notify | lation_ui | ZSX_UIV2 | okokNotify | mythic_notify | pNotify | t-notify | brutal_notify | FL-Notify | msk_core]
|
||||
BridgeSharedConfig.HelpText = "auto" -- [ auto | ox_lib | jg-textui | lation_ui | ZSX_UIV2 | cd_drawtextui | lab-HintUI | okokTextUI]
|
||||
BridgeSharedConfig.Phone = "auto" -- [ auto | qs-smartphone | lb-phone | gksphone]
|
||||
BridgeSharedConfig.Skills = "auto" -- [ auto | OT_skills | evolent_skills | pickle_xp]
|
||||
|
||||
Reference in new issue
Block a user