From a5e5c4c493a1b80a811d1fa339ec6a3aaa4b479e Mon Sep 17 00:00:00 2001 From: sprunk Date: Mon, 10 Jul 2023 17:56:08 +0930 Subject: [PATCH] Fix music counting morph as violence (port of Zero-K/e12f08a29e9d6639f2edd1c6f5f66f27bf8b6c1e) --- snd_music.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snd_music.lua b/snd_music.lua index 5fa246c..6566b74 100644 --- a/snd_music.lua +++ b/snd_music.lua @@ -88,6 +88,7 @@ local unitExceptions = include("Configs/snd_music_exception.lua") local spAreTeamsAllied = Spring.AreTeamsAllied +local spGetUnitRulesParam = Spring.GetUnitRulesParam 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 @@ -407,6 +408,7 @@ end function widget:UnitDestroyed(unitID, unitDefID, teamID) if unitExceptions[unitDefID] then return end + if spGetUnitRulesParam(unitID, "wasMorphedTo") then return end local unitCost = UnitDefs[unitDefID].metalCost if spAreTeamsAllied(teamID or 0, myTeam) then