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>
|
||||
protected internal bool AddSittingAvatar(UUID avatarId)
|
||||
{
|
||||
if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
|
||||
SitTargetAvatar = avatarId;
|
||||
|
||||
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
||||
|
||||
if (sittingAvatars == null)
|
||||
|
@ -4857,6 +4860,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name='avatarId'></param>
|
||||
protected internal bool RemoveSittingAvatar(UUID avatarId)
|
||||
{
|
||||
if (SitTargetAvatar == avatarId)
|
||||
SitTargetAvatar = UUID.Zero;
|
||||
|
||||
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
||||
|
||||
// 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
|
||||
// on a sit target, m_pos will contain the desired offset
|
||||
// without the parent rotation applied.
|
||||
if (ParentID != 0)
|
||||
{
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID);
|
||||
if (part != null)
|
||||
{
|
||||
return part.AbsolutePosition + (m_pos * part.GetWorldRotation());
|
||||
}
|
||||
else
|
||||
{
|
||||
return ParentPosition + m_pos;
|
||||
}
|
||||
}
|
||||
SceneObjectPart sitPart = ParentPart;
|
||||
|
||||
if (sitPart != null)
|
||||
return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation());
|
||||
}
|
||||
|
||||
return m_pos;
|
||||
}
|
||||
set
|
||||
|
@ -1846,36 +1839,30 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (ParentID != 0)
|
||||
{
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID);
|
||||
if (part != null)
|
||||
SceneObjectPart part = ParentPart;
|
||||
TaskInventoryDictionary taskIDict = part.TaskInventory;
|
||||
if (taskIDict != null)
|
||||
{
|
||||
TaskInventoryDictionary taskIDict = part.TaskInventory;
|
||||
if (taskIDict != null)
|
||||
lock (taskIDict)
|
||||
{
|
||||
lock (taskIDict)
|
||||
foreach (UUID taskID in taskIDict.Keys)
|
||||
{
|
||||
foreach (UUID taskID in taskIDict.Keys)
|
||||
{
|
||||
UnRegisterControlEventsToScript(LocalId, taskID);
|
||||
taskIDict[taskID].PermsMask &= ~(
|
||||
2048 | //PERMISSION_CONTROL_CAMERA
|
||||
4); // PERMISSION_TAKE_CONTROLS
|
||||
}
|
||||
UnRegisterControlEventsToScript(LocalId, taskID);
|
||||
taskIDict[taskID].PermsMask &= ~(
|
||||
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);
|
||||
ParentPosition = Vector3.Zero;
|
||||
|
||||
ParentID = 0;
|
||||
ParentPart = null;
|
||||
SendAvatarDataToAllAgents();
|
||||
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",
|
||||
// Name, part.Name, part.LocalId);
|
||||
|
||||
part.SitTargetAvatar = UUID;
|
||||
offset = part.SitTargetPosition;
|
||||
sitOrientation = part.SitTargetOrientation;
|
||||
canSit = true;
|
||||
|
@ -2299,6 +2285,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
|
||||
ParentID = m_requestedSitTargetID;
|
||||
|
||||
Velocity = Vector3.Zero;
|
||||
|
|
Loading…
Reference in New Issue