mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
Move update path to movement manager so all movement will use paths
This commit is contained in:
parent
2224b83ae0
commit
f754cb1307
@ -17,11 +17,10 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_DATA_VERIFICATION_H
|
||||
#define COMMON_DATA_VERIFICATION_H
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
@ -52,4 +51,3 @@ namespace EQEmu
|
||||
|
||||
} /*EQEmu*/
|
||||
|
||||
#endif /*COMMON_DATA_VERIFICATION_H*/
|
||||
|
||||
@ -87,28 +87,5 @@ public:
|
||||
~InitWinsock();
|
||||
};
|
||||
|
||||
template<class T> class AutoDelete {
|
||||
public:
|
||||
AutoDelete(T** iVar, T* iSetTo = 0) {
|
||||
init(iVar, iSetTo);
|
||||
}
|
||||
AutoDelete() { pVar = nullptr; }
|
||||
void init(T** iVar, T* iSetTo = 0)
|
||||
{
|
||||
pVar = iVar;
|
||||
if (iSetTo)
|
||||
*pVar = iSetTo;
|
||||
}
|
||||
~AutoDelete() {
|
||||
if(pVar != nullptr)
|
||||
safe_delete(*pVar);
|
||||
}
|
||||
void ReallyClearIt() {
|
||||
pVar = nullptr;
|
||||
}
|
||||
private:
|
||||
T** pVar;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
16
zone/bot.cpp
16
zone/bot.cpp
@ -2687,14 +2687,7 @@ void Bot::AI_Process() {
|
||||
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName());
|
||||
|
||||
Goal = GetTarget()->GetPosition();
|
||||
|
||||
if (RuleB(Bots, UsePathing) && zone->pathing) {
|
||||
bool WaypointChanged, NodeReached;
|
||||
|
||||
Goal = UpdatePath(Goal.x, Goal.y, Goal.z,
|
||||
GetBotRunspeed(), WaypointChanged, NodeReached);
|
||||
}
|
||||
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetBotRunspeed());
|
||||
return;
|
||||
}
|
||||
@ -2813,13 +2806,6 @@ void Bot::AI_Process() {
|
||||
|
||||
Goal = follow_mob->GetPosition();
|
||||
|
||||
if (RuleB(Bots, UsePathing) && zone->pathing) {
|
||||
bool WaypointChanged, NodeReached;
|
||||
|
||||
Goal = UpdatePath(Goal.x, Goal.y, Goal.z,
|
||||
speed, WaypointChanged, NodeReached);
|
||||
}
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -496,7 +496,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
||||
}
|
||||
}
|
||||
|
||||
void Doors::NPCOpen(NPC* sender, bool alt_mode)
|
||||
void Doors::Open(Mob* sender, bool alt_mode)
|
||||
{
|
||||
if (sender) {
|
||||
if (GetTriggerType() == 255 || GetTriggerDoorID() > 0 || GetLockpick() != 0 || GetKeyItem() != 0 || open_type == 59 || open_type == 58 || !sender->IsNPC()) { // this object isnt triggered or door is locked - NPCs should not open locked doors!
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
void ForceClose(Mob *sender, bool alt_mode = false);
|
||||
void ForceOpen(Mob *sender, bool alt_mode = false);
|
||||
void HandleClick(Client *sender, uint8 trigger);
|
||||
void NPCOpen(NPC *sender, bool alt_mode = false);
|
||||
void Open(Mob *sender, bool alt_mode = false);
|
||||
void SetDisableTimer(bool flag);
|
||||
void SetDoorName(const char *name);
|
||||
void SetEntityID(uint32 entity) { entity_id = entity; }
|
||||
|
||||
@ -3263,7 +3263,7 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 hate)
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::OpenDoorsNear(NPC *who)
|
||||
void EntityList::OpenDoorsNear(Mob *who)
|
||||
{
|
||||
|
||||
for (auto it = door_list.begin();it != door_list.end(); ++it) {
|
||||
@ -3276,7 +3276,7 @@ void EntityList::OpenDoorsNear(NPC *who)
|
||||
float curdist = diff.x * diff.x + diff.y * diff.y;
|
||||
|
||||
if (diff.z * diff.z < 10 && curdist <= 100)
|
||||
cdoor->NPCOpen(who);
|
||||
cdoor->Open(who);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -370,7 +370,7 @@ public:
|
||||
|
||||
void AddHealAggro(Mob* target, Mob* caster, uint16 hate);
|
||||
Mob* FindDefenseNPC(uint32 npcid);
|
||||
void OpenDoorsNear(NPC* opener);
|
||||
void OpenDoorsNear(Mob* opener);
|
||||
void UpdateWho(bool iSendFullUpdate = false);
|
||||
void SendPositionUpdates(Client* client, uint32 cLastUpdate = 0, float update_range = 0, Entity* always_send = 0, bool iSendEvenIfNotChanged = false);
|
||||
char* MakeNameUnique(char* name);
|
||||
|
||||
@ -231,7 +231,7 @@ void Lua_EntityList::ReplaceWithTarget(Lua_Mob target, Lua_Mob new_target) {
|
||||
self->ReplaceWithTarget(target, new_target);
|
||||
}
|
||||
|
||||
void Lua_EntityList::OpenDoorsNear(Lua_NPC opener) {
|
||||
void Lua_EntityList::OpenDoorsNear(Lua_Mob opener) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->OpenDoorsNear(opener);
|
||||
}
|
||||
@ -479,7 +479,7 @@ luabind::scope lua_register_entity_list() {
|
||||
.def("RemoveFromTargets", (void(Lua_EntityList::*)(Lua_Mob))&Lua_EntityList::RemoveFromTargets)
|
||||
.def("RemoveFromTargets", (void(Lua_EntityList::*)(Lua_Mob, bool))&Lua_EntityList::RemoveFromTargets)
|
||||
.def("ReplaceWithTarget", (void(Lua_EntityList::*)(Lua_Mob, Lua_Mob))&Lua_EntityList::ReplaceWithTarget)
|
||||
.def("OpenDoorsNear", (void(Lua_EntityList::*)(Lua_NPC))&Lua_EntityList::OpenDoorsNear)
|
||||
.def("OpenDoorsNear", (void(Lua_EntityList::*)(Lua_Mob))&Lua_EntityList::OpenDoorsNear)
|
||||
.def("MakeNameUnique", (std::string(Lua_EntityList::*)(const char*))&Lua_EntityList::MakeNameUnique)
|
||||
.def("RemoveNumbers", (std::string(Lua_EntityList::*)(const char*))&Lua_EntityList::RemoveNumbers)
|
||||
.def("SignalMobsByNPCID", (void(Lua_EntityList::*)(uint32, int))&Lua_EntityList::SignalMobsByNPCID)
|
||||
|
||||
@ -84,7 +84,7 @@ public:
|
||||
void RemoveFromTargets(Lua_Mob mob);
|
||||
void RemoveFromTargets(Lua_Mob mob, bool RemoveFromXTargets);
|
||||
void ReplaceWithTarget(Lua_Mob target, Lua_Mob new_target);
|
||||
void OpenDoorsNear(Lua_NPC opener);
|
||||
void OpenDoorsNear(Lua_Mob opener);
|
||||
std::string MakeNameUnique(const char *name);
|
||||
std::string RemoveNumbers(const char *name);
|
||||
void SignalMobsByNPCID(uint32 npc_id, int signal);
|
||||
|
||||
@ -1478,25 +1478,8 @@ void Merc::AI_Process() {
|
||||
return;
|
||||
}
|
||||
else if (!CheckLosFN(GetTarget())) {
|
||||
if (RuleB(Mercs, MercsUsePathing) && zone->pathing) {
|
||||
bool WaypointChanged, NodeReached;
|
||||
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
GetTarget()->GetX(),
|
||||
GetTarget()->GetY(),
|
||||
GetTarget()->GetZ(),
|
||||
GetRunspeed(),
|
||||
WaypointChanged,
|
||||
NodeReached
|
||||
);
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetRunspeed());
|
||||
}
|
||||
else {
|
||||
Mob* follow = entity_list.GetMob(GetFollowID());
|
||||
if (follow)
|
||||
CalculateNewPosition(follow->GetX(), follow->GetY(), follow->GetZ(), GetRunspeed());
|
||||
}
|
||||
auto Goal = GetTarget()->GetPosition();
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetRunspeed());
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1775,17 +1758,7 @@ void Merc::AI_Process() {
|
||||
SetRunAnimSpeed(0);
|
||||
|
||||
if (dist > GetFollowDistance()) {
|
||||
if (RuleB(Mercs, MercsUsePathing) && zone->pathing) {
|
||||
bool WaypointChanged, NodeReached;
|
||||
|
||||
glm::vec3 Goal = UpdatePath(follow->GetX(), follow->GetY(), follow->GetZ(),
|
||||
speed, WaypointChanged, NodeReached);
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed);
|
||||
}
|
||||
else {
|
||||
CalculateNewPosition(follow->GetX(), follow->GetY(), follow->GetZ(), speed);
|
||||
}
|
||||
CalculateNewPosition(follow->GetX(), follow->GetY(), follow->GetZ(), speed);
|
||||
|
||||
if (rest_timer.Enabled())
|
||||
rest_timer.Disable();
|
||||
|
||||
167
zone/mob_ai.cpp
167
zone/mob_ai.cpp
@ -807,22 +807,7 @@ void Client::AI_Process()
|
||||
CalculateNewFearpoint();
|
||||
}
|
||||
|
||||
if (!RuleB(Pathing, Fear) || !zone->pathing)
|
||||
CalculateNewPosition(m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z, speed, true);
|
||||
else {
|
||||
bool waypoint_changed, node_reached;
|
||||
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
m_FearWalkTarget.x,
|
||||
m_FearWalkTarget.y,
|
||||
m_FearWalkTarget.z,
|
||||
speed,
|
||||
waypoint_changed,
|
||||
node_reached
|
||||
);
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed);
|
||||
}
|
||||
CalculateNewPosition(m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z, speed, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -892,16 +877,7 @@ void Client::AI_Process()
|
||||
animation = newspeed;
|
||||
newspeed *= 2;
|
||||
SetCurrentSpeed(newspeed);
|
||||
if(!RuleB(Pathing, Aggro) || !zone->pathing)
|
||||
CalculateNewPosition(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), newspeed);
|
||||
else
|
||||
{
|
||||
bool WaypointChanged, NodeReached;
|
||||
glm::vec3 Goal = UpdatePath(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(),
|
||||
GetRunspeed(), WaypointChanged, NodeReached);
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, newspeed);
|
||||
}
|
||||
CalculateNewPosition(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), newspeed);
|
||||
}
|
||||
}
|
||||
else if(IsMoving())
|
||||
@ -1121,29 +1097,13 @@ void Mob::AI_Process() {
|
||||
// Calculate a new point to run to
|
||||
CalculateNewFearpoint();
|
||||
}
|
||||
if (!RuleB(Pathing, Fear) || !zone->pathing) {
|
||||
CalculateNewPosition(
|
||||
m_FearWalkTarget.x,
|
||||
m_FearWalkTarget.y,
|
||||
m_FearWalkTarget.z,
|
||||
GetFearSpeed(),
|
||||
true
|
||||
);
|
||||
}
|
||||
else {
|
||||
bool WaypointChanged, NodeReached;
|
||||
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
m_FearWalkTarget.x,
|
||||
m_FearWalkTarget.y,
|
||||
m_FearWalkTarget.z,
|
||||
GetFearSpeed(),
|
||||
WaypointChanged,
|
||||
NodeReached
|
||||
);
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetFearSpeed());
|
||||
}
|
||||
CalculateNewPosition(
|
||||
m_FearWalkTarget.x,
|
||||
m_FearWalkTarget.y,
|
||||
m_FearWalkTarget.z,
|
||||
GetFearSpeed(),
|
||||
true
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1462,18 +1422,7 @@ void Mob::AI_Process() {
|
||||
else if (AI_movement_timer->Check() && target) {
|
||||
if (!IsRooted()) {
|
||||
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", target->GetName());
|
||||
if (!RuleB(Pathing, Aggro) || !zone->pathing)
|
||||
CalculateNewPosition(target->GetX(), target->GetY(), target->GetZ(), GetRunspeed());
|
||||
else {
|
||||
bool WaypointChanged, NodeReached;
|
||||
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
target->GetX(), target->GetY(), target->GetZ(),
|
||||
GetRunspeed(), WaypointChanged, NodeReached
|
||||
);
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, GetRunspeed());
|
||||
}
|
||||
CalculateNewPosition(target->GetX(), target->GetY(), target->GetZ(), GetRunspeed());
|
||||
|
||||
}
|
||||
else if (IsMoving()) {
|
||||
@ -1572,14 +1521,7 @@ void Mob::AI_Process() {
|
||||
else {
|
||||
|
||||
bool waypoint_changed, node_reached;
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
owner->GetX(),
|
||||
owner->GetY(),
|
||||
owner->GetZ(),
|
||||
pet_speed,
|
||||
waypoint_changed,
|
||||
node_reached
|
||||
);
|
||||
auto &Goal = owner->GetPosition();
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, pet_speed, true);
|
||||
}
|
||||
@ -1633,14 +1575,7 @@ void Mob::AI_Process() {
|
||||
|
||||
bool waypoint_changed, node_reached;
|
||||
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
follow->GetX(),
|
||||
follow->GetY(),
|
||||
follow->GetZ(),
|
||||
speed,
|
||||
waypoint_changed,
|
||||
node_reached
|
||||
);
|
||||
auto &Goal = follow->GetPosition();
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed, true);
|
||||
}
|
||||
@ -1768,18 +1703,7 @@ void NPC::AI_DoMovement() {
|
||||
roambox_destination_y);
|
||||
}
|
||||
|
||||
bool waypoint_changed, node_reached;
|
||||
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
roambox_destination_x,
|
||||
roambox_destination_y,
|
||||
roambox_destination_z,
|
||||
move_speed,
|
||||
waypoint_changed,
|
||||
node_reached
|
||||
);
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, move_speed, true);
|
||||
CalculateNewPosition(roambox_destination_x, roambox_destination_y, roambox_destination_z, move_speed, true);
|
||||
|
||||
if (m_Position.x == roambox_destination_x && m_Position.y == roambox_destination_y) {
|
||||
time_until_can_move = Timer::GetCurrentTime() + RandomTimer(roambox_min_delay, roambox_delay);
|
||||
@ -1843,31 +1767,13 @@ void NPC::AI_DoMovement() {
|
||||
ClearFeignMemory();
|
||||
}
|
||||
if (doMove) { // not at waypoint yet or at 0 pause WP, so keep moving
|
||||
if (!RuleB(Pathing, AggroReturnToGrid) || !zone->pathing || (DistractedFromGrid == 0))
|
||||
CalculateNewPosition(
|
||||
m_CurrentWayPoint.x,
|
||||
m_CurrentWayPoint.y,
|
||||
m_CurrentWayPoint.z,
|
||||
move_speed,
|
||||
true
|
||||
);
|
||||
else {
|
||||
bool WaypointChanged;
|
||||
bool NodeReached;
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
m_CurrentWayPoint.x,
|
||||
m_CurrentWayPoint.y,
|
||||
m_CurrentWayPoint.z,
|
||||
move_speed,
|
||||
WaypointChanged,
|
||||
NodeReached
|
||||
);
|
||||
|
||||
if (NodeReached)
|
||||
entity_list.OpenDoorsNear(CastToNPC());
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, move_speed, true);
|
||||
}
|
||||
CalculateNewPosition(
|
||||
m_CurrentWayPoint.x,
|
||||
m_CurrentWayPoint.y,
|
||||
m_CurrentWayPoint.z,
|
||||
move_speed,
|
||||
true
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1887,35 +1793,14 @@ void NPC::AI_DoMovement() {
|
||||
}
|
||||
else if (IsGuarding()) {
|
||||
bool CP2Moved;
|
||||
if (!RuleB(Pathing, Guard) || !zone->pathing) {
|
||||
CP2Moved = CalculateNewPosition(m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z, move_speed);
|
||||
|
||||
if (!((m_Position.x == m_GuardPoint.x) && (m_Position.y == m_GuardPoint.y) && (m_Position.z == m_GuardPoint.z))) {
|
||||
CP2Moved = CalculateNewPosition(m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z, move_speed);
|
||||
}
|
||||
else {
|
||||
if (!((m_Position.x == m_GuardPoint.x) && (m_Position.y == m_GuardPoint.y) &&
|
||||
(m_Position.z == m_GuardPoint.z))) {
|
||||
|
||||
bool WaypointChanged, NodeReached;
|
||||
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
m_GuardPoint.x,
|
||||
m_GuardPoint.y,
|
||||
m_GuardPoint.z,
|
||||
move_speed,
|
||||
WaypointChanged,
|
||||
NodeReached
|
||||
);
|
||||
|
||||
if (NodeReached) {
|
||||
entity_list.OpenDoorsNear(CastToNPC());
|
||||
}
|
||||
|
||||
CP2Moved = CalculateNewPosition(Goal.x, Goal.y, Goal.z, move_speed);
|
||||
}
|
||||
else {
|
||||
CP2Moved = false;
|
||||
}
|
||||
|
||||
CP2Moved = false;
|
||||
}
|
||||
|
||||
if (!CP2Moved) {
|
||||
if (moved) {
|
||||
Log(Logs::Detail,
|
||||
@ -1981,7 +1866,7 @@ void NPC::AI_SetupNextWaypoint() {
|
||||
|
||||
SetAppearance(eaStanding, false);
|
||||
|
||||
entity_list.OpenDoorsNear(CastToNPC());
|
||||
entity_list.OpenDoorsNear(this);
|
||||
|
||||
if (!DistractedFromGrid) {
|
||||
//kick off event_waypoint depart
|
||||
|
||||
@ -165,7 +165,7 @@ void MobMovementManager::SendPositionUpdate(Mob *who, bool send_to_self)
|
||||
|
||||
bool MobMovementManager::HeadingEqual(float a, float b)
|
||||
{
|
||||
const float eps = 0.001f;
|
||||
const float eps = 0.0001f;
|
||||
return abs(a - b) < eps;
|
||||
}
|
||||
|
||||
|
||||
@ -1355,7 +1355,7 @@ XS(XS_EntityList_OpenDoorsNear) {
|
||||
Perl_croak(aTHX_ "Usage: EntityList::OpenDoorsNear(THIS, NPC* opener)");
|
||||
{
|
||||
EntityList *THIS;
|
||||
NPC *opener;
|
||||
Mob *opener;
|
||||
|
||||
if (sv_derived_from(ST(0), "EntityList")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
@ -1365,11 +1365,11 @@ XS(XS_EntityList_OpenDoorsNear) {
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (sv_derived_from(ST(1), "NPC")) {
|
||||
if (sv_derived_from(ST(1), "Mob")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(1)));
|
||||
opener = INT2PTR(NPC *, tmp);
|
||||
opener = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "opener is not of type NPC");
|
||||
Perl_croak(aTHX_ "opener is not of type Mob");
|
||||
if (opener == nullptr)
|
||||
Perl_croak(aTHX_ "opener is nullptr, avoiding crash.");
|
||||
|
||||
|
||||
@ -454,6 +454,17 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WaypointChanged = false;
|
||||
bool NodeReached = false;
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
x, y, z, speed, WaypointChanged, NodeReached
|
||||
);
|
||||
|
||||
if (WaypointChanged || NodeReached) {
|
||||
calculate_heading = true;
|
||||
entity_list.OpenDoorsNear(this);
|
||||
}
|
||||
|
||||
SetCurrentSpeed(static_cast<int>(speed));
|
||||
pRunAnimSpeed = speed;
|
||||
|
||||
@ -467,7 +478,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
}
|
||||
|
||||
//Setup Vectors
|
||||
glm::vec3 tar(x, y, z);
|
||||
glm::vec3 tar(Goal.x, Goal.y, Goal.z);
|
||||
glm::vec3 pos(m_Position.x, m_Position.y, m_Position.z);
|
||||
double len = glm::distance(pos, tar);
|
||||
if (len == 0) {
|
||||
@ -476,20 +487,16 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
|
||||
glm::vec3 dir = tar - pos;
|
||||
glm::vec3 ndir = glm::normalize(dir);
|
||||
if (calculate_heading) {
|
||||
m_Position.w = CalculateHeadingToTarget(x, y);
|
||||
}
|
||||
|
||||
double time_since_last = static_cast<double>(frame_time) / 1000.0;
|
||||
double distance_moved = time_since_last * speed * 2.275f;
|
||||
|
||||
if (distance_moved > len) {
|
||||
m_Position.x = x;
|
||||
m_Position.y = y;
|
||||
m_Position.z = z;
|
||||
m_Position.x = Goal.x;
|
||||
m_Position.y = Goal.y;
|
||||
m_Position.z = Goal.z;
|
||||
|
||||
if (IsNPC()) {
|
||||
entity_list.ProcessMove(CastToNPC(), x, y, z);
|
||||
entity_list.ProcessMove(CastToNPC(), Goal.x, Goal.y, Goal.z);
|
||||
}
|
||||
|
||||
if (check_z && fix_z_timer.Check() && (!IsEngaged() || flee_mode || currently_fleeing)) {
|
||||
@ -505,10 +512,14 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
m_Position.z = npos.z;
|
||||
|
||||
if (IsNPC()) {
|
||||
entity_list.ProcessMove(CastToNPC(), x, y, z);
|
||||
entity_list.ProcessMove(CastToNPC(), npos.x, npos.y, npos.z);
|
||||
}
|
||||
}
|
||||
|
||||
if (calculate_heading) {
|
||||
m_Position.w = CalculateHeadingToTarget(Goal.x, Goal.y);
|
||||
}
|
||||
|
||||
if (check_z && fix_z_timer.Check() && !IsEngaged()) {
|
||||
FixZ();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user