Skip to content

Commit

Permalink
Merge pull request #245 from bitpredator/develop
Browse files Browse the repository at this point in the history
refactor(wk_wrs): initial reconstruction
  • Loading branch information
bitpredator authored Mar 18, 2023
2 parents e30bc73 + b42520c commit 9e3bf0e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 29 deletions.
28 changes: 6 additions & 22 deletions server-data/resources/[esx_addons]/wk_wrs/cl_radar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ CreateThread( function()
SendNUIMessage( { resourcename = resourceName } )
end )


ESX = nil
CreateThread(function()
while ESX == nil do
Expand All @@ -27,7 +26,6 @@ CreateThread(function()
end
end)


SetNuiFocus(false)

function round( num )
Expand All @@ -51,9 +49,7 @@ end
function IsEntityInMyHeading( myAng, tarAng, range )
local rangeStartFront = myAng - ( range / 2 )
local rangeEndFront = myAng + ( range / 2 )

local opp = oppang( myAng )

local rangeStartBack = opp - ( range / 2 )
local rangeEndBack = opp + ( range / 2 )

Expand All @@ -75,9 +71,7 @@ local hidden = false
local radarInfo =
{
patrolSpeed = "000",

speedType = "mph",

fwdPrevVeh = 0,
fwdXmit = true,
fwdMode = "same",
Expand All @@ -87,7 +81,6 @@ local radarInfo =
fwdDir = nil,
fwdFastSpeed = 0,
fwdPlate = "",

bwdPrevVeh = 0,
bwdXmit = false,
bwdMode = "none",
Expand All @@ -97,7 +90,6 @@ local radarInfo =
bwdDir = nil,
bwdFastSpeed = 0,
bwdPlate = "",

fastResetLimit = 150,
fastLimit = 55,

Expand Down Expand Up @@ -177,7 +169,7 @@ function ResetFrontAntenna()
radarInfo.fwdFast = "000"
else
radarInfo.fwdSpeed = "OFF"
radarInfo.fwdFast = " "
radarInfo.fwdFast = ""
end

radarInfo.fwdDir = nil
Expand All @@ -191,7 +183,7 @@ function ResetRearAntenna()
radarInfo.bwdFast = "000"
else
radarInfo.bwdSpeed = "OFF"
radarInfo.bwdFast = " "
radarInfo.bwdFast = ""
end

radarInfo.bwdDir = nil
Expand All @@ -204,7 +196,6 @@ function ResetFrontFast()
radarInfo.fwdFast = "000"
radarInfo.fwdFastSpeed = 0
radarInfo.fwdFastLocked = false

SendNUIMessage( { lockfwdfast = false } )
end
end
Expand All @@ -214,7 +205,6 @@ function ResetRearFast()
radarInfo.bwdFast = "000"
radarInfo.bwdFastSpeed = 0
radarInfo.bwdFastLocked = false

SendNUIMessage( { lockbwdfast = false } )
end
end
Expand All @@ -224,9 +214,8 @@ function CloseRadarRC()
toggleradarrc = true
})

TriggerEvent( 'wk:toggleMenuControlLock', false )

SetNuiFocus( false )
TriggerEvent('wk:toggleMenuControlLock', false )
SetNuiFocus(false)
end

function ToggleSpeedType()
Expand All @@ -235,7 +224,7 @@ function ToggleSpeedType()
exports["esx_notify"]:Notify("info", 3000, "velocità in mph ?")
else
radarInfo.speedType = "mph"
exports["esx_notify"]:Notify("info", 3000, "stai controllando la velocità MPH ?")
exports["esx_notify"]:Notify("info", 3000, "stai controllando la velocità MPH ?")
end
end

Expand Down Expand Up @@ -480,12 +469,7 @@ CreateThread( function()
end )


--[[------------------------------------------------------------------------
Menu Control Lock - Prevents certain actions
Thanks to the authors of the ES Banking script.
------------------------------------------------------------------------]]--
local locked = false

RegisterNetEvent( 'wk:toggleMenuControlLock' )
AddEventHandler( 'wk:toggleMenuControlLock', function( lock )
locked = lock
Expand All @@ -508,6 +492,6 @@ CreateThread( function()

Wait( 0 )
end
end )
end)


2 changes: 0 additions & 2 deletions server-data/resources/[esx_addons]/wk_wrs/nui/radar.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


@font-face {
font-family: "Digital-7";
src: url( "digital-7.regular.ttf" );
Expand Down
7 changes: 2 additions & 5 deletions server-data/resources/[esx_addons]/wk_wrs/nui/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@ var targets = [];
$(function() {
radarInit();
var radarContainer = $("#policeradar");

var fwdArrowFront = radarContainer.find(".fwdarrowfront");
var fwdArrowBack = radarContainer.find(".fwdarrowback");
var bwdArrowFront = radarContainer.find(".bwdarrowfront");
var bwdArrowBack = radarContainer.find(".bwdarrowback");

var fwdSame = radarContainer.find(".fwdsame");
var fwdOpp = radarContainer.find(".fwdopp");
var fwdXmit = radarContainer.find(".fwdxmit");
var fwdPlate = radarContainer.find("#fwdPlate");

var bwdSame = radarContainer.find(".bwdsame");
var bwdOpp = radarContainer.find(".bwdopp");
var bwdXmit = radarContainer.find(".bwdxmit");
var bwdPlate = radarContainer.find("#bwdPlate");

var radarRCContainer = $("#policeradarrc");

window.addEventListener("message", function(event) {
Expand Down Expand Up @@ -130,7 +126,8 @@ function radarInit() {
sendData("RadarRC", data);
});
}
});
}
);
}

function updatePlate(attr, data) {
Expand Down

0 comments on commit 9e3bf0e

Please sign in to comment.