Enable bounded proximity conversations and confirmed social memories
This commit is contained in:
@@ -188,6 +188,7 @@ CreateLuaEvent(function() poll() end, POLL_MS, 0)
|
||||
-- Keep AzerothAI grounded in real online Playerbots even when no human is logged in.
|
||||
-- Expose a safe global refresh hook too, so the autonomy worker can explicitly
|
||||
-- request a fresh authoritative snapshot if the periodic timer ever stalls.
|
||||
local socialLast={}
|
||||
function AzerothAIEmitSnapshots()
|
||||
local ok,players=pcall(function() return GetPlayersInWorld() end)
|
||||
if not ok or type(players)~="table" then return 0 end
|
||||
@@ -201,7 +202,23 @@ function AzerothAIEmitSnapshots()
|
||||
end
|
||||
end
|
||||
-- Use snapshot transport so roster reconciliation shares fresh-event priority.
|
||||
emit("player.snapshot",{roster=true,observedAt=os.time(),characterGuids=guids})
|
||||
local roster={roster=true,observedAt=os.time(),characterGuids=guids}
|
||||
local ordered={}
|
||||
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
|
||||
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
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
if roster.socialA then break end
|
||||
end
|
||||
emit("player.snapshot",roster)
|
||||
return emitted
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user