Ticket #3176: livestock_attack_notification_r16549.diff
File livestock_attack_notification_r16549.diff, 2.2 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); 512 formatted = sprintf(translate("You have been attacked by %(attacker)s!"), { attacker: "[color=\"" + playerColor + "\"]" + username + "[/color]" }); 513 var targetEntState = GetExtendedEntityState(msg.target); 514 // Since livestock can be attacked/gathered by allied players, 515 // we display a more specific notification in this case to not confuse the player 516 if (targetEntState.resourceSupply) 517 var message = translate("Your livestock have been attacked by %(attacker)s!"); 518 else 519 var message = translate("You have been attacked by %(attacker)s!"); 520 formatted = sprintf(message, { attacker: "[color=\"" + playerColor + "\"]" + username + "[/color]" }); 513 521 break; 514 522 case "message": 515 523 // May have been hidden by the 'team' command. -
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