Skip to content

Commit

Permalink
notifications: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruwetuin committed Jul 9, 2024
1 parent 0b9dcb3 commit d613f3c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 24 deletions.
6 changes: 3 additions & 3 deletions luarules/gadgets/map_lava.lua
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ else -- UNSYCNED
//Get the fragment depth
// note that WE CANT GO LOWER THAN THE ACTUAL LAVA LEVEL!
vec2 screenUV = clamp(v_screenUV, 1.0/(viewGeometry.xy), 1.0 - 1.0/ (viewGeometry.xy));
// Sample the depth buffers, and choose whichever is closer to the screen
Expand Down Expand Up @@ -643,12 +643,12 @@ else -- UNSYCNED
if lavaGrow > 0 and not lavaRisingNotificationPlayed then
lavaRisingNotificationPlayed = true
if Script.LuaUI("NotificationEvent") then
Script.LuaUI.NotificationEvent("SoundEvents LavaRising "..myPlayerID)
Script.LuaUI.NotificationEvent("LavaRising "..myPlayerID)
end
elseif lavaGrow < 0 and not lavaDroppingNotificationPlayed then
lavaDroppingNotificationPlayed = true
if Script.LuaUI("NotificationEvent") then
Script.LuaUI.NotificationEvent("SoundEvents LavaDropping "..myPlayerID)
Script.LuaUI.NotificationEvent("LavaDropping "..myPlayerID)
end
elseif lavaGrow == 0 and (lavaRisingNotificationPlayed or lavaDroppingNotificationPlayed) then
lavaRisingNotificationPlayed = false
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/sfx_notifications.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ else

function BroadcastEvent(_,event, player)
if Script.LuaUI("NotificationEvent") and tonumber(player) and ((tonumber(player) == Spring.GetMyPlayerID()) or isSpec) then
Script.LuaUI.NotificationEvent("SoundEvents "..event.." "..player)
Script.LuaUI.NotificationEvent(event.." "..player)
end
end

Expand Down
15 changes: 6 additions & 9 deletions luaui/Widgets/snd_notifications.lua
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,12 @@ local function gadgetNotificationEvent(msg)
return
end

if string.find(msg, "SoundEvents", nil, true) then
msg = string.sub(msg, 13)
local forceplay = (string.sub(msg, string.len(msg) - 1) == ' y')
if not isSpec or (isSpec and playTrackedPlayerNotifs and lockPlayerID ~= nil) or forceplay then
local event = string.sub(msg, 1, string.find(msg, " ", nil, true) - 1)
local player = string.sub(msg, string.find(msg, " ", nil, true) + 1, string.len(msg))
if forceplay or (tonumber(player) and (tonumber(player) == Spring.GetMyPlayerID())) or (isSpec and tonumber(player) == lockPlayerID) then
queueNotification(event, forceplay)
end
local forceplay = (string.sub(msg, string.len(msg) - 1) == ' y')
if not isSpec or (isSpec and playTrackedPlayerNotifs and lockPlayerID ~= nil) or forceplay then
local event = string.sub(msg, 1, string.find(msg, " ", nil, true) - 1)
local player = string.sub(msg, string.find(msg, " ", nil, true) + 1, string.len(msg))
if forceplay or (tonumber(player) and (tonumber(player) == Spring.GetMyPlayerID())) or (isSpec and tonumber(player) == lockPlayerID) then
queueNotification(event, forceplay)
end
end
end
Expand Down
22 changes: 11 additions & 11 deletions sounds/sound_file_lengths.lua
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ local wavLengths = {
["voice/allison/AircraftSpotted.wav"] = 1.221361,
["voice/allison/AirtransportDetected.wav"] = 1.790431,
["voice/allison/AlliedComSelfD.wav"] = 2.748095,
["voice/allison/battleended.wav"] = 2.095283,
["voice/allison/BattleEnded.wav"] = 2.095283,
["voice/allison/Battlestarting.wav"] = 1.629025,
["voice/allison/Battlestarting2.wav"] = 1.672268,
["voice/allison/BehemothDetected.wav"] = 1.515351,
Expand All @@ -710,9 +710,9 @@ local wavLengths = {
["voice/allison/GameStarted.wav"] = 1.031224,
["voice/allison/IdleBuilder.wav"] = 2.366735,
["voice/allison/JuggernautDetected.wav"] = 1.776100,
["voice/allison/Lastcomremaining.wav"] = 2.374626,
["voice/allison/Lavadropping.wav"] = 1.720204,
["voice/allison/Lavarising.wav"] = 10.187528,
["voice/allison/LastComRemaining.wav"] = 2.374626,
["voice/allison/LavaDropping.wav"] = 1.720204,
["voice/allison/LavaRising.wav"] = 10.187528,
["voice/allison/LowPower.wav"] = 0.972857,
["voice/allison/LrpcDetected.wav"] = 2.498027,
["voice/allison/LrpcTargetUnits.wav"] = 3.335215,
Expand All @@ -736,7 +736,7 @@ local wavLengths = {
["voice/allison/T3UnitDetected.wav"] = 1.761451,
["voice/allison/TacticalNukeDetected.wav"] = 1.978617,
["voice/allison/TacticalNukeDetected_OLD.wav"] = 1.880930,
["voice/allison/Teamdownlastcommander.wav"] = 3.824240,
["voice/allison/TeamDownLastCommander.wav"] = 3.824240,
["voice/allison/Tech3UnitReady.wav"] = 1.744354,
["voice/allison/ThorDetected.wav"] = 1.357732,
["voice/allison/TitanDetected.wav"] = 1.483810,
Expand Down Expand Up @@ -903,7 +903,7 @@ local wavLengths = {
["voice/razkharn/AircraftSpotted.wav"] = 1.400000,
["voice/razkharn/AirtransportDetected.wav"] = 1.600000,
["voice/razkharn/AlliedComSelfD.wav"] = 2.775578,
["voice/razkharn/battleended.wav"] = 1.514807,
["voice/razkharn/BattleEnded.wav"] = 1.514807,
["voice/razkharn/Battlestarting.wav"] = 1.379796,
["voice/razkharn/Battlestarting2.wav"] = 1.485692,
["voice/razkharn/BehemothDetected.wav"] = 1.556712,
Expand All @@ -921,8 +921,8 @@ local wavLengths = {
["voice/razkharn/IdleBuilder.wav"] = 1.479524,
["voice/razkharn/JuggernautDetected.wav"] = 1.667823,
["voice/razkharn/Lastcomremaining.wav"] = 2.525125,
["voice/razkharn/Lavadropping.wav"] = 1.863288,
["voice/razkharn/Lavarising.wav"] = 1.502245,
["voice/razkharn/LavaDropping.wav"] = 1.863288,
["voice/razkharn/LavaRising.wav"] = 1.502245,
["voice/razkharn/LowPower.wav"] = 1.017528,
["voice/razkharn/LowPower2.wav"] = 0.938549,
["voice/razkharn/LrpcDetected.wav"] = 2.059796,
Expand All @@ -945,7 +945,7 @@ local wavLengths = {
["voice/razkharn/T2UnitDetected.wav"] = 1.642245,
["voice/razkharn/T3UnitDetected.wav"] = 1.705692,
["voice/razkharn/TacticalNukeDetected.wav"] = 1.884059,
["voice/razkharn/Teamdownlastcommander.wav"] = 2.058980,
["voice/razkharn/TeamDownLastCommander.wav"] = 2.058980,
["voice/razkharn/Tech3UnitReady.wav"] = 1.629478,
["voice/razkharn/ThorDetected.wav"] = 1.718594,
["voice/razkharn/TitanDetected.wav"] = 1.023628,
Expand Down Expand Up @@ -1001,8 +1001,8 @@ local wavLengths = {
["voice/winter/LastCommanderTeam.wav"] = 3.649773,
["voice/winter/LastCommanderYou.wav"] = 3.233832,
["voice/winter/LastCommanderYou2.wav"] = 2.723469,
["voice/winter/Lavadropping.wav"] = 4.973424,
["voice/winter/Lavarising.wav"] = 3.256961,
["voice/winter/LavaDropping.wav"] = 4.973424,
["voice/winter/LavaRising.wav"] = 3.256961,
["voice/winter/LowPower.wav"] = 0.929116,
["voice/winter/LowPower2.wav"] = 3.555828,
["voice/winter/LrpcDetected.wav"] = 2.582154,
Expand Down

0 comments on commit d613f3c

Please sign in to comment.