aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer
diff options
context:
space:
mode:
authorMW2007-06-17 14:10:19 +0000
committerMW2007-06-17 14:10:19 +0000
commitef0e5e913e2c22f8e2cba96d54436443b573c1ed (patch)
tree68ba282891693aa9777491ec95f9d99e9597096b /OpenSim/OpenSim.RegionServer
parent* Added 'LogFilename' attribute to simconfig.xml - in order to specify log name (diff)
downloadopensim-SC_OLD-ef0e5e913e2c22f8e2cba96d54436443b573c1ed.zip
opensim-SC_OLD-ef0e5e913e2c22f8e2cba96d54436443b573c1ed.tar.gz
opensim-SC_OLD-ef0e5e913e2c22f8e2cba96d54436443b573c1ed.tar.bz2
opensim-SC_OLD-ef0e5e913e2c22f8e2cba96d54436443b573c1ed.tar.xz
Very Preliminary local teleporting added (currently only can teleport within the current region).
Now need to add teleporting between regions and use of the dynamic texture for the terrain.
Diffstat (limited to 'OpenSim/OpenSim.RegionServer')
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.API.cs105
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs2
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs47
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.cs27
4 files changed, 126 insertions, 55 deletions
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
index 0ace92c..80719d6 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -63,6 +63,8 @@ namespace OpenSim
63 public event GenericCall2 OnStopMovement; 63 public event GenericCall2 OnStopMovement;
64 public event NewAvatar OnNewAvatar; 64 public event NewAvatar OnNewAvatar;
65 public event GenericCall6 OnRemoveAvatar; 65 public event GenericCall6 OnRemoveAvatar;
66 public event RequestMapBlocks OnRequestMapBlocks;
67 public event TeleportLocationRequest OnTeleportLocationRequest;
66 68
67 public event ParcelPropertiesRequest OnParcelPropertiesRequest; 69 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
68 public event ParcelDivideRequest OnParcelDivideRequest; 70 public event ParcelDivideRequest OnParcelDivideRequest;
@@ -155,7 +157,7 @@ namespace OpenSim
155 handshake.RegionInfo.TerrainBase3 = regionInfo.estateSettings.terrainBase3; 157 handshake.RegionInfo.TerrainBase3 = regionInfo.estateSettings.terrainBase3;
156 handshake.RegionInfo.TerrainDetail0 = regionInfo.estateSettings.terrainDetail0; 158 handshake.RegionInfo.TerrainDetail0 = regionInfo.estateSettings.terrainDetail0;
157 handshake.RegionInfo.TerrainDetail1 = regionInfo.estateSettings.terrainDetail1; 159 handshake.RegionInfo.TerrainDetail1 = regionInfo.estateSettings.terrainDetail1;
158 handshake.RegionInfo.TerrainDetail2 =regionInfo.estateSettings.terrainDetail2; 160 handshake.RegionInfo.TerrainDetail2 = regionInfo.estateSettings.terrainDetail2;
159 handshake.RegionInfo.TerrainDetail3 = regionInfo.estateSettings.terrainDetail3; 161 handshake.RegionInfo.TerrainDetail3 = regionInfo.estateSettings.terrainDetail3;
160 handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting? 162 handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting?
161 163
@@ -166,7 +168,7 @@ namespace OpenSim
166 /// 168 ///
167 /// </summary> 169 /// </summary>
168 /// <param name="regInfo"></param> 170 /// <param name="regInfo"></param>
169 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos) 171 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
170 { 172 {
171 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 173 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
172 mov.AgentData.SessionID = this.SessionID; 174 mov.AgentData.SessionID = this.SessionID;
@@ -182,16 +184,16 @@ namespace OpenSim
182 { 184 {
183 mov.Data.Position = this.startpos; 185 mov.Data.Position = this.startpos;
184 } 186 }
185 mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); 187 mov.Data.LookAt = look;
186 188
187 OutPacket(mov); 189 OutPacket(mov);
188 } 190 }
189 191
190 public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 192 public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
191 { 193 {
192 SendChatMessage( Helpers.StringToField( message ), type, fromPos, fromName, fromAgentID); 194 SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID);
193 } 195 }
194 196
195 /// <summary> 197 /// <summary>
196 /// 198 ///
197 /// </summary> 199 /// </summary>
@@ -216,7 +218,7 @@ namespace OpenSim
216 this.OutPacket(reply); 218 this.OutPacket(reply);
217 } 219 }
218 220
219 221
220 /// <summary> 222 /// <summary>
221 /// Send the region heightmap to the client 223 /// Send the region heightmap to the client
222 /// </summary> 224 /// </summary>
@@ -272,7 +274,7 @@ namespace OpenSim
272 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); 274 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString());
273 } 275 }
274 } 276 }
275 277
276 /// <summary> 278 /// <summary>
277 /// 279 ///
278 /// </summary> 280 /// </summary>
@@ -314,8 +316,8 @@ namespace OpenSim
314 316
315 public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort) 317 public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort)
316 { 318 {
317 LLVector3 look = new LLVector3(lookAt.X *10, lookAt.Y *10, lookAt.Z *10); 319 LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10);
318 320
319 CrossedRegionPacket newSimPack = new CrossedRegionPacket(); 321 CrossedRegionPacket newSimPack = new CrossedRegionPacket();
320 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); 322 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
321 newSimPack.AgentData.AgentID = this.AgentID; 323 newSimPack.AgentData.AgentID = this.AgentID;
@@ -334,7 +336,86 @@ namespace OpenSim
334 newSimPack.RegionData.SeedCapability = new byte[0]; 336 newSimPack.RegionData.SeedCapability = new byte[0];
335 337
336 this.OutPacket(newSimPack); 338 this.OutPacket(newSimPack);
337 this.DowngradeClient(); 339 //this.DowngradeClient();
340 }
341
342 public void SendMapBlock(List<MapBlockData> mapBlocks)
343 {
344 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
345
346 MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
347 mapReply.AgentData.AgentID = this.AgentID;
348 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count];
349 mapReply.AgentData.Flags = 0;
350
351 for (int i = 0; i < mapBlocks.Count; i++)
352 {
353 mapReply.Data[i] = new MapBlockReplyPacket.DataBlock();
354 mapReply.Data[i].MapImageID = mapBlocks[i].MapImageId;
355 mapReply.Data[i].X = mapBlocks[i].X;
356 mapReply.Data[i].Y = mapBlocks[i].Y;
357 mapReply.Data[i].WaterHeight = mapBlocks[i].WaterHeight;
358 mapReply.Data[i].Name = _enc.GetBytes(mapBlocks[i].Name);
359 mapReply.Data[i].RegionFlags = mapBlocks[i].RegionFlags;
360 mapReply.Data[i].Access = mapBlocks[i].Access;
361 mapReply.Data[i].Agents = mapBlocks[i].Agents;
362 }
363 this.OutPacket(mapReply);
364 }
365
366 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
367 {
368 TeleportLocalPacket tpLocal2 = new TeleportLocalPacket();
369 tpLocal2.Info.AgentID = this.AgentID;
370 tpLocal2.Info.TeleportFlags = flags;
371 tpLocal2.Info.LocationID = 2;
372 tpLocal2.Info.LookAt = lookAt;
373 tpLocal2.Info.Position = position;
374 OutPacket(tpLocal2);
375 }
376
377 public void SendRegionTeleport(ulong regionHandle, byte simAccess, string ipAddress, ushort ipPort, uint locationID, uint flags)
378 {
379 TeleportFinishPacket Teleport = new TeleportFinishPacket();
380 Teleport.Info.AgentID = this.AgentID;
381 Teleport.Info.RegionHandle = regionHandle;
382 Teleport.Info.SimAccess = simAccess;
383 Teleport.Info.SeedCapability = new byte[0];
384
385 System.Net.IPAddress oIP = System.Net.IPAddress.Parse(ipAddress);
386 byte[] byteIP = oIP.GetAddressBytes();
387 uint ip = (uint)byteIP[3] << 24;
388 ip += (uint)byteIP[2] << 16;
389 ip += (uint)byteIP[1] << 8;
390 ip += (uint)byteIP[0];
391
392 Teleport.Info.SimIP = ip;
393 Teleport.Info.SimPort = ipPort;
394 Teleport.Info.LocationID = 4;
395 Teleport.Info.TeleportFlags = 1 << 4;
396 OutPacket(Teleport);
397 }
398
399 /// <summary>
400 ///
401 /// </summary>
402 public void SendTeleportCancel()
403 {
404 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
405 tpCancel.Info.SessionID = this.SessionID;
406 tpCancel.Info.AgentID = this.AgentID;
407
408 OutPacket(tpCancel);
409 }
410
411 /// <summary>
412 ///
413 /// </summary>
414 public void SendTeleportLocationStart()
415 {
416 TeleportStartPacket tpStart = new TeleportStartPacket();
417 tpStart.Info.TeleportFlags = 16; // Teleport via location
418 OutPacket(tpStart);
338 } 419 }
339 420
340 #region Appearance/ Wearables Methods 421 #region Appearance/ Wearables Methods
@@ -511,7 +592,7 @@ namespace OpenSim
511 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 592 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
512 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID); 593 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID);
513 outPacket.ObjectData[0].ID = localID; 594 outPacket.ObjectData[0].ID = localID;
514 outPacket.ObjectData[0].FullID = primData.FullID; 595 outPacket.ObjectData[0].FullID = primData.FullID;
515 byte[] pb = pos.GetBytes(); 596 byte[] pb = pos.GetBytes();
516 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); 597 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
517 598
@@ -570,7 +651,7 @@ namespace OpenSim
570 ushort InternVelocityY; 651 ushort InternVelocityY;
571 ushort InternVelocityZ; 652 ushort InternVelocityZ;
572 Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0); 653 Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0);
573 654
574 internDirec = new Axiom.MathLib.Vector3(velocity.X, velocity.Y, velocity.Z); 655 internDirec = new Axiom.MathLib.Vector3(velocity.X, velocity.Y, velocity.Z);
575 656
576 internDirec = internDirec / 128.0f; 657 internDirec = internDirec / 128.0f;
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
index aaac4d0..a173c47 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
@@ -191,6 +191,8 @@ namespace OpenSim
191 } 191 }
192 this.OutPacket(mbReply); 192 this.OutPacket(mbReply);
193 * */ 193 * */
194
195
194 } 196 }
195 197
196 198
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index 4cf6ac2..f8425da 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -158,7 +158,6 @@ namespace OpenSim
158 } 158 }
159 break; 159 break;
160 case PacketType.CompleteAgentMovement: 160 case PacketType.CompleteAgentMovement:
161 if (this.m_child) this.UpgradeClient();
162 if (OnCompleteMovementToRegion != null) 161 if (OnCompleteMovementToRegion != null)
163 { 162 {
164 OnCompleteMovementToRegion(); 163 OnCompleteMovementToRegion();
@@ -396,8 +395,11 @@ namespace OpenSim
396 break; 395 break;
397 case PacketType.MapBlockRequest: 396 case PacketType.MapBlockRequest:
398 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; 397 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
399 398 if (OnRequestMapBlocks != null)
400 this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); 399 {
400 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
401 }
402 //this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
401 break; 403 break;
402 case PacketType.TeleportLandmarkRequest: 404 case PacketType.TeleportLandmarkRequest:
403 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; 405 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
@@ -449,16 +451,25 @@ namespace OpenSim
449 break; 451 break;
450 case PacketType.TeleportLocationRequest: 452 case PacketType.TeleportLocationRequest:
451 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; 453 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
452 Console.WriteLine(tpLocReq.ToString()); 454 // Console.WriteLine(tpLocReq.ToString());
453 455
454 tpStart = new TeleportStartPacket(); 456 if (OnTeleportLocationRequest != null)
455 tpStart.Info.TeleportFlags = 16; // Teleport via location 457 {
456 Console.WriteLine(tpStart.ToString()); 458 OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16);
457 OutPacket(tpStart); 459 }
460 else
461 {
462 //no event handler so cancel request
463 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
464 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
465 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
458 466
459 if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle) 467 OutPacket(tpCancel);
468 }
469
470 /* if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle)
460 { 471 {
461 /* m_gridServer.getRegion(tpLocReq.Info.RegionHandle); */ 472 // m_gridServer.getRegion(tpLocReq.Info.RegionHandle);
462 Console.WriteLine("Inter-sim teleport not yet implemented"); 473 Console.WriteLine("Inter-sim teleport not yet implemented");
463 TeleportCancelPacket tpCancel = new TeleportCancelPacket(); 474 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
464 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; 475 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
@@ -469,15 +480,15 @@ namespace OpenSim
469 else 480 else
470 { 481 {
471 Console.WriteLine("Local teleport"); 482 Console.WriteLine("Local teleport");
472 TeleportLocalPacket tpLocal = new TeleportLocalPacket(); 483 TeleportLocalPacket tpLocal2 = new TeleportLocalPacket();
473 tpLocal.Info.AgentID = tpLocReq.AgentData.AgentID; 484 tpLocal2.Info.AgentID = tpLocReq.AgentData.AgentID;
474 tpLocal.Info.TeleportFlags = tpStart.Info.TeleportFlags; 485 tpLocal2.Info.TeleportFlags = tpStart.Info.TeleportFlags;
475 tpLocal.Info.LocationID = 2; 486 tpLocal2.Info.LocationID = 2;
476 tpLocal.Info.LookAt = tpLocReq.Info.LookAt; 487 tpLocal2.Info.LookAt = tpLocReq.Info.LookAt;
477 tpLocal.Info.Position = tpLocReq.Info.Position; 488 tpLocal2.Info.Position = tpLocReq.Info.Position;
478 OutPacket(tpLocal); 489 OutPacket(tpLocal2);
479 490
480 } 491 }*/
481 break; 492 break;
482 #endregion 493 #endregion
483 494
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs
index 29c871e..74dbc1a 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.cs
@@ -95,7 +95,7 @@ namespace OpenSim
95 cirpack = initialcirpack; 95 cirpack = initialcirpack;
96 userEP = remoteEP; 96 userEP = remoteEP;
97 97
98 this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code); 98 //this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code);
99 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); 99 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code);
100 100
101 PacketQueue = new BlockingQueue<QueItem>(); 101 PacketQueue = new BlockingQueue<QueItem>();
@@ -113,27 +113,6 @@ namespace OpenSim
113 } 113 }
114 114
115 # region Client Methods 115 # region Client Methods
116 public void UpgradeClient()
117 {
118 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent");
119 this.m_child = false;
120 //this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode);
121 m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false);
122 if (OnChildAgentStatus != null)
123 {
124 OnChildAgentStatus(this.m_child);
125 }
126 }
127
128 public void DowngradeClient()
129 {
130 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child");
131 this.m_child = true;
132 if (OnChildAgentStatus != null)
133 {
134 OnChildAgentStatus(this.m_child);
135 }
136 }
137 116
138 public void KillClient() 117 public void KillClient()
139 { 118 {
@@ -147,9 +126,7 @@ namespace OpenSim
147 } 126 }
148 127
149 this.m_inventoryCache.ClientLeaving(this.AgentID, null); 128 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
150 129 m_world.RemoveAvatar(this.AgentId);
151
152 // m_world.RemoveViewerAgent(this);
153 130
154 m_clientThreads.Remove(this.CircuitCode); 131 m_clientThreads.Remove(this.CircuitCode);
155 m_networkServer.RemoveClientCircuit(this.CircuitCode); 132 m_networkServer.RemoveClientCircuit(this.CircuitCode);