Ticket #4276: 1910_nearbyUnits.2.diff

File 1910_nearbyUnits.2.diff, 1.4 KB (added by fatherbushido, 8 years ago)

adress Itms advice

  • binaries/data/mods/public/simulation/components/Damage.js

    Damage.prototype.MissileHit = function(d  
    130130    // If we didn't hit the main target look for nearby units
    131131    let cmpPlayer = QueryPlayerIDInterface(data.attackerOwner);
    132132    let ents = this.EntitiesNearPoint(Vector2D.from3D(data.position), targetPosition.horizDistanceTo(data.position) * 2, cmpPlayer.GetEnemies());
    133133   
    134134    for (let ent of ents)
     135    {
    135136        if (!this.TestCollision(ent, data.position, lateness))
    136         {
    137             this.CauseDamage({
    138                 "strengths": data.strengths,
    139                 "target": ent,
    140                 "attacker": data.attacker,
    141                 "multiplier": data.multiplier,
    142                 "type": data.type,
    143                 "attackerOwner": data.attackerOwner
    144             });
    145 
    146             cmpProjectileManager.RemoveProjectile(data.projectileId);
    147             break;
    148         }
     137            continue;
     138        this.CauseDamage({
     139            "strengths": data.strengths,
     140            "target": ent,
     141            "attacker": data.attacker,
     142            "multiplier": data.multiplier,
     143            "type": data.type,
     144            "attackerOwner": data.attackerOwner
     145        });
     146        cmpProjectileManager.RemoveProjectile(data.projectileId);
     147    }
    149148};
    150149
    151150/**
    152151 * Damages units around a given origin.
    153152 * @param {Object}   data - the data sent by the caller.