From ccfddd1775fe2786ad54b7bbfe528e7eb65170b1 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 27 Mar 2007 19:12:55 +0000 Subject: * Continued refactoring away OpenSimRoot - now it's down to the final 2. --- OpenSim.RegionServer/world/Avatar.cs | 39 ++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'OpenSim.RegionServer/world/Avatar.cs') diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs index 75f2cff..2ae9992 100644 --- a/OpenSim.RegionServer/world/Avatar.cs +++ b/OpenSim.RegionServer/world/Avatar.cs @@ -30,14 +30,23 @@ namespace OpenSim.world private byte[] visualParams; private AvatarWearable[] Wearables; private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); + private World m_world; + private ulong m_regionHandle; + private Dictionary m_clientThreads; + private string m_regionName; - public Avatar(SimClient TheClient) + public Avatar(SimClient TheClient, World world, string regionName, Dictionary clientThreads, ulong regionHandle) { + m_world = world; + m_clientThreads = clientThreads; + m_regionName = regionName; + m_regionHandle = regionHandle; + OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); ControllingClient = TheClient; - localid = 8880000 + (OpenSimRoot.Instance.LocalWorld._localNumber++); + localid = 8880000 + (m_world._localNumber++); position = new LLVector3(100.0f, 100.0f, 30.0f); - position.Z = OpenSimRoot.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1; + position.Z = m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1; visualParams = new byte[218]; for (int i = 0; i < 218; i++) { @@ -52,7 +61,7 @@ namespace OpenSim.world this.Wearables[0].ItemID = LLUUID.Random(); this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); - + } public PhysicsActor PhysActor @@ -96,11 +105,11 @@ namespace OpenSim.world //use CreateTerseBlock() ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); - terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME + terse.RegionData.RegionHandle = m_regionHandle; // FIXME terse.RegionData.TimeDilation = 64096; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData[0] = terseBlock; - foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) + foreach (SimClient client in m_clientThreads.Values) { client.OutPacket(terse); } @@ -119,11 +128,11 @@ namespace OpenSim.world //It has been a while since last update was sent so lets send one. ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); - terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME + terse.RegionData.RegionHandle = m_regionHandle; // FIXME terse.RegionData.TimeDilation = 64096; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData[0] = terseBlock; - foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) + foreach (SimClient client in m_clientThreads.Values) { client.OutPacket(terse); } @@ -172,7 +181,7 @@ namespace OpenSim.world AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); mov.AgentData.SessionID = this.ControllingClient.SessionID; mov.AgentData.AgentID = this.ControllingClient.AgentID; - mov.Data.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; + mov.Data.RegionHandle = m_regionHandle; // TODO - dynamicalise this stuff mov.Data.Timestamp = 1172750370; mov.Data.Position = new LLVector3(100f, 100f, 23f); @@ -187,7 +196,7 @@ namespace OpenSim.world System.Text.Encoding _enc = System.Text.Encoding.ASCII; //send a objectupdate packet with information about the clients avatar ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); - objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; + objupdate.RegionData.RegionHandle = m_regionHandle; objupdate.RegionData.TimeDilation = 64096; objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; @@ -202,9 +211,9 @@ namespace OpenSim.world byte[] pb = pos2.GetBytes(); Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); - OpenSimRoot.Instance.LocalWorld._localNumber++; + m_world._localNumber++; - foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) + foreach (SimClient client in m_clientThreads.Values) { client.OutPacket(objupdate); if (client.AgentID != ControllingClient.AgentID) @@ -241,7 +250,7 @@ namespace OpenSim.world System.Text.Encoding _enc = System.Text.Encoding.ASCII; //send a objectupdate packet with information about the clients avatar ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); - objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; + objupdate.RegionData.RegionHandle = m_regionHandle; objupdate.RegionData.TimeDilation = 64096; objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; @@ -293,7 +302,7 @@ namespace OpenSim.world this.visualParams[i] = appear.VisualParam[i].ParamValue; } - foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) + foreach (SimClient client in m_clientThreads.Values) { if (client.AgentID != ControllingClient.AgentID) { @@ -490,7 +499,7 @@ namespace OpenSim.world handshake.RegionInfo.SimAccess = 13; handshake.RegionInfo.WaterHeight = 20; handshake.RegionInfo.RegionFlags = 72458694; - handshake.RegionInfo.SimName = _enc.GetBytes(OpenSimRoot.Instance.Cfg.RegionName + "\0"); + handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); -- cgit v1.1