mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-28 15:13:47 +00:00
Allow to play different sounds based on what attacked you
Discussed with: @Lion.Kanzen Sound by: @Samulis Reviewed by: @Freagarach Differential Revision: https://code.wildfiregames.com/D2859 This was SVN commit r23989.
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
|
||||||
|
<SoundGroup>
|
||||||
|
<Omnipresent>1</Omnipresent>
|
||||||
|
<HeardBy>owner</HeardBy>
|
||||||
|
<Gain>0.35</Gain>
|
||||||
|
<Priority>100</Priority>
|
||||||
|
<ConeGain>1</ConeGain>
|
||||||
|
<Looping>0</Looping>
|
||||||
|
<RandOrder>1</RandOrder>
|
||||||
|
<RandGain>1</RandGain>
|
||||||
|
<GainUpper>0.35</GainUpper>
|
||||||
|
<GainLower>0.30</GainLower>
|
||||||
|
<RandPitch>1</RandPitch>
|
||||||
|
<Threshold>1</Threshold>
|
||||||
|
<Path>audio/interface/alarm/</Path>
|
||||||
|
<Sound>alarm_attacked_gaia_01.ogg</Sound>
|
||||||
|
</SoundGroup>
|
||||||
Binary file not shown.
@@ -7,7 +7,8 @@ const g_EffectReceiver = {
|
|||||||
},
|
},
|
||||||
"Capture": {
|
"Capture": {
|
||||||
"IID": "IID_Capturable",
|
"IID": "IID_Capturable",
|
||||||
"method": "Capture"
|
"method": "Capture",
|
||||||
|
"sound": "capture"
|
||||||
},
|
},
|
||||||
"ApplyStatus": {
|
"ApplyStatus": {
|
||||||
"IID": "IID_StatusEffectsReceiver",
|
"IID": "IID_StatusEffectsReceiver",
|
||||||
|
|||||||
@@ -50,12 +50,12 @@ AttackDetection.prototype.OnGlobalAttacked = function(msg)
|
|||||||
|
|
||||||
Engine.PostMessage(msg.target, MT_MinimapPing);
|
Engine.PostMessage(msg.target, MT_MinimapPing);
|
||||||
|
|
||||||
this.AttackAlert(msg.target, msg.attacker, msg.attackerOwner);
|
this.AttackAlert(msg.target, msg.attacker, msg.type, msg.attackerOwner);
|
||||||
};
|
};
|
||||||
|
|
||||||
//// External interface ////
|
//// External interface ////
|
||||||
|
|
||||||
AttackDetection.prototype.AttackAlert = function(target, attacker, attackerOwner)
|
AttackDetection.prototype.AttackAlert = function(target, attacker, type, attackerOwner)
|
||||||
{
|
{
|
||||||
let playerID = Engine.QueryInterface(this.entity, IID_Player).GetPlayerID();
|
let playerID = Engine.QueryInterface(this.entity, IID_Player).GetPlayerID();
|
||||||
|
|
||||||
@@ -127,7 +127,15 @@ AttackDetection.prototype.AttackAlert = function(target, attacker, attackerOwner
|
|||||||
"attacker": atkOwner,
|
"attacker": atkOwner,
|
||||||
"targetIsDomesticAnimal": targetIsDomesticAnimal
|
"targetIsDomesticAnimal": targetIsDomesticAnimal
|
||||||
});
|
});
|
||||||
PlaySound("attacked", target);
|
|
||||||
|
let soundGroup = "attacked";
|
||||||
|
if (g_EffectReceiver[type] && g_EffectReceiver[type].sound)
|
||||||
|
soundGroup += '_' + g_EffectReceiver[type].sound;
|
||||||
|
|
||||||
|
if (attackerOwner === 0)
|
||||||
|
soundGroup += "_gaia";
|
||||||
|
|
||||||
|
PlaySound(soundGroup, target);
|
||||||
};
|
};
|
||||||
|
|
||||||
AttackDetection.prototype.GetSuppressionTime = function()
|
AttackDetection.prototype.GetSuppressionTime = function()
|
||||||
|
|||||||
@@ -133,6 +133,9 @@
|
|||||||
<constructed>interface/complete/building/complete_universal.xml</constructed>
|
<constructed>interface/complete/building/complete_universal.xml</constructed>
|
||||||
<death>attack/destruction/building_collapse_large.xml</death>
|
<death>attack/destruction/building_collapse_large.xml</death>
|
||||||
<attacked>interface/alarm/alarm_attackplayer.xml</attacked>
|
<attacked>interface/alarm/alarm_attackplayer.xml</attacked>
|
||||||
|
<attacked_gaia>interface/alarm/alarm_attacked_gaia.xml</attacked_gaia>
|
||||||
|
<attacked_capture>interface/alarm/alarm_attackplayer.xml</attacked_capture>
|
||||||
|
<attacked_capture_gaia>interface/alarm/alarm_attacked_gaia.xml</attacked_capture_gaia>
|
||||||
<attack_ranged>attack/weapon/bow_attack.xml</attack_ranged>
|
<attack_ranged>attack/weapon/bow_attack.xml</attack_ranged>
|
||||||
<attack_impact_ranged>attack/impact/arrow_impact.xml</attack_impact_ranged>
|
<attack_impact_ranged>attack/impact/arrow_impact.xml</attack_impact_ranged>
|
||||||
</SoundGroups>
|
</SoundGroups>
|
||||||
|
|||||||
@@ -104,6 +104,9 @@
|
|||||||
<Sound>
|
<Sound>
|
||||||
<SoundGroups>
|
<SoundGroups>
|
||||||
<attacked>interface/alarm/alarm_attackplayer.xml</attacked>
|
<attacked>interface/alarm/alarm_attackplayer.xml</attacked>
|
||||||
|
<attacked_gaia>interface/alarm/alarm_attacked_gaia.xml</attacked_gaia>
|
||||||
|
<attacked_capture>interface/alarm/alarm_attackplayer.xml</attacked_capture>
|
||||||
|
<attacked_capture_gaia>interface/alarm/alarm_attacked_gaia.xml</attacked_capture_gaia>
|
||||||
<attack_slaughter>attack/weapon/sword_attack.xml</attack_slaughter>
|
<attack_slaughter>attack/weapon/sword_attack.xml</attack_slaughter>
|
||||||
</SoundGroups>
|
</SoundGroups>
|
||||||
</Sound>
|
</Sound>
|
||||||
|
|||||||
Reference in New Issue
Block a user