diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 75 |
1 files changed, 64 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 42a429d..f06afc0 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -816,14 +816,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
816 | // Moved this from SendInitialData to ensure that m_appearance is initialized | 816 | // Moved this from SendInitialData to ensure that m_appearance is initialized |
817 | // before the inventory is processed in MakeRootAgent. This fixes a race condition | 817 | // before the inventory is processed in MakeRootAgent. This fixes a race condition |
818 | // related to the handling of attachments | 818 | // related to the handling of attachments |
819 | m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); | 819 | //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); |
820 | 820 | ||
821 | if (pos.X < 0 || pos.X > Constants.RegionSize || pos.Y < 0 || pos.Y > Constants.RegionSize || pos.Z < 0) | 821 | if (pos.X < 0 || pos.X > Constants.RegionSize || pos.Y < 0 || pos.Y > Constants.RegionSize || pos.Z < 0) |
822 | { | 822 | { |
823 | Vector3 emergencyPos = new Vector3(128, 128, 128); | 823 | Vector3 emergencyPos = new Vector3(128, 128, 128); |
824 | 824 | ||
825 | m_log.WarnFormat( | 825 | m_log.WarnFormat( |
826 | "[SCENE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", | 826 | "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", |
827 | pos, Name, UUID, emergencyPos); | 827 | pos, Name, UUID, emergencyPos); |
828 | 828 | ||
829 | pos = emergencyPos; | 829 | pos = emergencyPos; |
@@ -845,8 +845,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
845 | AbsolutePosition = pos; | 845 | AbsolutePosition = pos; |
846 | 846 | ||
847 | AddToPhysicalScene(isFlying); | 847 | AddToPhysicalScene(isFlying); |
848 | if ((m_appearance != null) && (m_appearance.AvatarHeight > 0)) | 848 | if (m_appearance != null) |
849 | SetHeight(m_appearance.AvatarHeight); | 849 | { |
850 | if (m_appearance.AvatarHeight > 0) | ||
851 | SetHeight(m_appearance.AvatarHeight); | ||
852 | } | ||
853 | else | ||
854 | { | ||
855 | m_log.ErrorFormat("[SCENE PRESENCE]: null appearance in MakeRoot in {0}", Scene.RegionInfo.RegionName); | ||
856 | // emergency; this really shouldn't happen | ||
857 | m_appearance = new AvatarAppearance(); | ||
858 | } | ||
850 | 859 | ||
851 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying | 860 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying |
852 | // avatar to return to the standing position in mid-air. On login it looks like this is being sent | 861 | // avatar to return to the standing position in mid-air. On login it looks like this is being sent |
@@ -2573,7 +2582,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2573 | cAgent.Position = m_pos; | 2582 | cAgent.Position = m_pos; |
2574 | cAgent.Velocity = m_velocity; | 2583 | cAgent.Velocity = m_velocity; |
2575 | cAgent.Center = m_CameraCenter; | 2584 | cAgent.Center = m_CameraCenter; |
2576 | cAgent.Size = new Vector3(0, 0, m_avHeight); | 2585 | // Don't copy the size; it is inferred from apearance parameters |
2586 | //cAgent.Size = new Vector3(0, 0, m_avHeight); | ||
2577 | cAgent.AtAxis = m_CameraAtAxis; | 2587 | cAgent.AtAxis = m_CameraAtAxis; |
2578 | cAgent.LeftAxis = m_CameraLeftAxis; | 2588 | cAgent.LeftAxis = m_CameraLeftAxis; |
2579 | cAgent.UpAxis = m_CameraUpAxis; | 2589 | cAgent.UpAxis = m_CameraUpAxis; |
@@ -2605,13 +2615,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
2605 | 2615 | ||
2606 | cAgent.AlwaysRun = m_setAlwaysRun; | 2616 | cAgent.AlwaysRun = m_setAlwaysRun; |
2607 | 2617 | ||
2608 | //cAgent.AgentTextures = ??? | ||
2609 | //cAgent.GroupID = ?? | 2618 | //cAgent.GroupID = ?? |
2610 | // Groups??? | 2619 | // Groups??? |
2611 | 2620 | ||
2612 | // Animations??? | 2621 | // Animations??? |
2613 | 2622 | ||
2614 | cAgent.VisualParams = m_appearance.VisualParams; | 2623 | try |
2624 | { | ||
2625 | int i = 0; | ||
2626 | UUID[] textures = new UUID[m_appearance.Wearables.Length * 2]; | ||
2627 | foreach (AvatarWearable aw in m_appearance.Wearables) | ||
2628 | { | ||
2629 | if (aw != null) | ||
2630 | { | ||
2631 | textures[i++] = aw.ItemID; | ||
2632 | textures[i++] = aw.AssetID; | ||
2633 | } | ||
2634 | else | ||
2635 | m_log.DebugFormat("[SCENE PRESENCE]: Null wearable in CopyTo"); | ||
2636 | } | ||
2637 | cAgent.AgentTextures = textures; | ||
2638 | cAgent.VisualParams = m_appearance.VisualParams; | ||
2639 | } | ||
2640 | catch (Exception e) | ||
2641 | { | ||
2642 | m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message); | ||
2643 | } | ||
2644 | //cAgent.GroupID = ?? | ||
2645 | // Groups??? | ||
2646 | |||
2647 | // Animations??? | ||
2648 | |||
2615 | } | 2649 | } |
2616 | 2650 | ||
2617 | public void CopyFrom(AgentData cAgent) | 2651 | public void CopyFrom(AgentData cAgent) |
@@ -2622,7 +2656,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2622 | m_pos = cAgent.Position; | 2656 | m_pos = cAgent.Position; |
2623 | m_velocity = cAgent.Velocity; | 2657 | m_velocity = cAgent.Velocity; |
2624 | m_CameraCenter = cAgent.Center; | 2658 | m_CameraCenter = cAgent.Center; |
2625 | m_avHeight = cAgent.Size.Z; | 2659 | //m_avHeight = cAgent.Size.Z; |
2626 | m_CameraAtAxis = cAgent.AtAxis; | 2660 | m_CameraAtAxis = cAgent.AtAxis; |
2627 | m_CameraLeftAxis = cAgent.LeftAxis; | 2661 | m_CameraLeftAxis = cAgent.LeftAxis; |
2628 | m_CameraUpAxis = cAgent.UpAxis; | 2662 | m_CameraUpAxis = cAgent.UpAxis; |
@@ -2634,20 +2668,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
2634 | 2668 | ||
2635 | m_headrotation = cAgent.HeadRotation; | 2669 | m_headrotation = cAgent.HeadRotation; |
2636 | m_bodyRot = cAgent.BodyRotation; | 2670 | m_bodyRot = cAgent.BodyRotation; |
2637 | m_AgentControlFlags = cAgent.ControlFlags; // We need more flags! | 2671 | m_AgentControlFlags = cAgent.ControlFlags; |
2638 | 2672 | ||
2639 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 2673 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
2640 | m_godlevel = cAgent.GodLevel; | 2674 | m_godlevel = cAgent.GodLevel; |
2641 | m_setAlwaysRun = cAgent.AlwaysRun; | 2675 | m_setAlwaysRun = cAgent.AlwaysRun; |
2642 | 2676 | ||
2643 | //cAgent.AgentTextures = ??? | 2677 | uint i = 0; |
2678 | AvatarWearable[] wearables = new AvatarWearable[cAgent.AgentTextures.Length / 2]; | ||
2679 | Primitive.TextureEntry te = new Primitive.TextureEntry(UUID.Random()); | ||
2680 | try | ||
2681 | { | ||
2682 | for (uint n = 0; n < cAgent.AgentTextures.Length; n += 2) | ||
2683 | { | ||
2684 | UUID itemId = cAgent.AgentTextures[n]; | ||
2685 | UUID assetId = cAgent.AgentTextures[n + 1]; | ||
2686 | wearables[i] = new AvatarWearable(itemId, assetId); | ||
2687 | te.CreateFace(i++).TextureID = assetId; | ||
2688 | } | ||
2689 | } | ||
2690 | catch (Exception e) | ||
2691 | { | ||
2692 | m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message); | ||
2693 | } | ||
2694 | //m_appearance.Texture = te; | ||
2695 | m_appearance.Wearables = wearables; | ||
2696 | //m_appearance.VisualParams = cAgent.VisualParams; | ||
2697 | m_appearance.SetAppearance(te.ToBytes(), new List<byte>(cAgent.VisualParams)); | ||
2644 | 2698 | ||
2645 | //cAgent.GroupID = ?? | 2699 | //cAgent.GroupID = ?? |
2646 | //Groups??? | 2700 | //Groups??? |
2647 | 2701 | ||
2648 | // Animations??? | 2702 | // Animations??? |
2649 | 2703 | ||
2650 | m_appearance.VisualParams = cAgent.VisualParams; | ||
2651 | } | 2704 | } |
2652 | 2705 | ||
2653 | #endregion Child Agent Updates | 2706 | #endregion Child Agent Updates |