Skip to content

Commit

Permalink
internetradio: small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Dutchman101 committed Jul 17, 2024
1 parent 3dd5cbd commit 8ffc446
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions [gameplay]/internetradio/config/ShRadioConfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
-- ## Version: 1.0 ##
-- #######################################

RADIO_CREATE_SPEAKER_DELAY = 3000
RADIO_CREATE_SPEAKER_DELAY = 1000
RADIO_TOGGLE_SPEAKER_DELAY = 1500
RADIO_DESTROY_SPEAKER_DELAY = 1500
RADIO_ALLOW_CUSTOM_URLS = true
RADIO_STREAM_URL_MAX_LENGTH = 512
RADIO_STREAM_URL_MAX_LENGTH = 1024 -- Accomodate long .mp3 CDN URLs from certain YT converter sites
RADIO_MAX_SOUND_DISTANCE = 65
RADIO_STATIONS = {
{"[Top 40 Mix] BAYERN Radio - Top40", "http://stream.antenne.de:80/top-40"},
Expand Down Expand Up @@ -95,4 +95,4 @@ RADIO_STATIONS = {
{"[Summer96] RadioRecord", "https://radiorecord.hostingradio.ru/summerparty96.aacp"},
{"[Dance] BAYERN Radio - Dance XXL", "http://stream.antenne.de:80/dance-xxl"},
{"[Dance] FunX Dance", "https://icecast.omroep.nl/funx-dance-bb-mp3"},
}
}
2 changes: 1 addition & 1 deletion [gameplay]/internetradio/gui/CRadioGUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ local function initializeRadioGUI()

local screenX, screenY = guiGetScreenSize()
local radioWindowSizeX, radioWindowSizeY = 325, 380
local radioWindowPosX, radioWindowPosY = (screenX - 325)/1.1, (screenY - 380)/1.4
local radioWindowPosX, radioWindowPosY = (screenX - 325) / 1.1, (screenY - 380) / 1.4
local allowRemoteSpeakers = getRadioSetting("allowRemoteSpeakers")

RADIO_GUI = {}
Expand Down
2 changes: 1 addition & 1 deletion [gameplay]/internetradio/handle_radio/CHandleRadio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,4 @@ function clearSpeakersOnDestroyQuit()
clearPlayerSpeaker(source)
end
addEventHandler("onClientPlayerQuit", root, clearSpeakersOnDestroyQuit)
addEventHandler("onClientElementDestroy", resourceRoot, clearSpeakersOnDestroyQuit)
addEventHandler("onClientElementDestroy", resourceRoot, clearSpeakersOnDestroyQuit)
6 changes: 5 additions & 1 deletion [gameplay]/internetradio/handle_radio/SHandleRadio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ function destroyAttachedRadioOnVehicleExplodeOrDestroy()
local attachedElementObject = (attachedElementType == "object")

if (attachedElementObject) then
clearPlayerSpeaker(attachedElement)
local boxFound = clearPlayerSpeaker(attachedElement)

if (boxFound) then
break
end
end
end
end
Expand Down
4 changes: 1 addition & 3 deletions [gameplay]/internetradio/track_name/CRadioTrackName.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ local function toggleSpeakerTrackRender()
local toggleOn = next(NEARBY_SPEAKERS)

if (toggleOn) then

if (speakerTrackRender) then
return false
end
Expand All @@ -26,7 +25,6 @@ local function toggleSpeakerTrackRender()
end

if (not toggleOn) then

if (not speakerTrackRender) then
return false
end
Expand Down Expand Up @@ -102,7 +100,7 @@ function onClientRenderRadioTrackName()

if (screenX and screenY) then
local textWidth = dxGetTextWidth(trackName, RADIO_TRACK_SCALE, RADIO_TRACK_FONT, trackNameColorCoded)
local textPosX = (screenX - textWidth/2)
local textPosX = (screenX - textWidth / 2)
local textBackgroundPosX = (textPosX - 5)
local textBackgroundPosY = (textWidth + 8)

Expand Down

0 comments on commit 8ffc446

Please sign in to comment.