- remove locales module

This commit is contained in:
Mustachedom committed 2026-08-18 00:02:04 -07:00
1 parent d6cffd01bc
commit 07530a8662
25 files changed
+84 -724

No files matched your search

+5 -5
View File
@@ -3,14 +3,14 @@ Utility = Utility or Require("lib/utility/client/utility.lua")
if not lib then Require('init.lua', 'ox_lib') end
local activePlacementProp = nil
lib.locale()
-- Object placer --
local placementText = {
locale('placeable_object.place_object_place'),
locale('placeable_object.place_object_cancel'),
locale('placeable_object.place_object_scroll_up'),
locale('placeable_object.place_object_scroll_down')
lib.locale('placeable_object.place_object_place'),
lib.locale('placeable_object.place_object_cancel'),
lib.locale('placeable_object.place_object_scroll_up'),
lib.locale('placeable_object.place_object_scroll_down')
}
local function finishPlacing()
+12 -13
View File
@@ -1,18 +1,17 @@
Scaleform = Scaleform or Require("lib/scaleform/client/scaleform.lua")
Utility = Utility or Require("lib/utility/client/utility.lua")
Raycast = Raycast or Require("lib/raycast/client/raycast.lua")
Language = Language or Require("modules/locales/shared.lua")
PlaceableObject = PlaceableObject or {}
-- Register key mappings for placement controls
RegisterKeyMapping('+place_object', locale('placeable_object.object_place'), 'mouse_button', 'MOUSE_LEFT')
RegisterKeyMapping('+cancel_placement', locale('placeable_object.object_cancel'), 'mouse_button', 'MOUSE_RIGHT')
RegisterKeyMapping('+rotate_left', locale('placeable_object.rotate_left'), 'keyboard', 'LEFT')
RegisterKeyMapping('+rotate_right', locale('placeable_object.rotate_right'), 'keyboard', 'RIGHT')
RegisterKeyMapping('+scroll_up', locale('placeable_object.object_scroll_up'), 'mouse_wheel', 'IOM_WHEEL_UP')
RegisterKeyMapping('+scroll_down', locale('placeable_object.object_scroll_down'), 'mouse_wheel', 'IOM_WHEEL_DOWN')
RegisterKeyMapping('+depth_modifier', locale('placeable_object.depth_modifier'), 'keyboard', 'LCONTROL')
RegisterKeyMapping('+place_object', lib.locale('placeable_object.object_place'), 'mouse_button', 'MOUSE_LEFT')
RegisterKeyMapping('+cancel_placement', lib.locale('placeable_object.object_cancel'), 'mouse_button', 'MOUSE_RIGHT')
RegisterKeyMapping('+rotate_left', lib.locale('placeable_object.rotate_left'), 'keyboard', 'LEFT')
RegisterKeyMapping('+rotate_right', lib.locale('placeable_object.rotate_right'), 'keyboard', 'RIGHT')
RegisterKeyMapping('+scroll_up', lib.locale('placeable_object.object_scroll_up'), 'mouse_wheel', 'IOM_WHEEL_UP')
RegisterKeyMapping('+scroll_down', lib.locale('placeable_object.object_scroll_down'), 'mouse_wheel', 'IOM_WHEEL_DOWN')
RegisterKeyMapping('+depth_modifier', lib.locale('placeable_object.depth_modifier'), 'keyboard', 'LCONTROL')
local state = {
isPlacing = false,
@@ -45,11 +44,11 @@ local state = {
}
local placementText = {
string.format(locale('placeable_object.object_place'), Utility.GetCommandKey('+place_object')),
string.format(locale('placeable_object.object_cancel'), Utility.GetCommandKey('+cancel_placement')),
string.format(locale('placeable_object.rotate_clockwise'), Utility.GetCommandKey('+scroll_up')),
string.format(locale('placeable_object.rotate_counter_clockwise'), Utility.GetCommandKey('+scroll_down')),
string.format(locale('placeable_object.depth_modifier'), Utility.GetCommandKey('+depth_modifier'))
string.format(lib.locale('placeable_object.object_place'), Utility.GetCommandKey('+place_object')),
string.format(lib.locale('placeable_object.object_cancel'), Utility.GetCommandKey('+cancel_placement')),
string.format(lib.locale('placeable_object.rotate_clockwise'), Utility.GetCommandKey('+scroll_up')),
string.format(lib.locale('placeable_object.rotate_counter_clockwise'), Utility.GetCommandKey('+scroll_down')),
string.format(lib.locale('placeable_object.depth_modifier'), Utility.GetCommandKey('+depth_modifier'))
}
+1 -2
View File
@@ -3,7 +3,6 @@ local blipIDs = {}
local spawnedPeds = {}
local spawnedProps = {}
Locales = Locales or Require('modules/locales/shared.lua')
Point = Point or Require('lib/points/client/points.lua')
---Get the hash of a model (string or number)
@@ -496,7 +495,7 @@ function Utility.CopyToClipboard(text)
type = "copytoclipboard",
text = text
})
local message = Locales and Locales.Locale("clipboard.copy")
local message = lib.locale("clipboard.copy")
--TriggerEvent('community_bridge:Client:Notify', message, 'success')
return true
end
-532
View File
@@ -1,532 +0,0 @@
LA = LA or {}
--https://easings.net
LA.Lerp = function(a, b, t)
return a + (b - a) * t
end
LA.LerpVector = function(a, b, t)
return vector3(LA.Lerp(a.x, b.x, t), LA.Lerp(a.y, b.y, t), LA.Lerp(a.z, b.z, t))
end
LA.EaseInSine = function(t)
return 1 - math.cos((t * math.pi) / 2)
end
LA.EaseOutSine = function(t)
return math.sin((t * math.pi) / 2)
end
LA.EaseInOutSine = function(t)
return -(math.cos(math.pi * t) - 1) / 2
end
LA.EaseInCubic = function(t)
return t ^ 3
end
LA.EaseOutCubic = function(t)
return 1 - (1 - t) ^ 3
end
LA.EaseInOutCubic = function(t)
return t < 0.5 and 4 * t ^ 3 or 1 - ((-2 * t + 2) ^ 3) / 2
end
LA.EaseInQuint = function(t)
return t ^ 5
end
LA.EaseOutQuint = function(t)
return 1 - (1 - t) ^ 5
end
LA.EaseInOutQuint = function(t)
return t < 0.5 and 16 * t ^ 5 or 1 - ((-2 * t + 2) ^ 5) / 2
end
LA.EaseInCirc = function(t)
return 1 - math.sqrt(1 - t ^ 2)
end
LA.EaseOutCirc = function(t)
return math.sqrt(1 - (t - 1) ^ 2)
end
LA.EaseInOutCirc = function(t)
return t < 0.5 and (1 - math.sqrt(1 - (2 * t) ^ 2)) / 2 or (math.sqrt(1 - (-2 * t + 2) ^ 2) + 1) / 2
end
LA.EaseInElastic = function(t)
return t == 0 and 0 or t == 1 and 1 or -2 ^ (10 * t - 10) * math.sin((t * 10 - 10.75) * (2 * math.pi) / 3)
end
LA.EaseOutElastic = function(t)
return t == 0 and 0 or t == 1 and 1 or 2 ^ (-10 * t) * math.sin((t * 10 - 0.75) * (2 * math.pi) / 3) + 1
end
LA.EaseInOutElastic = function(t)
return t == 0 and 0 or t == 1 and 1 or t < 0.5 and -(2 ^ (20 * t - 10) * math.sin((20 * t - 11.125) * (2 * math.pi) / 4.5)) / 2 or (2 ^ (-20 * t + 10) * math.sin((20 * t - 11.125) * (2 * math.pi) / 4.5)) / 2 + 1
end
LA.EaseInQuad = function(t)
return t ^ 2
end
LA.EaseOutQuad = function(t)
return 1 - (1 - t) ^ 2
end
LA.EaseInOutQuad = function(t)
return t < 0.5 and 2 * t ^ 2 or 1 - (-2 * t + 2) ^ 2 / 2
end
LA.EaseInQuart = function(t)
return t ^ 4
end
LA.EaseOutQuart = function(t)
return 1 - (1 - t) ^ 4
end
LA.EaseInOutQuart = function(t)
return t < 0.5 and 8 * t ^ 4 or 1 - ((-2 * t + 2) ^ 4) / 2
end
LA.EaseInExpo = function(t)
return t == 0 and 0 or 2 ^ (10 * t - 10)
end
LA.EaseOutExpo = function(t)
return t == 1 and 1 or 1 - 2 ^ (-10 * t)
end
LA.EaseInOutExpo = function(t)
return t == 0 and 0 or t == 1 and 1 or t < 0.5 and 2 ^ (20 * t - 10) / 2 or (2 - 2 ^ (-20 * t + 10)) / 2
end
LA.EaseInBack = function(t)
return 2.70158 * t ^ 3 - 1.70158 * t ^ 2
end
LA.EaseOutBack = function(t)
return 1 + 2.70158 * (t - 1) ^ 3 + 1.70158 * (t - 1) ^ 2
end
LA.EaseInOutBack = function(t)
return t < 0.5 and (2 * t) ^ 2 * ((1.70158 + 1) * 2 * t - 1.70158) / 2 or ((2 * t - 2) ^ 2 * ((1.70158 + 1) * (t * 2 - 2) + 1.70158) + 2) / 2
end
LA.EaseInBounce = function(t)
print(1 - LA.EaseOutBounce(1 - t))
return 1 - LA.EaseOutBounce(1 - t)
end
LA.EaseOutBounce = function(t)
if t < 1 / 2.75 then
return 7.5625 * t ^ 2
elseif t < 2 / 2.75 then
return 7.5625 * (t - 1.5 / 2.75) ^ 2 + 0.75
elseif t < 2.5 / 2.75 then
return 7.5625 * (t - 2.25 / 2.75) ^ 2 + 0.9375
else
return 7.5625 * (t - 2.625 / 2.75) ^ 2 + 0.984375
end
end
LA.EaseInOutBounce = function(t)
return t < 0.5 and (1 - LA.EaseOutBounce(1 - 2 * t)) / 2 or (1 + LA.EaseOutBounce(2 * t - 1)) / 2
end
LA.EaseIn = function(t, easingType)
easingType = string.lower(easingType)
if easingType == "linear" then
return t
elseif easingType == "sine" then
return LA.EaseInSine(t)
elseif easingType == "cubic" then
return LA.EaseInCubic(t)
elseif easingType == "quint" then
return LA.EaseInQuint(t)
elseif easingType == "circ" then
return LA.EaseInCirc(t)
elseif easingType == "elastic" then
return LA.EaseInElastic(t)
elseif easingType == "quad" then
return LA.EaseInQuad(t)
elseif easingType == "quart" then
return LA.EaseInQuart(t)
elseif easingType == "expo" then
return LA.EaseInExpo(t)
elseif easingType == "back" then
return LA.EaseInBack(t)
elseif easingType == "bounce" then
return LA.EaseInBounce(t)
end
end
LA.EaseOut = function(t, easingType)
easingType = string.lower(easingType)
if easingType == "linear" then
return t
elseif easingType == "sine" then
return LA.EaseOutSine(t)
elseif easingType == "cubic" then
return LA.EaseOutCubic(t)
elseif easingType == "quint" then
return LA.EaseOutQuint(t)
elseif easingType == "circ" then
return LA.EaseOutCirc(t)
elseif easingType == "elastic" then
return LA.EaseOutElastic(t)
elseif easingType == "quad" then
return LA.EaseOutQuad(t)
elseif easingType == "quart" then
return LA.EaseOutQuart(t)
elseif easingType == "expo" then
return LA.EaseOutExpo(t)
elseif easingType == "back" then
return LA.EaseOutBack(t)
elseif easingType == "bounce" then
return LA.EaseOutBounce(t)
end
end
LA.EaseInOut = function(t, easingType)
easingType = string.lower(easingType)
if easingType == "linear" then
return t
elseif easingType == "sine" then
return LA.EaseInOutSine(t)
elseif easingType == "cubic" then
return LA.EaseInOutCubic(t)
elseif easingType == "quint" then
return LA.EaseInOutQuint(t)
elseif easingType == "circ" then
return LA.EaseInOutCirc(t)
elseif easingType == "elastic" then
return LA.EaseInOutElastic(t)
elseif easingType == "quad" then
return LA.EaseInOutQuad(t)
elseif easingType == "quart" then
return LA.EaseInOutQuart(t)
elseif easingType == "expo" then
return LA.EaseInOutExpo(t)
elseif easingType == "back" then
return LA.EaseInOutBack(t)
elseif easingType == "bounce" then
return LA.EaseInOutBounce(t)
end
end
LA.EaseInVector = function(a, b, t, easingType)
local tEase = LA.EaseIn(t, easingType)
local x, y, z = a.x, a.y, a.z
local x2, y2, z2 = b.x, b.y, b.z
local x3, y3, z3 = x2 - x, y2 - y, z2 - z
local x4, y4, z4 = x3 * tEase, y3 * tEase, z3 * tEase
local x5, y5, z5 = x + x4, y + y4, z + z4
return vector3(x5, y5, z5)
end
LA.EaseOutVector = function(a, b, t, easingType)
local tEase = LA.EaseOut(t, easingType)
local x, y, z = a.x, a.y, a.z
local x2, y2, z2 = b.x, b.y, b.z
local x3, y3, z3 = x2 - x, y2 - y, z2 - z
local x4, y4, z4 = x3 * tEase, y3 * tEase, z3 * tEase
local x5, y5, z5 = x + x4, y + y4, z + z4
return vector3(x5, y5, z5)
end
LA.EaseInOutVector = function(a, b, t, easingType)
local tEase = LA.EaseInOut(t, easingType)
local x, y, z = a.x, a.y, a.z
local x2, y2, z2 = b.x, b.y, b.z
local x3, y3, z3 = x2 - x, y2 - y, z2 - z
local x4, y4, z4 = x3 * tEase, y3 * tEase, z3 * tEase
local x5, y5, z5 = x + x4, y + y4, z + z4
return vector3(x5, y5, z5)
end
LA.EaseVector = function(inout, a, b, t, easingType)
inout = string.lower(inout)
if inout == "in" then
return LA.EaseInVector(a, b, t, easingType)
elseif inout == "out" then
return LA.EaseOutVector(a, b, t, easingType)
elseif inout == "inout" then
return LA.EaseInOutVector(a, b, t, easingType)
end
assert(false, "Invalid type")
end
LA.EaseOnAxis = function(inout, a, b, t, easingType, axis)
axis = axis or vector3(0, 0, 0)
local x, y, z = a.x, a.y, a.z
local increment = 0
if inout == "in" then
increment = LA.EaseIn(t, easingType)
elseif inout == "out" then
increment = LA.EaseOut(t, easingType)
elseif inout == "inout" then
increment = LA.EaseInOut(t, easingType)
end
return axis * increment
end
LA.TestCheck = function(point1, point2)
local dx = point1.x - point2.x
local dy = point1.y - point2.y
local dz = point1.z - point2.z
return math.sqrt(dx*dx + dy*dy + dz*dz)
end
LA.BoxZoneCheck = function(point, lower, upper)
local x1, y1, z1 = lower.x, lower.y, lower.z
local x2, y2, z2 = upper.x, upper.y, upper.z
return point.x > x1 and point.x < x2 and point.y > y1 and point.y < y2 and point.z > z1 and point.z < z2
end
LA.DistanceCheck = function(pointA, pointB)
return #(pointA - pointB) < 0.5
end
LA.Chance = function(chance)
assert(chance, "Chance must be passed")
assert(type(chance) == "number", "Chance must be a number")
assert(chance >= 0 and chance <= 100, "Chance must be between 0 and 100")
return math.random(1, 100) <= chance
end
LA.Vector4To3 = function(vector4)
assert(vector4, "Vector4 must be passed")
assert(type(vector4) == "vector4", "Vector4 must be a vector4")
return vector3(vector4.x, vector4.y, vector4.z), vector4.w
end
LA.Dot = function(vectorA, vectorB)
return vectorA.x * vectorB.x + vectorA.y * vectorB.y + vectorA.z * vectorB.z
end
LA.Length = function(vector)
return math.sqrt(vector.x * vector.x + vector.y * vector.y + vector.z * vector.z)
end
LA.Normalize = function(vector)
local length = LA.Length(vector)
return vector3(vector.x / length, vector.y / length, vector.z / length)
end
LA.Create2DRotationMatrix = function(angle) -- angle in radians
local c = math.cos(angle)
local s = math.sin(angle)
return {
c, -s, 0, 0,
s, c, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1,
}
end
LA.Create3DAxisRotationMatrix = function(vector)
local yaw = vector.z
local pitch = vector.x
local roll = vector.y
local cy = math.cos(yaw)
local sy = math.sin(yaw)
local cp = math.cos(pitch)
local sp = math.sin(pitch)
local cr = math.cos(roll)
local sr = math.sin(roll)
local matrix = {
vector3(cp * cy, cp * sy, -sp),
vector3(cy * sp * sr - cr * sy, sy * sp * sr + cr * cy, cp * sr),
vector3(cy * sp * cr + sr * sy, cr * cy * sp - sr * sy, cp * cr)
}
return matrix
end
LA.Circle = function(t, radius, center)
local x = radius * math.cos(t) + center.x
local y = radius * math.sin(t) + center.y
return vector3(x, y, center.z)
end
LA.Clamp = function(value, min, max)
return math.min(math.max(value, min), max)
end
LA.CrossProduct = function(a, b)
local x = a.y * b.z - a.z * b.y
local y = a.z * b.x - a.x * b.z
local z = a.x * b.y - a.y * b.x
return vector3(x, y, z)
end
LA.CreateTranslateMatrix = function(x, y, z)
return {
1, 0, 0, x,
0, 1, 0, y,
0, 0, 1, z,
0, 0, 0, 1,
}
end
LA.MultiplyMatrix = function(m1, m2)
local result = {}
for i = 1, 4 do
for j = 1, 4 do
local sum = 0
for k = 1, 4 do
sum = sum + m1[(i - 1) * 4 + k] * m2[(k - 1) * 4 + j]
end
result[(i - 1) * 4 + j] = sum
end
end
return result
end
LA.MultiplyMatrixByVector = function(m, v)
local result = {}
for i = 1, 4 do
local sum = 0
for j = 1, 4 do
sum = sum + m[(i - 1) * 4 + j] * v[j]
end
result[i] = sum
end
return result
end
--Slines
LA.SplineLerp = function(nodes, start, endPos, t)
-- Ensure t is clamped between 0 and 1
t = LA.Clamp(t, 0, 1)
-- Find the two closest nodes around t
local prevNode, nextNode = nil, nil
for i = 1, #nodes - 1 do
if nodes[i].time <= t and nodes[i + 1].time >= t then
prevNode, nextNode = nodes[i], nodes[i + 1]
break
end
end
-- Edge cases: If t is before or after the defined range
if not prevNode then return start end
if not nextNode then return endPos end
-- Normalize t within the segment
local segmentT = (t - prevNode.time) / (nextNode.time - prevNode.time)
-- Interpolate the value (y-axis)
local smoothedT = LA.Lerp(prevNode.value, nextNode.value, segmentT)
-- Perform final Lerp using the interpolated smoothing factor
return LA.Lerp(start, endPos, smoothedT)
end
LA.SplineSmooth = function(nodes, points, t)
-- Ensure valid input
if #points < 2 then return points end
t = LA.Clamp(t, 0, 1)
local smoothedPoints = {}
for i = 1, #points - 1 do
local smoothedPos = LA.SplineLerp(nodes, points[i], points[i + 1], t)
table.insert(smoothedPoints, smoothedPos)
end
-- Ensure last point remains unchanged
table.insert(smoothedPoints, points[#points])
return smoothedPoints
end
LA.Spline = function(points, resolution)
-- Ensure valid input
if #points < 2 then return points end
-- Create a list of nodes
local nodes = {}
for i = 1, #points do
table.insert(nodes, { time = i / (#points - 1), value = i })
end
-- Smooth the points
local smoothedPoints = {}
for i = 0, 1, resolution do
local smoothedPos = LA.SplineSmooth(nodes, points, i)
table.insert(smoothedPoints, smoothedPos)
end
return smoothedPoints
end
LA.SplineCatmullRom = function(points, resolution)
-- Ensure valid input
if #points < 4 then return points end
-- Create a list of nodes
local nodes = {}
for i = 1, #points do
table.insert(nodes, { time = i / (#points - 1), value = i })
end
-- Smooth the points
local smoothedPoints = {}
for i = 0, 1, resolution do
local smoothedPos = LA.SplineSmooth(nodes, points, i)
table.insert(smoothedPoints, smoothedPos)
end
return smoothedPoints
end
exports('LA', LA)
return LA
-- local easingTypes = {
-- "linear",
-- "sine",
-- "cubic",
-- "quint",
-- "circ",
-- "elastic",
-- "quad",
-- "quart",
-- "expo",
-- "back",
-- "bounce"
-- }
--local inout = {
-- "in",
-- "out",
-- "inout"
--}
-- LA.LerpAngle = function(a, b, t)
-- local num = math.abs(b - a) % 360
-- local num2 = 360 - num
-- if num < num2 then
-- return a + num * t
-- else
-- return a - num2 * t
-- end
-- end
-- LA.LerpVectorAngle = function(a, b, t)
-- local x, y, z = a.x, a.y, a.z
-- local x2, y2, z2 = b.x, b.y, b.z
-- local x3, y3, z3 = LA.LerpAngle(x, x2, t), LA.LerpAngle(y, y2, t), LA.LerpAngle(z, z2, t)
-- return vector3(x3, y3, z3)
-- end
-- return LA
@@ -8,7 +8,7 @@ Dispatch.SendAlert = function(data)
if data.vehicle then
table.insert(metadata, {
type = 'vehicle',
model = data.vehicle or locale('unknown_vehicle_model'),
model = data.vehicle or lib.locale('unknown_vehicle_model'),
plate = data.plate or nil,
color = data.colorHex or nil
})
@@ -13,7 +13,7 @@ Dispatch.SendAlert = function(data)
if data.vehicle then
table.insert(metadata, {
type = 'vehicle',
model = data.vehicle or locale('unknown_vehicle_model'),
model = data.vehicle or lib.locale('unknown_vehicle_model'),
plate = data.plate or nil,
color = data.colorHex or nil
})
-50
View File
@@ -1,50 +0,0 @@
local ConvarLang = GetConvar("lang", "none")
local OXLang = GetConvar("ox:locale", "none")
local QBXLang = GetConvar("qb_locale", "none")
local txLang = GetConvar("txAdmin-locale", "none")
local esxLang = GetConvar("esx:locale", "none")
BridgeSharedConfig = Require("settings/sharedConfig.lua")
Lang = ConvarLang ~= "none" and
ConvarLang or BridgeSharedConfig.Lang ~= "auto" and BridgeSharedConfig.Lang or
OXLang ~= "none" and OXLang or
QBXLang ~= "none" and QBXLang or
txLang ~= "none" and txLang or
esxLang ~= "none" and esxLang or
"en"
Language = {}
function Language.Locale(str, ...)
local resource = GetInvokingResource() or GetCurrentResourceName()
assert(resource, "Resource name not found")
local locales = LoadResourceFile(resource, "locales/" .. Lang .. ".json")
locales = locales and json.decode(locales) or {}
-- Handle nested tables via dot notation
local current = locales
for part in str:gmatch("([^%.]+)") do
if type(current) ~= "table" then
warn(("Invalid nested locale path: %s for resource: %s"):format(str, resource))
return str
end
current = current[part]
if not current then
warn(("Locale not found for key: %s in language: %s for resource: %s"):format(str, Lang, resource))
return str
end
end
-- Handle variable replacement
local args = {...}
if type(current) == "string" and #args > 0 then
current = string.format(current, ...)
end
return current
end
return Language
+1 -5
View File
@@ -5,10 +5,6 @@ Notify.GetResourceName = function()
return "default"
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
---12/13/25
---@param src number
@@ -31,7 +27,7 @@ end
Notify.SendNotification = function(src, title, message, _type, time, props)
time = time or 3000
if not title then
title = placeHolderText
title = lib.locale("Notifications.PlaceholderTitle")
end
TriggerClientEvent('community_bridge:Client:Notify', src, title, message, _type, time, props)
end
+1 -5
View File
@@ -9,10 +9,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports['brutal_notify']:SendAlert('Notification', message, time, _type or "success", false)
@@ -27,7 +23,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
return exports['brutal_notify']:SendAlert(title, message, time, _type or "success", false)
end
+1 -6
View File
@@ -8,11 +8,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
Notify.SendNotify = function(message, _type, time)
time = time or 3000
if _type == "error" or _type == "info" then
@@ -36,7 +31,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
if _type == "error" or _type == "info" then
_type = tostring(1)
elseif _type == "success" then
+1 -4
View File
@@ -9,9 +9,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
Notify.SendNotify = function(message, _type, time)
@@ -28,7 +25,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
return exports.lation_ui:notify({ title = title, message = message, type = _type or "success", duration = time, position = 'top-right' })
end
+1 -4
View File
@@ -8,9 +8,6 @@ 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
@@ -31,7 +28,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
return exports.msk_core:Notify(title, message, _type or "success", time)
end
+1 -5
View File
@@ -8,10 +8,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
Notify.SendNotify = function(message, _type, time)
time = time or 3000
_type = _type or "inform"
@@ -28,7 +24,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
_type = _type or "inform"
return exports['mythic_notify']:SendAlert(_type, message, time)
end
+1 -5
View File
@@ -8,10 +8,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports['okokNotify']:Alert('Notification', message, time, _type or "Success", false)
@@ -27,7 +23,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
return exports['okokNotify']:Alert(title, message, time, _type or "Success", false)
end
+1 -6
View File
@@ -8,11 +8,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports.ox_lib:notify({ description = message, type = _type, duration = time, position = 'top-right' })
@@ -27,7 +22,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
return exports.ox_lib:notify({ title = title, description = message, type = _type or "success", duration = time, position = 'top-right' })
end
+1 -5
View File
@@ -8,10 +8,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports['pNotify']:SendNotification({ text = message, type = _type, timeout = time, layout = 'centerRight' })
@@ -27,7 +23,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
return exports['pNotify']:SendNotification({ title = title, text = message, type = _type or "success", timeout = time, layout = 'centerRight' })
end
+1 -5
View File
@@ -8,10 +8,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports.r_notify:notify({title = 'Notification', content = message, type = _type, icon = "fas fa-check", duration = time, position = 'top-right', sound = false})
@@ -26,7 +22,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
return exports.r_notify:notify({title = title, content = message, type = _type or "success", icon = "fas fa-check", duration = time, position = 'top-right', sound = false})
end
+1 -5
View File
@@ -9,10 +9,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
Notify.SendNotify = function(message, _type, time)
time = time or 3000
@@ -28,7 +24,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title or title == "" then title = placeHolderText end
if not title or title == "" then title = lib.locale("Notifications.PlaceholderTitle") end
props = props or {}
+1 -5
View File
@@ -8,10 +8,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
Notify.SendNotify = function(message, _type, time)
time = time or 3000
_type = _type or "info"
@@ -27,7 +23,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
_type = _type or "info"
return exports['t-notify']:Alert({ title = title, style = _type, message = message, duration = time, })
end
+1 -5
View File
@@ -8,10 +8,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
Notify.SendNotify = function(message, _type, time)
time = time or 3000
_type = _type or "info"
@@ -27,7 +23,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
_type = _type or "info"
return exports.wasabi_notify:notify(_type, message, time, _type)
end
+2 -6
View File
@@ -8,10 +8,6 @@ Notify.GetResourceName = function()
return resourceName
end
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
local placeHolderText = locale("Notifications.PlaceholderTitle")
local function getIconByType(_type)
local icon = "info"
if _type == "success" then
@@ -27,7 +23,7 @@ end
Notify.SendNotify = function(message, _type, time)
time = time or 3000
local icon = getIconByType(_type)
local serial = exports['ZSX_UIV2']:Notification(placeHolderText, message, icon, time)
local serial = exports['ZSX_UIV2']:Notification(lib.locale("Notifications.PlaceholderTitle"), message, icon, time)
return serial
end
@@ -40,7 +36,7 @@ end
---@return nil
Notify.SendNotification = function(title, message, _type, time, props)
time = time or 3000
if not title then title = placeHolderText end
if not title then title = lib.locale("Notifications.PlaceholderTitle") end
local icon = getIconByType(_type)
exports['ZSX_UIV2']:Notification(title, message, icon, time)
end
+10 -10
View File
@@ -24,23 +24,23 @@ Shops.FinalizeCheckOut = function(shopName, item, itemLabel, price, amount)
local generatedID = lib.string.random('Aa1A', 8) -- Generate a random ID if not provided
local buildMenu = {
{
title = locale('Shops.PayByCash', tostring(mathStuff)),
description = locale('Shops.AreYouSure', itemLabel),
icon = locale('Shops.CashIcon'),
title = lib.locale('Shops.PayByCash', tostring(mathStuff)),
description = lib.locale('Shops.AreYouSure', itemLabel),
icon = lib.locale('Shops.CashIcon'),
onSelect = function(_, __, ___)
TriggerServerEvent('community_bridge:Server:completeCheckout', shopName, item, amount, "money")
end
},
{
title = locale('Shops.PayByCard', tostring(mathStuff)),
description = locale('Shops.AreYouSure', itemLabel),
icon = locale('Shops.CardIcon'),
title = lib.locale('Shops.PayByCard', tostring(mathStuff)),
description = lib.locale('Shops.AreYouSure', itemLabel),
icon = lib.locale('Shops.CardIcon'),
onSelect = function(_, __, ___)
TriggerServerEvent('community_bridge:Server:completeCheckout', shopName, item, amount, "bank")
end
}
}
Menu.Open({ id = generatedID, title = locale("Shops.Input"), options = buildMenu }, false)
Menu.Open({ id = generatedID, title = lib.locale("Shops.Input"), options = buildMenu }, false)
end
---This is an internal functions that is used to open the amount select menu. Please do not use this function directly.
@@ -57,7 +57,7 @@ Shops.AmountSelect = function(shopName, item, itemLabel, price)
table.insert(numberOptions, {label = tostring(i), value = i})
end
local _input = Input.Open(shopName, {
{type = 'select', label = locale("Shops.PurchaseAmount"), options = numberOptions},
{type = 'select', label = lib.locale("Shops.PurchaseAmount"), options = numberOptions},
})
if _input and _input[1] then
@@ -78,8 +78,8 @@ Shops.OpenShop = function(shopName, shopData)
local getItemName = Inventory.GetItemInfo(v.name).label
table.insert(buildMenu, {
title = getItemName,
description = locale('Shops.CurrencySymbol', tostring(v.price)),
icon = locale('Shops.ShopIcon'),
description = lib.locale('Shops.CurrencySymbol', tostring(v.price)),
icon = lib.locale('Shops.ShopIcon'),
onSelect = function(selected, secondary, args)
Shops.AmountSelect(shopName, v.name, getItemName, v.price)
end
+5 -8
View File
@@ -3,9 +3,6 @@ Shops = Shops or {}
local registeredShops = {}
local Language = Language or Require("modules/locales/shared.lua")
local locale = Language.Locale
---This can open a shop for the client
---@param src number
---@param shopName string
@@ -51,23 +48,23 @@ Shops.CompleteCheckout = function(src, shopName, item, amount, account)
end
end
if not itemData or not itemData.price then return print("community_bridge Player ID "..src.." attempted to purchase invalid item from shop: "..shopName) end
if itemData.count and itemData.count <= 0 then return Notify.SendNotify(src, locale('Shops.NotEnoughStock'), "error", 5000) end
if itemData.count and itemData.count <= 0 then return Notify.SendNotify(src, lib.locale('Shops.NotEnoughStock'), "error", 5000) end
local totalCost = tonumber(itemData.price) * amount
local balance = Framework.GetAccountBalance(src, account)
if not balance then return end
if balance <= 0 then return Notify.SendNotify(src, locale('Shops.NotEnoughMoney'), "error", 5000) end
if balance < totalCost then return Notify.SendNotify(src, locale('Shops.NotEnoughMoney'), "error", 5000) end
if balance <= 0 then return Notify.SendNotify(src, lib.locale('Shops.NotEnoughMoney'), "error", 5000) end
if balance < totalCost then return Notify.SendNotify(src, lib.locale('Shops.NotEnoughMoney'), "error", 5000) end
if not Framework.RemoveAccountBalance(src, account, totalCost) then return end
local success = Inventory.AddItem(src, itemData.name, amount)
if not success then
Framework.AddAccountBalance(src, account, totalCost)
return Notify.SendNotify(src, locale('Shops.PurchaseFailed'), "error", 5000)
return Notify.SendNotify(src, lib.locale('Shops.PurchaseFailed'), "error", 5000)
end
local itemLabel = Inventory.GetItemInfo(itemData.name).label or itemData.name
Notify.SendNotify(src, locale('Shops.PurchasedItem', amount, itemLabel), "success", 5000)
Notify.SendNotify(src, lib.locale('Shops.PurchasedItem', amount, itemLabel), "success", 5000)
end
---This is an internal event to complete a checkout, complete with multiple validations. Please do not use this event directly.
+6 -6
View File
@@ -83,12 +83,12 @@ function Target.AddLocalEntity(entities, _options)
end
for _, entity in pairs(entities) do
local id = lib.string.random('Aa1A', 8) -- Generate a random ID if not provided
local title = Language.Locale("target.title")
local title = lib.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 = lib.locale("target.description"),
onSelect = function(selected, secondary, args)
if v.onSelect then
v.onSelect(selected, secondary, args)
@@ -99,7 +99,7 @@ function Target.AddLocalEntity(entities, _options)
Point.Register(id, entity, 5, nil, function()
local coords = GetEntityCoords(entity)
local sleep = 3000
local test = Language.Locale("target.interact")
local test = lib.locale("target.interact")
CreateThread(function()
while DoesEntityExist(entity) do
Wait(sleep)
@@ -131,12 +131,12 @@ end
function Target.AddBoxZone(name, coords, size, heading, options)
local fixedOptions = Target.FixOptions(options)
local id = lib.string.random('Aa1A', 8) -- Generate a random ID if not provided
local title = Bridge.Language.Locale("target.title")
local title = lib.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 = Bridge.Language.Locale("target.description"),
description = lib.locale("target.description"),
onSelect = function(selected, secondary, args)
if v.onSelect then
v.onSelect(selected, secondary, args)
@@ -153,7 +153,7 @@ function Target.AddBoxZone(name, coords, size, heading, options)
local distance = #(coords - GetEntityCoords(PlayerPedId()))
if distance < 10 then
sleep = 0
Utility.Draw3DHelpText(coords, Bridge.Language.Locale("target.interact"), 0.35)
Utility.Draw3DHelpText(coords, lib.locale("target.interact"), 0.35)
if IsControlJustPressed(0, 38) then
Menu.Open(menuData, false)
end
+28 -25
View File
@@ -1,31 +1,34 @@
I think Community Bridge has been a huge benefit to the FiveM ecosystem and has helped a lot of creators support different frameworks without having to reinvent the same integrations over and over.
Overall Community Bridge has been a blessing to fivem and a lot of creators, but i know people are becoming more and more wary to actually utilizing this because the scope has
since lost its way. over complicated library modules have led to bloatware where we dont need bloat. since ox_lib is required to run the bridge, why try to re-invent the wheel
of a great library already and include it in a "bridge"
That said, I think the scope of the project has gradually become too broad. A number of the library modules are now duplicating functionality that already exists in `ox_lib`, which is already a required dependency of Community Bridge.
Since I personally believe that we should have a much more narrow scope I decided to do some leg work and reduce the lib modules to things that are **needed** and **not already handled by ox_lib**
Because of that, I don't think we should maintain abstractions for functionality that can already be handled directly by `ox_lib`. It adds additional code, maintenance, and surface area without providing much benefit.
# Completely Removed | Lib
This PR removes the following `lib` modules:
1) lib/anim module
- this already exists inside of ox_lib. there is no use for it.
- its only called in entities/client/client_entity so if that module stays it will be replaced with ox's call
2) callback
- while I do enjoy these callbacks, theres no specific reason to keep these involved as ox already exists in this repo by requiring it
- all modules that used callbacks are easily switched to ox callbacks
3) markers
- while a neat module, ox does this
4) points as well as you can really just use ox zones. may not be a 1 for 1, but ox zones can accomplish the same things
5) raycast is already handled with ox lib
6) scaleform already handled with ox_lib
7) shells is pointless, if anything the script should be doing the spawning and handling and not a bridge. as many different shells from different creators exits
8) sql is a wrapper of a wrapper for mysql, every framework starts with oxmysql, while an ORM would be nice, this isnt ORM level yet
9) vehicles is not needed as ox handles this
10) cutscenes
- like why? its used in so little of resources, no sense of keep loading this everywhere
* `anim` — already provided by `ox_lib`
* `callback` — can be replaced with `ox_lib` callbacks
* `markers` — already handled by `ox_lib`
* `raycast` — already handled by `ox_lib` and relatively niche
* `scaleform` — already handled by `ox_lib`
* `shells` — should be owned by the resource that needs them rather than the bridge
* `sql` — effectively another abstraction over `oxmysql` without providing ORM-level functionality
* `vehicles` — unnecessary given existing `ox_lib` functionality
* `cutscenes` — extremely niche and doesn't justify being maintained as part of the bridge
# Completely Removed | modules
1) zones
- lets face it, polyzone is fucking trash and hasnt been given a semi decent update in 5 years. ox_lib is required for this bridge so we should enforce higher code quality
and there isnt a need for a wrapper when its a single resource being used, i can see this coming back in the future if someone makes a better or comparable zone
I've also removed the `zones` and `locale` module.
PolyZone has been around for a long time and was a perfectly reasonable solution when there weren't many alternatives. However, it hasn't received a meaningful update in years, and I don't think we should continue building abstractions around it when `ox_lib` already provides a modern zone implementation.
Since `ox_lib` is already a required dependency of Community Bridge, I'd rather enforce the use of the better-supported implementation than continue wrapping an older solution simply for compatibility.
If someone eventually develops a zone library that is genuinely better or provides functionality that `ox_lib` doesn't, I'm completely open to revisiting this decision. But right now, I don't think there's a strong reason to maintain a bridge layer around PolyZone.
As for locales, ox already does a really great job with locales, and we should be utilizing this as well.
# footnote
The goal here isn't to remove functionality for the sake of removing it. It's to establish a much narrower scope for Community Bridge and avoid turning it into a general-purpose library.
I'd rather see the bridge focus its maintenance and development effort on framework/resource compatibility — the part that actually benefits from having a bridge — while leaving general-purpose functionality to libraries that already specialize in it.
If there's a legitimate use case for any of these modules that I'm overlooking, I'm absolutely open to discussing it. The main thing I'm trying to avoid is maintaining duplicate abstractions simply because they exist.