Ticket #3176: livestock_attack_notification_r16544.diff
File livestock_attack_notification_r16544.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); 512 formatted = sprintf(translate("You have been attacked by %(attacker)s!"), { attacker: "[color=\"" + playerColor + "\"]" + username + "[/color]" }); 513 var targetEntState = GetExtendedEntityState(msg.target); 514 if (targetEntState.resourceSupply) 515 var message = translate("Your livestock have been attacked by %(attacker)s!"); 516 else 517 var message = translate("You have been attacked by %(attacker)s!"); 518 formatted = sprintf(message, { attacker: "[color=\"" + playerColor + "\"]" + username + "[/color]" }); 513 519 break; 514 520 case "message": 515 521 // 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