diff options
author | Tom | 2011-09-04 07:06:36 -0700 |
---|---|---|
committer | Tom | 2011-09-04 07:06:36 -0700 |
commit | 66dec3b8742eff04fbbcc6e3249fe4ba87986500 (patch) | |
tree | 76cc708a821d35fac5cdbbce2de304b47064e732 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | Guard another nullref (diff) | |
parent | Fixed BulletSim config files for Linux *.so libraries. (diff) | |
download | opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.zip opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.gz opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.bz2 opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.xz |
Resolve merge commits, stage 1
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 308 |
1 files changed, 191 insertions, 117 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ec82cc3..26fe61d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -635,6 +635,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
635 | "delete object name <name>", | 635 | "delete object name <name>", |
636 | "Delete object by name", HandleDeleteObject); | 636 | "Delete object by name", HandleDeleteObject); |
637 | 637 | ||
638 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside", | ||
639 | "delete object outside", | ||
640 | "Delete all objects outside boundaries", HandleDeleteObject); | ||
641 | |||
638 | //Bind Storage Manager functions to some land manager functions for this scene | 642 | //Bind Storage Manager functions to some land manager functions for this scene |
639 | EventManager.OnLandObjectAdded += | 643 | EventManager.OnLandObjectAdded += |
640 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); | 644 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); |
@@ -1703,20 +1707,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1703 | 1707 | ||
1704 | m_sceneGridService.SetScene(this); | 1708 | m_sceneGridService.SetScene(this); |
1705 | 1709 | ||
1706 | // If we generate maptiles internally at all, the maptile generator | 1710 | GridRegion region = new GridRegion(RegionInfo); |
1707 | // will register the region. If not, do it here | 1711 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); |
1708 | if (m_generateMaptiles) | 1712 | if (error != String.Empty) |
1709 | { | 1713 | { |
1710 | RegenerateMaptile(null, null); | 1714 | throw new Exception(error); |
1711 | } | 1715 | } |
1712 | else | 1716 | |
1717 | // Generate the maptile asynchronously, because sometimes it can be very slow and we | ||
1718 | // don't want this to delay starting the region. | ||
1719 | if (m_generateMaptiles) | ||
1713 | { | 1720 | { |
1714 | GridRegion region = new GridRegion(RegionInfo); | 1721 | Util.FireAndForget(delegate { |
1715 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); | 1722 | RegenerateMaptile(null, null); |
1716 | if (error != String.Empty) | 1723 | }); |
1717 | { | ||
1718 | throw new Exception(error); | ||
1719 | } | ||
1720 | } | 1724 | } |
1721 | } | 1725 | } |
1722 | 1726 | ||
@@ -1757,6 +1761,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1757 | /// <summary> | 1761 | /// <summary> |
1758 | /// Loads the World's objects | 1762 | /// Loads the World's objects |
1759 | /// </summary> | 1763 | /// </summary> |
1764 | /// <param name="regionID"></param> | ||
1760 | public virtual void LoadPrimsFromStorage(UUID regionID) | 1765 | public virtual void LoadPrimsFromStorage(UUID regionID) |
1761 | { | 1766 | { |
1762 | LoadingPrims = true; | 1767 | LoadingPrims = true; |
@@ -1769,20 +1774,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1769 | foreach (SceneObjectGroup group in PrimsFromDB) | 1774 | foreach (SceneObjectGroup group in PrimsFromDB) |
1770 | { | 1775 | { |
1771 | EventManager.TriggerOnSceneObjectLoaded(group); | 1776 | EventManager.TriggerOnSceneObjectLoaded(group); |
1772 | |||
1773 | if (group.RootPart == null) | ||
1774 | { | ||
1775 | m_log.ErrorFormat( | ||
1776 | "[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children", | ||
1777 | group.Parts == null ? 0 : group.PrimCount); | ||
1778 | } | ||
1779 | |||
1780 | AddRestoredSceneObject(group, true, true); | 1777 | AddRestoredSceneObject(group, true, true); |
1781 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 1778 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
1782 | rootPart.Flags &= ~PrimFlags.Scripted; | 1779 | rootPart.Flags &= ~PrimFlags.Scripted; |
1783 | rootPart.TrimPermissions(); | 1780 | rootPart.TrimPermissions(); |
1784 | group.CheckSculptAndLoad(); | 1781 | |
1785 | //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | 1782 | // Don't do this here - it will get done later on when sculpt data is loaded. |
1783 | // group.CheckSculptAndLoad(); | ||
1786 | } | 1784 | } |
1787 | 1785 | ||
1788 | m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); | 1786 | m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); |
@@ -2643,10 +2641,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2643 | #region Add/Remove Avatar Methods | 2641 | #region Add/Remove Avatar Methods |
2644 | 2642 | ||
2645 | /// <summary> | 2643 | /// <summary> |
2646 | /// Adding a New Client and Create a Presence for it. | 2644 | /// Add a new client and create a child agent for it. |
2647 | /// </summary> | 2645 | /// </summary> |
2648 | /// <param name="client"></param> | 2646 | /// <param name="client"></param> |
2649 | public override void AddNewClient(IClientAPI client) | 2647 | /// <param name="type">The type of agent to add.</param> |
2648 | public override void AddNewClient(IClientAPI client, PresenceType type) | ||
2650 | { | 2649 | { |
2651 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | 2650 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); |
2652 | bool vialogin = false; | 2651 | bool vialogin = false; |
@@ -2667,7 +2666,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2667 | m_clientManager.Add(client); | 2666 | m_clientManager.Add(client); |
2668 | SubscribeToClientEvents(client); | 2667 | SubscribeToClientEvents(client); |
2669 | 2668 | ||
2670 | ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); | 2669 | ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); |
2671 | m_eventManager.TriggerOnNewPresence(sp); | 2670 | m_eventManager.TriggerOnNewPresence(sp); |
2672 | 2671 | ||
2673 | sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; | 2672 | sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; |
@@ -2678,16 +2677,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2678 | if (aCircuit.child == false) | 2677 | if (aCircuit.child == false) |
2679 | { | 2678 | { |
2680 | sp.IsChildAgent = false; | 2679 | sp.IsChildAgent = false; |
2681 | Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); | 2680 | Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); |
2682 | } | 2681 | } |
2683 | } | 2682 | } |
2684 | 2683 | ||
2685 | if (TryGetScenePresence(client.AgentId, out presence)) | 2684 | ScenePresence createdSp = GetScenePresence(client.AgentId); |
2685 | if (createdSp != null) | ||
2686 | { | 2686 | { |
2687 | m_LastLogin = Util.EnvironmentTickCount(); | 2687 | m_LastLogin = Util.EnvironmentTickCount(); |
2688 | 2688 | ||
2689 | // Cache the user's name | 2689 | // Cache the user's name |
2690 | CacheUserName(aCircuit); | 2690 | CacheUserName(createdSp, aCircuit); |
2691 | 2691 | ||
2692 | EventManager.TriggerOnNewClient(client); | 2692 | EventManager.TriggerOnNewClient(client); |
2693 | if (vialogin) | 2693 | if (vialogin) |
@@ -2702,28 +2702,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
2702 | } | 2702 | } |
2703 | } | 2703 | } |
2704 | 2704 | ||
2705 | private void CacheUserName(AgentCircuitData aCircuit) | 2705 | /// <summary> |
2706 | /// Cache the user name for later use. | ||
2707 | /// </summary> | ||
2708 | /// <param name="sp"></param> | ||
2709 | /// <param name="aCircuit"></param> | ||
2710 | private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit) | ||
2706 | { | 2711 | { |
2707 | IUserManagement uMan = RequestModuleInterface<IUserManagement>(); | 2712 | IUserManagement uMan = RequestModuleInterface<IUserManagement>(); |
2708 | if (uMan != null) | 2713 | if (uMan != null) |
2709 | { | 2714 | { |
2710 | string homeURL = string.Empty; | ||
2711 | string first = aCircuit.firstname, last = aCircuit.lastname; | 2715 | string first = aCircuit.firstname, last = aCircuit.lastname; |
2712 | 2716 | ||
2713 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 2717 | if (sp.PresenceType == PresenceType.Npc) |
2714 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | 2718 | { |
2715 | 2719 | uMan.AddUser(aCircuit.AgentID, first, last); | |
2716 | if (aCircuit.lastname.StartsWith("@")) | 2720 | } |
2721 | else | ||
2717 | { | 2722 | { |
2718 | string[] parts = aCircuit.firstname.Split('.'); | 2723 | string homeURL = string.Empty; |
2719 | if (parts.Length >= 2) | 2724 | |
2725 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | ||
2726 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
2727 | |||
2728 | if (aCircuit.lastname.StartsWith("@")) | ||
2720 | { | 2729 | { |
2721 | first = parts[0]; | 2730 | string[] parts = aCircuit.firstname.Split('.'); |
2722 | last = parts[1]; | 2731 | if (parts.Length >= 2) |
2732 | { | ||
2733 | first = parts[0]; | ||
2734 | last = parts[1]; | ||
2735 | } | ||
2723 | } | 2736 | } |
2724 | } | ||
2725 | 2737 | ||
2726 | uMan.AddUser(aCircuit.AgentID, first, last, homeURL); | 2738 | uMan.AddUser(aCircuit.AgentID, first, last, homeURL); |
2739 | } | ||
2727 | } | 2740 | } |
2728 | } | 2741 | } |
2729 | 2742 | ||
@@ -2821,12 +2834,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2821 | 2834 | ||
2822 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) | 2835 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) |
2823 | { | 2836 | { |
2824 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; | 2837 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2825 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 2838 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2826 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; | 2839 | |
2827 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimRotation; | 2840 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2841 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | ||
2828 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 2842 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
2829 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; | 2843 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; |
2844 | |||
2830 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; | 2845 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; |
2831 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; | 2846 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; |
2832 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; | 2847 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; |
@@ -2856,7 +2871,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2856 | client.OnUndo += m_sceneGraph.HandleUndo; | 2871 | client.OnUndo += m_sceneGraph.HandleUndo; |
2857 | client.OnRedo += m_sceneGraph.HandleRedo; | 2872 | client.OnRedo += m_sceneGraph.HandleRedo; |
2858 | client.OnObjectDescription += m_sceneGraph.PrimDescription; | 2873 | client.OnObjectDescription += m_sceneGraph.PrimDescription; |
2859 | client.OnObjectDrop += m_sceneGraph.DropObject; | ||
2860 | client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; | 2874 | client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; |
2861 | client.OnObjectOwner += ObjectOwner; | 2875 | client.OnObjectOwner += ObjectOwner; |
2862 | } | 2876 | } |
@@ -2949,12 +2963,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2949 | 2963 | ||
2950 | public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) | 2964 | public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) |
2951 | { | 2965 | { |
2952 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimPosition; | 2966 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
2953 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 2967 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
2954 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimRotation; | 2968 | |
2955 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimRotation; | 2969 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
2970 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | ||
2956 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 2971 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
2957 | client.OnUpdatePrimSingleRotationPosition -= m_sceneGraph.UpdatePrimSingleRotationPosition; | 2972 | client.OnUpdatePrimSingleRotationPosition -= m_sceneGraph.UpdatePrimSingleRotationPosition; |
2973 | |||
2958 | client.OnUpdatePrimScale -= m_sceneGraph.UpdatePrimScale; | 2974 | client.OnUpdatePrimScale -= m_sceneGraph.UpdatePrimScale; |
2959 | client.OnUpdatePrimGroupScale -= m_sceneGraph.UpdatePrimGroupScale; | 2975 | client.OnUpdatePrimGroupScale -= m_sceneGraph.UpdatePrimGroupScale; |
2960 | client.OnUpdateExtraParams -= m_sceneGraph.UpdateExtraParam; | 2976 | client.OnUpdateExtraParams -= m_sceneGraph.UpdateExtraParam; |
@@ -2982,7 +2998,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2982 | client.OnUndo -= m_sceneGraph.HandleUndo; | 2998 | client.OnUndo -= m_sceneGraph.HandleUndo; |
2983 | client.OnRedo -= m_sceneGraph.HandleRedo; | 2999 | client.OnRedo -= m_sceneGraph.HandleRedo; |
2984 | client.OnObjectDescription -= m_sceneGraph.PrimDescription; | 3000 | client.OnObjectDescription -= m_sceneGraph.PrimDescription; |
2985 | client.OnObjectDrop -= m_sceneGraph.DropObject; | ||
2986 | client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable; | 3001 | client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable; |
2987 | client.OnObjectOwner -= ObjectOwner; | 3002 | client.OnObjectOwner -= ObjectOwner; |
2988 | } | 3003 | } |
@@ -3098,58 +3113,51 @@ namespace OpenSim.Region.Framework.Scenes | |||
3098 | Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); | 3113 | Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); |
3099 | Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); | 3114 | Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); |
3100 | 3115 | ||
3101 | if (target2.ParentGroup != null) | 3116 | pos = target2.AbsolutePosition; |
3102 | { | 3117 | //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); |
3103 | pos = target2.AbsolutePosition; | ||
3104 | //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); | ||
3105 | 3118 | ||
3106 | // TODO: Raytrace better here | 3119 | // TODO: Raytrace better here |
3107 | 3120 | ||
3108 | //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); | 3121 | //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); |
3109 | Ray NewRay = new Ray(AXOrigin, AXdirection); | 3122 | Ray NewRay = new Ray(AXOrigin, AXdirection); |
3110 | 3123 | ||
3111 | // Ray Trace against target here | 3124 | // Ray Trace against target here |
3112 | EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters); | 3125 | EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters); |
3113 | 3126 | ||
3114 | // Un-comment out the following line to Get Raytrace results printed to the console. | 3127 | // Un-comment out the following line to Get Raytrace results printed to the console. |
3115 | //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 3128 | //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
3116 | float ScaleOffset = 0.5f; | 3129 | float ScaleOffset = 0.5f; |
3117 | 3130 | ||
3118 | // If we hit something | 3131 | // If we hit something |
3119 | if (ei.HitTF) | 3132 | if (ei.HitTF) |
3120 | { | 3133 | { |
3121 | Vector3 scale = target.Scale; | 3134 | Vector3 scale = target.Scale; |
3122 | Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); | 3135 | Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); |
3123 | if (scaleComponent.X != 0) ScaleOffset = scale.X; | 3136 | if (scaleComponent.X != 0) ScaleOffset = scale.X; |
3124 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; | 3137 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; |
3125 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; | 3138 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; |
3126 | ScaleOffset = Math.Abs(ScaleOffset); | 3139 | ScaleOffset = Math.Abs(ScaleOffset); |
3127 | Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 3140 | Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
3128 | Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); | 3141 | Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); |
3129 | Vector3 offset = normal * (ScaleOffset / 2f); | 3142 | Vector3 offset = normal * (ScaleOffset / 2f); |
3130 | pos = intersectionpoint + offset; | 3143 | pos = intersectionpoint + offset; |
3131 | 3144 | ||
3132 | // stick in offset format from the original prim | 3145 | // stick in offset format from the original prim |
3133 | pos = pos - target.ParentGroup.AbsolutePosition; | 3146 | pos = pos - target.ParentGroup.AbsolutePosition; |
3134 | if (CopyRotates) | 3147 | if (CopyRotates) |
3135 | { | 3148 | { |
3136 | Quaternion worldRot = target2.GetWorldRotation(); | 3149 | Quaternion worldRot = target2.GetWorldRotation(); |
3137 | 3150 | ||
3138 | // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); | 3151 | // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); |
3139 | m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); | 3152 | m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); |
3140 | //obj.Rotation = worldRot; | 3153 | //obj.Rotation = worldRot; |
3141 | //obj.UpdateGroupRotationR(worldRot); | 3154 | //obj.UpdateGroupRotationR(worldRot); |
3142 | } | 3155 | } |
3143 | else | 3156 | else |
3144 | { | 3157 | { |
3145 | m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); | 3158 | m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); |
3146 | } | ||
3147 | } | 3159 | } |
3148 | |||
3149 | return; | ||
3150 | } | 3160 | } |
3151 | |||
3152 | return; | ||
3153 | } | 3161 | } |
3154 | } | 3162 | } |
3155 | 3163 | ||
@@ -3192,7 +3200,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3192 | if (aCircuit == null) | 3200 | if (aCircuit == null) |
3193 | { | 3201 | { |
3194 | m_log.DebugFormat("[APPEARANCE] Client did not supply a circuit. Non-Linden? Creating default appearance."); | 3202 | m_log.DebugFormat("[APPEARANCE] Client did not supply a circuit. Non-Linden? Creating default appearance."); |
3195 | appearance = new AvatarAppearance(client.AgentId); | 3203 | appearance = new AvatarAppearance(); |
3196 | return; | 3204 | return; |
3197 | } | 3205 | } |
3198 | 3206 | ||
@@ -3200,15 +3208,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3200 | if (appearance == null) | 3208 | if (appearance == null) |
3201 | { | 3209 | { |
3202 | m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName); | 3210 | m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName); |
3203 | appearance = new AvatarAppearance(client.AgentId); | 3211 | appearance = new AvatarAppearance(); |
3204 | } | 3212 | } |
3205 | } | 3213 | } |
3206 | 3214 | ||
3207 | /// <summary> | 3215 | public override void RemoveClient(UUID agentID, bool closeChildAgents) |
3208 | /// Remove the given client from the scene. | ||
3209 | /// </summary> | ||
3210 | /// <param name="agentID"></param> | ||
3211 | public override void RemoveClient(UUID agentID) | ||
3212 | { | 3216 | { |
3213 | CheckHeartbeat(); | 3217 | CheckHeartbeat(); |
3214 | bool childagentYN = false; | 3218 | bool childagentYN = false; |
@@ -3229,15 +3233,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3229 | (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); | 3233 | (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); |
3230 | 3234 | ||
3231 | m_sceneGraph.removeUserCount(!childagentYN); | 3235 | m_sceneGraph.removeUserCount(!childagentYN); |
3232 | 3236 | ||
3233 | if (CapsModule != null) | 3237 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3238 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | ||
3239 | if (closeChildAgents && CapsModule != null) | ||
3234 | CapsModule.RemoveCaps(agentID); | 3240 | CapsModule.RemoveCaps(agentID); |
3235 | 3241 | ||
3236 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3242 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3237 | // this method is doing is HORRIBLE!!! | 3243 | // this method is doing is HORRIBLE!!! |
3238 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); | 3244 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); |
3239 | 3245 | ||
3240 | if (!avatar.IsChildAgent) | 3246 | if (closeChildAgents && !avatar.IsChildAgent) |
3241 | { | 3247 | { |
3242 | //List<ulong> childknownRegions = new List<ulong>(); | 3248 | //List<ulong> childknownRegions = new List<ulong>(); |
3243 | //List<ulong> ckn = avatar.KnownChildRegionHandles; | 3249 | //List<ulong> ckn = avatar.KnownChildRegionHandles; |
@@ -3263,8 +3269,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3263 | m_eventManager.TriggerOnRemovePresence(agentID); | 3269 | m_eventManager.TriggerOnRemovePresence(agentID); |
3264 | m_log.Debug("[Scene] Finished OnRemovePresence"); | 3270 | m_log.Debug("[Scene] Finished OnRemovePresence"); |
3265 | 3271 | ||
3266 | if (avatar != null && (!avatar.IsChildAgent)) | 3272 | if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) |
3267 | avatar.SaveChangedAttachments(); | 3273 | AttachmentsModule.SaveChangedAttachments(avatar); |
3268 | 3274 | ||
3269 | if (avatar != null && (!avatar.IsChildAgent)) | 3275 | if (avatar != null && (!avatar.IsChildAgent)) |
3270 | avatar.SaveChangedAttachments(); | 3276 | avatar.SaveChangedAttachments(); |
@@ -3304,7 +3310,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3304 | } | 3310 | } |
3305 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); | 3311 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); |
3306 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3312 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3307 | CleanDroppedAttachments(); | 3313 | // CleanDroppedAttachments(); |
3308 | m_log.Debug("[Scene] The avatar has left the building"); | 3314 | m_log.Debug("[Scene] The avatar has left the building"); |
3309 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3315 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
3310 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 3316 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
@@ -3540,7 +3546,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3540 | 3546 | ||
3541 | if (vialogin) | 3547 | if (vialogin) |
3542 | { | 3548 | { |
3543 | CleanDroppedAttachments(); | 3549 | // CleanDroppedAttachments(); |
3544 | 3550 | ||
3545 | if (TestBorderCross(agent.startpos, Cardinals.E)) | 3551 | if (TestBorderCross(agent.startpos, Cardinals.E)) |
3546 | { | 3552 | { |
@@ -3699,11 +3705,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3699 | 3705 | ||
3700 | if (AuthorizationService != null) | 3706 | if (AuthorizationService != null) |
3701 | { | 3707 | { |
3702 | if (!AuthorizationService.IsAuthorizedForRegion(agentID.ToString(), RegionInfo.RegionID.ToString(),out reason)) | 3708 | if (!AuthorizationService.IsAuthorizedForRegion( |
3709 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) | ||
3703 | { | 3710 | { |
3704 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the region", | 3711 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the region", |
3705 | agentID, RegionInfo.RegionName); | 3712 | agentID, RegionInfo.RegionName); |
3706 | //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName); | 3713 | |
3707 | return false; | 3714 | return false; |
3708 | } | 3715 | } |
3709 | } | 3716 | } |
@@ -4033,8 +4040,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4033 | } | 4040 | } |
4034 | 4041 | ||
4035 | /// <summary> | 4042 | /// <summary> |
4036 | /// Tries to teleport agent to other region. | 4043 | /// Tries to teleport agent to another region. |
4037 | /// </summary> | 4044 | /// </summary> |
4045 | /// <remarks> | ||
4046 | /// The region name must exactly match that given. | ||
4047 | /// </remarks> | ||
4038 | /// <param name="remoteClient"></param> | 4048 | /// <param name="remoteClient"></param> |
4039 | /// <param name="regionName"></param> | 4049 | /// <param name="regionName"></param> |
4040 | /// <param name="position"></param> | 4050 | /// <param name="position"></param> |
@@ -4043,15 +4053,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4043 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, | 4053 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, |
4044 | Vector3 lookat, uint teleportFlags) | 4054 | Vector3 lookat, uint teleportFlags) |
4045 | { | 4055 | { |
4046 | List<GridRegion> regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1); | 4056 | GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName); |
4047 | if (regions == null || regions.Count == 0) | 4057 | |
4058 | if (region == null) | ||
4048 | { | 4059 | { |
4049 | // can't find the region: Tell viewer and abort | 4060 | // can't find the region: Tell viewer and abort |
4050 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); | 4061 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); |
4051 | return; | 4062 | return; |
4052 | } | 4063 | } |
4053 | 4064 | ||
4054 | RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags); | 4065 | RequestTeleportLocation(remoteClient, region.RegionHandle, position, lookat, teleportFlags); |
4055 | } | 4066 | } |
4056 | 4067 | ||
4057 | /// <summary> | 4068 | /// <summary> |
@@ -4353,7 +4364,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4353 | // their scripts will actually run. | 4364 | // their scripts will actually run. |
4354 | // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 | 4365 | // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 |
4355 | SceneObjectPart parent = part.ParentGroup.RootPart; | 4366 | SceneObjectPart parent = part.ParentGroup.RootPart; |
4356 | if (parent != null && parent.IsAttachment) | 4367 | if (part.ParentGroup.IsAttachment) |
4357 | return ScriptDanger(parent, parent.GetWorldPosition()); | 4368 | return ScriptDanger(parent, parent.GetWorldPosition()); |
4358 | else | 4369 | else |
4359 | return ScriptDanger(part, part.GetWorldPosition()); | 4370 | return ScriptDanger(part, part.GetWorldPosition()); |
@@ -5122,11 +5133,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
5122 | 5133 | ||
5123 | private void HandleDeleteObject(string module, string[] cmd) | 5134 | private void HandleDeleteObject(string module, string[] cmd) |
5124 | { | 5135 | { |
5125 | if (cmd.Length < 4) | 5136 | if (cmd.Length < 3) |
5126 | return; | 5137 | return; |
5127 | 5138 | ||
5128 | string mode = cmd[2]; | 5139 | string mode = cmd[2]; |
5129 | string o = cmd[3]; | 5140 | string o = ""; |
5141 | |||
5142 | if (mode != "outside") | ||
5143 | { | ||
5144 | if (cmd.Length < 4) | ||
5145 | return; | ||
5146 | |||
5147 | o = cmd[3]; | ||
5148 | } | ||
5130 | 5149 | ||
5131 | List<SceneObjectGroup> deletes = new List<SceneObjectGroup>(); | 5150 | List<SceneObjectGroup> deletes = new List<SceneObjectGroup>(); |
5132 | 5151 | ||
@@ -5168,10 +5187,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
5168 | deletes.Add(g); | 5187 | deletes.Add(g); |
5169 | }); | 5188 | }); |
5170 | break; | 5189 | break; |
5190 | case "outside": | ||
5191 | ForEachSOG(delegate (SceneObjectGroup g) | ||
5192 | { | ||
5193 | SceneObjectPart rootPart = g.RootPart; | ||
5194 | bool delete = false; | ||
5195 | |||
5196 | if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) | ||
5197 | { | ||
5198 | delete = true; | ||
5199 | } | ||
5200 | else | ||
5201 | { | ||
5202 | ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); | ||
5203 | |||
5204 | if (parcel == null || parcel.LandData.Name == "NO LAND") | ||
5205 | delete = true; | ||
5206 | } | ||
5207 | |||
5208 | if (delete && !g.IsAttachment && !deletes.Contains(g)) | ||
5209 | deletes.Add(g); | ||
5210 | }); | ||
5211 | break; | ||
5171 | } | 5212 | } |
5172 | 5213 | ||
5173 | foreach (SceneObjectGroup g in deletes) | 5214 | foreach (SceneObjectGroup g in deletes) |
5215 | { | ||
5216 | m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID); | ||
5174 | DeleteSceneObject(g, false); | 5217 | DeleteSceneObject(g, false); |
5218 | } | ||
5175 | } | 5219 | } |
5176 | 5220 | ||
5177 | private void HandleReloadEstate(string module, string[] cmd) | 5221 | private void HandleReloadEstate(string module, string[] cmd) |
@@ -5268,10 +5312,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
5268 | } | 5312 | } |
5269 | } | 5313 | } |
5270 | 5314 | ||
5271 | public void CleanDroppedAttachments() | 5315 | // public void CleanDroppedAttachments() |
5272 | { | 5316 | // { |
5273 | List<SceneObjectGroup> objectsToDelete = | 5317 | // List<SceneObjectGroup> objectsToDelete = |
5274 | new List<SceneObjectGroup>(); | 5318 | // new List<SceneObjectGroup>(); |
5319 | // | ||
5320 | // lock (m_cleaningAttachments) | ||
5321 | // { | ||
5322 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5323 | // { | ||
5324 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5325 | // { | ||
5326 | // UUID agentID = grp.OwnerID; | ||
5327 | // if (agentID == UUID.Zero) | ||
5328 | // { | ||
5329 | // objectsToDelete.Add(grp); | ||
5330 | // return; | ||
5331 | // } | ||
5332 | // | ||
5333 | // ScenePresence sp = GetScenePresence(agentID); | ||
5334 | // if (sp == null) | ||
5335 | // { | ||
5336 | // objectsToDelete.Add(grp); | ||
5337 | // return; | ||
5338 | // } | ||
5339 | // } | ||
5340 | // }); | ||
5341 | // } | ||
5342 | // | ||
5343 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5344 | // { | ||
5345 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5346 | // DeleteSceneObject(grp, true); | ||
5347 | // } | ||
5348 | // } | ||
5275 | 5349 | ||
5276 | lock (m_cleaningAttachments) | 5350 | lock (m_cleaningAttachments) |
5277 | { | 5351 | { |