Fix music counting morph as violence

(port of Zero-K/e12f08a29e9d6639f2edd1c6f5f66f27bf8b6c1e)
This commit is contained in:
sprunk 2023-07-10 17:56:08 +09:30 committed by Luke Hubmayer-Werner
parent 263359a7da
commit a5e5c4c493
1 changed files with 2 additions and 0 deletions

View File

@ -88,6 +88,7 @@ local unitExceptions = include("Configs/snd_music_exception.lua")
local spAreTeamsAllied = Spring.AreTeamsAllied local spAreTeamsAllied = Spring.AreTeamsAllied
local spGetUnitRulesParam = Spring.GetUnitRulesParam
local MOODS = {"peace", "war", "war2", "winning", "losing", "briefing", "victory", "defeat"} local MOODS = {"peace", "war", "war2", "winning", "losing", "briefing", "victory", "defeat"}
local moodPriorities = {peace=0, war=1, war2=2, winning=4, losing=4, briefing=10, victory=10, defeat=10, [""]=0} -- Determines which music moods will instantly interrupt others, and which will wait for playing track to finish local moodPriorities = {peace=0, war=1, war2=2, winning=4, losing=4, briefing=10, victory=10, defeat=10, [""]=0} -- Determines which music moods will instantly interrupt others, and which will wait for playing track to finish
@ -407,6 +408,7 @@ end
function widget:UnitDestroyed(unitID, unitDefID, teamID) function widget:UnitDestroyed(unitID, unitDefID, teamID)
if unitExceptions[unitDefID] then return end if unitExceptions[unitDefID] then return end
if spGetUnitRulesParam(unitID, "wasMorphedTo") then return end
local unitCost = UnitDefs[unitDefID].metalCost local unitCost = UnitDefs[unitDefID].metalCost
if spAreTeamsAllied(teamID or 0, myTeam) then if spAreTeamsAllied(teamID or 0, myTeam) then