Focus camera on the spy after bribing it.

Reviewed By: mimo, Imarok
Differential Revision: https://code.wildfiregames.com/D169
This was SVN commit r19249.
This commit is contained in:
elexis 2017-02-27 21:14:47 +00:00
parent 52d5c62f61
commit e14ad3c771
2 changed files with 17 additions and 4 deletions

View file

@ -353,6 +353,11 @@ var g_NotificationsTypes =
"resourceBought": notification.resourceBought
});
},
"spy-response": function(notification, player)
{
if (g_ViewedPlayer == player)
setCameraFollow(notification.entity);
},
"attack": function(notification, player)
{
if (player != g_ViewedPlayer)

View file

@ -751,15 +751,23 @@ var g_Commands = {
"spy-request": function(player, cmd, data)
{
let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
let ents = cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent => {
let ent = pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent => {
let cmpVisionSharing = Engine.QueryInterface(ent, IID_VisionSharing);
return cmpVisionSharing && cmpVisionSharing.IsBribable() && !cmpVisionSharing.ShareVisionWith(player);
});
let ent = pickRandom(ents);
}));
let cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
if (ent)
{
Engine.QueryInterface(ent, IID_VisionSharing).AddSpy(cmd.source);
cmpGUIInterface.PushNotification({
"type": "spy-response",
"players": [player],
"entity": ent
});
}
else
Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface).PushNotification({
cmpGUIInterface.PushNotification({
"type": "text",
"players": [player],
"message": markForTranslation("There are no bribable units"),