This was crowleys commit and work - Refactor entity behaviors and improve particle handling

Refactored entity behavior triggers to simplify argument passing and added OnSet handler for particle behaviors. Improved particle effect management and event handling, updated locale and lib initialization in several modules, and fixed skill metadata access. Also streamlined point zone logic and menu/zone system initialization for better reliability.
This commit is contained in:
MrNewb committed 2025-10-26 16:20:27 -04:00
1 parent 179c3bad85
commit 444040dd39
13 files changed
+71 -64

No files matched your search

+2
View File
@@ -5,6 +5,8 @@ if (configValue == "auto" and GetResourceState(resourceName) == "missing") or (c
Input = {}
if not lib then Require('init.lua', 'ox_lib') end
function Input.Open(title, data, isQBFormat, submitText)
local inputs = data.inputs
if isQBFormat then
+1 -1
View File
@@ -3,7 +3,7 @@ local configValue = BridgeClientConfig.MenuSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Menus = Menus or {}
lib = lib or Require("init.lua", "ox_lib")
if not lib then Require('init.lua', 'ox_lib') end
---Converts a QB menu to an Ox menu.
---@param id string The menu ID.
+2 -2
View File
@@ -47,7 +47,7 @@ end
---@return number
Skills.GetSkillLevel = function(skillName)
if not skillName then return 0 end
local plyrSkills = Framework.GetPlayerMetaData("community_bridge_skills")
local plyrSkills = Bridge.Framework.GetPlayerMetaData("community_bridge_skills")
if not plyrSkills or not plyrSkills[skillName] then return 1 end
return plyrSkills[skillName].level or 1
end
@@ -57,7 +57,7 @@ end
---@return number
Skills.GetXP = function(skillName)
if not skillName then return 0 end
local plyrSkills = Framework.GetPlayerMetaData("community_bridge_skills")
local plyrSkills = Bridge.Framework.GetPlayerMetaData("community_bridge_skills")
if not plyrSkills or not plyrSkills[skillName] then return 1 end
return plyrSkills[skillName].currentXP or 1
end
+17 -19
View File
@@ -122,14 +122,14 @@ Target.AddModel = function(models, options)
end
Target.AddBoxZone = function(name, coords, size, heading, options)
local fixedOptions = Target.FixOptions(_options)
local fixedOptions = Target.FixOptions(options)
local id = Ids.RandomString()
local title = Language.Locale("target.title")
local title = Bridge.Language.Locale("target.title")
local menuData = { id = id, title = title, options = {} }
for k, v in pairs(fixedOptions) do
table.insert(menuData.options, {
title = title .. " " .. k,
description = Language.Locale("target.description"),
description = Bridge.Language.Locale("target.description"),
onSelect = function(selected, secondary, args)
if v.onSelect then
v.onSelect(selected, secondary, args)
@@ -138,28 +138,26 @@ Target.AddBoxZone = function(name, coords, size, heading, options)
})
end
local inZone = false
local test = Language.Locale("target.interact")
Point.Register(id, coords, 5, nil, function()
Point.Register(id, coords, 5, nil,
function()
local sleep = 3000
CreateThread(function()
while inZone do
Wait(sleep)
local distance = #(coords - GetEntityCoords(PlayerPedId()))
if distance < 2 then
sleep = 0
Utility.Draw3DHelpText(coords, test, 0.35)
if IsControlJustPressed(0, 38) then
Menu.Open(menuData, false)
end
else
sleep = 1000
while inZone do
Wait(sleep)
local distance = #(coords - GetEntityCoords(PlayerPedId()))
if distance < 10 then
sleep = 0
Utility.Draw3DHelpText(coords, Bridge.Language.Locale("target.interact"), 0.35)
if IsControlJustPressed(0, 38) then
Menu.Open(menuData, false)
end
end
end)
end
end,
function()
inZone = false
Point.Remove(id)
end, function()
end,
function()
--No need for this in this one
end)
end
+1 -1
View File
@@ -23,7 +23,7 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ox_lib"
if GetResourceState(resourceName) == 'missing' then return end
lib = lib or Require("init.lua", "ox_lib")
if not lib then Require('init.lua', 'ox_lib') end
Ids = Ids or Require('lib/utility/shared/ids.lua')
cZones = {} --conflict with ox