Merge branch 'master' of /home/opensim/var/repo/opensim
commit
466d3793b1
|
@ -135,6 +135,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return ParentGroup.RootPart == this; }
|
get { return ParentGroup.RootPart == this; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Is an explicit sit target set for this part?
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSitTargetSet
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return
|
||||||
|
!(SitTargetPosition == Vector3.Zero
|
||||||
|
&& (SitTargetOrientation == Quaternion.Identity // Valid Zero Rotation quaternion
|
||||||
|
|| SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 1f && SitTargetOrientation.W == 0f // W-Z Mapping was invalid at one point
|
||||||
|
|| SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f && SitTargetOrientation.W == 0f)); // Invalid Quaternion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
public bool AllowedDrop;
|
public bool AllowedDrop;
|
||||||
|
@ -4510,6 +4525,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)
|
||||||
|
@ -4532,6 +4550,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
|
||||||
|
|
|
@ -1799,10 +1799,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset sit target.
|
|
||||||
if (part.SitTargetAvatar == UUID)
|
|
||||||
part.SitTargetAvatar = UUID.Zero;
|
|
||||||
|
|
||||||
ParentPosition = part.GetWorldPosition();
|
ParentPosition = part.GetWorldPosition();
|
||||||
ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
|
ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
|
||||||
|
|
||||||
|
@ -1846,15 +1842,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//look for prims with explicit sit targets that are available
|
//look for prims with explicit sit targets that are available
|
||||||
foreach (SceneObjectPart part in partArray)
|
foreach (SceneObjectPart part in partArray)
|
||||||
{
|
{
|
||||||
// Is a sit target available?
|
if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero)
|
||||||
Vector3 avSitOffset = part.SitTargetPosition;
|
|
||||||
Quaternion avSitOrientation = part.SitTargetOrientation;
|
|
||||||
UUID avOnTargetAlready = part.SitTargetAvatar;
|
|
||||||
|
|
||||||
bool SitTargetUnOccupied = avOnTargetAlready == UUID.Zero;
|
|
||||||
bool SitTargetisSet = avSitOffset != Vector3.Zero || avSitOrientation != Quaternion.Identity;
|
|
||||||
|
|
||||||
if (SitTargetisSet && SitTargetUnOccupied)
|
|
||||||
{
|
{
|
||||||
//switch the target to this prim
|
//switch the target to this prim
|
||||||
return part;
|
return part;
|
||||||
|
@ -1865,10 +1853,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return targetPart;
|
return targetPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendSitResponse(UUID targetID, Vector3 offset, Quaternion pSitOrientation)
|
private void SendSitResponse(UUID targetID, Vector3 offset, Quaternion sitOrientation)
|
||||||
{
|
{
|
||||||
Vector3 pos = new Vector3();
|
|
||||||
Quaternion sitOrientation = pSitOrientation;
|
|
||||||
Vector3 cameraEyeOffset = Vector3.Zero;
|
Vector3 cameraEyeOffset = Vector3.Zero;
|
||||||
Vector3 cameraAtOffset = Vector3.Zero;
|
Vector3 cameraAtOffset = Vector3.Zero;
|
||||||
bool forceMouselook = false;
|
bool forceMouselook = false;
|
||||||
|
@ -1880,43 +1866,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// TODO: determine position to sit at based on scene geometry; don't trust offset from client
|
// TODO: determine position to sit at based on scene geometry; don't trust offset from client
|
||||||
// see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
|
// see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
|
||||||
|
|
||||||
// Is a sit target available?
|
|
||||||
Vector3 avSitOffSet = part.SitTargetPosition;
|
|
||||||
Quaternion avSitOrientation = part.SitTargetOrientation;
|
|
||||||
UUID avOnTargetAlready = part.SitTargetAvatar;
|
|
||||||
|
|
||||||
bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero));
|
|
||||||
bool SitTargetisSet =
|
|
||||||
(!(avSitOffSet == Vector3.Zero &&
|
|
||||||
(
|
|
||||||
avSitOrientation == Quaternion.Identity // Valid Zero Rotation quaternion
|
|
||||||
|| avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f && avSitOrientation.W == 0f // W-Z Mapping was invalid at one point
|
|
||||||
|| avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied);
|
|
||||||
|
|
||||||
if (PhysicsActor != null)
|
if (PhysicsActor != null)
|
||||||
m_sitAvatarHeight = PhysicsActor.Size.Z;
|
m_sitAvatarHeight = PhysicsActor.Size.Z;
|
||||||
|
|
||||||
bool canSit = false;
|
bool canSit = false;
|
||||||
pos = part.AbsolutePosition + offset;
|
Vector3 pos = part.AbsolutePosition + offset;
|
||||||
|
|
||||||
if (SitTargetisSet)
|
if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero)
|
||||||
{
|
|
||||||
if (SitTargetUnOccupied)
|
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[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 = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z);
|
sitOrientation = part.SitTargetOrientation;
|
||||||
sitOrientation = avSitOrientation;
|
|
||||||
canSit = true;
|
canSit = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10)
|
if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10)
|
||||||
|
|
Loading…
Reference in New Issue