mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-21 14:14:22 +00:00
feat: hatchlings (#2008)
tested that hatchlings now function fixes #759 Update MovementAIComponent.cpp Update MovementAIComponent.cpp Update HatchlingPets.cpp
This commit is contained in:
@@ -2237,6 +2237,7 @@ bool Entity::MsgRequestServerObjectInfo(GameMessages::RequestServerObjectInfo& r
|
||||
objectInfo.PushDebug<AMFIntValue>("Template ID(LOT)") = GetLOT();
|
||||
objectInfo.PushDebug<AMFStringValue>("Object ID") = std::to_string(GetObjectID());
|
||||
objectInfo.PushDebug<AMFStringValue>("Spawner's Object ID") = std::to_string(GetSpawnerID());
|
||||
objectInfo.PushDebug<AMFStringValue>("Owner override") = std::to_string(m_OwnerOverride);
|
||||
|
||||
auto& componentDetails = objectInfo.PushDebug("Component Information");
|
||||
for (const auto [id, component] : m_Components) {
|
||||
|
||||
@@ -189,6 +189,15 @@ void MovementAIComponent::Update(const float deltaTime) {
|
||||
}
|
||||
} else {
|
||||
Stop();
|
||||
if (m_FollowedTarget != LWOOBJID_EMPTY) {
|
||||
GameMessages::GetPosition getPos;
|
||||
if (!getPos.Send(m_FollowedTarget)) {
|
||||
LOG("Target %llu does not exist anymore to follow", m_FollowedTarget);
|
||||
m_FollowedTarget = LWOOBJID_EMPTY;
|
||||
} else {
|
||||
SetDestination(getPos.pos);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -555,5 +564,25 @@ bool MovementAIComponent::OnGetObjectReportInfo(GameMessages::GetObjectReportInf
|
||||
pathCopy.pop();
|
||||
}
|
||||
|
||||
movementInfo.PushDebug<AMFStringValue>("Followed Target") = std::to_string(m_FollowedTarget);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MovementAIComponent::FollowTarget(const LWOOBJID target) {
|
||||
if (target == LWOOBJID_EMPTY) {
|
||||
m_FollowedTarget = target;
|
||||
return;
|
||||
}
|
||||
GameMessages::GetPosition getPos;
|
||||
if (!getPos.Send(target)) {
|
||||
LOG("Tried to follow target %llu but they don't exist", target);
|
||||
m_FollowedTarget = LWOOBJID_EMPTY;
|
||||
return;
|
||||
}
|
||||
|
||||
m_FollowedTarget = target;
|
||||
SetMaxSpeed(1.0f);
|
||||
m_CurrentSpeed = 1.0f;
|
||||
SetDestination(getPos.pos);
|
||||
}
|
||||
|
||||
@@ -31,27 +31,27 @@ struct MovementAIInfo {
|
||||
/**
|
||||
* The radius that the entity can wander in
|
||||
*/
|
||||
float wanderRadius;
|
||||
float wanderRadius{};
|
||||
|
||||
/**
|
||||
* The speed at which the entity wanders
|
||||
*/
|
||||
float wanderSpeed;
|
||||
float wanderSpeed{};
|
||||
|
||||
/**
|
||||
* This is only used for the emotes
|
||||
*/
|
||||
float wanderChance;
|
||||
float wanderChance{};
|
||||
|
||||
/**
|
||||
* The min amount of delay before wandering
|
||||
*/
|
||||
float wanderDelayMin;
|
||||
float wanderDelayMin{};
|
||||
|
||||
/**
|
||||
* The max amount of delay before wandering
|
||||
*/
|
||||
float wanderDelayMax;
|
||||
float wanderDelayMax{};
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -214,6 +214,8 @@ public:
|
||||
bool OnGetObjectReportInfo(GameMessages::GetObjectReportInfo& reportInfo);
|
||||
|
||||
bool HasPath() const { return m_Path != nullptr; }
|
||||
|
||||
void FollowTarget(const LWOOBJID target);
|
||||
private:
|
||||
|
||||
/**
|
||||
@@ -337,6 +339,8 @@ private:
|
||||
|
||||
// The number of waypoints that were on the path in the call to SetPath
|
||||
uint32_t m_CurrentPathWaypointCount{ 0 };
|
||||
|
||||
LWOOBJID m_FollowedTarget{ LWOOBJID_EMPTY };
|
||||
};
|
||||
|
||||
#endif // MOVEMENTAICOMPONENT_H
|
||||
|
||||
Reference in New Issue
Block a user