From 36bcda6cfaec008d51cc47838912aa49a889c18c Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 29 May 2007 17:10:31 +0000 Subject: [PATCH] --- .../OpenSim.RegionServer/ClientView.API.cs | 2 +- OpenSim/OpenSim.World/Avatar.cs | 11 ++-- OpenSim/OpenSim.World/World.cs | 57 +++++++++++++++++-- 3 files changed, 58 insertions(+), 12 deletions(-) diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs index 55ff8a195a..7b1e5376b1 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs @@ -101,7 +101,7 @@ namespace OpenSim avp.ObjectData.TextureEntry = textureEntry; AvatarAppearancePacket.VisualParamBlock avblock = null; - for (int i = 0; i < 218; i++) + for (int i = 0; i < visualParams.Length; i++) { avblock = new AvatarAppearancePacket.VisualParamBlock(); avblock.ParamValue = visualParams[i]; diff --git a/OpenSim/OpenSim.World/Avatar.cs b/OpenSim/OpenSim.World/Avatar.cs index 77c18bfd7d..24698603f8 100644 --- a/OpenSim/OpenSim.World/Avatar.cs +++ b/OpenSim/OpenSim.World/Avatar.cs @@ -37,15 +37,16 @@ namespace OpenSim.world private ushort m_regionWaterHeight; private bool m_regionTerraform; private bool childAvatar = false; + private RegionInfo regionData; - public Avatar(IClientAPI TheClient, World world, string regionName, Dictionary clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) + public Avatar(IClientAPI TheClient, World world, Dictionary clientThreads, RegionInfo regionDat) { m_world = world; // m_clientThreads = clientThreads; - m_regionName = regionName; - m_regionHandle = regionHandle; - m_regionTerraform = regionTerraform; - m_regionWaterHeight = regionWater; + m_regionName = regionData.RegionName; + m_regionHandle = regionData.RegionHandle; + m_regionTerraform = regionData.RegionTerraform; + m_regionWaterHeight = regionData.RegionWaterHeight; OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Avatar.cs - Loading details from grid (DUMMY)"); ControllingClient = TheClient; diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs index 8c8c2a620d..c67366a653 100644 --- a/OpenSim/OpenSim.World/World.cs +++ b/OpenSim/OpenSim.World/World.cs @@ -86,7 +86,7 @@ namespace OpenSim.world this.SetDefaultScripts(); this.LoadScriptEngines(); - + } catch (Exception e) { @@ -459,7 +459,7 @@ namespace OpenSim.world /// Client to send to public void GetInitialPrims(IClientAPI RemoteClient) { - + } /// @@ -484,7 +484,7 @@ namespace OpenSim.world /// The object to load public void PrimFromStorage(PrimData prim) { - + } public void AddNewPrim(Packet addPacket, IClientAPI agentClient) @@ -494,7 +494,7 @@ namespace OpenSim.world public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) { - + } #endregion @@ -503,12 +503,57 @@ namespace OpenSim.world public override void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child) { - return ; + remoteClient.OnRegionHandShakeReply += new GenericCall(this.SendLayerData); + remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); + + Avatar newAvatar = null; + try + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + newAvatar = new Avatar(remoteClient, this, m_clientThreads, this.m_regInfo); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world"); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake "); + newAvatar.SendRegionHandshake(this); + + PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); + lock (this.LockPhysicsEngine) + { + newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); + } + + lock (Entities) + { + if (!Entities.ContainsKey(agentID)) + { + this.Entities.Add(agentID, newAvatar); + } + else + { + Entities[agentID] = newAvatar; + } + } + lock (Avatars) + { + if (Avatars.ContainsKey(agentID)) + { + Avatars[agentID] = newAvatar; + } + else + { + this.Avatars.Add(agentID, newAvatar); + } + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); + } + return; } public override void RemoveAvatar(LLUUID agentID) { - return ; + return; } #endregion