Skip to content

Commit

Permalink
chore: minor fixes for wk_wars2
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Sep 9, 2024
1 parent ae23755 commit 0cf38cd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function READER:Main()
-- Loop through front (1) and rear (-1)
for i = 1, -1, -2 do
-- Get the world position of the player's vehicle
local pos = GetEntityCoords(PLY.veh)
local _ = GetEntityCoords(PLY.veh)

-- Get a start position 5m in front/behind the player's vehicle
local start = GetOffsetFromEntityInWorldCoords(PLY.veh, 0.0, (5.0 * i), 0.0)
Expand Down
25 changes: 8 additions & 17 deletions server-data/resources/[esx_addons]/wk_wars2x/cl_radar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ local tostring = tostring
local math = math
local pairs = pairs

--[[----------------------------------------------------------------------------------
UI loading and key binds registering
----------------------------------------------------------------------------------]]
--
--[UI loading and key binds registering]
local function RegisterKeyBinds()
if UTIL:IsResourceNameValid() then
UTIL:Log("Registering radar commands and key binds.")
Expand Down Expand Up @@ -101,13 +98,10 @@ local function LoadUISettings()
end
end

--[[----------------------------------------------------------------------------------
Radar variables
--[[Radar variables
NOTE - This is not a config, do not touch anything unless you know what
you are actually doing.]]--

NOTE - This is not a config, do not touch anything unless you know what
you are actually doing.
----------------------------------------------------------------------------------]]
--
RADAR = {}
RADAR.vars = {
-- Whether or not the radar's UI is visible
Expand Down Expand Up @@ -677,7 +671,7 @@ function RADAR:UpdateOptionIndexes(loadSaved)
-- Iterate through each of the internal settings
for k, v in pairs(self.vars.settings) do
-- Iterate through all of the menu options
for i, t in pairs(self.vars.menuOptions) do
for _, t in pairs(self.vars.menuOptions) do
-- If the current menu option is the same as the current setting
if t.settingText == k then
-- Iterate through the option values of the current menu option
Expand All @@ -693,10 +687,7 @@ function RADAR:UpdateOptionIndexes(loadSaved)
end
end

--[[----------------------------------------------------------------------------------
Radar basics functions
----------------------------------------------------------------------------------]]
--
-- [Radar basics functions]
-- Returns the patrol speed value stored
function RADAR:GetPatrolSpeed()
return self.vars.patrolSpeed
Expand Down Expand Up @@ -1459,7 +1450,7 @@ function RADAR:GetVehiclesForAntenna()
-- Check that the table for the current antenna is not empty
if not UTIL:IsTableEmpty(vehs[ant]) then
-- Get the 'strongest' vehicle for the antenna
for k, v in pairs(vehs[ant]) do
for _, v in pairs(vehs[ant]) do
-- Check if the current vehicle item fits the mode set by the user
if self:CheckVehicleDataFitsMode(ant, v.rayType) then
-- Set the result for the current antenna
Expand All @@ -1478,7 +1469,7 @@ function RADAR:GetVehiclesForAntenna()
local temp = results[ant][1]

-- Iterate through the vehicles for the current antenna
for k, v in pairs(vehs[ant]) do
for _, v in pairs(vehs[ant]) do
-- When we grab a vehicle for the fastest section, as it is like how the real system works, there are a few
-- additional checks that have to be made
if self:CheckVehicleDataFitsMode(ant, v.rayType) and v.veh ~= temp.veh and v.size < temp.size and v.speed > temp.speed + 1.0 then
Expand Down
7 changes: 3 additions & 4 deletions server-data/resources/[esx_addons]/wk_wars2x/cl_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function UTIL:FormatSpeed(speed)
local pipes = ""

-- Create a string of pipes (¦) for the number of spaces
for i = 1, 3 - string.len(text) do
for _ = 1, 3 - string.len(text) do
pipes = pipes .. "¦"
end

Expand Down Expand Up @@ -64,7 +64,7 @@ end
-- Old ray trace function for getting a vehicle in a specific direction from a start point
function UTIL:GetVehicleInDirection(entFrom, coordFrom, coordTo)
local rayHandle = StartShapeTestCapsule(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 5.0, 10, entFrom, 7)
local _, _, _, _, vehicle = GetShapeTestResult(rayHandle)
local vehicle = GetShapeTestResult(rayHandle)
return vehicle
end

Expand Down Expand Up @@ -112,10 +112,9 @@ end
-- Used to draw text to the screen, helpful for debugging issues
function UTIL:DrawDebugText(x, y, scale, centre, text)
SetTextFont(4)
SetTextProportional(0)
SetTextScale(scale, scale)
SetTextColour(255, 255, 255, 255)
SetTextDropShadow(0, 0, 0, 0, 255)
SetTextDropShadow()
SetTextEdge(2, 0, 0, 0, 255)
SetTextCentre(centre)
SetTextDropShadow()
Expand Down
2 changes: 1 addition & 1 deletion server-data/resources/[esx_addons]/wk_wars2x/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CONFIG.use_sonorancad = false
-- These keybinds can be changed by each person in their GTA Settings->Keybinds->FiveM
CONFIG.keyDefaults = {
-- Remote control key
remote_control = "f5",
remote_control = "f4",

-- Radar key lock key
key_lock = "l",
Expand Down

0 comments on commit 0cf38cd

Please sign in to comment.