diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 35 |
2 files changed, 20 insertions, 30 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6677dae..dcec7e9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -135,6 +135,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
135 | get { return ParentGroup.RootPart == this; } | 135 | get { return ParentGroup.RootPart == this; } |
136 | } | 136 | } |
137 | 137 | ||
138 | /// <summary> | ||
139 | /// Is an explicit sit target set for this part? | ||
140 | /// </summary> | ||
141 | public bool IsSitTargetSet | ||
142 | { | ||
143 | get | ||
144 | { | ||
145 | return | ||
146 | !(SitTargetPosition == Vector3.Zero | ||
147 | && (SitTargetOrientation == Quaternion.Identity // Valid Zero Rotation quaternion | ||
148 | || SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 1f && SitTargetOrientation.W == 0f // W-Z Mapping was invalid at one point | ||
149 | || SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f && SitTargetOrientation.W == 0f)); // Invalid Quaternion | ||
150 | } | ||
151 | } | ||
152 | |||
138 | #region Fields | 153 | #region Fields |
139 | 154 | ||
140 | public bool AllowedDrop; | 155 | public bool AllowedDrop; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c71bae9..c644ea5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1846,15 +1846,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1846 | //look for prims with explicit sit targets that are available | 1846 | //look for prims with explicit sit targets that are available |
1847 | foreach (SceneObjectPart part in partArray) | 1847 | foreach (SceneObjectPart part in partArray) |
1848 | { | 1848 | { |
1849 | // Is a sit target available? | 1849 | if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero) |
1850 | Vector3 avSitOffset = part.SitTargetPosition; | ||
1851 | Quaternion avSitOrientation = part.SitTargetOrientation; | ||
1852 | UUID avOnTargetAlready = part.SitTargetAvatar; | ||
1853 | |||
1854 | bool SitTargetUnOccupied = avOnTargetAlready == UUID.Zero; | ||
1855 | bool SitTargetisSet = avSitOffset != Vector3.Zero || avSitOrientation != Quaternion.Identity; | ||
1856 | |||
1857 | if (SitTargetisSet && SitTargetUnOccupied) | ||
1858 | { | 1850 | { |
1859 | //switch the target to this prim | 1851 | //switch the target to this prim |
1860 | return part; | 1852 | return part; |
@@ -1880,40 +1872,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
1880 | // TODO: determine position to sit at based on scene geometry; don't trust offset from client | 1872 | // TODO: determine position to sit at based on scene geometry; don't trust offset from client |
1881 | // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it | 1873 | // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it |
1882 | 1874 | ||
1883 | // Is a sit target available? | ||
1884 | Vector3 avSitOffSet = part.SitTargetPosition; | ||
1885 | Quaternion avSitOrientation = part.SitTargetOrientation; | ||
1886 | UUID avOnTargetAlready = part.SitTargetAvatar; | ||
1887 | |||
1888 | bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); | ||
1889 | bool SitTargetisSet = | ||
1890 | (!(avSitOffSet == Vector3.Zero && | ||
1891 | ( | ||
1892 | avSitOrientation == Quaternion.Identity // Valid Zero Rotation quaternion | ||
1893 | || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f && avSitOrientation.W == 0f // W-Z Mapping was invalid at one point | ||
1894 | || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion | ||
1895 | ) | ||
1896 | )); | ||
1897 | |||
1898 | // m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); | ||
1899 | |||
1900 | if (PhysicsActor != null) | 1875 | if (PhysicsActor != null) |
1901 | m_sitAvatarHeight = PhysicsActor.Size.Z; | 1876 | m_sitAvatarHeight = PhysicsActor.Size.Z; |
1902 | 1877 | ||
1903 | bool canSit = false; | 1878 | bool canSit = false; |
1904 | pos = part.AbsolutePosition + offset; | 1879 | pos = part.AbsolutePosition + offset; |
1905 | 1880 | ||
1906 | if (SitTargetisSet) | 1881 | if (part.IsSitTargetSet) |
1907 | { | 1882 | { |
1908 | if (SitTargetUnOccupied) | 1883 | if (part.SitTargetAvatar == UUID.Zero) |
1909 | { | 1884 | { |
1910 | // m_log.DebugFormat( | 1885 | // m_log.DebugFormat( |
1911 | // "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied", | 1886 | // "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied", |
1912 | // Name, part.Name, part.LocalId); | 1887 | // Name, part.Name, part.LocalId); |
1913 | 1888 | ||
1914 | part.SitTargetAvatar = UUID; | 1889 | part.SitTargetAvatar = UUID; |
1915 | offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); | 1890 | offset = part.SitTargetPosition; |
1916 | sitOrientation = avSitOrientation; | 1891 | sitOrientation = part.SitTargetOrientation; |
1917 | canSit = true; | 1892 | canSit = true; |
1918 | } | 1893 | } |
1919 | } | 1894 | } |