From ef0e5e913e2c22f8e2cba96d54436443b573c1ed Mon Sep 17 00:00:00 2001
From: MW
Date: Sun, 17 Jun 2007 14:10:19 +0000
Subject: 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.
---
OpenSim/OpenSim.RegionServer/ClientView.API.cs | 105 ++++++++++++++++++---
.../ClientView.PacketHandlers.cs | 2 +
.../ClientView.ProcessPackets.cs | 47 +++++----
OpenSim/OpenSim.RegionServer/ClientView.cs | 27 +-----
4 files changed, 126 insertions(+), 55 deletions(-)
(limited to 'OpenSim/OpenSim.RegionServer')
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
public event GenericCall2 OnStopMovement;
public event NewAvatar OnNewAvatar;
public event GenericCall6 OnRemoveAvatar;
+ public event RequestMapBlocks OnRequestMapBlocks;
+ public event TeleportLocationRequest OnTeleportLocationRequest;
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
public event ParcelDivideRequest OnParcelDivideRequest;
@@ -155,7 +157,7 @@ namespace OpenSim
handshake.RegionInfo.TerrainBase3 = regionInfo.estateSettings.terrainBase3;
handshake.RegionInfo.TerrainDetail0 = regionInfo.estateSettings.terrainDetail0;
handshake.RegionInfo.TerrainDetail1 = regionInfo.estateSettings.terrainDetail1;
- handshake.RegionInfo.TerrainDetail2 =regionInfo.estateSettings.terrainDetail2;
+ handshake.RegionInfo.TerrainDetail2 = regionInfo.estateSettings.terrainDetail2;
handshake.RegionInfo.TerrainDetail3 = regionInfo.estateSettings.terrainDetail3;
handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting?
@@ -166,7 +168,7 @@ namespace OpenSim
///
///
///
- public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos)
+ public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
{
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
mov.AgentData.SessionID = this.SessionID;
@@ -182,16 +184,16 @@ namespace OpenSim
{
mov.Data.Position = this.startpos;
}
- mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
+ mov.Data.LookAt = look;
OutPacket(mov);
}
public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
- SendChatMessage( Helpers.StringToField( message ), type, fromPos, fromName, fromAgentID);
+ SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID);
}
-
+
///
///
///
@@ -216,7 +218,7 @@ namespace OpenSim
this.OutPacket(reply);
}
-
+
///
/// Send the region heightmap to the client
///
@@ -272,7 +274,7 @@ namespace OpenSim
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString());
}
}
-
+
///
///
///
@@ -314,8 +316,8 @@ namespace OpenSim
public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort)
{
- LLVector3 look = new LLVector3(lookAt.X *10, lookAt.Y *10, lookAt.Z *10);
-
+ LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10);
+
CrossedRegionPacket newSimPack = new CrossedRegionPacket();
newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
newSimPack.AgentData.AgentID = this.AgentID;
@@ -334,7 +336,86 @@ namespace OpenSim
newSimPack.RegionData.SeedCapability = new byte[0];
this.OutPacket(newSimPack);
- this.DowngradeClient();
+ //this.DowngradeClient();
+ }
+
+ public void SendMapBlock(List mapBlocks)
+ {
+ System.Text.Encoding _enc = System.Text.Encoding.ASCII;
+
+ MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
+ mapReply.AgentData.AgentID = this.AgentID;
+ mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count];
+ mapReply.AgentData.Flags = 0;
+
+ for (int i = 0; i < mapBlocks.Count; i++)
+ {
+ mapReply.Data[i] = new MapBlockReplyPacket.DataBlock();
+ mapReply.Data[i].MapImageID = mapBlocks[i].MapImageId;
+ mapReply.Data[i].X = mapBlocks[i].X;
+ mapReply.Data[i].Y = mapBlocks[i].Y;
+ mapReply.Data[i].WaterHeight = mapBlocks[i].WaterHeight;
+ mapReply.Data[i].Name = _enc.GetBytes(mapBlocks[i].Name);
+ mapReply.Data[i].RegionFlags = mapBlocks[i].RegionFlags;
+ mapReply.Data[i].Access = mapBlocks[i].Access;
+ mapReply.Data[i].Agents = mapBlocks[i].Agents;
+ }
+ this.OutPacket(mapReply);
+ }
+
+ public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
+ {
+ TeleportLocalPacket tpLocal2 = new TeleportLocalPacket();
+ tpLocal2.Info.AgentID = this.AgentID;
+ tpLocal2.Info.TeleportFlags = flags;
+ tpLocal2.Info.LocationID = 2;
+ tpLocal2.Info.LookAt = lookAt;
+ tpLocal2.Info.Position = position;
+ OutPacket(tpLocal2);
+ }
+
+ public void SendRegionTeleport(ulong regionHandle, byte simAccess, string ipAddress, ushort ipPort, uint locationID, uint flags)
+ {
+ TeleportFinishPacket Teleport = new TeleportFinishPacket();
+ Teleport.Info.AgentID = this.AgentID;
+ Teleport.Info.RegionHandle = regionHandle;
+ Teleport.Info.SimAccess = simAccess;
+ Teleport.Info.SeedCapability = new byte[0];
+
+ System.Net.IPAddress oIP = System.Net.IPAddress.Parse(ipAddress);
+ byte[] byteIP = oIP.GetAddressBytes();
+ uint ip = (uint)byteIP[3] << 24;
+ ip += (uint)byteIP[2] << 16;
+ ip += (uint)byteIP[1] << 8;
+ ip += (uint)byteIP[0];
+
+ Teleport.Info.SimIP = ip;
+ Teleport.Info.SimPort = ipPort;
+ Teleport.Info.LocationID = 4;
+ Teleport.Info.TeleportFlags = 1 << 4;
+ OutPacket(Teleport);
+ }
+
+ ///
+ ///
+ ///
+ public void SendTeleportCancel()
+ {
+ TeleportCancelPacket tpCancel = new TeleportCancelPacket();
+ tpCancel.Info.SessionID = this.SessionID;
+ tpCancel.Info.AgentID = this.AgentID;
+
+ OutPacket(tpCancel);
+ }
+
+ ///
+ ///
+ ///
+ public void SendTeleportLocationStart()
+ {
+ TeleportStartPacket tpStart = new TeleportStartPacket();
+ tpStart.Info.TeleportFlags = 16; // Teleport via location
+ OutPacket(tpStart);
}
#region Appearance/ Wearables Methods
@@ -511,7 +592,7 @@ namespace OpenSim
outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID);
outPacket.ObjectData[0].ID = localID;
- outPacket.ObjectData[0].FullID = primData.FullID;
+ outPacket.ObjectData[0].FullID = primData.FullID;
byte[] pb = pos.GetBytes();
Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
@@ -570,7 +651,7 @@ namespace OpenSim
ushort InternVelocityY;
ushort InternVelocityZ;
Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0);
-
+
internDirec = new Axiom.MathLib.Vector3(velocity.X, velocity.Y, velocity.Z);
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
}
this.OutPacket(mbReply);
* */
+
+
}
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
}
break;
case PacketType.CompleteAgentMovement:
- if (this.m_child) this.UpgradeClient();
if (OnCompleteMovementToRegion != null)
{
OnCompleteMovementToRegion();
@@ -396,8 +395,11 @@ namespace OpenSim
break;
case PacketType.MapBlockRequest:
MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
-
- this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
+ if (OnRequestMapBlocks != null)
+ {
+ OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
+ }
+ //this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
break;
case PacketType.TeleportLandmarkRequest:
TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
@@ -449,16 +451,25 @@ namespace OpenSim
break;
case PacketType.TeleportLocationRequest:
TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
- Console.WriteLine(tpLocReq.ToString());
+ // Console.WriteLine(tpLocReq.ToString());
- tpStart = new TeleportStartPacket();
- tpStart.Info.TeleportFlags = 16; // Teleport via location
- Console.WriteLine(tpStart.ToString());
- OutPacket(tpStart);
+ if (OnTeleportLocationRequest != null)
+ {
+ OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16);
+ }
+ else
+ {
+ //no event handler so cancel request
+ TeleportCancelPacket tpCancel = new TeleportCancelPacket();
+ tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
+ tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
- if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle)
+ OutPacket(tpCancel);
+ }
+
+ /* if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle)
{
- /* m_gridServer.getRegion(tpLocReq.Info.RegionHandle); */
+ // m_gridServer.getRegion(tpLocReq.Info.RegionHandle);
Console.WriteLine("Inter-sim teleport not yet implemented");
TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
@@ -469,15 +480,15 @@ namespace OpenSim
else
{
Console.WriteLine("Local teleport");
- TeleportLocalPacket tpLocal = new TeleportLocalPacket();
- tpLocal.Info.AgentID = tpLocReq.AgentData.AgentID;
- tpLocal.Info.TeleportFlags = tpStart.Info.TeleportFlags;
- tpLocal.Info.LocationID = 2;
- tpLocal.Info.LookAt = tpLocReq.Info.LookAt;
- tpLocal.Info.Position = tpLocReq.Info.Position;
- OutPacket(tpLocal);
+ TeleportLocalPacket tpLocal2 = new TeleportLocalPacket();
+ tpLocal2.Info.AgentID = tpLocReq.AgentData.AgentID;
+ tpLocal2.Info.TeleportFlags = tpStart.Info.TeleportFlags;
+ tpLocal2.Info.LocationID = 2;
+ tpLocal2.Info.LookAt = tpLocReq.Info.LookAt;
+ tpLocal2.Info.Position = tpLocReq.Info.Position;
+ OutPacket(tpLocal2);
- }
+ }*/
break;
#endregion
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
cirpack = initialcirpack;
userEP = remoteEP;
- this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code);
+ //this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code);
this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code);
PacketQueue = new BlockingQueue();
@@ -113,27 +113,6 @@ namespace OpenSim
}
# region Client Methods
- public void UpgradeClient()
- {
- OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent");
- this.m_child = false;
- //this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode);
- m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false);
- if (OnChildAgentStatus != null)
- {
- OnChildAgentStatus(this.m_child);
- }
- }
-
- public void DowngradeClient()
- {
- OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child");
- this.m_child = true;
- if (OnChildAgentStatus != null)
- {
- OnChildAgentStatus(this.m_child);
- }
- }
public void KillClient()
{
@@ -147,9 +126,7 @@ namespace OpenSim
}
this.m_inventoryCache.ClientLeaving(this.AgentID, null);
-
-
- // m_world.RemoveViewerAgent(this);
+ m_world.RemoveAvatar(this.AgentId);
m_clientThreads.Remove(this.CircuitCode);
m_networkServer.RemoveClientCircuit(this.CircuitCode);
--
cgit v1.1