mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
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:
parent
52d5c62f61
commit
e14ad3c771
2 changed files with 17 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue