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)