diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 98 |
1 files changed, 48 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index beff239..b8ae553 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -285,16 +285,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
285 | 285 | ||
286 | #region Properties | 286 | #region Properties |
287 | 287 | ||
288 | protected PhysicsActor m_physicsActor; | ||
289 | |||
290 | /// <summary> | 288 | /// <summary> |
291 | /// Physical scene representation of this Avatar. | 289 | /// Physical scene representation of this Avatar. |
292 | /// </summary> | 290 | /// </summary> |
293 | public PhysicsActor PhysicsActor | 291 | public PhysicsActor PhysicsActor { get; private set; } |
294 | { | ||
295 | set { m_physicsActor = value; } | ||
296 | get { return m_physicsActor; } | ||
297 | } | ||
298 | 292 | ||
299 | private byte m_movementflag; | 293 | private byte m_movementflag; |
300 | 294 | ||
@@ -508,9 +502,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
508 | { | 502 | { |
509 | m_pos = PhysicsActor.Position; | 503 | m_pos = PhysicsActor.Position; |
510 | 504 | ||
511 | // m_log.DebugFormat( | 505 | //m_log.DebugFormat( |
512 | // "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", | 506 | // "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", |
513 | // m_pos, Name, Scene.RegionInfo.RegionName); | 507 | // m_pos, Name, Scene.RegionInfo.RegionName); |
514 | } | 508 | } |
515 | else | 509 | else |
516 | { | 510 | { |
@@ -540,7 +534,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
540 | } | 534 | } |
541 | } | 535 | } |
542 | } | 536 | } |
543 | |||
544 | return m_pos; | 537 | return m_pos; |
545 | } | 538 | } |
546 | set | 539 | set |
@@ -560,9 +553,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
560 | m_pos = value; | 553 | m_pos = value; |
561 | ParentPosition = Vector3.Zero; | 554 | ParentPosition = Vector3.Zero; |
562 | 555 | ||
563 | // m_log.DebugFormat( | 556 | //m_log.DebugFormat( |
564 | // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", | 557 | // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", |
565 | // Scene.RegionInfo.RegionName, Name, m_pos); | 558 | // Scene.RegionInfo.RegionName, Name, m_pos); |
566 | } | 559 | } |
567 | } | 560 | } |
568 | 561 | ||
@@ -791,7 +784,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
791 | public void RegisterToEvents() | 784 | public void RegisterToEvents() |
792 | { | 785 | { |
793 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; | 786 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; |
794 | //ControllingClient.OnCompleteMovementToRegion += SendInitialData; | ||
795 | ControllingClient.OnAgentUpdate += HandleAgentUpdate; | 787 | ControllingClient.OnAgentUpdate += HandleAgentUpdate; |
796 | ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; | 788 | ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; |
797 | ControllingClient.OnAgentSit += HandleAgentSit; | 789 | ControllingClient.OnAgentSit += HandleAgentSit; |
@@ -839,11 +831,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
839 | 831 | ||
840 | #endregion | 832 | #endregion |
841 | 833 | ||
842 | public uint GenerateClientFlags(UUID ObjectID) | ||
843 | { | ||
844 | return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID); | ||
845 | } | ||
846 | |||
847 | #region Status Methods | 834 | #region Status Methods |
848 | 835 | ||
849 | /// <summary> | 836 | /// <summary> |
@@ -1032,18 +1019,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1032 | { | 1019 | { |
1033 | if (PhysicsActor != null) | 1020 | if (PhysicsActor != null) |
1034 | { | 1021 | { |
1035 | try | 1022 | // PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; |
1036 | { | 1023 | PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; |
1037 | PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; | 1024 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); |
1038 | PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; | 1025 | PhysicsActor.UnSubscribeEvents(); |
1039 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); | 1026 | PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; |
1040 | PhysicsActor.UnSubscribeEvents(); | 1027 | PhysicsActor = null; |
1041 | PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; | ||
1042 | PhysicsActor = null; | ||
1043 | } | ||
1044 | catch | ||
1045 | { } | ||
1046 | } | 1028 | } |
1029 | // else | ||
1030 | // { | ||
1031 | // m_log.ErrorFormat( | ||
1032 | // "[SCENE PRESENCE]: Attempt to remove physics actor for {0} on {1} but this scene presence has no physics actor", | ||
1033 | // Name, Scene.RegionInfo.RegionName); | ||
1034 | // } | ||
1047 | } | 1035 | } |
1048 | 1036 | ||
1049 | /// <summary> | 1037 | /// <summary> |
@@ -1154,13 +1142,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1154 | /// <summary> | 1142 | /// <summary> |
1155 | /// Sets avatar height in the physics plugin | 1143 | /// Sets avatar height in the physics plugin |
1156 | /// </summary> | 1144 | /// </summary> |
1145 | /// <param name="height">New height of avatar</param> | ||
1157 | public void SetHeight(float height) | 1146 | public void SetHeight(float height) |
1158 | { | 1147 | { |
1159 | if (PhysicsActor != null && !IsChildAgent) | 1148 | if (PhysicsActor != null && !IsChildAgent) |
1160 | { | 1149 | PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); |
1161 | Vector3 SetSize = new Vector3(0.45f, 0.6f, height); | ||
1162 | PhysicsActor.Size = SetSize; | ||
1163 | } | ||
1164 | } | 1150 | } |
1165 | 1151 | ||
1166 | /// <summary> | 1152 | /// <summary> |
@@ -1925,7 +1911,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1925 | // m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); | 1911 | // m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); |
1926 | 1912 | ||
1927 | if (PhysicsActor != null) | 1913 | if (PhysicsActor != null) |
1928 | m_sitAvatarHeight = m_physicsActor.Size.Z; | 1914 | m_sitAvatarHeight = PhysicsActor.Size.Z; |
1929 | 1915 | ||
1930 | bool canSit = false; | 1916 | bool canSit = false; |
1931 | pos = part.AbsolutePosition + offset; | 1917 | pos = part.AbsolutePosition + offset; |
@@ -2570,7 +2556,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2570 | // only send update from root agents to other clients; children are only "listening posts" | 2556 | // only send update from root agents to other clients; children are only "listening posts" |
2571 | if (IsChildAgent) | 2557 | if (IsChildAgent) |
2572 | { | 2558 | { |
2573 | m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); | 2559 | m_log.WarnFormat( |
2560 | "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}", | ||
2561 | Name, Scene.RegionInfo.RegionName); | ||
2562 | |||
2574 | return; | 2563 | return; |
2575 | } | 2564 | } |
2576 | 2565 | ||
@@ -2628,7 +2617,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2628 | // only send update from root agents to other clients; children are only "listening posts" | 2617 | // only send update from root agents to other clients; children are only "listening posts" |
2629 | if (IsChildAgent) | 2618 | if (IsChildAgent) |
2630 | { | 2619 | { |
2631 | m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); | 2620 | m_log.WarnFormat( |
2621 | "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}", | ||
2622 | Name, Scene.RegionInfo.RegionName); | ||
2623 | |||
2632 | return; | 2624 | return; |
2633 | } | 2625 | } |
2634 | 2626 | ||
@@ -2675,7 +2667,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2675 | public void SendAppearanceToAgent(ScenePresence avatar) | 2667 | public void SendAppearanceToAgent(ScenePresence avatar) |
2676 | { | 2668 | { |
2677 | // m_log.DebugFormat( | 2669 | // m_log.DebugFormat( |
2678 | // "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); | 2670 | // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); |
2679 | 2671 | ||
2680 | avatar.ControllingClient.SendAppearance( | 2672 | avatar.ControllingClient.SendAppearance( |
2681 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); | 2673 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); |
@@ -2957,7 +2949,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2957 | if (byebyeRegions.Count > 0) | 2949 | if (byebyeRegions.Count > 0) |
2958 | { | 2950 | { |
2959 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); | 2951 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); |
2960 | m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); | 2952 | Util.FireAndForget(delegate |
2953 | { | ||
2954 | m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); | ||
2955 | }); | ||
2961 | } | 2956 | } |
2962 | 2957 | ||
2963 | foreach (ulong handle in byebyeRegions) | 2958 | foreach (ulong handle in byebyeRegions) |
@@ -3007,6 +3002,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3007 | CopyFrom(cAgentData); | 3002 | CopyFrom(cAgentData); |
3008 | } | 3003 | } |
3009 | 3004 | ||
3005 | private static Vector3 marker = new Vector3(-1f, -1f, -1f); | ||
3010 | /// <summary> | 3006 | /// <summary> |
3011 | /// This updates important decision making data about a child agent | 3007 | /// This updates important decision making data about a child agent |
3012 | /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region | 3008 | /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region |
@@ -3027,8 +3023,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3027 | // region's draw distance. | 3023 | // region's draw distance. |
3028 | // DrawDistance = cAgentData.Far; | 3024 | // DrawDistance = cAgentData.Far; |
3029 | DrawDistance = Scene.DefaultDrawDistance; | 3025 | DrawDistance = Scene.DefaultDrawDistance; |
3030 | 3026 | ||
3031 | if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! | 3027 | if (cAgentData.Position != marker) // UGH!! |
3032 | m_pos = cAgentData.Position + offset; | 3028 | m_pos = cAgentData.Position + offset; |
3033 | 3029 | ||
3034 | if (Vector3.Distance(AbsolutePosition, posLastSignificantMove) >= Scene.ChildReprioritizationDistance) | 3030 | if (Vector3.Distance(AbsolutePosition, posLastSignificantMove) >= Scene.ChildReprioritizationDistance) |
@@ -3039,8 +3035,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3039 | 3035 | ||
3040 | CameraPosition = cAgentData.Center + offset; | 3036 | CameraPosition = cAgentData.Center + offset; |
3041 | 3037 | ||
3042 | //SetHeight(cAgentData.AVHeight); | ||
3043 | |||
3044 | if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) | 3038 | if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) |
3045 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); | 3039 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); |
3046 | 3040 | ||
@@ -3251,6 +3245,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3251 | // "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", | 3245 | // "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", |
3252 | // Name, isFlying, Scene.RegionInfo.RegionName); | 3246 | // Name, isFlying, Scene.RegionInfo.RegionName); |
3253 | 3247 | ||
3248 | if (PhysicsActor != null) | ||
3249 | { | ||
3250 | m_log.ErrorFormat( | ||
3251 | "[SCENE PRESENCE]: Adding physics actor for {0} to {1} but this scene presence already has a physics actor", | ||
3252 | Name, Scene.RegionInfo.RegionName); | ||
3253 | } | ||
3254 | |||
3254 | if (Appearance.AvatarHeight == 0) | 3255 | if (Appearance.AvatarHeight == 0) |
3255 | Appearance.SetHeight(); | 3256 | Appearance.SetHeight(); |
3256 | 3257 | ||
@@ -3258,18 +3259,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3258 | 3259 | ||
3259 | Vector3 pVec = AbsolutePosition; | 3260 | Vector3 pVec = AbsolutePosition; |
3260 | 3261 | ||
3261 | // Old bug where the height was in centimeters instead of meters | 3262 | PhysicsActor = scene.AddAvatar( |
3262 | PhysicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, | 3263 | LocalId, Firstname + "." + Lastname, pVec, |
3263 | new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); | 3264 | new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); |
3264 | 3265 | ||
3265 | scene.AddPhysicsActorTaint(PhysicsActor); | ||
3266 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 3266 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
3267 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 3267 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
3268 | PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong | 3268 | PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong |
3269 | PhysicsActor.SubscribeEvents(500); | 3269 | PhysicsActor.SubscribeEvents(500); |
3270 | PhysicsActor.LocalID = LocalId; | 3270 | PhysicsActor.LocalID = LocalId; |
3271 | |||
3272 | SetHeight(Appearance.AvatarHeight); | ||
3273 | } | 3271 | } |
3274 | 3272 | ||
3275 | private void OutOfBoundsCall(Vector3 pos) | 3273 | private void OutOfBoundsCall(Vector3 pos) |