mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
Added los movement logic to combat and follow code (los is rule-based and can by disabled by applying the optional 2017_03_14_mercs_use_pathing_rule.sql)
This commit is contained in:
parent
750e65f847
commit
2d24237aac
@ -163,6 +163,7 @@ RULE_INT(Mercs, AggroRadius, 100) // Determines the distance from which a merc
|
|||||||
RULE_INT(Mercs, AggroRadiusPuller, 25) // Determines the distance from which a merc will aggro group member's target, if they have the group role of puller (also used to determine the distance at which a healer merc will begin healing a group member, if they have the group role of puller)
|
RULE_INT(Mercs, AggroRadiusPuller, 25) // Determines the distance from which a merc will aggro group member's target, if they have the group role of puller (also used to determine the distance at which a healer merc will begin healing a group member, if they have the group role of puller)
|
||||||
RULE_INT(Mercs, ResurrectRadius, 50) // Determines the distance from which a healer merc will attempt to resurrect a group member's corpse
|
RULE_INT(Mercs, ResurrectRadius, 50) // Determines the distance from which a healer merc will attempt to resurrect a group member's corpse
|
||||||
RULE_INT(Mercs, ScaleRate, 100)
|
RULE_INT(Mercs, ScaleRate, 100)
|
||||||
|
RULE_BOOL(Mercs, MercsUsePathing, true) // Mercs will use node pathing when moving
|
||||||
RULE_BOOL(Mercs, AllowMercSuspendInCombat, true)
|
RULE_BOOL(Mercs, AllowMercSuspendInCombat, true)
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Mercs:MercsUsePathing', 'false', 'Mercs will use node pathing when moving');
|
||||||
@ -1462,7 +1462,7 @@ void Merc::AI_Process() {
|
|||||||
// Let's check if we have a los with our target.
|
// Let's check if we have a los with our target.
|
||||||
// If we don't, our hate_list is wiped.
|
// If we don't, our hate_list is wiped.
|
||||||
// Else, it was causing the merc to aggro behind wall etc... causing massive trains.
|
// Else, it was causing the merc to aggro behind wall etc... causing massive trains.
|
||||||
if(!CheckLosFN(GetTarget()) || GetTarget()->IsMezzed() || !IsAttackAllowed(GetTarget())) {
|
if(GetTarget()->IsMezzed() || !IsAttackAllowed(GetTarget())) {
|
||||||
WipeHateList();
|
WipeHateList();
|
||||||
|
|
||||||
if(IsMoving()) {
|
if(IsMoving()) {
|
||||||
@ -1477,6 +1477,26 @@ void Merc::AI_Process() {
|
|||||||
|
|
||||||
return;
|
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);
|
||||||
|
|
||||||
|
if (WaypointChanged)
|
||||||
|
tar_ndx = 20;
|
||||||
|
|
||||||
|
CalculateNewPosition2(Goal.x, Goal.y, Goal.z, GetRunspeed());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Mob* follow = entity_list.GetMob(GetFollowID());
|
||||||
|
if (follow)
|
||||||
|
CalculateNewPosition2(follow->GetX(), follow->GetY(), follow->GetZ(), GetRunspeed());
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(m_PlayerState & static_cast<uint32>(PlayerState::Aggressive)))
|
if (!(m_PlayerState & static_cast<uint32>(PlayerState::Aggressive)))
|
||||||
SendAddPlayerState(PlayerState::Aggressive);
|
SendAddPlayerState(PlayerState::Aggressive);
|
||||||
@ -1738,34 +1758,42 @@ void Merc::AI_Process() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(AI_movement_timer->Check())
|
if(AI_movement_timer->Check()) {
|
||||||
{
|
if(GetFollowID()) {
|
||||||
if(GetFollowID())
|
|
||||||
{
|
|
||||||
Mob* follow = entity_list.GetMob(GetFollowID());
|
Mob* follow = entity_list.GetMob(GetFollowID());
|
||||||
|
|
||||||
if(follow)
|
if (follow) {
|
||||||
{
|
|
||||||
float dist = DistanceSquared(m_Position, follow->GetPosition());
|
float dist = DistanceSquared(m_Position, follow->GetPosition());
|
||||||
int speed = GetRunspeed();
|
int speed = GetRunspeed();
|
||||||
|
|
||||||
if(dist < GetFollowDistance() + 1000)
|
if (dist < GetFollowDistance() + 1000)
|
||||||
speed = GetWalkspeed();
|
speed = GetWalkspeed();
|
||||||
|
|
||||||
SetRunAnimSpeed(0);
|
SetRunAnimSpeed(0);
|
||||||
|
|
||||||
if(dist > GetFollowDistance()) {
|
if (dist > GetFollowDistance()) {
|
||||||
CalculateNewPosition2(follow->GetX(), follow->GetY(), follow->GetZ(), speed);
|
if (RuleB(Mercs, MercsUsePathing) && zone->pathing) {
|
||||||
if(rest_timer.Enabled())
|
bool WaypointChanged, NodeReached;
|
||||||
rest_timer.Disable();
|
|
||||||
return;
|
glm::vec3 Goal = UpdatePath(follow->GetX(), follow->GetY(), follow->GetZ(),
|
||||||
|
speed, WaypointChanged, NodeReached);
|
||||||
|
|
||||||
|
if (WaypointChanged)
|
||||||
|
tar_ndx = 20;
|
||||||
|
|
||||||
|
CalculateNewPosition2(Goal.x, Goal.y, Goal.z, speed);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
CalculateNewPosition2(follow->GetX(), follow->GetY(), follow->GetZ(), speed);
|
||||||
if(moved)
|
}
|
||||||
{
|
|
||||||
SetCurrentSpeed(0);
|
if (rest_timer.Enabled())
|
||||||
|
rest_timer.Disable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (moved) {
|
||||||
moved = false;
|
moved = false;
|
||||||
|
SetCurrentSpeed(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user