remove more unneeded functions

This commit is contained in:
Kakarot
2025-06-01 15:42:49 -05:00
parent 8f883ccd2a
commit 28753848dc
5 changed files with 10 additions and 147 deletions
-53
View File
@@ -26,10 +26,6 @@ function QBCore.Functions.TriggerCallback(name, ...)
end
end
function QBCore.Debug(resource, obj, depth)
TriggerServerEvent('QBCore:DebugSomething', resource, obj, depth)
end
-- Player
function QBCore.Functions.GetPlayerData(cb)
@@ -53,55 +49,6 @@ function QBCore.Functions.GetName()
return charinfo.firstname .. ' ' .. charinfo.lastname
end
---@param entity number - The entity to look at
---@param timeout number - The time in milliseconds before the function times out
---@param speed number - The speed at which the entity should turn
---@return number - The time at which the entity was looked at
function QBCore.Functions.LookAtEntity(entity, timeout, speed)
local involved = GetInvokingResource()
if not DoesEntityExist(entity) then
return involved .. ' :^1 Entity does not exist'
end
if type(entity) ~= 'number' then
return involved .. ' :^1 Entity must be a number'
end
if type(speed) ~= 'number' then
return involved .. ' :^1 Speed must be a number'
end
if speed > 5.0 then speed = 5.0 end
if timeout > 5000 then timeout = 5000 end
local ped = PlayerPedId()
local playerPos = GetEntityCoords(ped)
local targetPos = GetEntityCoords(entity)
local dx = targetPos.x - playerPos.x
local dy = targetPos.y - playerPos.y
local targetHeading = GetHeadingFromVector_2d(dx, dy)
local turnSpeed
local startTimeout = GetGameTimer()
while true do
local currentHeading = GetEntityHeading(ped)
local diff = targetHeading - currentHeading
if math.abs(diff) < 2 then
break
end
if diff < -180 then
diff = diff + 360
elseif diff > 180 then
diff = diff - 360
end
turnSpeed = speed + (2.5 - speed) * (1 - math.abs(diff) / 180)
if diff > 0 then
currentHeading = currentHeading + turnSpeed
else
currentHeading = currentHeading - turnSpeed
end
SetEntityHeading(ped, currentHeading)
Wait(0)
if (startTimeout + timeout) < GetGameTimer() then break end
end
SetEntityHeading(ped, targetHeading)
end
-- Function to run an animation
--- @param animDic string: The name of the animation dictionary
--- @param animName string - The name of the animation within the dictionary