mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-09-30 19:50:05 +00:00
Only loop NPC movement if the NPC has a looping path assigned
Allows paths to terminate. Also fixes a bug where follower NPCs sometimes oscillate their positions.
This commit is contained in:
@@ -310,10 +310,9 @@ static void stepNPCPathing() {
|
||||
}
|
||||
|
||||
/*
|
||||
* Move processed point to the back to maintain cycle, unless this is a
|
||||
* dynamically calculated mob route.
|
||||
* If this path should be repeated, move processed point to the back to maintain cycle.
|
||||
*/
|
||||
if (!(npc->type == EntityType::MOB && !((Mob*)npc)->staticPath))
|
||||
if (npc->loopingPath)
|
||||
queue->push(point);
|
||||
|
||||
it++; // go to next entry in map
|
||||
@@ -388,6 +387,7 @@ void Transport::constructPathNPC(int32_t id, NPCPath* path) {
|
||||
BaseNPC* npc = NPCManager::NPCs[id];
|
||||
if (npc->type == EntityType::MOB)
|
||||
((Mob*)(npc))->staticPath = true;
|
||||
npc->loopingPath = path->isLoop;
|
||||
|
||||
// Interpolate
|
||||
std::vector<Vec3> pathPoints = path->points;
|
||||
|
Reference in New Issue
Block a user