Skip to content

Commit 7c75cd9

Browse files
committed
Fixed an issue where unnecessary path updates could finish spontaneously, overriding a valid path update and resulting in the actor going back into sentry mode and staying idle
1 parent 01f1df5 commit 7c75cd9

File tree

8 files changed

+7
-47
lines changed

8 files changed

+7
-47
lines changed

Data/Base.rte/AI/HumanBehaviors.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
18521852
local Trace = SceneMan:ShortestDistance(Owner.Head.Pos, FallPos, false);
18531853
SceneMan:CastObstacleRay(Owner.Head.Pos, Trace, FallPos, Vector(), Owner.ID, Owner.IgnoresWhichTeam, rte.grassID, 3);
18541854

1855-
local deltaToJump = 25;
1855+
local deltaToJump = 15;
18561856
if Owner.Jetpack.JetpackType == AEJetpack.JumpPack then
18571857
deltaToJump = deltaToJump * 1.4;
18581858
end

Source/Activities/GameActivity.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,8 +1330,6 @@ void GameActivity::Update() {
13301330
if (m_PlayerController[player].IsState(PRESS_SECONDARY) || m_PlayerController[player].IsState(ACTOR_NEXT_PREP) || m_PlayerController[player].IsState(ACTOR_PREV_PREP)) {
13311331
// Stop drawing the waypoints
13321332
// m_ControlledActor[player]->DrawWaypoints(false);
1333-
// Update the player's move path now to the first waypoint set
1334-
m_ControlledActor[player]->UpdateMovePath();
13351333
// Give player control back to actor
13361334
m_ControlledActor[player]->GetController()->SetDisabled(false);
13371335
// Switch back to normal view
@@ -1351,8 +1349,7 @@ void GameActivity::Update() {
13511349
// Just pointing into somewhere in the scene, so give that command
13521350
else
13531351
m_ControlledActor[player]->AddAISceneWaypoint(m_ActorCursor[player]);
1354-
// Update the player's move path now to the first waypoint set
1355-
m_ControlledActor[player]->UpdateMovePath();
1352+
13561353
if (m_pLastMarkedActor[player] && m_pLastMarkedActor[player]->GetPieMenu()) {
13571354
m_pLastMarkedActor[player]->GetPieMenu()->SetAnimationModeToNormal();
13581355
}
@@ -1439,7 +1436,6 @@ void GameActivity::Update() {
14391436
pActor->ClearAIWaypoints();
14401437
pActor->SetAIMode(Actor::AIMODE_SQUAD);
14411438
pActor->AddAIMOWaypoint(m_ControlledActor[player]);
1442-
pActor->UpdateMovePath(); // Make sure pActor has m_ControlledActor registered as an AIMOWaypoint
14431439
}
14441440
}
14451441

Source/Entities/ACrab.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ bool ACrab::HandlePieCommand(PieSliceType pieSliceIndex) {
581581
} else if (pieSliceIndex == PieSliceType::GoTo) {
582582
m_AIMode = AIMODE_GOTO;
583583
ClearAIWaypoints();
584-
m_UpdateMovePath = true;
585584
} else {
586585
return Actor::HandlePieCommand(pieSliceIndex);
587586
}
@@ -1257,34 +1256,6 @@ void ACrab::Update() {
12571256
if (m_Vel.MagnitudeIsGreaterThan(10.0F))
12581257
m_ViewPoint += m_Vel * std::sqrt(m_Vel.GetMagnitude() * 0.1F);
12591258

1260-
/* Done by pie menu now, see HandlePieCommand()
1261-
////////////////////////////////////////
1262-
// AI mode setting
1263-
1264-
if (m_Controller.IsState(AI_MODE_SET))
1265-
{
1266-
if (m_Controller.IsState(PRESS_RIGHT))
1267-
{
1268-
m_AIMode = AIMODE_BRAINHUNT;
1269-
m_UpdateMovePath = true;
1270-
}
1271-
else if (m_Controller.IsState(PRESS_LEFT))
1272-
{
1273-
m_AIMode = AIMODE_PATROL;
1274-
}
1275-
else if (m_Controller.IsState(PRESS_UP))
1276-
{
1277-
m_AIMode = AIMODE_SENTRY;
1278-
}
1279-
else if (m_Controller.IsState(PRESS_DOWN))
1280-
{
1281-
m_AIMode = AIMODE_GOLDDIG;
1282-
}
1283-
1284-
m_DeviceState = SCANNING;
1285-
}
1286-
*/
1287-
12881259
////////////////////////////////////////
12891260
// Balance stuff
12901261

Source/Entities/ACraft.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ bool ACraft::HandlePieCommand(PieSliceType pieSliceIndex) {
406406
m_AIMode = AIMODE_GOTO;
407407
m_DeliveryState = FALL;
408408
ClearAIWaypoints();
409-
m_UpdateMovePath = true;
410409
} else if (pieSliceIndex == PieSliceType::Scuttle) {
411410
m_AIMode = AIMODE_SCUTTLE;
412411
} else {

Source/Entities/AHuman.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,6 @@ bool AHuman::HandlePieCommand(PieSliceType pieSliceIndex) {
597597
} else if (pieSliceIndex == PieSliceType::GoTo) {
598598
m_AIMode = AIMODE_GOTO;
599599
ClearAIWaypoints();
600-
m_UpdateMovePath = true;
601600
} else if (pieSliceIndex == PieSliceType::GoldDig) {
602601
m_AIMode = AIMODE_GOLDDIG;
603602
} else {

Source/Entities/Activity.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,8 +682,6 @@ void Activity::ReassignSquadLeader(const int player, const int team) {
682682
if (actor && (actor->GetAIMode() == Actor::AIMODE_SQUAD) && (actor->GetAIMOWaypointID() == leaderID) && !actor->GetController()->IsPlayerControlled() && !actor->IsInGroup("Brains")) {
683683
actor->ClearAIWaypoints();
684684
actor->AddAIMOWaypoint(m_ControlledActor[player]);
685-
// Make sure actor has m_ControlledActor registered as an AIMOWaypoint
686-
actor->UpdateMovePath();
687685
} else if (actor && actor->GetID() == leaderID) {
688686
// Set the old leader to follow the controlled actor and inherit his AI mode
689687
m_ControlledActor[player]->ClearAIWaypoints();
@@ -703,8 +701,6 @@ void Activity::ReassignSquadLeader(const int player, const int team) {
703701
actor->ClearAIWaypoints();
704702
actor->SetAIMode(Actor::AIMODE_SQUAD);
705703
actor->AddAIMOWaypoint(m_ControlledActor[player]);
706-
// Make sure actor has m_ControlledActor registered as an AIMOWaypoint
707-
actor->UpdateMovePath();
708704
}
709705
actor = g_MovableMan.GetNextTeamActor(team, actor);
710706
} while (actor && actor != m_ControlledActor[player]);

Source/Entities/Actor.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void Actor::Clear() {
109109
m_PrevPathTarget.Reset();
110110
m_MoveVector.Reset();
111111
m_MovePath.clear();
112-
m_UpdateMovePath = true;
112+
m_UpdateMovePath = false;
113113
m_MoveProximityLimit = 20.0F;
114114
m_AIBaseDigStrength = c_PathFindingDefaultDigStrength;
115115
m_BaseMass = std::numeric_limits<float>::infinity();
@@ -135,7 +135,6 @@ int Actor::Create() {
135135
// Default to an interesting AI controller mode
136136
m_Controller.SetInputMode(Controller::CIM_AI);
137137
m_Controller.SetControlledActor(this);
138-
m_UpdateMovePath = true;
139138

140139
m_ViewPoint = m_Pos;
141140
m_HUDStack = -m_CharHeight / 2;
@@ -1098,7 +1097,7 @@ void Actor::Update() {
10981097
///////////////////////////////////////////////////////////////////////////////
10991098
// Check for manual player-made progress made toward the set AI goal
11001099

1101-
if ((m_AIMode == AIMODE_GOTO || m_AIMode == AIMODE_SQUAD) && m_Controller.IsPlayerControlled() && !m_Controller.IsDisabled()) {
1100+
if ((m_AIMode == AIMODE_GOTO || m_AIMode == AIMODE_SQUAD) && (!m_PathRequest || m_PathRequest->complete) && m_Controller.IsPlayerControlled() && !m_Controller.IsDisabled()) {
11021101
Vector notUsed;
11031102
// See if we are close enough to the next move target that we should grab the next in the path that is out of proximity range
11041103
Vector pathPointVec;

Source/Entities/Actor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,9 +639,6 @@ namespace RTE {
639639
/// @return The number of waypoints in the MovePath.
640640
int GetMovePathSize() const { return m_MovePath.size(); }
641641

642-
/// Starts updating this Actor's movepath.
643-
virtual void UpdateMovePath();
644-
645642
/// Returns whether we're waiting on a new pending movepath.
646643
/// @return Whether we're waiting on a new pending movepath.
647644
bool IsWaitingOnNewMovePath() const { return m_PathRequest != nullptr || m_UpdateMovePath; }
@@ -808,6 +805,9 @@ namespace RTE {
808805
/// This processes and cleans up the movepath.
809806
virtual void OnNewMovePath();
810807

808+
/// Starts updating this Actor's movepath.
809+
virtual void UpdateMovePath();
810+
811811
// Member variables
812812
static Entity::ClassInfo m_sClass;
813813

0 commit comments

Comments
 (0)