aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-09 21:24:32 +0100
committerJustin Clark-Casey (justincc)2012-07-09 21:24:32 +0100
commit2eaa6d5ace738cf1848f82ce7a0b435928b6846f (patch)
tree091add9a2885fbb702cf908e1b2f70f5d1730131 /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentMore keys for automated ini processing (diff)
downloadopensim-SC_OLD-2eaa6d5ace738cf1848f82ce7a0b435928b6846f.zip
opensim-SC_OLD-2eaa6d5ace738cf1848f82ce7a0b435928b6846f.tar.gz
opensim-SC_OLD-2eaa6d5ace738cf1848f82ce7a0b435928b6846f.tar.bz2
opensim-SC_OLD-2eaa6d5ace738cf1848f82ce7a0b435928b6846f.tar.xz
Do not allow a script to attach a prim if its being sat upon.
This prevents a stack overflow where a get position on the avatar will refer to the attachment which will in turn refer back to the avatar. This required recording of all sitting avatars on a prim which is done separately from recording the sit target avatar. Recording HashSet is null if there are no sitting avatars in order to save memory.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs18
1 files changed, 17 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index c7a670f..c6a2a03 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -578,6 +578,12 @@ namespace OpenSim.Region.Framework.Scenes
578 public uint ParentID { get; set; } 578 public uint ParentID { get; set; }
579 579
580 /// <summary> 580 /// <summary>
581 /// Are we sitting on an object?
582 /// </summary>
583 /// <remarks>A more readable way of testing presence sit status than ParentID == 0</remarks>
584 public bool IsSatOnObject { get { return ParentID != 0; } }
585
586 /// <summary>
581 /// If the avatar is sitting, the prim that it's sitting on. If not sitting then null. 587 /// If the avatar is sitting, the prim that it's sitting on. If not sitting then null.
582 /// </summary> 588 /// </summary>
583 /// <remarks> 589 /// <remarks>
@@ -1808,6 +1814,8 @@ namespace OpenSim.Region.Framework.Scenes
1808 SendAvatarDataToAllAgents(); 1814 SendAvatarDataToAllAgents();
1809 m_requestedSitTargetID = 0; 1815 m_requestedSitTargetID = 0;
1810 1816
1817 part.RemoveSittingAvatar(UUID);
1818
1811 if (part != null) 1819 if (part != null)
1812 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 1820 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
1813 } 1821 }
@@ -1887,7 +1895,7 @@ namespace OpenSim.Region.Framework.Scenes
1887 ) 1895 )
1888 )); 1896 ));
1889 1897
1890// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); 1898 m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied);
1891 1899
1892 if (PhysicsActor != null) 1900 if (PhysicsActor != null)
1893 m_sitAvatarHeight = PhysicsActor.Size.Z; 1901 m_sitAvatarHeight = PhysicsActor.Size.Z;
@@ -1920,6 +1928,12 @@ namespace OpenSim.Region.Framework.Scenes
1920 AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); 1928 AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight);
1921 canSit = true; 1929 canSit = true;
1922 } 1930 }
1931// else
1932// {
1933// m_log.DebugFormat(
1934// "[SCENE PRESENCE]: Ignoring sit request of {0} on {1} {2} because sit target is unset and outside 10m",
1935// Name, part.Name, part.LocalId);
1936// }
1923 } 1937 }
1924 1938
1925 if (canSit) 1939 if (canSit)
@@ -1930,6 +1944,8 @@ namespace OpenSim.Region.Framework.Scenes
1930 RemoveFromPhysicalScene(); 1944 RemoveFromPhysicalScene();
1931 } 1945 }
1932 1946
1947 part.AddSittingAvatar(UUID);
1948
1933 cameraAtOffset = part.GetCameraAtOffset(); 1949 cameraAtOffset = part.GetCameraAtOffset();
1934 cameraEyeOffset = part.GetCameraEyeOffset(); 1950 cameraEyeOffset = part.GetCameraEyeOffset();
1935 forceMouselook = part.GetForceMouselook(); 1951 forceMouselook = part.GetForceMouselook();