refactor: move management of SOP.SitTargetAvatar into SOP.AddSittingAvatar() and SOP.RemoveSittingAvatar()
parent
b34fd50155
commit
56d894ae24
|
@ -4835,6 +4835,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name='avatarId'></param>
|
/// <param name='avatarId'></param>
|
||||||
protected internal bool AddSittingAvatar(UUID avatarId)
|
protected internal bool AddSittingAvatar(UUID avatarId)
|
||||||
{
|
{
|
||||||
|
if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
|
||||||
|
SitTargetAvatar = avatarId;
|
||||||
|
|
||||||
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
||||||
|
|
||||||
if (sittingAvatars == null)
|
if (sittingAvatars == null)
|
||||||
|
@ -4857,6 +4860,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name='avatarId'></param>
|
/// <param name='avatarId'></param>
|
||||||
protected internal bool RemoveSittingAvatar(UUID avatarId)
|
protected internal bool RemoveSittingAvatar(UUID avatarId)
|
||||||
{
|
{
|
||||||
|
if (SitTargetAvatar == avatarId)
|
||||||
|
SitTargetAvatar = UUID.Zero;
|
||||||
|
|
||||||
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
||||||
|
|
||||||
// This can occur under a race condition where another thread
|
// This can occur under a race condition where another thread
|
||||||
|
|
|
@ -519,19 +519,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// in the sim unless the avatar is on a sit target. While
|
// in the sim unless the avatar is on a sit target. While
|
||||||
// on a sit target, m_pos will contain the desired offset
|
// on a sit target, m_pos will contain the desired offset
|
||||||
// without the parent rotation applied.
|
// without the parent rotation applied.
|
||||||
if (ParentID != 0)
|
SceneObjectPart sitPart = ParentPart;
|
||||||
{
|
|
||||||
SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID);
|
if (sitPart != null)
|
||||||
if (part != null)
|
return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation());
|
||||||
{
|
|
||||||
return part.AbsolutePosition + (m_pos * part.GetWorldRotation());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ParentPosition + m_pos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_pos;
|
return m_pos;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
|
@ -1846,36 +1839,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (ParentID != 0)
|
if (ParentID != 0)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID);
|
SceneObjectPart part = ParentPart;
|
||||||
if (part != null)
|
TaskInventoryDictionary taskIDict = part.TaskInventory;
|
||||||
|
if (taskIDict != null)
|
||||||
{
|
{
|
||||||
TaskInventoryDictionary taskIDict = part.TaskInventory;
|
lock (taskIDict)
|
||||||
if (taskIDict != null)
|
|
||||||
{
|
{
|
||||||
lock (taskIDict)
|
foreach (UUID taskID in taskIDict.Keys)
|
||||||
{
|
{
|
||||||
foreach (UUID taskID in taskIDict.Keys)
|
UnRegisterControlEventsToScript(LocalId, taskID);
|
||||||
{
|
taskIDict[taskID].PermsMask &= ~(
|
||||||
UnRegisterControlEventsToScript(LocalId, taskID);
|
2048 | //PERMISSION_CONTROL_CAMERA
|
||||||
taskIDict[taskID].PermsMask &= ~(
|
4); // PERMISSION_TAKE_CONTROLS
|
||||||
2048 | //PERMISSION_CONTROL_CAMERA
|
|
||||||
4); // PERMISSION_TAKE_CONTROLS
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset sit target.
|
|
||||||
if (part.SitTargetAvatar == UUID)
|
|
||||||
part.SitTargetAvatar = UUID.Zero;
|
|
||||||
|
|
||||||
ParentPosition = part.GetWorldPosition();
|
|
||||||
ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ParentPosition = part.GetWorldPosition();
|
||||||
|
ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
|
||||||
|
|
||||||
m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
|
m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
|
||||||
ParentPosition = Vector3.Zero;
|
ParentPosition = Vector3.Zero;
|
||||||
|
|
||||||
ParentID = 0;
|
ParentID = 0;
|
||||||
|
ParentPart = null;
|
||||||
SendAvatarDataToAllAgents();
|
SendAvatarDataToAllAgents();
|
||||||
m_requestedSitTargetID = 0;
|
m_requestedSitTargetID = 0;
|
||||||
|
|
||||||
|
@ -1949,7 +1936,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied",
|
// "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied",
|
||||||
// Name, part.Name, part.LocalId);
|
// Name, part.Name, part.LocalId);
|
||||||
|
|
||||||
part.SitTargetAvatar = UUID;
|
|
||||||
offset = part.SitTargetPosition;
|
offset = part.SitTargetPosition;
|
||||||
sitOrientation = part.SitTargetOrientation;
|
sitOrientation = part.SitTargetOrientation;
|
||||||
canSit = true;
|
canSit = true;
|
||||||
|
@ -2299,6 +2285,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
|
||||||
ParentID = m_requestedSitTargetID;
|
ParentID = m_requestedSitTargetID;
|
||||||
|
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
|
|
Loading…
Reference in New Issue