mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-20 23:24:16 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user