First part of border crossing fix.

zircon^2
MW 2007-05-25 19:09:19 +00:00
parent b2d588ed1c
commit 64741b55a6
8 changed files with 138 additions and 86 deletions

View File

@ -24,6 +24,11 @@ namespace OpenSim.Framework.Interfaces
event StartAnim OnStartAnim; event StartAnim OnStartAnim;
event LinkObjects OnLinkObjects; event LinkObjects OnLinkObjects;
LLVector3 StartPos
{
get;
set;
}
void SendAppearance(AvatarWearable[] wearables); void SendAppearance(AvatarWearable[] wearables);
void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
} }

View File

@ -30,6 +30,7 @@ namespace OpenSim
public delegate void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient); public delegate void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient);
public delegate void UpdatePrimVector(uint localID, LLVector3 pos, ClientView remoteClient); public delegate void UpdatePrimVector(uint localID, LLVector3 pos, ClientView remoteClient);
public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient); public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient);
public delegate void StatusChange(bool status);
public event ChatFromViewer OnChatFromViewer; public event ChatFromViewer OnChatFromViewer;
public event RezObject OnRezObject; public event RezObject OnRezObject;
@ -51,6 +52,7 @@ namespace OpenSim
public event UpdatePrimVector OnUpdatePrimPosition; public event UpdatePrimVector OnUpdatePrimPosition;
public event UpdatePrimRotation OnUpdatePrimRotation; public event UpdatePrimRotation OnUpdatePrimRotation;
public event UpdatePrimVector OnUpdatePrimScale; public event UpdatePrimVector OnUpdatePrimScale;
public event StatusChange OnChildAgentStatus;
protected override void ProcessInPacket(Packet Pack) protected override void ProcessInPacket(Packet Pack)
{ {

View File

@ -86,6 +86,18 @@ namespace OpenSim
} }
} }
public LLVector3 StartPos
{
get
{
return startpos;
}
set
{
startpos = value;
}
}
public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, ClientView> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat, AuthenticateSessionsBase authenSessions) public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, ClientView> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat, AuthenticateSessionsBase authenSessions)
{ {
m_world = world; m_world = world;
@ -133,21 +145,23 @@ namespace OpenSim
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent");
this.m_child = false; this.m_child = false;
this.m_world.RemoveViewerAgent(this); //this.m_world.RemoveViewerAgent(this);
if (!this.m_sandboxMode) if (!this.m_sandboxMode)
{ {
this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode);
m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false);
} }
this.InitNewClient(); OnChildAgentStatus(this.m_child);
//this.InitNewClient();
} }
public void DowngradeClient() public void DowngradeClient()
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child");
this.m_child = true; this.m_child = true;
this.m_world.RemoveViewerAgent(this); OnChildAgentStatus(this.m_child);
this.m_world.AddViewerAgent(this); //this.m_world.RemoveViewerAgent(this);
//this.m_world.AddViewerAgent(this);
} }
public void KillClient() public void KillClient()
@ -256,11 +270,7 @@ namespace OpenSim
protected virtual void InitNewClient() protected virtual void InitNewClient()
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
this.ClientAvatar = m_world.AddViewerAgent(this);
m_world.AddViewerAgent(this);
world.Entity tempent = m_world.Entities[this.AgentID];
this.ClientAvatar = (world.Avatar)tempent;
} }
protected virtual void AuthUser() protected virtual void AuthUser()
@ -280,7 +290,7 @@ namespace OpenSim
this.AgentID = cirpack.CircuitCode.ID; this.AgentID = cirpack.CircuitCode.ID;
this.SessionID = cirpack.CircuitCode.SessionID; this.SessionID = cirpack.CircuitCode.SessionID;
this.CircuitCode = cirpack.CircuitCode.Code; this.CircuitCode = cirpack.CircuitCode.Code;
InitNewClient(); //shouldn't be called here as we might be a child agent and not want a full avatar InitNewClient();
this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; this.ClientAvatar.firstname = sessionInfo.LoginInfo.First;
this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last;
if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero)

View File

@ -58,7 +58,6 @@ namespace OpenSim
{ {
if (this._localWorld != null) if (this._localWorld != null)
{ {
//ClientView.AddPacketHandler(PacketType.DeRezObject, _localWorld.DeRezObject);
ClientView.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName); ClientView.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName);
} }
} }

View File

@ -9,6 +9,8 @@ namespace OpenSim.world
partial class Avatar partial class Avatar
{ {
public override void update() public override void update()
{
if (!this.childAvatar)
{ {
if (this._physActor == null) if (this._physActor == null)
{ {
@ -91,8 +93,10 @@ namespace OpenSim.world
ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
} }
} }
}
} }
public void SendUpdateToOtherClient(Avatar remoteAvatar) public void SendUpdateToOtherClient(Avatar remoteAvatar)
{ {
ObjectUpdatePacket objupdate = CreateUpdatePacket(); ObjectUpdatePacket objupdate = CreateUpdatePacket();

View File

@ -35,7 +35,7 @@ namespace OpenSim.world
private string m_regionName; private string m_regionName;
private ushort m_regionWaterHeight; private ushort m_regionWaterHeight;
private bool m_regionTerraform; private bool m_regionTerraform;
//private bool childShadowAvatar = false; private bool childAvatar = false;
public Avatar(ClientView TheClient, World world, string regionName, Dictionary<uint, ClientView> clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) public Avatar(ClientView TheClient, World world, string regionName, Dictionary<uint, ClientView> clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater)
{ {
@ -72,6 +72,7 @@ namespace OpenSim.world
ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.SendInitialPosition); ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.SendInitialPosition);
ControllingClient.OnAgentUpdate += new ClientView.GenericCall3(this.HandleAgentUpdate); ControllingClient.OnAgentUpdate += new ClientView.GenericCall3(this.HandleAgentUpdate);
ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
ControllingClient.OnChildAgentStatus += new ClientView.StatusChange(this.ChildStatusChange);
} }
@ -87,6 +88,35 @@ namespace OpenSim.world
} }
} }
public void ChildStatusChange(bool status)
{
this.childAvatar = status;
if (this.childAvatar == true)
{
this._physActor.Velocity = new PhysicsVector(0, 0, 0);
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
terse.RegionData.TimeDilation = 64096;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = terseBlock;
List<Avatar> avList = this.m_world.RequestAvatarList();
foreach (Avatar client in avList)
{
client.SendPacketToViewer(terse);
}
}
else
{
LLVector3 startp = ControllingClient.StartPos;
lock (m_world.LockPhysicsEngine)
{
this._physActor.Position = new PhysicsVector(startp.X, startp.Y, startp.Z);
}
}
}
public override void addForces() public override void addForces()
{ {
lock (this.forcesList) lock (this.forcesList)

View File

@ -530,7 +530,7 @@ namespace OpenSim.world
#region Add/Remove Avatar Methods #region Add/Remove Avatar Methods
public override void AddViewerAgent(ClientView agentClient) public override Avatar AddViewerAgent(ClientView agentClient)
{ {
//register for events //register for events
agentClient.OnChatFromViewer += new ChatFromViewer(this.SimChat); agentClient.OnChatFromViewer += new ChatFromViewer(this.SimChat);
@ -549,22 +549,23 @@ namespace OpenSim.world
agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation); agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation);
agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale); agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale);
agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject); agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject);
Avatar newAvatar = null;
try try
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
Avatar newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle, true, 20); newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle, true, 20);
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world");
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake "); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake ");
newAvatar.SendRegionHandshake(this); newAvatar.SendRegionHandshake(this);
if (!agentClient.m_child) //if (!agentClient.m_child)
{ //{
PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
lock (this.LockPhysicsEngine) lock (this.LockPhysicsEngine)
{ {
newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); newAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
} }
} // }
lock (Entities) lock (Entities)
{ {
if (!Entities.ContainsKey(agentClient.AgentID)) if (!Entities.ContainsKey(agentClient.AgentID))
@ -592,6 +593,7 @@ namespace OpenSim.world
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddViewerAgent() - Failed with exception " + e.ToString());
} }
return newAvatar;
} }
public override void RemoveViewerAgent(ClientView agentClient) public override void RemoveViewerAgent(ClientView agentClient)
@ -608,7 +610,7 @@ namespace OpenSim.world
} }
if (agentClient.ClientAvatar.PhysActor != null) if (agentClient.ClientAvatar.PhysActor != null)
{ {
//this.phyScene.RemoveAvatar(agentClient.ClientAvatar.PhysActor); this.phyScene.RemoveAvatar(agentClient.ClientAvatar.PhysActor);
} }
} }
catch (Exception e) catch (Exception e)

View File

@ -148,9 +148,9 @@ namespace OpenSim.world
/// Add a new Agent's avatar /// Add a new Agent's avatar
/// </summary> /// </summary>
/// <param name="agentClient"></param> /// <param name="agentClient"></param>
public virtual void AddViewerAgent(ClientView agentClient) public virtual Avatar AddViewerAgent(ClientView agentClient)
{ {
return null;
} }
/// <summary> /// <summary>