1
0
forked from 0ad/0ad

Fix sound not played when being attacked by non-capture attacks.

Wrong assumptions on reviewing 2627714c07 and 7f7a3edfae made it such
that non-capture attacks did not play a being-attacked sound anymore.
We only want a different sound when being captured.

Differential revision: D3408
Tested by: @Stan
This was SVN commit r24694.
This commit is contained in:
Freagarach 2021-01-19 07:22:27 +00:00
parent 214299b6c1
commit f1de414a6d
5 changed files with 7 additions and 19 deletions

View File

@ -7,7 +7,6 @@ class AttackEffects
{
let effectsDataObj = {};
this.effectReceivers = [];
this.effectSounds = {};
for (let filename of Engine.ListDirectoryFiles("simulation/data/attack_effects", "*.json", false))
{
@ -28,7 +27,6 @@ class AttackEffects
"IID": data.IID,
"method": data.method
});
this.effectSounds[data.code] = data.sound || "";
}
let effDataSort = (a, b) => a.order < b.order ? -1 : a.order > b.order ? 1 : 0;
@ -39,7 +37,6 @@ class AttackEffects
this.effectReceivers.sort(effSort);
deepfreeze(this.effectReceivers);
deepfreeze(this.effectSounds);
}
/**
@ -49,13 +46,4 @@ class AttackEffects
{
return this.effectReceivers;
}
/**
* @param {string} type - The type of effect to get the receiving sound for.
* @return {string} - The name of the soundgroup to play.
*/
GetSound(type)
{
return this.effectSounds[type] || "";
}
}

View File

@ -128,7 +128,10 @@ AttackDetection.prototype.AttackAlert = function(target, attacker, type, attacke
"targetIsDomesticAnimal": targetIsDomesticAnimal
});
let soundGroup = g_AttackEffects.GetSound(type);
let soundGroup = "attacked";
if (type == "capture")
soundGroup += "_capture";
if (attackerOwner === 0)
soundGroup += "_gaia";

View File

@ -4,6 +4,5 @@
"IID": "IID_StatusEffectsReceiver",
"method": "ApplyStatus",
"name": "Apply Status",
"order": 3,
"sound": "attacked"
"order": 3
}

View File

@ -4,6 +4,5 @@
"IID": "IID_Capturable",
"method": "Capture",
"name": "Capture",
"order": 2,
"sound": "attacked_capture"
"order": 2
}

View File

@ -4,6 +4,5 @@
"IID": "IID_Health",
"method": "TakeDamage",
"name": "Damage",
"order": 1,
"sound": "attacked"
"order": 1
}