Publish validated group flight landings and extend moving trail handoffs
This commit is contained in:
1 parent
3056063f12
commit
ae0b7513d9
9 files changed
+301
-9
No files matched your search
@@ -499,17 +499,22 @@ bool ClientlessFlightMgr::Begin(Player * player, Position const & target, std::s
|
||||
record.Status.State = ClientlessFlightState::Mounting;
|
||||
record.Status.MountSpell = existingMount ? existingMount : spell;
|
||||
record.Status.Detail = "waiting for native flying mount";
|
||||
record.Published->Landing=PointOf(record.Status.Landing);
|
||||
record.Published->LandingReady=true;
|
||||
if(!following)if(auto group=player->GetGroup())if(group->GetLeaderGUID()!=player->GetGUID())
|
||||
{
|
||||
auto source=_records.find(group->GetLeaderGUID().GetCounter());
|
||||
if(source!=_records.end() && source->second.Status.MapId==player->GetMapId() &&
|
||||
source->second.Status.Target.GetExactDist(target)<1 && !source->second.Published->Aborted)
|
||||
{
|
||||
record.Following=source->second.Published;record.Status.Landing=source->second.Status.Landing;
|
||||
// The leader may still be walking to takeoff and have no landing
|
||||
// yet. Its published trail survives that preparation. Bind the
|
||||
// verified landing lazily rather than copying an unset Position.
|
||||
record.Following=source->second.Published;
|
||||
std::vector<ObjectGuid> members;for(auto const& member:group->GetMemberSlots())if(member.guid!=group->GetLeaderGUID())members.push_back(member.guid);
|
||||
std::sort(members.begin(),members.end());auto slot=std::find(members.begin(),members.end(),player->GetGUID())-members.begin();
|
||||
record.FormationDelay=3500+uint32(slot)*600; // native shared corridor, staggered single-file departure
|
||||
TC_LOG_INFO("server.adventurebot.navigation","FLIGHT_SHARED_TRAIL guid=%u leader=%u",player->GetGUID().GetCounter(),group->GetLeaderGUID().GetCounter());
|
||||
TC_LOG_INFO("server.adventurebot.navigation","FLIGHT_SHARED_TRAIL guid=%u leader=%u landingReady=%u",player->GetGUID().GetCounter(),group->GetLeaderGUID().GetCounter(),record.Following->LandingReady?1u:0u);
|
||||
}
|
||||
}
|
||||
if(airborne)
|
||||
@@ -625,6 +630,17 @@ void ClientlessFlightMgr::Fail(Player * player, Record & record, std::string con
|
||||
|
||||
bool ClientlessFlightMgr::Advance(Player * player, Record & record, bool handoff)
|
||||
{
|
||||
if(record.Following && !record.Returning)
|
||||
{
|
||||
Point landing;
|
||||
if(!record.Following->Aborted && !record.Following->BindLanding(landing))
|
||||
{record.Status.Detail="waiting for leader validated landing";return true;}
|
||||
if(record.Following->BindLanding(landing))
|
||||
{
|
||||
record.Status.Landing.Relocate(landing.X,landing.Y,landing.Z);
|
||||
record.Published->Landing=landing;record.Published->LandingReady=true;
|
||||
}
|
||||
}
|
||||
Point current = PointOf(* player), goal = PointOf(record.Returning ? record.Start : record.Status.Landing);
|
||||
auto sample =[&](float x, float y)
|
||||
{
|
||||
@@ -665,9 +681,13 @@ bool ClientlessFlightMgr::Advance(Player * player, Record & record, bool handoff
|
||||
}
|
||||
else if(record.Following)
|
||||
{
|
||||
auto shared=FollowTrail(current,goal,record.Settings,*record.Following,record.SharedIndex,sample,ray);
|
||||
auto shared=FollowTrail(current,goal,record.Settings,*record.Following,record.SharedIndex,sample,ray,
|
||||
handoff?player->GetSpeed(MOVE_FLIGHT)*1.5f:0.f);
|
||||
if(shared.Waiting)return true;
|
||||
next=shared.Step;
|
||||
if(!next.Valid)
|
||||
TC_LOG_WARN("server.adventurebot.navigation","FLIGHT_SHARED_REJECT guid=%u index=%u size=%u aborted=%u landing=(%.3f %.3f %.3f)",
|
||||
player->GetGUID().GetCounter(),uint32(record.SharedIndex),uint32(record.Following->Points.size()),record.Following->Aborted?1u:0u,goal.X,goal.Y,goal.Z);
|
||||
if(handoff && next.Valid && Distance(next.Next,PointOf(record.Segment))<1)return true;
|
||||
}
|
||||
else
|
||||
@@ -832,7 +852,7 @@ void ClientlessFlightMgr::Update(uint32 diff)
|
||||
record.Moving = false;
|
||||
Advance(player, record);
|
||||
}
|
||||
else if (!record.Returning && player->movespline->timeRemaining() <= 600 &&
|
||||
else if (!record.Returning && player->movespline->timeRemaining() <= 1500 &&
|
||||
Distance(PointOf(record.Segment), PointOf(record.Status.Landing)) > 0.1f)
|
||||
{
|
||||
// Replace a still-running spline from its native current position.
|
||||
|
||||
Reference in new issue
Block a user