diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 66 |
1 files changed, 46 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e3bc8c7..2e64819 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2769,8 +2769,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2769 | 2769 | ||
2770 | if (newPosition != Vector3.Zero) | 2770 | if (newPosition != Vector3.Zero) |
2771 | newObject.RootPart.GroupPosition = newPosition; | 2771 | newObject.RootPart.GroupPosition = newPosition; |
2772 | if (newObject.RootPart.KeyframeMotion != null) | ||
2773 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2774 | 2772 | ||
2775 | if (!AddSceneObject(newObject)) | 2773 | if (!AddSceneObject(newObject)) |
2776 | { | 2774 | { |
@@ -2798,6 +2796,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2798 | // before we restart the scripts, or else some functions won't work. | 2796 | // before we restart the scripts, or else some functions won't work. |
2799 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); | 2797 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); |
2800 | newObject.ResumeScripts(); | 2798 | newObject.ResumeScripts(); |
2799 | |||
2800 | if (newObject.RootPart.KeyframeMotion != null) | ||
2801 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2801 | } | 2802 | } |
2802 | 2803 | ||
2803 | // Do this as late as possible so that listeners have full access to the incoming object | 2804 | // Do this as late as possible so that listeners have full access to the incoming object |
@@ -2865,7 +2866,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2865 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2866 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2866 | 2867 | ||
2867 | if (AttachmentsModule != null) | 2868 | if (AttachmentsModule != null) |
2868 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false); | 2869 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false, true); |
2869 | } | 2870 | } |
2870 | else | 2871 | else |
2871 | { | 2872 | { |
@@ -2970,6 +2971,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2970 | SubscribeToClientEvents(client); | 2971 | SubscribeToClientEvents(client); |
2971 | 2972 | ||
2972 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | 2973 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); |
2974 | InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46); | ||
2975 | if (cof == null) | ||
2976 | sp.COF = UUID.Zero; | ||
2977 | else | ||
2978 | sp.COF = cof.ID; | ||
2979 | |||
2980 | m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF); | ||
2973 | m_eventManager.TriggerOnNewPresence(sp); | 2981 | m_eventManager.TriggerOnNewPresence(sp); |
2974 | 2982 | ||
2975 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | 2983 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; |
@@ -3615,7 +3623,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3615 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop | 3623 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3616 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | 3624 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI |
3617 | if (closeChildAgents && CapsModule != null) | 3625 | if (closeChildAgents && CapsModule != null) |
3618 | CapsModule.RemoveCaps(agentID); | 3626 | CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); |
3619 | 3627 | ||
3620 | // // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3628 | // // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3621 | // // this method is doing is HORRIBLE!!! | 3629 | // // this method is doing is HORRIBLE!!! |
@@ -3846,20 +3854,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3846 | return false; | 3854 | return false; |
3847 | } | 3855 | } |
3848 | 3856 | ||
3849 | |||
3850 | ScenePresence sp = GetScenePresence(agent.AgentID); | 3857 | ScenePresence sp = GetScenePresence(agent.AgentID); |
3851 | 3858 | ||
3852 | if (sp != null && !sp.IsChildAgent) | 3859 | // If we have noo presence here or if that presence is a zombie root |
3860 | // presence that will be kicled, we need a new CAPS object. | ||
3861 | if (sp == null || (sp != null && !sp.IsChildAgent)) | ||
3853 | { | 3862 | { |
3854 | // We have a zombie from a crashed session. | 3863 | if (CapsModule != null) |
3855 | // Or the same user is trying to be root twice here, won't work. | 3864 | { |
3856 | // Kill it. | 3865 | lock (agent) |
3857 | m_log.WarnFormat( | 3866 | { |
3858 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | 3867 | CapsModule.SetAgentCapsSeeds(agent); |
3859 | sp.Name, sp.UUID, RegionInfo.RegionName); | 3868 | CapsModule.CreateCaps(agent.AgentID, agent.circuitcode); |
3869 | } | ||
3870 | } | ||
3871 | } | ||
3860 | 3872 | ||
3861 | sp.ControllingClient.Close(true, true); | 3873 | if (sp != null) |
3862 | sp = null; | 3874 | { |
3875 | if (!sp.IsChildAgent) | ||
3876 | { | ||
3877 | // We have a zombie from a crashed session. | ||
3878 | // Or the same user is trying to be root twice here, won't work. | ||
3879 | // Kill it. | ||
3880 | m_log.WarnFormat( | ||
3881 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3882 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3883 | |||
3884 | sp.ControllingClient.Close(true, true); | ||
3885 | sp = null; | ||
3886 | } | ||
3863 | } | 3887 | } |
3864 | 3888 | ||
3865 | lock (agent) | 3889 | lock (agent) |
@@ -3900,7 +3924,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3900 | if (vialogin || (!m_seeIntoBannedRegion)) | 3924 | if (vialogin || (!m_seeIntoBannedRegion)) |
3901 | { | 3925 | { |
3902 | if (!AuthorizeUser(agent, out reason)) | 3926 | if (!AuthorizeUser(agent, out reason)) |
3927 | { | ||
3903 | return false; | 3928 | return false; |
3929 | } | ||
3904 | } | 3930 | } |
3905 | } | 3931 | } |
3906 | catch (Exception e) | 3932 | catch (Exception e) |
@@ -3915,11 +3941,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3915 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3941 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3916 | agent.AgentID, agent.circuitcode); | 3942 | agent.AgentID, agent.circuitcode); |
3917 | 3943 | ||
3918 | if (CapsModule != null) | ||
3919 | { | ||
3920 | CapsModule.SetAgentCapsSeeds(agent); | ||
3921 | CapsModule.CreateCaps(agent.AgentID); | ||
3922 | } | ||
3923 | } | 3944 | } |
3924 | else | 3945 | else |
3925 | { | 3946 | { |
@@ -3945,6 +3966,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3945 | agent.teleportFlags = teleportFlags; | 3966 | agent.teleportFlags = teleportFlags; |
3946 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | 3967 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); |
3947 | 3968 | ||
3969 | if (CapsModule != null) | ||
3970 | { | ||
3971 | CapsModule.ActivateCaps(agent.circuitcode); | ||
3972 | } | ||
3973 | |||
3948 | if (vialogin) | 3974 | if (vialogin) |
3949 | { | 3975 | { |
3950 | // CleanDroppedAttachments(); | 3976 | // CleanDroppedAttachments(); |
@@ -5122,7 +5148,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5122 | { | 5148 | { |
5123 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) | 5149 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) |
5124 | { | 5150 | { |
5125 | if (grp.RootPart.Expires <= DateTime.Now) | 5151 | if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= DateTime.Now) |
5126 | DeleteSceneObject(grp, false); | 5152 | DeleteSceneObject(grp, false); |
5127 | } | 5153 | } |
5128 | } | 5154 | } |