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

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

View File

@ -58,6 +58,11 @@ namespace OpenGrid.Framework.Communications.GridServer
{
return null;
}
public virtual RegionInfo RequestNeighbourInfo(ulong regionHandle)
{
return null;
}
}
}

View File

@ -54,5 +54,10 @@ namespace OpenGrid.Framework.Communications.GridServer
{
return sandBoxManager.RequestNeighbours(regionInfo);
}
public override RegionInfo RequestNeighbourInfo(ulong regionHandle)
{
return sandBoxManager.RequestNeighbourInfo(regionHandle);
}
}
}

View File

@ -42,5 +42,7 @@ namespace OpenGrid.Framework.Communications
/// <param name="agentData"></param>
/// <returns></returns>
public abstract bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
public abstract bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position);
}
}

View File

@ -52,5 +52,10 @@ namespace OpenGrid.Framework.Communications
{
return sandBoxManager.InformNeighbourOfChildAgent(regionHandle, agentData);
}
public override bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
{
return sandBoxManager.ExpectAvatarCrossing(regionHandle, agentID, position);
}
}
}

View File

@ -39,5 +39,10 @@ namespace OpenGrid.Framework.Communications
{
return false;
}
public override bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
{
return false;
}
}
}

View File

@ -95,6 +95,20 @@ namespace OpenGrid.Framework.Communications
return neighbours;
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <returns></returns>
public RegionInfo RequestNeighbourInfo(ulong regionHandle)
{
if (this.regions.ContainsKey(regionHandle))
{
return this.regions[regionHandle];
}
return null;
}
/// <summary>
/// </summary>
/// <param name="regionHandle"></param>
@ -112,6 +126,24 @@ namespace OpenGrid.Framework.Communications
return false;
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
/// <returns></returns>
public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
{
if (this.regionHosts.ContainsKey(regionHandle))
{
// Console.WriteLine("CommsManager- Informing a region to expect avatar crossing");
this.regionHosts[regionHandle].ExpectAvatarCrossing(regionHandle, agentID, position);
return true;
}
return false;
}
/// <summary>
/// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
/// </summary>

View File

@ -35,12 +35,13 @@ namespace OpenSim.Framework
{
public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent);
public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
public delegate void AgentCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position);
public interface IRegionCommsHost
{
event ExpectUserDelegate OnExpectUser;
event GenericCall2 OnExpectChildAgent;
event GenericCall2 OnAvatarCrossingIntoRegion;
event AgentCrossing OnAvatarCrossingIntoRegion;
event UpdateNeighbours OnNeighboursUpdate;
}
}

View File

@ -125,9 +125,10 @@ namespace OpenSim.Framework.Interfaces
void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
void SendLayerData(float[] map);
void MoveAgentIntoRegion(RegionInfo regInfo);
void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos);
void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort);
AgentCircuitData RequestClientInfo();
void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort);
void SendAvatarData(RegionInfo regionInfo, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos);
void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity);

View File

@ -37,7 +37,7 @@ namespace OpenSim.Framework
{
public event ExpectUserDelegate OnExpectUser;
public event GenericCall2 OnExpectChildAgent;
public event GenericCall2 OnAvatarCrossingIntoRegion;
public event AgentCrossing OnAvatarCrossingIntoRegion;
public event UpdateNeighbours OnNeighboursUpdate;
/// <summary>
@ -55,5 +55,15 @@ namespace OpenSim.Framework
return false;
}
public virtual bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
{
if (OnAvatarCrossingIntoRegion != null)
{
OnAvatarCrossingIntoRegion(regionHandle, agentID, position);
return true;
}
return false;
}
}
}

View File

@ -120,22 +120,22 @@ namespace OpenSim.Physics.BasicPhysicsPlugin
}
else
{
if (actor.Position.Y < -1)
if (actor.Position.Y < 0)
{
actor.Position.Y = -1;
actor.Position.Y = 0;
}
else if (actor.Position.Y > 257)
else if (actor.Position.Y > 256)
{
actor.Position.Y = 257;
actor.Position.Y = 256;
}
if (actor.Position.X < -1)
if (actor.Position.X < 0)
{
actor.Position.X = -1;
actor.Position.X = 0;
}
if (actor.Position.X > 257)
if (actor.Position.X > 256)
{
actor.Position.X = 257;
actor.Position.X = 256;
}
}
//}

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>

View File

@ -166,7 +166,7 @@ namespace OpenSim
///
/// </summary>
/// <param name="regInfo"></param>
public void MoveAgentIntoRegion(RegionInfo regInfo)
public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos)
{
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
mov.AgentData.SessionID = this.SessionID;
@ -174,7 +174,14 @@ namespace OpenSim
mov.Data.RegionHandle = regInfo.RegionHandle;
// TODO - dynamicalise this stuff
mov.Data.Timestamp = 1172750370;
mov.Data.Position = this.startpos;
if (pos != null)
{
mov.Data.Position = pos;
}
else
{
mov.Data.Position = this.startpos;
}
mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
OutPacket(mov);
@ -305,6 +312,29 @@ namespace OpenSim
return agentData;
}
public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort)
{
CrossedRegionPacket newSimPack = new CrossedRegionPacket();
newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
newSimPack.AgentData.AgentID = this.AgentID;
newSimPack.AgentData.SessionID = this.SessionID;
newSimPack.Info = new CrossedRegionPacket.InfoBlock();
newSimPack.Info.Position = pos;
newSimPack.Info.LookAt = lookAt; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
newSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock();
newSimPack.RegionData.RegionHandle = newRegionHandle;
byte[] byteIP = newRegionIP.GetAddressBytes();
newSimPack.RegionData.SimIP = (uint)byteIP[3] << 24;
newSimPack.RegionData.SimIP += (uint)byteIP[2] << 16;
newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8;
newSimPack.RegionData.SimIP += (uint)byteIP[0];
newSimPack.RegionData.SimPort = newRegionPort;
newSimPack.RegionData.SeedCapability = new byte[0];
this.OutPacket(newSimPack);
this.DowngradeClient();
}
#region Appearance/ Wearables Methods
/// <summary>

View File

@ -163,7 +163,6 @@ namespace OpenSim
{
OnCompleteMovementToRegion();
}
// this.EnableNeighbours();
break;
case PacketType.AgentUpdate:
if (OnAgentUpdate != null)

View File

@ -117,17 +117,22 @@ namespace OpenSim
{
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);
//this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode);
m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false);
OnChildAgentStatus(this.m_child);
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;
OnChildAgentStatus(this.m_child);
if (OnChildAgentStatus != null)
{
OnChildAgentStatus(this.m_child);
}
}
public void KillClient()