Index: binaries/data/mods/public/audio/interface/alarm/alarm_ally_defeat.xml =================================================================== --- /dev/null +++ binaries/data/mods/public/audio/interface/alarm/alarm_ally_defeat.xml @@ -0,0 +1,15 @@ + + + 1 + owner + 1 + 100 + 1 + 0 + 1 + 1 + 1 + 1 + audio/interface/alarm/ + alarmdefeat_1.ogg + Index: binaries/data/mods/public/audio/interface/alarm/alarm_defeat.xml =================================================================== --- binaries/data/mods/public/audio/interface/alarm/alarm_defeat.xml +++ binaries/data/mods/public/audio/interface/alarm/alarm_defeat.xml @@ -1,5 +1,7 @@ + 1 + owner 1 100 1 Index: binaries/data/mods/public/audio/interface/alarm/alarm_enemy_defeat.xml =================================================================== --- /dev/null +++ binaries/data/mods/public/audio/interface/alarm/alarm_enemy_defeat.xml @@ -0,0 +1,15 @@ + + + 1 + owner + 1 + 100 + 1 + 0 + 1 + 1 + 1 + 1 + audio/interface/alarm/ + alarmdefeat_1.ogg + Index: binaries/data/mods/public/simulation/components/Player.js =================================================================== --- binaries/data/mods/public/simulation/components/Player.js +++ binaries/data/mods/public/simulation/components/Player.js @@ -435,6 +435,28 @@ return; } + if (newState === "defeated") + { + let cmpSoundManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_SoundManager); + let cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager); + let dummyPosition = new Vector3D(); + let players = cmpPlayerManager.GetAllPlayers(); + for (let i = 1; i < players.length; ++i) + { + let playerEnt = players[i]; + let cmpSound = Engine.QueryInterface(playerEnt, IID_Sound); + if (!cmpSound) + continue; + + if (playerEnt === this.entity) + cmpSoundManager.PlaySoundGroupAtPosition(cmpSound.GetSoundGroup("defeat"), dummyPosition) + else if (this.IsAlly(i)) + cmpSoundManager.PlaySoundGroupAtPosition(cmpSound.GetSoundGroup("ally_defeat"), dummyPosition) + else + cmpSoundManager.PlaySoundGroupAtPosition(cmpSound.GetSoundGroup("enemy_defeat"), dummyPosition) + } + } + this.state = newState; let won = newState == "won"; Index: binaries/data/mods/public/simulation/templates/special/player/player.xml =================================================================== --- binaries/data/mods/public/simulation/templates/special/player/player.xml +++ binaries/data/mods/public/simulation/templates/special/player/player.xml @@ -89,29 +89,36 @@ 1000 + + + interface/alarm/alarm_defeat.xml + interface/alarm/alarm_ally_defeat.xml + interface/alarm/alarm_enemy_defeat.xml + + - - - Infantry - Worker - FemaleCitizen - Cavalry - Champion - Hero - Siege - Ship - Domestic - Trader - - - House - Economic - Outpost - Military - Fortress - CivCentre - Wonder - + + + Infantry + Worker + FemaleCitizen + Cavalry + Champion + Hero + Siege + Ship + Domestic + Trader + + + House + Economic + Outpost + Military + Fortress + CivCentre + Wonder +