mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Do not follow rally point commands for observers
Some checks failed
checkrefs / lfscheck (push) Has been cancelled
checkrefs / checkrefs (push) Has been cancelled
lint / cppcheck (push) Has been cancelled
lint / copyright (push) Has been cancelled
lint / jenkinsfiles (push) Has been cancelled
pre-commit / build (push) Has been cancelled
Some checks failed
checkrefs / lfscheck (push) Has been cancelled
checkrefs / checkrefs (push) Has been cancelled
lint / cppcheck (push) Has been cancelled
lint / copyright (push) Has been cancelled
lint / jenkinsfiles (push) Has been cancelled
pre-commit / build (push) Has been cancelled
When observing a player with camera follow enabled, the camera would jump to newly trained units as they executed their rally point commands, which were just rendering the "Follow Player" feature frustrating.
This commit is contained in:
parent
77a53121e0
commit
68d8604c51
2 changed files with 9 additions and 6 deletions
|
|
@ -251,19 +251,18 @@ var g_NotificationsTypes =
|
|||
},
|
||||
"playercommand": function(notification, player)
|
||||
{
|
||||
// For observers, focus the camera on units commanded by the selected player
|
||||
// For observers, focus the camera on units commanded by the selected player
|
||||
if (!g_FollowPlayer || player != g_ViewedPlayer)
|
||||
return;
|
||||
|
||||
const cmd = notification.cmd;
|
||||
|
||||
// Ignore rallypoint commands of trained animals
|
||||
const entState = cmd.entities && cmd.entities[0] && GetEntityState(cmd.entities[0]);
|
||||
if (g_ViewedPlayer != 0 &&
|
||||
entState && entState.identity && entState.identity.classes &&
|
||||
entState.identity.classes.indexOf("Animal") != -1)
|
||||
// Ignore commands executed because of units following rally points
|
||||
if (cmd.fromRallyPoint)
|
||||
return;
|
||||
|
||||
const entState = cmd.entities && cmd.entities[0] && GetEntityState(cmd.entities[0]);
|
||||
|
||||
// Focus the structure to build.
|
||||
if (cmd.type == "repair")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -295,7 +295,11 @@ Trainer.prototype.Item.prototype.Spawn = function()
|
|||
|
||||
if (spawnedEnts.length && cmpRallyPoint)
|
||||
for (const com of GetRallyPointCommands(cmpRallyPoint, spawnedEnts))
|
||||
{
|
||||
// Tag this command as coming from a rally point
|
||||
com.fromRallyPoint = true;
|
||||
ProcessCommand(this.player, com);
|
||||
}
|
||||
|
||||
const cmpPlayer = QueryOwnerInterface(this.trainer);
|
||||
if (createdEnts.length)
|
||||
|
|
|
|||
Loading…
Reference in a new issue