aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorMelanie2012-02-15 01:11:35 +0000
committerMelanie2012-02-15 01:11:35 +0000
commit7be9ba55642868cb21b09908fb49635fa387fd17 (patch)
tree12e5be55b2130942338a447bdceab7576dc7c4dd /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentMerge branch 'master' into careminster (diff)
parentImplement region crossing of sitting avatars. Edit mode and llSetPos work (diff)
downloadopensim-SC_OLD-7be9ba55642868cb21b09908fb49635fa387fd17.zip
opensim-SC_OLD-7be9ba55642868cb21b09908fb49635fa387fd17.tar.gz
opensim-SC_OLD-7be9ba55642868cb21b09908fb49635fa387fd17.tar.bz2
opensim-SC_OLD-7be9ba55642868cb21b09908fb49635fa387fd17.tar.xz
Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs139
1 files changed, 88 insertions, 51 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 13854c7..429fc06 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -233,6 +233,8 @@ namespace OpenSim.Region.Framework.Scenes
233 private bool m_collisionEventFlag = false; 233 private bool m_collisionEventFlag = false;
234 private object m_collisionEventLock = new Object(); 234 private object m_collisionEventLock = new Object();
235 235
236 private Vector3 m_prevSitOffset;
237
236 protected AvatarAppearance m_appearance; 238 protected AvatarAppearance m_appearance;
237 239
238 public AvatarAppearance Appearance 240 public AvatarAppearance Appearance
@@ -644,6 +646,13 @@ namespace OpenSim.Region.Framework.Scenes
644 } 646 }
645 private uint m_parentID; 647 private uint m_parentID;
646 648
649 public UUID ParentUUID
650 {
651 get { return m_parentUUID; }
652 set { m_parentUUID = value; }
653 }
654 private UUID m_parentUUID = UUID.Zero;
655
647 public float Health 656 public float Health
648 { 657 {
649 get { return m_health; } 658 get { return m_health; }
@@ -865,7 +874,26 @@ namespace OpenSim.Region.Framework.Scenes
865 "[SCENE]: Upgrading child to root agent for {0} in {1}", 874 "[SCENE]: Upgrading child to root agent for {0} in {1}",
866 Name, m_scene.RegionInfo.RegionName); 875 Name, m_scene.RegionInfo.RegionName);
867 876
868 //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); 877 if (ParentUUID != UUID.Zero)
878 {
879 m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID);
880 SceneObjectPart part = m_scene.GetSceneObjectPart(ParentUUID);
881 if (part == null)
882 {
883 m_log.ErrorFormat("[SCENE PRESENCE]: Can't find prim {0} to sit on", ParentUUID);
884 }
885 else
886 {
887 part.ParentGroup.AddAvatar(UUID);
888 if (part.SitTargetPosition != Vector3.Zero)
889 part.SitTargetAvatar = UUID;
890 ParentPosition = part.GetWorldPosition();
891 ParentID = part.LocalId;
892 m_pos = m_prevSitOffset;
893 pos = ParentPosition;
894 }
895 ParentUUID = UUID.Zero;
896 }
869 897
870 bool wasChild = IsChildAgent; 898 bool wasChild = IsChildAgent;
871 IsChildAgent = false; 899 IsChildAgent = false;
@@ -878,62 +906,64 @@ namespace OpenSim.Region.Framework.Scenes
878 906
879 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); 907 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
880 908
881 // Moved this from SendInitialData to ensure that Appearance is initialized 909 if (ParentID == 0)
882 // before the inventory is processed in MakeRootAgent. This fixes a race condition
883 // related to the handling of attachments
884 //m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
885 if (m_scene.TestBorderCross(pos, Cardinals.E))
886 { 910 {
887 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); 911 // Moved this from SendInitialData to ensure that Appearance is initialized
888 pos.X = crossedBorder.BorderLine.Z - 1; 912 // before the inventory is processed in MakeRootAgent. This fixes a race condition
889 } 913 // related to the handling of attachments
914 //m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
915 if (m_scene.TestBorderCross(pos, Cardinals.E))
916 {
917 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
918 pos.X = crossedBorder.BorderLine.Z - 1;
919 }
890 920
891 if (m_scene.TestBorderCross(pos, Cardinals.N)) 921 if (m_scene.TestBorderCross(pos, Cardinals.N))
892 { 922 {
893 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); 923 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N);
894 pos.Y = crossedBorder.BorderLine.Z - 1; 924 pos.Y = crossedBorder.BorderLine.Z - 1;
895 } 925 }
896 926
897 CheckAndAdjustLandingPoint(ref pos); 927 CheckAndAdjustLandingPoint(ref pos);
898 928
899 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) 929 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f)
900 { 930 {
901 m_log.WarnFormat( 931 m_log.WarnFormat(
902 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping", 932 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping",
903 pos, Name, UUID); 933 pos, Name, UUID);
904 934
905 if (pos.X < 0f) pos.X = 0f; 935 if (pos.X < 0f) pos.X = 0f;
906 if (pos.Y < 0f) pos.Y = 0f; 936 if (pos.Y < 0f) pos.Y = 0f;
907 if (pos.Z < 0f) pos.Z = 0f; 937 if (pos.Z < 0f) pos.Z = 0f;
908 } 938 }
909 939
910 float localAVHeight = 1.56f; 940 float localAVHeight = 1.56f;
911 if (Appearance.AvatarHeight > 0) 941 if (Appearance.AvatarHeight > 0)
912 localAVHeight = Appearance.AvatarHeight; 942 localAVHeight = Appearance.AvatarHeight;
913 943
914 float posZLimit = 0; 944 float posZLimit = 0;
915 945
916 if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize) 946 if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize)
917 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 947 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
918 948
919 float newPosZ = posZLimit + localAVHeight / 2; 949 float newPosZ = posZLimit + localAVHeight / 2;
920 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) 950 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
921 { 951 {
922 pos.Z = newPosZ; 952 pos.Z = newPosZ;
923 } 953 }
924 AbsolutePosition = pos; 954 AbsolutePosition = pos;
925 955
926 AddToPhysicalScene(isFlying); 956 AddToPhysicalScene(isFlying);
927 957
928 if (ForceFly) 958 if (ForceFly)
929 { 959 {
930 Flying = true; 960 Flying = true;
931 } 961 }
932 else if (FlyDisabled) 962 else if (FlyDisabled)
933 { 963 {
934 Flying = false; 964 Flying = false;
965 }
935 } 966 }
936
937 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying 967 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
938 // avatar to return to the standing position in mid-air. On login it looks like this is being sent 968 // avatar to return to the standing position in mid-air. On login it looks like this is being sent
939 // elsewhere anyway 969 // elsewhere anyway
@@ -951,11 +981,13 @@ namespace OpenSim.Region.Framework.Scenes
951 { 981 {
952 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); 982 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments...");
953 // Resume scripts 983 // Resume scripts
954 foreach (SceneObjectGroup sog in m_attachments) 984 Util.FireAndForget(delegate(object x) {
955 { 985 foreach (SceneObjectGroup sog in m_attachments)
956 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 986 {
957 sog.ResumeScripts(); 987 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
958 } 988 sog.ResumeScripts();
989 }
990 });
959 } 991 }
960 } 992 }
961 993
@@ -3109,6 +3141,9 @@ namespace OpenSim.Region.Framework.Scenes
3109 cAgent.AlwaysRun = SetAlwaysRun; 3141 cAgent.AlwaysRun = SetAlwaysRun;
3110 3142
3111 cAgent.Appearance = new AvatarAppearance(Appearance); 3143 cAgent.Appearance = new AvatarAppearance(Appearance);
3144
3145 cAgent.ParentPart = ParentUUID;
3146 cAgent.SitOffset = m_pos;
3112 3147
3113 lock (scriptedcontrols) 3148 lock (scriptedcontrols)
3114 { 3149 {
@@ -3168,6 +3203,8 @@ namespace OpenSim.Region.Framework.Scenes
3168 CameraAtAxis = cAgent.AtAxis; 3203 CameraAtAxis = cAgent.AtAxis;
3169 CameraLeftAxis = cAgent.LeftAxis; 3204 CameraLeftAxis = cAgent.LeftAxis;
3170 m_CameraUpAxis = cAgent.UpAxis; 3205 m_CameraUpAxis = cAgent.UpAxis;
3206 ParentUUID = cAgent.ParentPart;
3207 m_prevSitOffset = cAgent.SitOffset;
3171 3208
3172 // When we get to the point of re-computing neighbors everytime this 3209 // When we get to the point of re-computing neighbors everytime this
3173 // changes, then start using the agent's drawdistance rather than the 3210 // changes, then start using the agent's drawdistance rather than the