diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim.RegionServer/world/Avatar.cs | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs index 2ae9992..75f2cff 100644 --- a/OpenSim.RegionServer/world/Avatar.cs +++ b/OpenSim.RegionServer/world/Avatar.cs | |||
@@ -30,23 +30,14 @@ namespace OpenSim.world | |||
30 | private byte[] visualParams; | 30 | private byte[] visualParams; |
31 | private AvatarWearable[] Wearables; | 31 | private AvatarWearable[] Wearables; |
32 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | 32 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); |
33 | private World m_world; | ||
34 | private ulong m_regionHandle; | ||
35 | private Dictionary<uint, SimClient> m_clientThreads; | ||
36 | private string m_regionName; | ||
37 | 33 | ||
38 | public Avatar(SimClient TheClient, World world, string regionName, Dictionary<uint, SimClient> clientThreads, ulong regionHandle) | 34 | public Avatar(SimClient TheClient) |
39 | { | 35 | { |
40 | m_world = world; | ||
41 | m_clientThreads = clientThreads; | ||
42 | m_regionName = regionName; | ||
43 | m_regionHandle = regionHandle; | ||
44 | |||
45 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); | 36 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); |
46 | ControllingClient = TheClient; | 37 | ControllingClient = TheClient; |
47 | localid = 8880000 + (m_world._localNumber++); | 38 | localid = 8880000 + (OpenSimRoot.Instance.LocalWorld._localNumber++); |
48 | position = new LLVector3(100.0f, 100.0f, 30.0f); | 39 | position = new LLVector3(100.0f, 100.0f, 30.0f); |
49 | position.Z = m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1; | 40 | position.Z = OpenSimRoot.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1; |
50 | visualParams = new byte[218]; | 41 | visualParams = new byte[218]; |
51 | for (int i = 0; i < 218; i++) | 42 | for (int i = 0; i < 218; i++) |
52 | { | 43 | { |
@@ -61,7 +52,7 @@ namespace OpenSim.world | |||
61 | this.Wearables[0].ItemID = LLUUID.Random(); | 52 | this.Wearables[0].ItemID = LLUUID.Random(); |
62 | 53 | ||
63 | this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | 54 | this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); |
64 | 55 | ||
65 | } | 56 | } |
66 | 57 | ||
67 | public PhysicsActor PhysActor | 58 | public PhysicsActor PhysActor |
@@ -105,11 +96,11 @@ namespace OpenSim.world | |||
105 | //use CreateTerseBlock() | 96 | //use CreateTerseBlock() |
106 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | 97 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); |
107 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 98 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
108 | terse.RegionData.RegionHandle = m_regionHandle; // FIXME | 99 | terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME |
109 | terse.RegionData.TimeDilation = 64096; | 100 | terse.RegionData.TimeDilation = 64096; |
110 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 101 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
111 | terse.ObjectData[0] = terseBlock; | 102 | terse.ObjectData[0] = terseBlock; |
112 | foreach (SimClient client in m_clientThreads.Values) | 103 | foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) |
113 | { | 104 | { |
114 | client.OutPacket(terse); | 105 | client.OutPacket(terse); |
115 | } | 106 | } |
@@ -128,11 +119,11 @@ namespace OpenSim.world | |||
128 | //It has been a while since last update was sent so lets send one. | 119 | //It has been a while since last update was sent so lets send one. |
129 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | 120 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); |
130 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 121 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
131 | terse.RegionData.RegionHandle = m_regionHandle; // FIXME | 122 | terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME |
132 | terse.RegionData.TimeDilation = 64096; | 123 | terse.RegionData.TimeDilation = 64096; |
133 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 124 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
134 | terse.ObjectData[0] = terseBlock; | 125 | terse.ObjectData[0] = terseBlock; |
135 | foreach (SimClient client in m_clientThreads.Values) | 126 | foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) |
136 | { | 127 | { |
137 | client.OutPacket(terse); | 128 | client.OutPacket(terse); |
138 | } | 129 | } |
@@ -181,7 +172,7 @@ namespace OpenSim.world | |||
181 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); | 172 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); |
182 | mov.AgentData.SessionID = this.ControllingClient.SessionID; | 173 | mov.AgentData.SessionID = this.ControllingClient.SessionID; |
183 | mov.AgentData.AgentID = this.ControllingClient.AgentID; | 174 | mov.AgentData.AgentID = this.ControllingClient.AgentID; |
184 | mov.Data.RegionHandle = m_regionHandle; | 175 | mov.Data.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; |
185 | // TODO - dynamicalise this stuff | 176 | // TODO - dynamicalise this stuff |
186 | mov.Data.Timestamp = 1172750370; | 177 | mov.Data.Timestamp = 1172750370; |
187 | mov.Data.Position = new LLVector3(100f, 100f, 23f); | 178 | mov.Data.Position = new LLVector3(100f, 100f, 23f); |
@@ -196,7 +187,7 @@ namespace OpenSim.world | |||
196 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | 187 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; |
197 | //send a objectupdate packet with information about the clients avatar | 188 | //send a objectupdate packet with information about the clients avatar |
198 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | 189 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
199 | objupdate.RegionData.RegionHandle = m_regionHandle; | 190 | objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; |
200 | objupdate.RegionData.TimeDilation = 64096; | 191 | objupdate.RegionData.TimeDilation = 64096; |
201 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | 192 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; |
202 | 193 | ||
@@ -211,9 +202,9 @@ namespace OpenSim.world | |||
211 | byte[] pb = pos2.GetBytes(); | 202 | byte[] pb = pos2.GetBytes(); |
212 | 203 | ||
213 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | 204 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); |
214 | m_world._localNumber++; | 205 | OpenSimRoot.Instance.LocalWorld._localNumber++; |
215 | 206 | ||
216 | foreach (SimClient client in m_clientThreads.Values) | 207 | foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) |
217 | { | 208 | { |
218 | client.OutPacket(objupdate); | 209 | client.OutPacket(objupdate); |
219 | if (client.AgentID != ControllingClient.AgentID) | 210 | if (client.AgentID != ControllingClient.AgentID) |
@@ -250,7 +241,7 @@ namespace OpenSim.world | |||
250 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | 241 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; |
251 | //send a objectupdate packet with information about the clients avatar | 242 | //send a objectupdate packet with information about the clients avatar |
252 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | 243 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
253 | objupdate.RegionData.RegionHandle = m_regionHandle; | 244 | objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; |
254 | objupdate.RegionData.TimeDilation = 64096; | 245 | objupdate.RegionData.TimeDilation = 64096; |
255 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | 246 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; |
256 | 247 | ||
@@ -302,7 +293,7 @@ namespace OpenSim.world | |||
302 | this.visualParams[i] = appear.VisualParam[i].ParamValue; | 293 | this.visualParams[i] = appear.VisualParam[i].ParamValue; |
303 | } | 294 | } |
304 | 295 | ||
305 | foreach (SimClient client in m_clientThreads.Values) | 296 | foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) |
306 | { | 297 | { |
307 | if (client.AgentID != ControllingClient.AgentID) | 298 | if (client.AgentID != ControllingClient.AgentID) |
308 | { | 299 | { |
@@ -499,7 +490,7 @@ namespace OpenSim.world | |||
499 | handshake.RegionInfo.SimAccess = 13; | 490 | handshake.RegionInfo.SimAccess = 13; |
500 | handshake.RegionInfo.WaterHeight = 20; | 491 | handshake.RegionInfo.WaterHeight = 20; |
501 | handshake.RegionInfo.RegionFlags = 72458694; | 492 | handshake.RegionInfo.RegionFlags = 72458694; |
502 | handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); | 493 | handshake.RegionInfo.SimName = _enc.GetBytes(OpenSimRoot.Instance.Cfg.RegionName + "\0"); |
503 | handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); | 494 | handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); |
504 | handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); | 495 | handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); |
505 | handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); | 496 | handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); |