Very Preliminary border crossing added to sugilite. (Note: Sugilite doesn't have any backend ogs communication support yet so everything is Sandbox mode only )

This commit is contained in:
MW
2007-06-15 16:03:02 +00:00
parent 95676b2988
commit 17b4818b8e
17 changed files with 266 additions and 40 deletions

View File

@@ -32,6 +32,7 @@ using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Physics.Manager;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
namespace OpenSim.Region.Scenes
{
@@ -55,7 +56,24 @@ namespace OpenSim.Region.Scenes
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();
}
}
/// <summary>
@@ -147,5 +165,47 @@ namespace OpenSim.Region.Scenes
}
private 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;
uint neighboury = this.m_regionInfo.RegionLocY;
if (pos.X < 2)
{
neighbourx -= 1;
newpos.X = 254;
}
if (pos.X > 253)
{
neighbourx += 1;
newpos.X = 1;
}
if (pos.Y < 2)
{
neighboury -= 1;
newpos.Y = 254;
}
if (pos.Y > 253)
{
neighboury += 1;
newpos.Y = 1;
}
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.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort);
}
}
}
}

View File

@@ -102,10 +102,10 @@ namespace OpenSim.Region.Scenes
ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement);
ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition);
ControllingClient.OnAgentUpdate += new UpdateAgent(this.HandleAgentUpdate);
/* ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
// ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
*/
//ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
}
/// <summary>
@@ -129,7 +129,14 @@ namespace OpenSim.Region.Scenes
/// <param name="status"></param>
public void ChildStatusChange(bool status)
{
this.childAvatar = status;
if (this.childAvatar == true)
{
this.Velocity = new LLVector3(0, 0, 0);
this.Pos = new LLVector3(128, 128, 70);
}
}
/// <summary>
@@ -137,22 +144,17 @@ namespace OpenSim.Region.Scenes
/// </summary>
public override void addForces()
{
newForce = false;
lock (this.forcesList)
{
newForce = false;
{
if (this.forcesList.Count > 0)
{
for (int i = 0; i < this.forcesList.Count; i++)
{
NewForce force = this.forcesList[i];
PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
lock (m_world.SyncRoot)
{
this._physActor.Velocity = phyVector;
}
this.updateflag = true;
this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
// but as we are setting the velocity (rather than using real forces) at the moment it is okay.
this.Velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
this.newForce = true;
}
for (int i = 0; i < this.forcesList.Count; i++)
@@ -165,7 +167,9 @@ namespace OpenSim.Region.Scenes
public void SendTerseUpdateToClient(IClientAPI RemoteClient)
{
RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.localid, new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z), new LLVector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z));
LLVector3 pos = this.Pos;
LLVector3 vel = this.Velocity;
RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.localid, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z));
}
/// <summary>
@@ -185,7 +189,7 @@ namespace OpenSim.Region.Scenes
/// </summary>
public void CompleteMovement()
{
this.ControllingClient.MoveAgentIntoRegion(m_regionInfo);
this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos);
}
/// <summary>
@@ -240,10 +244,6 @@ namespace OpenSim.Region.Scenes
}
else
{
if (movementflag == 16)
{
movementflag = 0;
}
if ((movementflag) != 0)
{
NewForce newVelocity = new NewForce();
@@ -252,9 +252,6 @@ namespace OpenSim.Region.Scenes
newVelocity.Z = 0;
this.forcesList.Add(newVelocity);
movementflag = 0;
this.movementflag = 16;
}
}

View File

@@ -93,6 +93,41 @@ namespace OpenSim.Region.Scenes
}
}
public virtual LLVector3 Velocity
{
get
{
if (this._physActor != null)
{
velocity.X = _physActor.Velocity.X;
velocity.Y = _physActor.Velocity.Y;
velocity.Z = _physActor.Velocity.Z;
}
return velocity;
}
set
{
if (this._physActor != null)
{
try
{
lock (this.m_world.SyncRoot)
{
this._physActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
velocity = value;
}
}
/// <summary>
/// Creates a new Entity (should not occur on it's own)
/// </summary>

View File

@@ -580,12 +580,34 @@ namespace OpenSim.Region.Scenes
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>
///
/// </summary>
@@ -678,6 +700,7 @@ namespace OpenSim.Region.Scenes
if (this.regionCommsHost != null)
{
this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection);
this.regionCommsHost.OnAvatarCrossingIntoRegion += new AgentCrossing(this.AgentCrossing);
}
}
@@ -696,6 +719,17 @@ namespace OpenSim.Region.Scenes
}
}
public void AgentCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
{
if (regionHandle == this.m_regInfo.RegionHandle)
{
if (this.Avatars.ContainsKey(agentID))
{
this.Avatars[agentID].Pos = position;
}
}
}
#endregion
/// <summary>