diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index 358701343..77cf71392 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -95,6 +95,7 @@ #include "GateRushComponent.h" #include "FactionTriggerComponent.h" #include "RocketLandingComponent.h" +#include "PathfindingComponent.h" #include "PhysicsSystemComponent.h" #include "VehiclePhysicsComponent.h" #include "ProjectilePhysicsComponent.h" @@ -455,6 +456,8 @@ void Entity::Initialize() { } case eReplicaComponentType::PET: { if (petComponentID > 0) { + // LWOPetComponent::Factory (0x01031240): a pet that isn't in an inventory gets pathfinding control first + if (!GetVar(u"inInventory") && !HasComponent(eReplicaComponentType::PATHFINDING)) AddComponent(-1); AddComponent(petComponentID); } break; diff --git a/dGame/dComponents/PathfindingComponent.h b/dGame/dComponents/PathfindingComponent.h new file mode 100644 index 000000000..029725301 --- /dev/null +++ b/dGame/dComponents/PathfindingComponent.h @@ -0,0 +1,19 @@ +#ifndef PATHFINDINGCOMPONENT_H +#define PATHFINDINGCOMPONENT_H + +#include "Component.h" +#include "eReplicaComponentType.h" + +/** + * Pathfinding control, as the client's LWOPathfindingControlComponent: the client adds one (componentID -1) to a pet + * that isn't in an inventory, and to a script or combat AI object with movement physics. Nothing of it is sent or done + * on the server yet (the server's pathing is MovementAIComponent). + */ +class PathfindingComponent final : public Component { +public: + static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PATHFINDING; + + PathfindingComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {} +}; + +#endif // PATHFINDINGCOMPONENT_H