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.
This commit is contained in:
MW
2007-06-17 14:10:19 +00:00
parent c6b99fbca5
commit ef0e5e913e
31 changed files with 507 additions and 154 deletions

View File

@@ -86,6 +86,12 @@
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Caches\OpenSim.Caches.csproj">
<Name>OpenSim.Caches</Name>
<Project>{1938EB12-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
<Name>OpenSim.Framework</Name>
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>

View File

@@ -39,6 +39,7 @@
<include name="../../bin/Db4objects.Db4o.dll" />
<include name="../../bin/libsecondlife.dll" />
<include name="../../bin/OpenGrid.Framework.Communications.dll" />
<include name="../../bin/OpenSim.Caches.dll" />
<include name="../../bin/OpenSim.Framework.dll" />
<include name="../../bin/OpenSim.Framework.Console.dll" />
<include name="../../bin/OpenSim.GenericConfig.Xml.dll" />

View File

@@ -43,36 +43,24 @@ namespace OpenSim.Region.Scenes
/// </summary>
public override void update()
{
if (this.newForce)
if (this.childAvatar == false)
{
this.SendTerseUpdateToALLClients();
_updateCount = 0;
}
else if (movementflag != 0)
{
_updateCount++;
if (_updateCount > 3)
if (this.newForce)
{
this.SendTerseUpdateToALLClients();
_updateCount = 0;
}
}
else if (movementflag != 0)
{
_updateCount++;
if (_updateCount > 3)
{
this.SendTerseUpdateToALLClients();
_updateCount = 0;
}
}
LLVector3 pos2 = this.Pos;
LLVector3 vel = this.Velocity;
float timeStep = 0.3f;
pos2.X = pos2.X + (vel.X * timeStep);
pos2.Y = pos2.Y + (vel.Y * timeStep);
pos2.Z = pos2.Z + (vel.Z * timeStep);
if ((pos2.X < 0) || (pos2.X > 256))
{
this.CrossToNewRegion();
}
if ((pos2.Y < 0) || (pos2.Y > 256))
{
this.CrossToNewRegion();
this.CheckBorderCrossing();
}
}
@@ -165,10 +153,35 @@ namespace OpenSim.Region.Scenes
}
private void CrossToNewRegion()
/// <summary>
///
/// </summary>
protected void CheckBorderCrossing()
{
LLVector3 pos2 = this.Pos;
LLVector3 vel = this.Velocity;
float timeStep = 0.3f;
pos2.X = pos2.X + (vel.X * timeStep);
pos2.Y = pos2.Y + (vel.Y * timeStep);
pos2.Z = pos2.Z + (vel.Z * timeStep);
if ((pos2.X < 0) || (pos2.X > 256))
{
this.CrossToNewRegion();
}
if ((pos2.Y < 0) || (pos2.Y > 256))
{
this.CrossToNewRegion();
}
}
/// <summary>
///
/// </summary>
protected void CrossToNewRegion()
{
// Console.WriteLine("crossing to new region from region " + this.m_regionInfo.RegionLocX + " , "+ this.m_regionInfo.RegionLocY);
LLVector3 pos = this.Pos;
LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z);
uint neighbourx = this.m_regionInfo.RegionLocX;
@@ -196,14 +209,14 @@ namespace OpenSim.Region.Scenes
}
LLVector3 vel = this.velocity;
// Console.WriteLine("new region should be " + neighbourx + " , " + neighboury);
ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury* 256));
RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle);
if (neighbourRegion != null)
{
// Console.WriteLine("current region port is "+ this.m_regionInfo.IPListenPort + " now crossing to new region with port " + neighbourRegion.IPListenPort);
this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos);
this.DownGradeAvatar();
this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort);
}
}

View File

@@ -103,7 +103,7 @@ namespace OpenSim.Region.Scenes
ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition);
ControllingClient.OnAgentUpdate += new UpdateAgent(this.HandleAgentUpdate);
// ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
// ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
//ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
}
@@ -138,7 +138,34 @@ namespace OpenSim.Region.Scenes
}
}
/// <summary>
///
/// </summary>
/// <param name="pos"></param>
public void UpGradeAvatar(LLVector3 pos)
{
//this.childAvatar = false;
this.Pos = pos;
}
protected void DownGradeAvatar()
{
this.Velocity = new LLVector3(0, 0, 0);
this.Pos = new LLVector3(128, 128, 70);
this.childAvatar = true;
}
/// <summary>
///
/// </summary>
/// <param name="pos"></param>
public void Teleport(LLVector3 pos)
{
this.Pos = pos;
this.SendTerseUpdateToALLClients();
}
/// <summary>
///
/// </summary>
@@ -189,7 +216,16 @@ namespace OpenSim.Region.Scenes
/// </summary>
public void CompleteMovement()
{
this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos);
LLVector3 look = this.Velocity;
if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
{
look = new LLVector3(0.99f, 0.042f, 0);
}
this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look);
if (this.childAvatar)
{
this.childAvatar = false;
}
}
/// <summary>

View File

@@ -42,7 +42,7 @@ using OpenSim.Framework;
using OpenSim.Region.Scripting;
using OpenSim.Terrain;
using OpenGrid.Framework.Communications;
using OpenSim.Caches;
namespace OpenSim.Region.Scenes
{
@@ -64,8 +64,9 @@ namespace OpenSim.Region.Scenes
private Mutex updateLock;
public string m_datastore;
protected AuthenticateSessionsBase authenticateHandler;
protected RegionCommsHostBase regionCommsHost;
protected RegionCommsListener regionCommsHost;
protected CommunicationsManager commsManager;
public ParcelManager parcelManager;
public EstateManager estateManager;
@@ -95,13 +96,14 @@ namespace OpenSim.Region.Scenes
/// <param name="clientThreads">Dictionary to contain client threads</param>
/// <param name="regionHandle">Region Handle for this region</param>
/// <param name="regionName">Region Name for this region</param>
public Scene(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan)
public Scene(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach)
{
try
{
updateLock = new Mutex(false);
this.authenticateHandler = authen;
this.commsManager = commsMan;
this.assetCache = assetCach;
m_clientThreads = clientThreads;
m_regInfo = regInfo;
m_regionHandle = m_regInfo.RegionHandle;
@@ -507,8 +509,10 @@ namespace OpenSim.Region.Scenes
remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours);
remoteClient.OnAddPrim += new GenericCall4(this.AddNewPrim);
remoteClient.OnUpdatePrimPosition += new UpdatePrimVector(this.UpdatePrimPosition);
/* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
remoteClient.OnRequestMapBlocks += new RequestMapBlocks(this.RequestMapBlocks);
remoteClient.OnTeleportLocationRequest += new TeleportLocationRequest(this.RequestTeleportLocation);
/* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest);
remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest);
remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest);
@@ -562,51 +566,7 @@ namespace OpenSim.Region.Scenes
return;
}
/// <summary>
///
/// </summary>
protected void InformClientOfNeighbours(IClientAPI remoteClient)
{
// Console.WriteLine("informing client of neighbouring regions");
List<RegionInfo> neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo);
//Console.WriteLine("we have " + neighbours.Count + " neighbouring regions");
if (neighbours != null)
{
for (int i = 0; i < neighbours.Count; i++)
{
// Console.WriteLine("sending neighbours data");
AgentCircuitData agent = remoteClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero;
agent.startpos = new LLVector3(128, 128, 70);
agent.child = true;
this.commsManager.InterSims.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent);
remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort);
}
}
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <returns></returns>
public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
{
return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle);
}
/// <summary>
///
/// </summary>
/// <param name="regionhandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
public void InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position)
{
this.commsManager.InterSims.ExpectAvatarCrossing(regionhandle, agentID, position);
}
/// <summary>
///
@@ -725,11 +685,97 @@ namespace OpenSim.Region.Scenes
{
if (this.Avatars.ContainsKey(agentID))
{
this.Avatars[agentID].Pos = position;
this.Avatars[agentID].UpGradeAvatar(position);
}
}
}
/// <summary>
///
/// </summary>
protected void InformClientOfNeighbours(IClientAPI remoteClient)
{
// Console.WriteLine("informing client of neighbouring regions");
List<RegionInfo> neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo);
//Console.WriteLine("we have " + neighbours.Count + " neighbouring regions");
if (neighbours != null)
{
for (int i = 0; i < neighbours.Count; i++)
{
// Console.WriteLine("sending neighbours data");
AgentCircuitData agent = remoteClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero;
agent.startpos = new LLVector3(128, 128, 70);
agent.child = true;
this.commsManager.InterRegion.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent);
remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort);
}
}
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <returns></returns>
public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
{
return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle);
}
/// <summary>
///
/// </summary>
/// <param name="minX"></param>
/// <param name="minY"></param>
/// <param name="maxX"></param>
/// <param name="maxY"></param>
public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY)
{
List<MapBlockData> mapBlocks;
mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
remoteClient.SendMapBlock(mapBlocks);
}
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="RegionHandle"></param>
/// <param name="position"></param>
/// <param name="lookAt"></param>
/// <param name="flags"></param>
public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags)
{
if (regionHandle == this.m_regionHandle)
{
if (this.Avatars.ContainsKey(remoteClient.AgentId))
{
remoteClient.SendTeleportLocationStart();
remoteClient.SendLocalTeleport(position, lookAt, flags);
this.Avatars[remoteClient.AgentId].Teleport(position);
}
}
else
{
remoteClient.SendTeleportCancel();
}
}
/// <summary>
///
/// </summary>
/// <param name="regionhandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
public void InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position)
{
this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position);
}
#endregion
/// <summary>

View File

@@ -39,6 +39,7 @@ using OpenSim.Framework.Types;
using OpenSim.Framework.Inventory;
using OpenSim.Region.Scripting;
using OpenSim.Terrain;
using OpenSim.Caches;
namespace OpenSim.Region.Scenes
{
@@ -54,6 +55,7 @@ namespace OpenSim.Region.Scenes
protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine
protected object m_syncRoot = new object();
private uint m_nextLocalId = 8880000;
protected AssetCache assetCache;
#region Update Methods
/// <summary>