From 68d8604c51017106d621bb28b24b59f73be9cf57 Mon Sep 17 00:00:00 2001 From: Atrik Date: Sun, 19 Apr 2026 15:39:55 +0200 Subject: [PATCH] Do not follow rally point commands for observers 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. --- binaries/data/mods/public/gui/session/messages.js | 11 +++++------ .../data/mods/public/simulation/components/Trainer.js | 4 ++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/binaries/data/mods/public/gui/session/messages.js b/binaries/data/mods/public/gui/session/messages.js index 4bf3f9c862..6c1a3bffb3 100644 --- a/binaries/data/mods/public/gui/session/messages.js +++ b/binaries/data/mods/public/gui/session/messages.js @@ -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") { diff --git a/binaries/data/mods/public/simulation/components/Trainer.js b/binaries/data/mods/public/simulation/components/Trainer.js index 8664dc4cde..2b8bba713a 100644 --- a/binaries/data/mods/public/simulation/components/Trainer.js +++ b/binaries/data/mods/public/simulation/components/Trainer.js @@ -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)