forked from mirrors/0ad
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:
@@ -353,6 +353,11 @@ var g_NotificationsTypes =
|
|||||||
"resourceBought": notification.resourceBought
|
"resourceBought": notification.resourceBought
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
"spy-response": function(notification, player)
|
||||||
|
{
|
||||||
|
if (g_ViewedPlayer == player)
|
||||||
|
setCameraFollow(notification.entity);
|
||||||
|
},
|
||||||
"attack": function(notification, player)
|
"attack": function(notification, player)
|
||||||
{
|
{
|
||||||
if (player != g_ViewedPlayer)
|
if (player != g_ViewedPlayer)
|
||||||
|
|||||||
@@ -751,15 +751,23 @@ var g_Commands = {
|
|||||||
"spy-request": function(player, cmd, data)
|
"spy-request": function(player, cmd, data)
|
||||||
{
|
{
|
||||||
let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|
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);
|
let cmpVisionSharing = Engine.QueryInterface(ent, IID_VisionSharing);
|
||||||
return cmpVisionSharing && cmpVisionSharing.IsBribable() && !cmpVisionSharing.ShareVisionWith(player);
|
return cmpVisionSharing && cmpVisionSharing.IsBribable() && !cmpVisionSharing.ShareVisionWith(player);
|
||||||
});
|
}));
|
||||||
let ent = pickRandom(ents);
|
|
||||||
|
let cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
|
||||||
if (ent)
|
if (ent)
|
||||||
|
{
|
||||||
Engine.QueryInterface(ent, IID_VisionSharing).AddSpy(cmd.source);
|
Engine.QueryInterface(ent, IID_VisionSharing).AddSpy(cmd.source);
|
||||||
|
cmpGUIInterface.PushNotification({
|
||||||
|
"type": "spy-response",
|
||||||
|
"players": [player],
|
||||||
|
"entity": ent
|
||||||
|
});
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface).PushNotification({
|
cmpGUIInterface.PushNotification({
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"players": [player],
|
"players": [player],
|
||||||
"message": markForTranslation("There are no bribable units"),
|
"message": markForTranslation("There are no bribable units"),
|
||||||
|
|||||||
Reference in New Issue
Block a user