fix(chat): cross-region avatar chat delivery to llListen (#192)

This commit is contained in:
OpenGenesis (MPL 2.0) authored and GitHub committed 2026-10-13 20:52:37 +02:00
1 parent c29f3e5a70
commit 6947586fed
13 files changed
+454 -2

No files matched your search

+6
View File
@@ -416,6 +416,12 @@ jobs:
shell: bash
run: python3 tools/ci/verify_object_messaging.py
- name: Verify cross-region llListen and NexBus chat forwarding
shell: bash
run: |
python3 tools/ci/verify_cross_region_chat.py
dotnet run --configuration Release --project tools/ci/CrossRegionChatRegression/CrossRegionChatRegression.csproj
- name: Verify estate-wide LSL messaging
shell: bash
run: python3 tools/ci/verify_estate_say.py
@@ -57,6 +57,12 @@ namespace NexVerse.RegionModules.NodeAgent
private int m_HeartbeatSeconds = 30;
private bool m_ObjectMessagingEnabled;
private bool m_EstateScriptMessagingEnabled = true;
private bool m_CrossRegionChatMessaging;
private int m_ChatWhisperDistance = 10;
private int m_ChatSayDistance = 20;
private int m_ChatShoutDistance = 100;
private readonly ConcurrentDictionary<UUID, ObjectMessageRateState> m_ChatOutboundRates = new();
private readonly ConcurrentDictionary<UUID, ObjectMessageRateState> m_ChatInboundRates = new();
private bool m_AllowCrossOwnerObjectMessages;
private int m_ObjectMessagesPerSecond = 20;
private int m_ObjectMessageMaxAgeSeconds = 30;
@@ -72,6 +78,7 @@ namespace NexVerse.RegionModules.NodeAgent
private IDisposable m_IarControlSubscription;
private IDisposable m_ObjectMessageSubscription;
private IDisposable m_EstateScriptMessageSubscription;
private IDisposable m_CrossRegionChatSubscription;
private volatile bool m_MaintenanceMode;
private volatile bool m_Draining;
private DateTimeOffset m_StartedAt;
@@ -123,6 +130,12 @@ namespace NexVerse.RegionModules.NodeAgent
config.GetBoolean(
"EstateScriptMessaging",
true);
m_CrossRegionChatMessaging = config.GetBoolean(
"CrossRegionChatMessaging", false);
IConfig chatConfig = source.Configs["Chat"];
m_ChatWhisperDistance = chatConfig?.GetInt("whisper_distance", 10) ?? 10;
m_ChatSayDistance = chatConfig?.GetInt("say_distance", 20) ?? 20;
m_ChatShoutDistance = chatConfig?.GetInt("shout_distance", 100) ?? 100;
m_AllowCrossOwnerObjectMessages =
config.GetBoolean(
"AllowCrossOwnerObjectMessages",
@@ -176,6 +189,8 @@ namespace NexVerse.RegionModules.NodeAgent
scene.RegisterModuleInterface<INexVerseEventBusModule>(this);
scene.RegisterModuleInterface<ICrossRegionObjectMessageRouter>(this);
scene.RegisterModuleInterface<IEstateScriptMessageRouter>(this);
if (m_CrossRegionChatMessaging)
scene.EventManager.OnChatFromClient += PublishNeighbourAvatarChat;
}
public void RegionLoaded(Scene scene)
@@ -192,6 +207,8 @@ namespace NexVerse.RegionModules.NodeAgent
return;
PublishRegionEvent("region.offline", scene);
if (m_CrossRegionChatMessaging)
scene.EventManager.OnChatFromClient -= PublishNeighbourAvatarChat;
scene.UnregisterModuleInterface<IEstateScriptMessageRouter>(this);
scene.UnregisterModuleInterface<ICrossRegionObjectMessageRouter>(this);
scene.UnregisterModuleInterface<INexVerseEventBusModule>(this);
@@ -238,6 +255,10 @@ namespace NexVerse.RegionModules.NodeAgent
HandleObjectMessage);
}
if (m_CrossRegionChatMessaging)
m_CrossRegionChatSubscription = m_Bus.Subscribe(
"chat.neighbor.requested", HandleNeighbourAvatarChat);
if (m_EstateScriptMessagingEnabled)
{
m_EstateScriptMessageSubscription =
@@ -290,6 +311,12 @@ namespace NexVerse.RegionModules.NodeAgent
m_ObjectMessageSubscription = null;
m_EstateScriptMessageSubscription?.Dispose();
m_EstateScriptMessageSubscription = null;
m_CrossRegionChatSubscription?.Dispose();
m_CrossRegionChatSubscription = null;
foreach (Scene scene in m_Scenes.Values)
scene.EventManager.OnChatFromClient -= PublishNeighbourAvatarChat;
m_ChatOutboundRates.Clear();
m_ChatInboundRates.Clear();
m_ObjectMessageOutboundRates.Clear();
m_ObjectMessageInboundRates.Clear();
m_HeartbeatTimer?.Dispose();
@@ -317,6 +344,121 @@ namespace NexVerse.RegionModules.NodeAgent
m_Bus.Publish(nexEvent);
}
// Signed NexBus messages carry the original viewer's world position.
// Do not use ordinary viewer chat broadcasts here: these would be
// shown twice by child-agent viewers and do not reach llListen.
private void PublishNeighbourAvatarChat(object sender, OSChatMessage chat)
{
if (!m_Enabled || !m_CrossRegionChatMessaging || m_Bus == null ||
chat?.Sender == null || string.IsNullOrEmpty(chat.Message) ||
chat.Channel == DebugChannel)
return;
float range = CrossRegionChatGeometry.ChatRange(
chat.Type, m_ChatWhisperDistance, m_ChatSayDistance, m_ChatShoutDistance);
if (range <= 0 || chat.Scene is not Scene source ||
!m_Scenes.ContainsKey(source.RegionInfo.RegionID))
return;
ScenePresence avatar = source.GetScenePresence(chat.Sender.AgentId);
if (avatar == null || avatar.IsChildAgent || avatar.IsDeleted)
return;
Vector3 position = avatar.AbsolutePosition;
if (!float.IsFinite(position.X) || !float.IsFinite(position.Y) ||
!float.IsFinite(position.Z))
return;
// Skip network broadcast when no other region can be within range.
if (position.X >= range && position.Y >= range &&
position.X <= source.RegionInfo.RegionSizeX - range &&
position.Y <= source.RegionInfo.RegionSizeY - range)
return;
if (!TryTakeObjectMessageRateSlot(m_ChatOutboundRates, avatar.UUID))
return;
string message = chat.Message.Length > 1023 ? chat.Message[..1023] : chat.Message;
Dictionary<string, string> data = new()
{
["source_node_id"] = m_NodeId,
["source_region_id"] = source.RegionInfo.RegionID.ToString(),
["source_avatar_id"] = avatar.UUID.ToString(),
["source_name"] = avatar.Name,
["world_x"] = (source.RegionInfo.WorldLocX + position.X).ToString(
"R", System.Globalization.CultureInfo.InvariantCulture),
["world_y"] = (source.RegionInfo.WorldLocY + position.Y).ToString(
"R", System.Globalization.CultureInfo.InvariantCulture),
["world_z"] = position.Z.ToString(
"R", System.Globalization.CultureInfo.InvariantCulture),
["channel"] = chat.Channel.ToString(
System.Globalization.CultureInfo.InvariantCulture),
["chat_type"] = ((int)chat.Type).ToString(
System.Globalization.CultureInfo.InvariantCulture),
["message"] = message
};
Publish(new NexEvent("chat.neighbor.requested", "nexverse.simulator", data));
}
private static bool TryChatFloat(NexEvent ev, string key, out float value)
{
value = 0;
return TryCommandData(ev, key, out string raw) &&
float.TryParse(raw, System.Globalization.NumberStyles.Float,
System.Globalization.CultureInfo.InvariantCulture, out value) &&
float.IsFinite(value);
}
private void HandleNeighbourAvatarChat(NexEvent ev)
{
if (!m_Enabled || !m_CrossRegionChatMessaging ||
ev == null || Math.Abs((DateTimeOffset.UtcNow - ev.Timestamp).TotalSeconds) > 5 ||
!string.Equals(ev.Source, "nexverse.simulator", StringComparison.Ordinal) ||
!TryCommandData(ev, "source_node_id", out string sourceNode) ||
// A second simulator on the same machine may share the
// default NodeId; source-region ownership prevents loops.
!TryCommandData(ev, "source_region_id", out string rawRegion) ||
!UUID.TryParse(rawRegion, out UUID sourceRegion) ||
sourceRegion.IsZero() || m_Scenes.ContainsKey(sourceRegion) ||
!TryCommandData(ev, "source_avatar_id", out string rawAvatar) ||
!UUID.TryParse(rawAvatar, out UUID sourceAvatar) ||
sourceAvatar.IsZero() ||
!TryCommandData(ev, "source_name", out string sourceName) ||
(ev.Data == null || !ev.Data.TryGetValue("message", out string message) ||
message == null || message.Length == 0 || message.Length > 1023) ||
!TryCommandInt(ev, "chat_type", out int rawType) ||
!TryCommandInt(ev, "channel", out int channel) ||
channel == DebugChannel ||
!TryChatFloat(ev, "world_x", out float worldX) ||
!TryChatFloat(ev, "world_y", out float worldY) ||
!TryChatFloat(ev, "world_z", out float worldZ))
return;
ChatTypeEnum type = (ChatTypeEnum)rawType;
float range = CrossRegionChatGeometry.ChatRange(
type, m_ChatWhisperDistance, m_ChatSayDistance, m_ChatShoutDistance);
if (range <= 0 || !TryTakeObjectMessageRateSlot(m_ChatInboundRates, sourceAvatar))
return;
foreach (Scene target in m_Scenes.Values)
{
if (!CrossRegionChatGeometry.CanReachRegion(
worldX, worldY, target.RegionInfo.WorldLocX, target.RegionInfo.WorldLocY,
target.RegionInfo.RegionSizeX, target.RegionInfo.RegionSizeY, range))
continue;
IWorldComm worldComm = target.RequestModuleInterface<IWorldComm>();
if (worldComm == null || worldComm.ListenerCount == 0)
continue;
Vector3 localPos = new(
worldX - target.RegionInfo.WorldLocX,
worldY - target.RegionInfo.WorldLocY, worldZ);
worldComm.DeliverMessage(type, channel, sourceName, sourceAvatar,
message, localPos);
}
}
public bool TryRoute(
UUID sourceRegionId,
UUID sourceObjectId,
@@ -167,6 +167,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
// redistribute to interested subscribers
Scene scene = (Scene)c.Scene;
scene.EventManager.TriggerOnChatFromClient(sender, c);
// Object llListen events are scoped to their own scene. Send the
// original avatar chat to neighbouring scenes hosted by this
// simulator, without rebroadcasting it to viewer clients.
ForwardToLocalNeighbourListeners(scene, c);
// early return if not on public or debug channel
if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return;
@@ -189,6 +193,50 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
}
}
protected virtual void ForwardToLocalNeighbourListeners(Scene source, OSChatMessage c)
{
if (source == null || c?.Sender == null || string.IsNullOrEmpty(c.Message))
return;
float range = CrossRegionChatGeometry.ChatRange(
c.Type, m_whisperdistance, m_saydistance, m_shoutdistance);
if (range <= 0)
return;
ScenePresence speaker = source.GetScenePresence(c.Sender.AgentId);
if (speaker == null || speaker.IsChildAgent || speaker.IsDeleted)
return;
Vector3 sourcePosition = speaker.AbsolutePosition;
float worldX = source.RegionInfo.WorldLocX + sourcePosition.X;
float worldY = source.RegionInfo.WorldLocY + sourcePosition.Y;
Scene[] destinations;
lock (m_syncy)
destinations = m_scenes.ToArray();
foreach (Scene destination in destinations)
{
if (destination == source ||
!CrossRegionChatGeometry.CanReachRegion(
worldX, worldY, destination.RegionInfo.WorldLocX,
destination.RegionInfo.WorldLocY, destination.RegionInfo.RegionSizeX,
destination.RegionInfo.RegionSizeY, range))
continue;
IWorldComm listener = destination.RequestModuleInterface<IWorldComm>();
if (listener == null || listener.ListenerCount == 0)
continue;
Vector3 localPosition = new Vector3(
worldX - destination.RegionInfo.WorldLocX,
worldY - destination.RegionInfo.WorldLocY,
sourcePosition.Z);
listener.DeliverMessage(c.Type, c.Channel, speaker.Name,
c.Sender.AgentId, c.Message, localPosition);
}
}
public virtual void OnChatFromWorld(Object sender, OSChatMessage c)
{
// early return if not on public or debug channel
@@ -160,7 +160,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
return;
m_scene.UnregisterModuleInterface<IWorldComm>(this);
m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage;
m_scene.EventManager.OnChatFromClient -= DeliverClientMessage;
m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage;
}
@@ -700,7 +700,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.HostID);
if (sPart == null)
return;
continue;
if (maxDistanceSQ > Vector3.DistanceSquared(sPart.AbsolutePosition, position))
{
@@ -120,6 +120,7 @@
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Scenes\CrossRegionChatGeometry.cs" />
<Compile Include="Scenes\EventManager.cs">
<SubType>Code</SubType>
</Compile>
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: BSD-3-Clause
using System;
using OpenSim.Framework;
namespace OpenSim.Region.Framework.Scenes
{
/// <summary>
/// Computes chat coverage in world metres, independent of region origins
/// and region dimensions (including variable-sized regions).
/// </summary>
public static class CrossRegionChatGeometry
{
public static bool CanReachRegion(float worldX, float worldY,
float originX, float originY, float sizeX, float sizeY, float range)
{
if (!float.IsFinite(worldX) || !float.IsFinite(worldY) ||
!float.IsFinite(originX) || !float.IsFinite(originY) ||
sizeX <= 0 || sizeY <= 0 || range <= 0)
return false;
float dx = worldX < originX ? originX - worldX :
worldX > originX + sizeX ? worldX - (originX + sizeX) : 0f;
float dy = worldY < originY ? originY - worldY :
worldY > originY + sizeY ? worldY - (originY + sizeY) : 0f;
return dx * dx + dy * dy < range * range;
}
public static float ChatRange(ChatTypeEnum type, float whisper, float say, float shout)
{
switch (type)
{
case ChatTypeEnum.Whisper: return whisper;
case ChatTypeEnum.Say: return say;
case ChatTypeEnum.Shout: return shout;
default: return 0;
}
}
}
}
+1
View File
@@ -13,6 +13,7 @@
RequestTimeoutMilliseconds = 2000
DeduplicationWindow = 10000
CrossRegionObjectMessaging = true
CrossRegionChatMessaging = true
AllowCrossOwnerObjectMessages = true
EstateScriptMessaging = true
ObjectMessagesPerSecond = 20
+1
View File
@@ -13,6 +13,7 @@
RequestTimeoutMilliseconds = 2000
DeduplicationWindow = 10000
CrossRegionObjectMessaging = true
CrossRegionChatMessaging = true
AllowCrossOwnerObjectMessages = true
EstateScriptMessaging = true
ObjectMessagesPerSecond = 20
+1
View File
@@ -19,6 +19,7 @@
; object is not present in the local region. Requires NexBus transport.
; Same-owner delivery is the safe default.
CrossRegionObjectMessaging = false
CrossRegionChatMessaging = false
AllowCrossOwnerObjectMessages = false
; OpenGenesisLINK llEstateSay remote extension. Same-simulator Estate
@@ -0,0 +1,80 @@
# OpenGenesisLINK 0.9.3.12: Chat über Regionsgrenzen für llListen
## Problem
In OpenSimulator ist `WorldCommModule` ein nicht geteiltes Regionsmodul.
Ein Avatar in Region B erzeugt `OnChatFromClient` ausschließlich in B;
Objekte mit `llListen()` in der benachbarten Region A empfangen die
Nachricht deshalb nicht, auch wenn sie nur fünf Meter entfernt sind.
Die Viewer-Chat-Zustellung zu Child-Agents betrifft **nicht** die
LSL-`listen`-Event-Pipeline.
## Fix
1. `ChatModule` (shared module) liefert normalen Avatar-Chat an
`IWorldComm` anderer lokal gehosteter Regionen. Die Weltposition
wird in Zielregionskoordinaten übersetzt und der normale
`WorldCommModule.DeliverMessage`-Filter prüft vollständige
3D-Entfernung, Kanal, Avatar-ID, Name und Nachricht.
2. Für Regionen auf anderen Simulatorprozessen veröffentlicht der
aktivierte `NexVerseNodeAgentModule` nur Chat in Grenznähe
als signiertes `chat.neighbor.requested`-NexBus-Ereignis.
Der empfangende NodeAgent übergibt diese Nachricht direkt an das
lokale `IWorldComm` — nicht an den Viewer-Chat.
3. Die Event-Quelle muss ein echter Root-Avatar sein; Child-Agents
lösen keine weitere Weiterleitung aus. Lokale Source-Regionen
werden bei empfangenen NexBus-Events ausgeschlossen, sodass keine
doppelte Script-Zustellung durch dieselbe Simulatorinstanz erfolgt.
Der bestehende Event-ID-Deduplikator des NexBus bleibt aktiv.
4. Falsche `WorldCommModule.RemoveRegion`-Event-Abmeldung korrigiert.
Verwaiste Listener in gelöschten Prims blockieren nachfolgende
aktive Listener nicht mehr.
## Reichweiten
| Chat | Standardreichweite |
| --- | ---: |
| Whisper | 10 m |
| Say | 20 m |
| Shout | 100 m |
Die Werte werden aus der `[Chat]`-Konfiguration gelesen; der
Abstandsfilter arbeitet mit Weltkoordinaten und unterstützt auch
Variable-sized Regions (VarRegions). Private LSL-Chatkanäle werden
ebenfalls beachtet. Regionweite oder direkte Nachrichten werden **nicht**
als normale Nachbar-Chat-Nachricht weitergeleitet.
## Einrichtung und Sicherheit
Der lokale Regions-zu-Regions-Chat benötigt keine neue Option.
Für mehrere Prozesse müssen beide Simulatoren am **gleichen
authentifizierten NexBus-Verbund** teilnehmen.
```ini
[NexVerseNodeAgent]
Enabled = true
CrossRegionChatMessaging = true
```
`PeerUrl`, `SharedKey` und `NodeId` sind ebenfalls wie bei NexBus
erforderlich. In den OGL-`OpenSim.ini`-Vorlagen ist die Option
aktiviert; `OpenSimDefaults.ini` bleibt standardmäßig deaktiviert,
damit unbekannte Standard-Installationen kein zusätzliches
Netzwerk-Chat-Verhalten erhalten.
Remote-Nachrichten werden auf 1023 Zeichen begrenzt, anhand des
Avatar-Schlüssels mit den bestehenden NodeAgent-Ratenlimits gedrosselt,
auf gültige Kanal-/Typ-/Positionswerte geprüft und nur angenommen, wenn
ihr signiertes Event höchstens fünf Sekunden alt ist.
Nur vertrauenswürdige NexBus-Knoten dürfen solche Nachrichten
erzeugen; bei fehlendem NexBus funktioniert der lokale Fall weiterhin.
## Validierung
- `dotnet run --project tools/ci/CrossRegionChatRegression` prüft
Geometrie, Ecken, Entfernung, VarRegions und Kanaltypen.
- `python3 tools/ci/verify_cross_region_chat.py` prüft
Event-Verkabelung, Positionsumrechnung und Konfiguration.
- Vor einer Stable-Freigabe ist ein Live-Test mit zwei Simulatoren,
zwei Würfeln mit `llListen`, Grenzabstand 5 m und Out-of-Range-Test
bei >20 m nötig.
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="../../../OpenSim/Region/Framework/Scenes/CrossRegionChatGeometry.cs" Link="CrossRegionChatGeometry.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="OpenSim.Framework"><HintPath>../../../bin/OpenSim.Framework.dll</HintPath></Reference>
<Reference Include="OpenMetaverse">
<HintPath>../../../bin/OpenMetaverse.dll</HintPath>
</Reference>
<Reference Include="OpenMetaverseTypes">
<HintPath>../../../bin/OpenMetaverseTypes.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
@@ -0,0 +1,62 @@
// OpenGenesisLINK Cross-Region Chat geometry regression tests
using System;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
static class CrossRegionChatRegression
{
static int checks;
static void Check(bool condition, string reason)
{
checks++;
if (!condition) throw new InvalidOperationException(reason);
}
static void Main()
{
const float west = 1000 * 256;
const float east = 1001 * 256;
const float y = 1010 * 256;
float x3 = east + 3f;
// Avatar 3m east of the border, target region on its west.
Check(CrossRegionChatGeometry.CanReachRegion(x3, y + 128, west, y, 256, 256, 20),
"say from neighbouring region");
Check(CrossRegionChatGeometry.CanReachRegion(x3, y + 128, west, y, 256, 256, 10),
"whisper from neighbouring region");
Check(!CrossRegionChatGeometry.CanReachRegion(east + 30, y + 128,
west, y, 256, 256, 20), "say range must be enforced");
Check(!CrossRegionChatGeometry.CanReachRegion(east + 20, y + 128,
west, y, 256, 256, 20), "exact boundary distance is exclusive");
Check(CrossRegionChatGeometry.CanReachRegion(east + 30, y + 128,
west, y, 256, 256, 100), "shout reaches farther");
Check(!CrossRegionChatGeometry.CanReachRegion(east + 3, y + 282,
west, y, 256, 256, 20), "diagonal distance must be checked");
Check(CrossRegionChatGeometry.CanReachRegion(east + 3, y + 258,
west, y, 256, 256, 20), "diagonal near-corner distance");
Check(CrossRegionChatGeometry.CanReachRegion(west + 512 + 4, y + 50,
west, y, 512, 256, 20), "variable-sized region");
Check(!CrossRegionChatGeometry.CanReachRegion(west + 512 + 21, y + 50,
west, y, 512, 256, 20), "variable-sized out of range");
Check(!CrossRegionChatGeometry.CanReachRegion(float.NaN, y,
west, y, 256, 256, 20), "nonfinite position rejected");
Check(!CrossRegionChatGeometry.CanReachRegion(x3, y,
west, y, 0, 256, 20), "invalid target size rejected");
Check(CrossRegionChatGeometry.ChatRange(ChatTypeEnum.Whisper, 10, 20, 100) == 10,
"whisper range");
Check(CrossRegionChatGeometry.ChatRange(ChatTypeEnum.Say, 10, 20, 100) == 20,
"say range");
Check(CrossRegionChatGeometry.ChatRange(ChatTypeEnum.Shout, 10, 20, 100) == 100,
"shout range");
Check(CrossRegionChatGeometry.ChatRange(ChatTypeEnum.Region, 10, 20, 100) == 0,
"region broadcast must not propagate");
// Position transformation used by both in-process and NexBus delivery:
// B x=3 -> A x=259; a cube at A x=254 is only 5m away.
float targetLocal = x3 - west;
Check(Math.Abs(targetLocal - 254) < 20, "translated neighbour listener is in range");
Console.WriteLine($"OGL cross-region llListen geometry: PASS ({checks} checks)");
}
}
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/env python3
"""OpenGenesisLINK cross-region llListen propagation contract."""
from pathlib import Path
root=Path(__file__).resolve().parents[2]
def read(p): return (root/p).read_text(encoding="utf-8")
chat=read("OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs")
world=read("OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs")
node=read("NexVerse/RegionModules/NodeAgent/NexVerseNodeAgentModule.cs")
geometry=read("OpenSim/Region/Framework/Scenes/CrossRegionChatGeometry.cs")
project=read("OpenSim/Region/Framework/OpenSim.Region.Framework.csproj")
for marker in (
"ForwardToLocalNeighbourListeners(scene, c)",
"speaker.IsChildAgent",
"CrossRegionChatGeometry.CanReachRegion(",
"RequestModuleInterface<IWorldComm>()",
"listener.DeliverMessage(c.Type, c.Channel, speaker.Name,",
"worldX - destination.RegionInfo.WorldLocX",
):
assert marker in chat, "local relay missing: " + marker
assert "scene.EventManager.TriggerOnChatFromClient(sender, c)" in chat
assert "OnChatFromClient -= DeliverClientMessage" in world
assert "if (sPart == null)\n continue;" in world
for marker in (
"PublishNeighbourAvatarChat",
"HandleNeighbourAvatarChat",
"CrossRegionChatMessaging",
'"chat.neighbor.requested"',
"IsChildAgent",
"source.RegionInfo.WorldLocX + position.X",
"target.RegionInfo.WorldLocX",
"m_Scenes.ContainsKey(sourceRegion)",
"m_ChatInboundRates",
"m_ChatOutboundRates",
"TotalSeconds) > 5",
"TryChatFloat(",
"float.IsFinite(value)",
"worldComm.DeliverMessage(type, channel, sourceName, sourceAvatar,",
):
assert marker in node, "NexBus relay missing: " + marker
for marker in ("ChatTypeEnum.Whisper", "ChatTypeEnum.Say", "ChatTypeEnum.Shout",
"dx * dx + dy * dy < range * range", "float.IsFinite"):
assert marker in geometry, "geometry missing: " + marker
assert "Scenes\\CrossRegionChatGeometry.cs" in project
for config,value in [
("bin/OpenSim.ini","true"), ("bin/OpenSim.ini.example","true"),
("bin/OpenSimDefaults.ini","false")
]:
assert "CrossRegionChatMessaging = " + value in read(config), config
print("OGL cross-region chat wiring and fail-closed NexBus configuration: OK")