From eafd91ba809c839e99c27055f38fe038e317f08d Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 22 May 2007 11:25:34 +0000 Subject: More refactoring. --- OpenSim.RegionServer/ClientView.ProcessPackets.cs | 12 ++---------- OpenSim.RegionServer/ClientView.cs | 10 ++++------ OpenSim.RegionServer/world/Avatar.Update.cs | 5 +++++ OpenSim.RegionServer/world/World.PacketHandlers.cs | 14 ++++++++++++++ OpenSim.RegionServer/world/World.cs | 2 ++ 5 files changed, 27 insertions(+), 16 deletions(-) (limited to 'OpenSim.RegionServer') diff --git a/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim.RegionServer/ClientView.ProcessPackets.cs index 16f418d..708c143 100644 --- a/OpenSim.RegionServer/ClientView.ProcessPackets.cs +++ b/OpenSim.RegionServer/ClientView.ProcessPackets.cs @@ -38,6 +38,7 @@ namespace OpenSim public event GenericCall2 OnCompleteMovementToRegion; public event GenericCall3 OnAgentUpdate; public event StartAnim OnStartAnim; + public event GenericCall OnRequestAvatarsData; protected override void ProcessInPacket(Packet Pack) { @@ -106,16 +107,7 @@ namespace OpenSim break; case PacketType.AgentWearablesRequest: OnRequestWearables(this); - //need to move the follow to a event system - foreach (ClientView client in m_clientThreads.Values) - { - if (client.AgentID != this.AgentID) - { - ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket(); - this.OutPacket(objupdate); - client.ClientAvatar.SendAppearanceToOtherAgent(this.ClientAvatar); - } - } + OnRequestAvatarsData(this); break; case PacketType.AgentSetAppearance: AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; diff --git a/OpenSim.RegionServer/ClientView.cs b/OpenSim.RegionServer/ClientView.cs index 63bbfab..ccea2f3 100644 --- a/OpenSim.RegionServer/ClientView.cs +++ b/OpenSim.RegionServer/ClientView.cs @@ -52,6 +52,9 @@ namespace OpenSim /// public partial class ClientView : ClientViewBase { + protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients + protected Dictionary m_packetHandlers = new Dictionary(); //local handlers for this instance + public LLUUID AgentID; public LLUUID SessionID; public LLUUID SecureSessionID = LLUUID.Zero; @@ -75,10 +78,6 @@ namespace OpenSim private RegionInfo m_regionData; protected AuthenticateSessionsBase m_authenticateSessionsHandler; - protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients - - protected Dictionary m_packetHandlers = new Dictionary(); //local handlers for this instance - public IUserServer UserServer { set @@ -233,8 +232,6 @@ namespace OpenSim return result; } - # endregion - protected virtual void ClientLoop() { OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:ClientLoop() - Entered loop"); @@ -253,6 +250,7 @@ namespace OpenSim } } } + # endregion # region Setup diff --git a/OpenSim.RegionServer/world/Avatar.Update.cs b/OpenSim.RegionServer/world/Avatar.Update.cs index ee72ba3..266fc38 100644 --- a/OpenSim.RegionServer/world/Avatar.Update.cs +++ b/OpenSim.RegionServer/world/Avatar.Update.cs @@ -93,6 +93,11 @@ namespace OpenSim.world } } + public void SendUpdateToOtherClient(Avatar RemoteAvatar) + { + ObjectUpdatePacket objupdate = CreateUpdatePacket(); + RemoteAvatar.SendPacketToViewer(objupdate); + } public ObjectUpdatePacket CreateUpdatePacket() { diff --git a/OpenSim.RegionServer/world/World.PacketHandlers.cs b/OpenSim.RegionServer/world/World.PacketHandlers.cs index d12013a..119bb19 100644 --- a/OpenSim.RegionServer/world/World.PacketHandlers.cs +++ b/OpenSim.RegionServer/world/World.PacketHandlers.cs @@ -168,6 +168,20 @@ namespace OpenSim.world return true; } + public void SendAvatarsToClient(ClientView RemoteClient) + { + foreach (ClientView client in m_clientThreads.Values) + { + if (client.AgentID != RemoteClient.AgentID) + { + // ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket(); + // RemoteClient.OutPacket(objupdate); + client.ClientAvatar.SendUpdateToOtherClient(RemoteClient.ClientAvatar); + client.ClientAvatar.SendAppearanceToOtherAgent(RemoteClient.ClientAvatar); + } + } + } + /* public void RequestMapBlock(ClientView simClient, int minX, int minY, int maxX, int maxY) { diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index 70ca680..99fb8e0 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs @@ -538,6 +538,8 @@ namespace OpenSim.world agentClient.OnModifyTerrain += new ClientView.ModifyTerrain(this.ModifyTerrain); agentClient.OnRegionHandShakeReply += new ClientView.GenericCall(this.SendLayerData); agentClient.OnRequestWearables += new ClientView.GenericCall(this.GetInitialPrims); + agentClient.OnRequestAvatarsData += new ClientView.GenericCall(this.SendAvatarsToClient); + try { OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); -- cgit v1.1