Ticket #3176: no_attack_notification_for_domestic_animals_r16551.diff

File no_attack_notification_for_domestic_animals_r16551.diff, 962 bytes (added by fcxSanya, 9 years ago)

Another alternative patch; suspends the attack notification if the attacked entity has classes "Animal" and "Domestic"; fixed version: the notification for domestic animals isn't sent in the first place

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

     
    5353    // Don't register attacks dealt by myself
    5454    if (cmpAttackerOwnership.GetOwner() == cmpPlayer.GetPlayerID())
    5555        return;
     56    // Since livestock can be attacked/gathered by allied players
     57    // and generally not so valuable as other units/buildings,
     58    // we don't register attacks for it
     59    var cmpTargetIdentity = Engine.QueryInterface(target, IID_Identity);
     60    var targetIsDomesticAnimal = cmpTargetIdentity.HasClass("Animal") && cmpTargetIdentity.HasClass("Domestic");
     61    if (targetIsDomesticAnimal)
     62        return;
    5663
    5764    var cmpPosition = Engine.QueryInterface(target, IID_Position);
    5865    if (!cmpPosition || !cmpPosition.IsInWorld())