Prefer stationary social pairs and deliver roster before individual snapshots

This commit is contained in:
Codex
2026-09-22 17:13:19 -04:00
parent b0a661f425
commit 5bee808492
2 changed files with 6 additions and 4 deletions
+5 -3
View File
@@ -196,7 +196,6 @@ function AzerothAIEmitSnapshots()
local guids={}
for _,player in pairs(players) do
if is_playerbot(player) then
emit("player.snapshot",player_payload(player))
guids[#guids+1]=player:GetGUIDLow()
emitted=emitted+1
end
@@ -207,9 +206,9 @@ function AzerothAIEmitSnapshots()
for _,p in pairs(players) do if is_playerbot(p) then ordered[#ordered+1]=p end end
table.sort(ordered,function(a,b) return (socialLast[a:GetGUIDLow()] or 0)<(socialLast[b:GetGUIDLow()] or 0) end)
for _,p in ipairs(ordered) do
if not p:IsDead() and not p:IsInCombat() and os.time()-(socialLast[p:GetGUIDLow()] or 0)>600 then
if not p:IsDead() and not p:IsInCombat() and not p:IsMoving() and os.time()-(socialLast[p:GetGUIDLow()] or 0)>600 then
for _,q in pairs(p:GetPlayersInRange(25) or {}) do
if q:GetGUIDLow()~=p:GetGUIDLow() and is_playerbot(q) and not q:IsDead() and not q:IsInCombat() and p:GetTeam()==q:GetTeam() and p:GetPhaseMask()==q:GetPhaseMask() and os.time()-(socialLast[q:GetGUIDLow()] or 0)>600 then
if q:GetGUIDLow()~=p:GetGUIDLow() and is_playerbot(q) and not q:IsDead() and not q:IsInCombat() and not q:IsMoving() and p:GetDistance(q)<=15 and p:GetTeam()==q:GetTeam() and p:GetPhaseMask()==q:GetPhaseMask() and os.time()-(socialLast[q:GetGUIDLow()] or 0)>600 then
roster.socialA=p:GetName();roster.socialB=q:GetName();roster.zoneName=area_name(p:GetZoneId())
socialLast[p:GetGUIDLow()]=os.time();socialLast[q:GetGUIDLow()]=os.time()
break
@@ -219,6 +218,9 @@ function AzerothAIEmitSnapshots()
if roster.socialA then break end
end
emit("player.snapshot",roster)
for _,player in pairs(players) do
if is_playerbot(player) then emit("player.snapshot",player_payload(player)) end
end
return emitted
end