Ticket #3176: no_attack_notification_for_domestic_animals_r16549.diff
File no_attack_notification_for_domestic_animals_r16549.diff, 2.1 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/gui/session/messages.js
119 119 addChatMessage({ 120 120 "type": "attack", 121 121 "player": player, 122 "attacker": notification.attacker 122 "attacker": notification.attacker, 123 "target": notification.target 123 124 }); 124 125 }, 125 126 "dialog": function(notification, player) … … 509 510 return; 510 511 511 512 [username, playerColor] = getUsernameAndColor(msg.attacker); 513 var targetEntState = GetExtendedEntityState(msg.target); 514 var targetIdentityClasses = targetEntState.identity.classes; 515 var targetIsDomesticAnimal = targetIdentityClasses.indexOf("Animal") != -1 && targetIdentityClasses.indexOf("Domestic") != -1; 516 // Since livestock can be attacked/gathered by allied players 517 // and generally not so valuable as other units/buildings, 518 // we don't display the attack notification for it 519 if (targetIsDomesticAnimal) 520 return; 512 521 formatted = sprintf(translate("You have been attacked by %(attacker)s!"), { attacker: "[color=\"" + playerColor + "\"]" + username + "[/color]" }); 513 522 break; 514 523 case "message": -
binaries/data/mods/public/simulation/components/AttackDetection.js
78 78 this.AddSuppression(event); 79 79 Engine.PostMessage(this.entity, MT_AttackDetected, { "player": cmpPlayer.GetPlayerID(), "event": event }); 80 80 var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); 81 cmpGuiInterface.PushNotification({"type": "attack", "players": [cmpPlayer.GetPlayerID()], "attacker": cmpAttackerOwnership.GetOwner() });81 cmpGuiInterface.PushNotification({"type": "attack", "players": [cmpPlayer.GetPlayerID()], "attacker": cmpAttackerOwnership.GetOwner(), "target": target }); 82 82 PlaySound("attacked", target); 83 83 }; 84 84