Ticket #1910: 1910_splash_damage_broken.patch

File 1910_splash_damage_broken.patch, 1.9 KB (added by leper, 8 years ago)
  • binaries/data/mods/public/simulation/components/Attack.js

     
    545545        };
    546546        if (this.template.Ranged.Splash)
    547547        {
    548             data.friendlyFire = this.template.Ranged.Splash.FriendlyFire;
     548            data.friendlyFire = this.template.Ranged.Splash.FriendlyFire != "false";
    549549            data.radius = +this.template.Ranged.Splash.Range;
    550550            data.shape = this.template.Ranged.Splash.Shape;
    551551            data.isSplash = true;
  • binaries/data/mods/public/simulation/components/Damage.js

     
    8787    // Do this first in case the direct hit kills the target
    8888    if (data.isSplash)
    8989    {
    90         let playersToDamage = !data.friendlyFire ? QueryPlayerIDInterface(data.attackerOwner).GetEnemies() : null;
     90        let playersToDamage = [];
     91        if (!data.friendlyFire)
     92            playersToDamage = QueryPlayerIDInterface(data.attackerOwner).GetEnemies();
     93        else
     94        {
     95            let numPlayers = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers();
     96            for (let i = 0; i < numPlayers; ++i)
     97                playersToDamage.push(i);
     98        }
    9199
    92100        this.CauseSplashDamage({
    93101            "attacker": data.attacker,
     
    148156 * @param {string}   data.type - the type of damage.
    149157 * @param {number}   data.attackerOwner - the player id of the attacker.
    150158 * @param {Vector3D} data.direction - the unit vector defining the direction.
    151  * @param {number[]} [data.playersToDamage] - the array of player id's to damage.
     159 * @param {number[]} data.playersToDamage - the array of player id's to damage.
    152160 */
    153161Damage.prototype.CauseSplashDamage = function(data)
    154162{