MESS: changes in MakeRootAgent and CompleteMovement reordering things.

Added sending of land overlay and parcel information. This in order to
only send avatar related information after having its position well
defined and on the right parcel. THIS MAY STILL BE BAD :)
avinationmerge
UbitUmarov 2014-07-31 03:10:50 +01:00
parent 30f00bfb14
commit a5e9429f2b
6 changed files with 151 additions and 30 deletions

View File

@ -93,5 +93,7 @@ namespace OpenSim.Region.Framework.Interfaces
void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
void sendClientInitialLandInfo(IClientAPI remoteClient);
} }
} }

View File

@ -213,7 +213,13 @@ namespace OpenSim.Region.CoreModules.World.Land
m_landManagementModule.setParcelOtherCleanTime(remoteClient, localID, otherCleanTime); m_landManagementModule.setParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
} }
} }
public void sendClientInitialLandInfo(IClientAPI remoteClient)
{
if (m_landManagementModule != null)
{
m_landManagementModule.sendClientInitialLandInfo(remoteClient);
}
}
#endregion #endregion
} }
} }

View File

@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Land
m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;
m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
lock (m_scene) lock (m_scene)
{ {
m_scene.LandChannel = (ILandChannel)landChannel; m_scene.LandChannel = (ILandChannel)landChannel;
@ -194,13 +194,14 @@ namespace OpenSim.Region.CoreModules.World.Land
client.OnParcelEjectUser += ClientOnParcelEjectUser; client.OnParcelEjectUser += ClientOnParcelEjectUser;
client.OnParcelFreezeUser += ClientOnParcelFreezeUser; client.OnParcelFreezeUser += ClientOnParcelFreezeUser;
client.OnSetStartLocationRequest += ClientOnSetHome; client.OnSetStartLocationRequest += ClientOnSetHome;
/* avatar is still a child here position is unknow
EntityBase presenceEntity; EntityBase presenceEntity;
if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence)
{ {
SendParcelOverlay(client); SendParcelOverlay(client);
SendLandUpdate((ScenePresence)presenceEntity, true); SendLandUpdate((ScenePresence)presenceEntity, true);
} }
*/
} }
public void EventMakeChildAgent(ScenePresence avatar) public void EventMakeChildAgent(ScenePresence avatar)
@ -385,12 +386,29 @@ namespace OpenSim.Region.CoreModules.World.Land
return; return;
} }
public void sendClientInitialLandInfo(IClientAPI remoteClient)
{
SendParcelOverlay(remoteClient);
ScenePresence avatar;
if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out avatar))
return;
if (avatar.IsChildAgent)
return;
ILandObject over = GetLandObject(avatar.AbsolutePosition.X,avatar.AbsolutePosition.Y);
if (over == null)
return;
avatar.currentParcelUUID = over.LandData.GlobalID;
over.SendLandUpdateToClient(avatar.ControllingClient);
}
public void SendLandUpdate(ScenePresence avatar, bool force) public void SendLandUpdate(ScenePresence avatar, bool force)
{ {
if (avatar.IsChildAgent) if (avatar.IsChildAgent)
return; return;
ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X,avatar.AbsolutePosition.Y); ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
if (over != null) if (over != null)
{ {

View File

@ -140,8 +140,67 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public static readonly float SIGNIFICANT_MOVEMENT = 2.0f; public static readonly float SIGNIFICANT_MOVEMENT = 2.0f;
public UUID currentParcelUUID = UUID.Zero; private UUID m_currentParcelUUID = UUID.Zero;
private object parcelLock = new Object();
public UUID currentParcelUUID
{
get { return m_currentParcelUUID; }
set
{
lock (parcelLock)
{
m_currentParcelUUID = value;
}
}
}
public bool ParcelAllowThisAvatarSounds
{
get
{
try
{
lock (parcelLock)
{
ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y);
if (land == null)
return true;
if (land.LandData.AnyAVSounds)
return true;
if (!land.LandData.GroupAVSounds)
return false;
return land.LandData.GroupID == ControllingClient.ActiveGroupId;
}
}
catch
{
return true;
}
}
}
public bool ParcelHideThisAvatar
{
get
{
try
{
lock (parcelLock)
{
ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y);
if (land == null || !land.LandData.SeeAVs)
return false;
return true;
}
}
catch
{
return false;
}
}
}
/// <value> /// <value>
/// The animator for this avatar /// The animator for this avatar
/// </value> /// </value>
@ -482,21 +541,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public bool ParcelAllowThisAvatarSounds
{
get
{
ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y);
if (land == null)
return true;
if (land.LandData.AnyAVSounds)
return true;
if (!land.LandData.GroupAVSounds)
return false;
return land.LandData.GroupID == ControllingClient.ActiveGroupId;
}
}
public byte State { get; set; } public byte State { get; set; }
@ -1023,6 +1068,9 @@ namespace OpenSim.Region.Framework.Scenes
/// This method is on the critical path for transferring an avatar from one region to another. Delay here /// This method is on the critical path for transferring an avatar from one region to another. Delay here
/// delays that crossing. /// delays that crossing.
/// </remarks> /// </remarks>
// only in use as part of completemovement
private bool MakeRootAgent(Vector3 pos, bool isFlying) private bool MakeRootAgent(Vector3 pos, bool isFlying)
{ {
lock (m_completeMovementLock) lock (m_completeMovementLock)
@ -1229,6 +1277,7 @@ namespace OpenSim.Region.Framework.Scenes
// //
// One cannot simply iterate over attachments in a fire and forget thread because this would no longer // One cannot simply iterate over attachments in a fire and forget thread because this would no longer
// be locked, allowing race conditions if other code changes the attachments list. // be locked, allowing race conditions if other code changes the attachments list.
List<SceneObjectGroup> attachments = GetAttachments(); List<SceneObjectGroup> attachments = GetAttachments();
if (attachments.Count > 0) if (attachments.Count > 0)
@ -1236,16 +1285,19 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat( m_log.DebugFormat(
"[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
// Resume scripts // Resume scripts this possible should also be moved down after sending the avatar to viewer ?
foreach (SceneObjectGroup sog in attachments) foreach (SceneObjectGroup sog in attachments)
{ {
sog.ScheduleGroupForFullUpdate(); // sending attachments before the avatar ?
// moved to completemovement where it already was
// sog.ScheduleGroupForFullUpdate();
sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
sog.ResumeScripts(); sog.ResumeScripts();
} }
} }
} }
/*
SendAvatarDataToAllAgents(); SendAvatarDataToAllAgents();
// send the animations of the other presences to me // send the animations of the other presences to me
@ -1254,6 +1306,7 @@ namespace OpenSim.Region.Framework.Scenes
if (presence != this) if (presence != this)
presence.Animator.SendAnimPackToClient(ControllingClient); presence.Animator.SendAnimPackToClient(ControllingClient);
}); });
*/
// If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
// stall on the border crossing since the existing child agent will still have the last movement // stall on the border crossing since the existing child agent will still have the last movement
@ -1421,6 +1474,9 @@ namespace OpenSim.Region.Framework.Scenes
public void StopFlying() public void StopFlying()
{ {
if (IsInTransit)
return;
Vector3 pos = AbsolutePosition; Vector3 pos = AbsolutePosition;
if (Appearance.AvatarHeight != 127.0f) if (Appearance.AvatarHeight != 127.0f)
pos += new Vector3(0f, 0f, (Appearance.AvatarHeight / 6f)); pos += new Vector3(0f, 0f, (Appearance.AvatarHeight / 6f));
@ -1661,9 +1717,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.InfoFormat( m_log.InfoFormat(
"[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}", "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
client.Name, Scene.Name, AbsolutePosition); client.Name, Scene.Name, AbsolutePosition);
m_inTransit = true; m_inTransit = true;
try try
{ {
@ -1709,8 +1763,9 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
// Remember in HandleUseCircuitCode, we delayed this to here // Remember in HandleUseCircuitCode, we delayed this to here
if (m_teleportFlags > 0) // this prims etc, moved down
SendInitialDataToMe(); // if (m_teleportFlags > 0)
// SendInitialDataToMe();
// m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); // m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
@ -1742,6 +1797,20 @@ namespace OpenSim.Region.Framework.Scenes
// client.Name, client.AgentId, m_scene.RegionInfo.RegionName); // client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
// } // }
// send initial land overlay and parcel
if (!IsChildAgent)
{
ILandChannel landch = m_scene.LandChannel;
if (landch != null)
{
landch.sendClientInitialLandInfo(client);
}
}
// send agentData to all clients including us (?)
// get appearance
// if in cache sent it to all clients
// send what we have to us, even if not in cache ( bad? )
ValidateAndSendAppearanceAndAgentData(); ValidateAndSendAppearanceAndAgentData();
// Create child agents in neighbouring regions // Create child agents in neighbouring regions
@ -1750,11 +1819,11 @@ namespace OpenSim.Region.Framework.Scenes
IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
if (m_agentTransfer != null) if (m_agentTransfer != null)
m_agentTransfer.EnableChildAgents(this); m_agentTransfer.EnableChildAgents(this);
/* moved down
IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
if (friendsModule != null) if (friendsModule != null)
friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
*/
} }
// XXX: If we force an update here, then multiple attachments do appear correctly on a destination region // XXX: If we force an update here, then multiple attachments do appear correctly on a destination region
@ -1769,6 +1838,27 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
// send the rest of the world
if (m_teleportFlags > 0)
SendInitialDataToMe();
if (!IsChildAgent)
{
// moved from makeroot missing in sendInitialDataToMe ?
m_scene.ForEachRootScenePresence(delegate(ScenePresence presence)
{
if (presence != this)
presence.Animator.SendAnimPackToClient(ControllingClient);
});
if (openChildAgents)
{
IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
if (friendsModule != null)
friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
}
}
} }
finally finally
{ {
@ -1864,6 +1954,9 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
if (IsInTransit)
return;
#region Sanity Checking #region Sanity Checking
// This is irritating. Really. // This is irritating. Really.
@ -3307,13 +3400,13 @@ namespace OpenSim.Region.Framework.Scenes
SendAvatarDataToAllAgents(); SendAvatarDataToAllAgents();
// This invocation always shows up in the viewer logs as an error. Is it needed? // This invocation always shows up in the viewer logs as an error. Is it needed?
// try to send what we have even if not in cache
SendAppearanceToAgent(this); SendAppearanceToAgent(this);
// If we are using the the cached appearance then send it out to everyone // If we are using the the cached appearance then send it out to everyone
if (cachedappearance) if (cachedappearance)
{ {
m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name); m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name);
// If the avatars baked textures are all in the cache, then we have a // If the avatars baked textures are all in the cache, then we have a
// complete appearance... send it out, if not, then we'll send it when // complete appearance... send it out, if not, then we'll send it when
// the avatar finishes updating its appearance // the avatar finishes updating its appearance

View File

@ -196,6 +196,7 @@ namespace OpenSim.Region.RegionCombinerModule
RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime); RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
} }
public void sendClientInitialLandInfo(IClientAPI remoteClient) { }
#endregion #endregion
} }
} }

View File

@ -111,5 +111,6 @@ namespace OpenSim.Tests.Common.Mock
public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {}
public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {}
public void sendClientInitialLandInfo(IClientAPI remoteClient) { }
} }
} }