aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs3
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs47
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUserManagement.cs37
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs105
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs226
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs39
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs117
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs172
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs28
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs66
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs (renamed from OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs)223
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs (renamed from OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs)14
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs6
28 files changed, 642 insertions, 616 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 6cc64c6..4cb3df2 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -96,9 +96,10 @@ namespace OpenSim.Region.Framework.Interfaces
96 /// <summary> 96 /// <summary>
97 /// Detach an object from the avatar. 97 /// Detach an object from the avatar.
98 /// </summary> 98 /// </summary>
99 /// 99 /// <remarks>
100 /// This method is called in response to a client's detach request, so we only update the information in 100 /// This method is called in response to a client's detach request, so we only update the information in
101 /// inventory 101 /// inventory
102 /// </remarks>
102 /// <param name="objectLocalID"></param> 103 /// <param name="objectLocalID"></param>
103 /// <param name="remoteClient"></param> 104 /// <param name="remoteClient"></param>
104 void DetachObject(uint objectLocalID, IClientAPI remoteClient); 105 void DetachObject(uint objectLocalID, IClientAPI remoteClient);
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
index d0e5609..6817725 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
@@ -32,6 +32,14 @@ namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public interface IAvatarFactory 33 public interface IAvatarFactory
34 { 34 {
35 /// <summary>
36 /// Send the appearance of an avatar to others in the scene.
37 /// </summary>
38 /// <param name="agentId"></param>
39 /// <returns></returns>
40 bool SendAppearance(UUID agentId);
41
42 bool SaveBakedTextures(UUID agentId);
35 bool ValidateBakedTextureCache(IClientAPI client); 43 bool ValidateBakedTextureCache(IClientAPI client);
36 void QueueAppearanceSend(UUID agentid); 44 void QueueAppearanceSend(UUID agentid);
37 void QueueAppearanceSave(UUID agentid); 45 void QueueAppearanceSave(UUID agentid);
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index fa8d6b6..5e5c4a1 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework;
29using OpenSim.Region.Framework.Scenes; 30using OpenSim.Region.Framework.Scenes;
30 31
31namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
@@ -39,9 +40,26 @@ namespace OpenSim.Region.Framework.Interfaces
39 /// <param name="lastname"></param> 40 /// <param name="lastname"></param>
40 /// <param name="position"></param> 41 /// <param name="position"></param>
41 /// <param name="scene"></param> 42 /// <param name="scene"></param>
42 /// <param name="cloneAppearanceFrom">The UUID of the avatar from which to clone the NPC's appearance from.</param> 43 /// <param name="appearance">The avatar appearance to use for the new NPC.</param>
43 /// <returns>The UUID of the ScenePresence created.</returns> 44 /// <returns>The UUID of the ScenePresence created.</returns>
44 UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom); 45 UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, AvatarAppearance appearance);
46
47 /// <summary>
48 /// Check if the agent is an NPC.
49 /// </summary>
50 /// <param name="agentID"></param>
51 /// <param name="scene"></param>
52 /// <returns>True if the agent is an NPC in the given scene. False otherwise.</returns>
53 bool IsNPC(UUID agentID, Scene scene);
54
55 /// <summary>
56 /// Set the appearance for an NPC.
57 /// </summary>
58 /// <param name="agentID"></param>
59 /// <param name="appearance"></param>
60 /// <param name="scene"></param>
61 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
62 bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene);
45 63
46 /// <summary> 64 /// <summary>
47 /// Move an NPC to a target over time. 65 /// Move an NPC to a target over time.
@@ -49,7 +67,23 @@ namespace OpenSim.Region.Framework.Interfaces
49 /// <param name="agentID">The UUID of the NPC</param> 67 /// <param name="agentID">The UUID of the NPC</param>
50 /// <param name="scene"></param> 68 /// <param name="scene"></param>
51 /// <param name="pos"></param> 69 /// <param name="pos"></param>
52 void MoveToTarget(UUID agentID, Scene scene, Vector3 pos); 70 /// <param name="noFly">
71 /// If true, then the avatar will attempt to walk to the location even if it's up in the air.
72 /// This is to allow walking on prims.
73 /// </param>
74 /// <param name="landAtTarget">
75 /// If true and the avatar is flying when it reaches the target, land.
76 /// </param>
77 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
78 bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget);
79
80 /// <summary>
81 /// Stop the NPC's current movement.
82 /// </summary>
83 /// <param name="agentID">The UUID of the NPC</param>
84 /// <param name="scene"></param>
85 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
86 bool StopMoveToTarget(UUID agentID, Scene scene);
53 87
54 /// <summary> 88 /// <summary>
55 /// Get the NPC to say something. 89 /// Get the NPC to say something.
@@ -57,14 +91,15 @@ namespace OpenSim.Region.Framework.Interfaces
57 /// <param name="agentID">The UUID of the NPC</param> 91 /// <param name="agentID">The UUID of the NPC</param>
58 /// <param name="scene"></param> 92 /// <param name="scene"></param>
59 /// <param name="text"></param> 93 /// <param name="text"></param>
60 void Say(UUID agentID, Scene scene, string text); 94 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
61 95 bool Say(UUID agentID, Scene scene, string text);
62 96
63 /// <summary> 97 /// <summary>
64 /// Delete an NPC. 98 /// Delete an NPC.
65 /// </summary> 99 /// </summary>
66 /// <param name="agentID">The UUID of the NPC</param> 100 /// <param name="agentID">The UUID of the NPC</param>
67 /// <param name="scene"></param> 101 /// <param name="scene"></param>
68 void DeleteNPC(UUID agentID, Scene scene); 102 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
103 bool DeleteNPC(UUID agentID, Scene scene);
69 } 104 }
70} \ No newline at end of file 105} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index 5d30aa8..c66e053 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -5,13 +5,48 @@ using OpenMetaverse;
5 5
6namespace OpenSim.Region.Framework.Interfaces 6namespace OpenSim.Region.Framework.Interfaces
7{ 7{
8 /// <summary>
9 /// This maintains the relationship between a UUID and a user name.
10 /// </summary>
8 public interface IUserManagement 11 public interface IUserManagement
9 { 12 {
10 string GetUserName(UUID uuid); 13 string GetUserName(UUID uuid);
11 string GetUserHomeURL(UUID uuid); 14 string GetUserHomeURL(UUID uuid);
12 string GetUserUUI(UUID uuid); 15 string GetUserUUI(UUID uuid);
13 string GetUserServerURL(UUID uuid, string serverType); 16 string GetUserServerURL(UUID uuid, string serverType);
14 void AddUser(UUID uuid, string userData); 17
18 /// <summary>
19 /// Add a user.
20 /// </summary>
21 /// <remarks>
22 /// If an account is found for the UUID, then the names in this will be used rather than any information
23 /// extracted from creatorData.
24 /// </remarks>
25 /// <param name="uuid"></param>
26 /// <param name="creatorData">The creator data for this user.</param>
27 void AddUser(UUID uuid, string creatorData);
28
29 /// <summary>
30 /// Add a user.
31 /// </summary>
32 /// <remarks>
33 /// The UUID is related to the name without any other checks being performed, such as user account presence.
34 /// </remarks>
35 /// <param name="uuid"></param>
36 /// <param name="firstName"></param>
37 /// <param name="lastName"></param>
38 void AddUser(UUID uuid, string firstName, string lastName);
39
40 /// <summary>
41 /// Add a user.
42 /// </summary>
43 /// <remarks>
44 /// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the
45 /// AddUser(UUID uuid, string creatorData) method.
46 /// </remarks>
47 /// <param name="uuid"></param>
48 /// <param name="firstName"></param>
49 /// <param name="profileURL"></param>
15 void AddUser(UUID uuid, string firstName, string lastName, string profileURL); 50 void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
16 } 51 }
17} 52}
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 4ab818f..e07d8b4 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -77,6 +77,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
77 if (m_scenePresence.IsChildAgent) 77 if (m_scenePresence.IsChildAgent)
78 return; 78 return;
79 79
80// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
81
80 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) 82 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
81 SendAnimPack(); 83 SendAnimPack();
82 } 84 }
@@ -91,6 +93,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
91 if (animID == UUID.Zero) 93 if (animID == UUID.Zero)
92 return; 94 return;
93 95
96// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name);
97
94 AddAnimation(animID, objectID); 98 AddAnimation(animID, objectID);
95 } 99 }
96 100
@@ -127,13 +131,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
127 /// </summary> 131 /// </summary>
128 public void TrySetMovementAnimation(string anim) 132 public void TrySetMovementAnimation(string anim)
129 { 133 {
130 //m_log.DebugFormat("Updating movement animation to {0}", anim);
131
132 if (!m_scenePresence.IsChildAgent) 134 if (!m_scenePresence.IsChildAgent)
133 { 135 {
134 if (m_animations.TrySetDefaultAnimation( 136 if (m_animations.TrySetDefaultAnimation(
135 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) 137 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
136 { 138 {
139// m_log.DebugFormat(
140// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}",
141// anim, m_scenePresence.Name);
142
137 // 16384 is CHANGED_ANIMATION 143 // 16384 is CHANGED_ANIMATION
138 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); 144 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION});
139 SendAnimPack(); 145 SendAnimPack();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b3b6cbc..513c0ea 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -611,6 +611,10 @@ namespace OpenSim.Region.Framework.Scenes
611 "delete object name <name>", 611 "delete object name <name>",
612 "Delete object by name", HandleDeleteObject); 612 "Delete object by name", HandleDeleteObject);
613 613
614 MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside",
615 "delete object outside",
616 "Delete all objects outside boundaries", HandleDeleteObject);
617
614 //Bind Storage Manager functions to some land manager functions for this scene 618 //Bind Storage Manager functions to some land manager functions for this scene
615 EventManager.OnLandObjectAdded += 619 EventManager.OnLandObjectAdded +=
616 new EventManager.LandObjectAdded(simDataService.StoreLandObject); 620 new EventManager.LandObjectAdded(simDataService.StoreLandObject);
@@ -2539,10 +2543,11 @@ namespace OpenSim.Region.Framework.Scenes
2539 #region Add/Remove Avatar Methods 2543 #region Add/Remove Avatar Methods
2540 2544
2541 /// <summary> 2545 /// <summary>
2542 /// Adding a New Client and Create a Presence for it. 2546 /// Add a new client and create a child agent for it.
2543 /// </summary> 2547 /// </summary>
2544 /// <param name="client"></param> 2548 /// <param name="client"></param>
2545 public override void AddNewClient(IClientAPI client) 2549 /// <param name="type">The type of agent to add.</param>
2550 public override void AddNewClient(IClientAPI client, PresenceType type)
2546 { 2551 {
2547 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2552 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2548 bool vialogin = false; 2553 bool vialogin = false;
@@ -2562,7 +2567,7 @@ namespace OpenSim.Region.Framework.Scenes
2562 m_clientManager.Add(client); 2567 m_clientManager.Add(client);
2563 SubscribeToClientEvents(client); 2568 SubscribeToClientEvents(client);
2564 2569
2565 ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); 2570 ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
2566 m_eventManager.TriggerOnNewPresence(sp); 2571 m_eventManager.TriggerOnNewPresence(sp);
2567 2572
2568 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; 2573 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags;
@@ -2577,12 +2582,13 @@ namespace OpenSim.Region.Framework.Scenes
2577 } 2582 }
2578 } 2583 }
2579 2584
2580 if (GetScenePresence(client.AgentId) != null) 2585 ScenePresence createdSp = GetScenePresence(client.AgentId);
2586 if (createdSp != null)
2581 { 2587 {
2582 m_LastLogin = Util.EnvironmentTickCount(); 2588 m_LastLogin = Util.EnvironmentTickCount();
2583 2589
2584 // Cache the user's name 2590 // Cache the user's name
2585 CacheUserName(aCircuit); 2591 CacheUserName(createdSp, aCircuit);
2586 2592
2587 EventManager.TriggerOnNewClient(client); 2593 EventManager.TriggerOnNewClient(client);
2588 if (vialogin) 2594 if (vialogin)
@@ -2590,28 +2596,41 @@ namespace OpenSim.Region.Framework.Scenes
2590 } 2596 }
2591 } 2597 }
2592 2598
2593 private void CacheUserName(AgentCircuitData aCircuit) 2599 /// <summary>
2600 /// Cache the user name for later use.
2601 /// </summary>
2602 /// <param name="sp"></param>
2603 /// <param name="aCircuit"></param>
2604 private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit)
2594 { 2605 {
2595 IUserManagement uMan = RequestModuleInterface<IUserManagement>(); 2606 IUserManagement uMan = RequestModuleInterface<IUserManagement>();
2596 if (uMan != null) 2607 if (uMan != null)
2597 { 2608 {
2598 string homeURL = string.Empty;
2599 string first = aCircuit.firstname, last = aCircuit.lastname; 2609 string first = aCircuit.firstname, last = aCircuit.lastname;
2600 2610
2601 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 2611 if (sp.PresenceType == PresenceType.Npc)
2602 homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); 2612 {
2603 2613 uMan.AddUser(aCircuit.AgentID, first, last);
2604 if (aCircuit.lastname.StartsWith("@")) 2614 }
2615 else
2605 { 2616 {
2606 string[] parts = aCircuit.firstname.Split('.'); 2617 string homeURL = string.Empty;
2607 if (parts.Length >= 2) 2618
2619 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
2620 homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
2621
2622 if (aCircuit.lastname.StartsWith("@"))
2608 { 2623 {
2609 first = parts[0]; 2624 string[] parts = aCircuit.firstname.Split('.');
2610 last = parts[1]; 2625 if (parts.Length >= 2)
2626 {
2627 first = parts[0];
2628 last = parts[1];
2629 }
2611 } 2630 }
2612 }
2613 2631
2614 uMan.AddUser(aCircuit.AgentID, first, last, homeURL); 2632 uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
2633 }
2615 } 2634 }
2616 } 2635 }
2617 2636
@@ -3091,11 +3110,7 @@ namespace OpenSim.Region.Framework.Scenes
3091 } 3110 }
3092 } 3111 }
3093 3112
3094 /// <summary> 3113 public override void RemoveClient(UUID agentID, bool closeChildAgents)
3095 /// Remove the given client from the scene.
3096 /// </summary>
3097 /// <param name="agentID"></param>
3098 public override void RemoveClient(UUID agentID)
3099 { 3114 {
3100 CheckHeartbeat(); 3115 CheckHeartbeat();
3101 bool childagentYN = false; 3116 bool childagentYN = false;
@@ -3116,15 +3131,17 @@ namespace OpenSim.Region.Framework.Scenes
3116 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); 3131 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName);
3117 3132
3118 m_sceneGraph.removeUserCount(!childagentYN); 3133 m_sceneGraph.removeUserCount(!childagentYN);
3119 3134
3120 if (CapsModule != null) 3135 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop
3136 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI
3137 if (closeChildAgents && CapsModule != null)
3121 CapsModule.RemoveCaps(agentID); 3138 CapsModule.RemoveCaps(agentID);
3122 3139
3123 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever 3140 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3124 // this method is doing is HORRIBLE!!! 3141 // this method is doing is HORRIBLE!!!
3125 avatar.Scene.NeedSceneCacheClear(avatar.UUID); 3142 avatar.Scene.NeedSceneCacheClear(avatar.UUID);
3126 3143
3127 if (!avatar.IsChildAgent) 3144 if (closeChildAgents && !avatar.IsChildAgent)
3128 { 3145 {
3129 //List<ulong> childknownRegions = new List<ulong>(); 3146 //List<ulong> childknownRegions = new List<ulong>();
3130 //List<ulong> ckn = avatar.KnownChildRegionHandles; 3147 //List<ulong> ckn = avatar.KnownChildRegionHandles;
@@ -3136,6 +3153,7 @@ namespace OpenSim.Region.Framework.Scenes
3136 regions.Remove(RegionInfo.RegionHandle); 3153 regions.Remove(RegionInfo.RegionHandle);
3137 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); 3154 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
3138 } 3155 }
3156
3139 m_eventManager.TriggerClientClosed(agentID, this); 3157 m_eventManager.TriggerClientClosed(agentID, this);
3140 } 3158 }
3141 catch (NullReferenceException) 3159 catch (NullReferenceException)
@@ -3146,7 +3164,7 @@ namespace OpenSim.Region.Framework.Scenes
3146 3164
3147 m_eventManager.TriggerOnRemovePresence(agentID); 3165 m_eventManager.TriggerOnRemovePresence(agentID);
3148 3166
3149 if (avatar != null && (!avatar.IsChildAgent)) 3167 if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc)
3150 avatar.SaveChangedAttachments(); 3168 avatar.SaveChangedAttachments();
3151 3169
3152 ForEachClient( 3170 ForEachClient(
@@ -4942,11 +4960,19 @@ namespace OpenSim.Region.Framework.Scenes
4942 4960
4943 private void HandleDeleteObject(string module, string[] cmd) 4961 private void HandleDeleteObject(string module, string[] cmd)
4944 { 4962 {
4945 if (cmd.Length < 4) 4963 if (cmd.Length < 3)
4946 return; 4964 return;
4947 4965
4948 string mode = cmd[2]; 4966 string mode = cmd[2];
4949 string o = cmd[3]; 4967 string o = "";
4968
4969 if (mode != "outside")
4970 {
4971 if (cmd.Length < 4)
4972 return;
4973
4974 o = cmd[3];
4975 }
4950 4976
4951 List<SceneObjectGroup> deletes = new List<SceneObjectGroup>(); 4977 List<SceneObjectGroup> deletes = new List<SceneObjectGroup>();
4952 4978
@@ -4988,10 +5014,33 @@ namespace OpenSim.Region.Framework.Scenes
4988 deletes.Add(g); 5014 deletes.Add(g);
4989 }); 5015 });
4990 break; 5016 break;
5017 case "outside":
5018 ForEachSOG(delegate (SceneObjectGroup g)
5019 {
5020 SceneObjectPart rootPart = g.RootPart;
5021 bool delete = false;
5022
5023 if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0)
5024 {
5025 delete = true;
5026 } else {
5027 ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y);
5028
5029 if (parcel == null || parcel.LandData.Name == "NO LAND")
5030 delete = true;
5031 }
5032
5033 if (delete && !rootPart.IsAttachment && !deletes.Contains(g))
5034 deletes.Add(g);
5035 });
5036 break;
4991 } 5037 }
4992 5038
4993 foreach (SceneObjectGroup g in deletes) 5039 foreach (SceneObjectGroup g in deletes)
5040 {
5041 m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID);
4994 DeleteSceneObject(g, false); 5042 DeleteSceneObject(g, false);
5043 }
4995 } 5044 }
4996 5045
4997 private void HandleReloadEstate(string module, string[] cmd) 5046 private void HandleReloadEstate(string module, string[] cmd)
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index c4547f2..ec94f10 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -175,18 +175,8 @@ namespace OpenSim.Region.Framework.Scenes
175 175
176 #region Add/Remove Agent/Avatar 176 #region Add/Remove Agent/Avatar
177 177
178 /// <summary> 178 public abstract void AddNewClient(IClientAPI client, PresenceType type);
179 /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing 179 public abstract void RemoveClient(UUID agentID, bool closeChildAgents);
180 /// will promote it to a root agent during login.
181 /// </summary>
182 /// <param name="client"></param
183 public abstract void AddNewClient(IClientAPI client);
184
185 /// <summary>
186 /// Remove a client from the scene
187 /// </summary>
188 /// <param name="agentID"></param>
189 public abstract void RemoveClient(UUID agentID);
190 180
191 public bool TryGetScenePresence(UUID agentID, out object scenePresence) 181 public bool TryGetScenePresence(UUID agentID, out object scenePresence)
192 { 182 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 65dc2c9..f40b373 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -590,12 +590,13 @@ namespace OpenSim.Region.Framework.Scenes
590 } 590 }
591 } 591 }
592 592
593 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) 593 protected internal ScenePresence CreateAndAddChildScenePresence(
594 IClientAPI client, AvatarAppearance appearance, PresenceType type)
594 { 595 {
595 ScenePresence newAvatar = null; 596 ScenePresence newAvatar = null;
596 597
597 // ScenePresence always defaults to child agent 598 // ScenePresence always defaults to child agent
598 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); 599 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance, type);
599 600
600 AddScenePresence(newAvatar); 601 AddScenePresence(newAvatar);
601 602
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 97ee844..7fada4b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -53,12 +53,12 @@ namespace OpenSim.Region.Framework.Scenes
53 get { return m_instance; } 53 get { return m_instance; }
54 } 54 }
55 55
56 private readonly List<Scene> m_localScenes; 56 private readonly List<Scene> m_localScenes = new List<Scene>();
57 private Scene m_currentScene = null; 57 private Scene m_currentScene = null;
58 58
59 public List<Scene> Scenes 59 public List<Scene> Scenes
60 { 60 {
61 get { return m_localScenes; } 61 get { return new List<Scene>(m_localScenes); }
62 } 62 }
63 63
64 public Scene CurrentScene 64 public Scene CurrentScene
@@ -72,13 +72,12 @@ namespace OpenSim.Region.Framework.Scenes
72 { 72 {
73 if (m_currentScene == null) 73 if (m_currentScene == null)
74 { 74 {
75 if (m_localScenes.Count > 0) 75 lock (m_localScenes)
76 { 76 {
77 return m_localScenes[0]; 77 if (m_localScenes.Count > 0)
78 } 78 return m_localScenes[0];
79 else 79 else
80 { 80 return null;
81 return null;
82 } 81 }
83 } 82 }
84 else 83 else
@@ -98,17 +97,21 @@ namespace OpenSim.Region.Framework.Scenes
98 { 97 {
99 // collect known shared modules in sharedModules 98 // collect known shared modules in sharedModules
100 Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>(); 99 Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>();
101 for (int i = 0; i < m_localScenes.Count; i++) 100
101 lock (m_localScenes)
102 { 102 {
103 // extract known shared modules from scene 103 for (int i = 0; i < m_localScenes.Count; i++)
104 foreach (string k in m_localScenes[i].Modules.Keys)
105 { 104 {
106 if (m_localScenes[i].Modules[k].IsSharedModule && 105 // extract known shared modules from scene
107 !sharedModules.ContainsKey(k)) 106 foreach (string k in m_localScenes[i].Modules.Keys)
108 sharedModules[k] = m_localScenes[i].Modules[k]; 107 {
108 if (m_localScenes[i].Modules[k].IsSharedModule &&
109 !sharedModules.ContainsKey(k))
110 sharedModules[k] = m_localScenes[i].Modules[k];
111 }
112 // close scene/region
113 m_localScenes[i].Close();
109 } 114 }
110 // close scene/region
111 m_localScenes[i].Close();
112 } 115 }
113 116
114 // all regions/scenes are now closed, we can now safely 117 // all regions/scenes are now closed, we can now safely
@@ -121,13 +124,16 @@ namespace OpenSim.Region.Framework.Scenes
121 124
122 public void Close(Scene cscene) 125 public void Close(Scene cscene)
123 { 126 {
124 if (m_localScenes.Contains(cscene)) 127 lock (m_localScenes)
125 { 128 {
126 for (int i = 0; i < m_localScenes.Count; i++) 129 if (m_localScenes.Contains(cscene))
127 { 130 {
128 if (m_localScenes[i].Equals(cscene)) 131 for (int i = 0; i < m_localScenes.Count; i++)
129 { 132 {
130 m_localScenes[i].Close(); 133 if (m_localScenes[i].Equals(cscene))
134 {
135 m_localScenes[i].Close();
136 }
131 } 137 }
132 } 138 }
133 } 139 }
@@ -136,27 +142,33 @@ namespace OpenSim.Region.Framework.Scenes
136 public void Add(Scene scene) 142 public void Add(Scene scene)
137 { 143 {
138 scene.OnRestart += HandleRestart; 144 scene.OnRestart += HandleRestart;
139 m_localScenes.Add(scene); 145
146 lock (m_localScenes)
147 m_localScenes.Add(scene);
140 } 148 }
141 149
142 public void HandleRestart(RegionInfo rdata) 150 public void HandleRestart(RegionInfo rdata)
143 { 151 {
144 m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); 152 m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main");
145 int RegionSceneElement = -1; 153 int RegionSceneElement = -1;
146 for (int i = 0; i < m_localScenes.Count; i++) 154
155 lock (m_localScenes)
147 { 156 {
148 if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName) 157 for (int i = 0; i < m_localScenes.Count; i++)
149 { 158 {
150 RegionSceneElement = i; 159 if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName)
160 {
161 RegionSceneElement = i;
162 }
151 } 163 }
152 }
153 164
154 // Now we make sure the region is no longer known about by the SceneManager 165 // Now we make sure the region is no longer known about by the SceneManager
155 // Prevents duplicates. 166 // Prevents duplicates.
156 167
157 if (RegionSceneElement >= 0) 168 if (RegionSceneElement >= 0)
158 { 169 {
159 m_localScenes.RemoveAt(RegionSceneElement); 170 m_localScenes.RemoveAt(RegionSceneElement);
171 }
160 } 172 }
161 173
162 // Send signal to main that we're restarting this sim. 174 // Send signal to main that we're restarting this sim.
@@ -167,28 +179,32 @@ namespace OpenSim.Region.Framework.Scenes
167 { 179 {
168 RegionInfo Result = null; 180 RegionInfo Result = null;
169 181
170 for (int i = 0; i < m_localScenes.Count; i++) 182 lock (m_localScenes)
171 {
172 if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle)
173 {
174 // Inform other regions to tell their avatar about me
175 Result = m_localScenes[i].RegionInfo;
176 }
177 }
178 if (Result != null)
179 { 183 {
180 for (int i = 0; i < m_localScenes.Count; i++) 184 for (int i = 0; i < m_localScenes.Count; i++)
181 { 185 {
182 if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle) 186 if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle)
183 { 187 {
184 // Inform other regions to tell their avatar about me 188 // Inform other regions to tell their avatar about me
185 //m_localScenes[i].OtherRegionUp(Result); 189 Result = m_localScenes[i].RegionInfo;
186 } 190 }
187 } 191 }
188 } 192
189 else 193 if (Result != null)
190 { 194 {
191 m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up"); 195 for (int i = 0; i < m_localScenes.Count; i++)
196 {
197 if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle)
198 {
199 // Inform other regions to tell their avatar about me
200 //m_localScenes[i].OtherRegionUp(Result);
201 }
202 }
203 }
204 else
205 {
206 m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up");
207 }
192 } 208 }
193 } 209 }
194 210
@@ -292,7 +308,8 @@ namespace OpenSim.Region.Framework.Scenes
292 { 308 {
293 if (m_currentScene == null) 309 if (m_currentScene == null)
294 { 310 {
295 m_localScenes.ForEach(func); 311 lock (m_localScenes)
312 m_localScenes.ForEach(func);
296 } 313 }
297 else 314 else
298 { 315 {
@@ -321,12 +338,15 @@ namespace OpenSim.Region.Framework.Scenes
321 } 338 }
322 else 339 else
323 { 340 {
324 foreach (Scene scene in m_localScenes) 341 lock (m_localScenes)
325 { 342 {
326 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) 343 foreach (Scene scene in m_localScenes)
327 { 344 {
328 m_currentScene = scene; 345 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
329 return true; 346 {
347 m_currentScene = scene;
348 return true;
349 }
330 } 350 }
331 } 351 }
332 352
@@ -338,12 +358,15 @@ namespace OpenSim.Region.Framework.Scenes
338 { 358 {
339 m_log.Debug("Searching for Region: '" + regionID + "'"); 359 m_log.Debug("Searching for Region: '" + regionID + "'");
340 360
341 foreach (Scene scene in m_localScenes) 361 lock (m_localScenes)
342 { 362 {
343 if (scene.RegionInfo.RegionID == regionID) 363 foreach (Scene scene in m_localScenes)
344 { 364 {
345 m_currentScene = scene; 365 if (scene.RegionInfo.RegionID == regionID)
346 return true; 366 {
367 m_currentScene = scene;
368 return true;
369 }
347 } 370 }
348 } 371 }
349 372
@@ -352,26 +375,33 @@ namespace OpenSim.Region.Framework.Scenes
352 375
353 public bool TryGetScene(string regionName, out Scene scene) 376 public bool TryGetScene(string regionName, out Scene scene)
354 { 377 {
355 foreach (Scene mscene in m_localScenes) 378 lock (m_localScenes)
356 { 379 {
357 if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) 380 foreach (Scene mscene in m_localScenes)
358 { 381 {
359 scene = mscene; 382 if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0)
360 return true; 383 {
384 scene = mscene;
385 return true;
386 }
361 } 387 }
362 } 388 }
389
363 scene = null; 390 scene = null;
364 return false; 391 return false;
365 } 392 }
366 393
367 public bool TryGetScene(UUID regionID, out Scene scene) 394 public bool TryGetScene(UUID regionID, out Scene scene)
368 { 395 {
369 foreach (Scene mscene in m_localScenes) 396 lock (m_localScenes)
370 { 397 {
371 if (mscene.RegionInfo.RegionID == regionID) 398 foreach (Scene mscene in m_localScenes)
372 { 399 {
373 scene = mscene; 400 if (mscene.RegionInfo.RegionID == regionID)
374 return true; 401 {
402 scene = mscene;
403 return true;
404 }
375 } 405 }
376 } 406 }
377 407
@@ -381,13 +411,16 @@ namespace OpenSim.Region.Framework.Scenes
381 411
382 public bool TryGetScene(uint locX, uint locY, out Scene scene) 412 public bool TryGetScene(uint locX, uint locY, out Scene scene)
383 { 413 {
384 foreach (Scene mscene in m_localScenes) 414 lock (m_localScenes)
385 { 415 {
386 if (mscene.RegionInfo.RegionLocX == locX && 416 foreach (Scene mscene in m_localScenes)
387 mscene.RegionInfo.RegionLocY == locY)
388 { 417 {
389 scene = mscene; 418 if (mscene.RegionInfo.RegionLocX == locX &&
390 return true; 419 mscene.RegionInfo.RegionLocY == locY)
420 {
421 scene = mscene;
422 return true;
423 }
391 } 424 }
392 } 425 }
393 426
@@ -397,13 +430,16 @@ namespace OpenSim.Region.Framework.Scenes
397 430
398 public bool TryGetScene(IPEndPoint ipEndPoint, out Scene scene) 431 public bool TryGetScene(IPEndPoint ipEndPoint, out Scene scene)
399 { 432 {
400 foreach (Scene mscene in m_localScenes) 433 lock (m_localScenes)
401 { 434 {
402 if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) && 435 foreach (Scene mscene in m_localScenes)
403 (mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port))
404 { 436 {
405 scene = mscene; 437 if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) &&
406 return true; 438 (mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port))
439 {
440 scene = mscene;
441 return true;
442 }
407 } 443 }
408 } 444 }
409 445
@@ -472,11 +508,14 @@ namespace OpenSim.Region.Framework.Scenes
472 508
473 public RegionInfo GetRegionInfo(UUID regionID) 509 public RegionInfo GetRegionInfo(UUID regionID)
474 { 510 {
475 foreach (Scene scene in m_localScenes) 511 lock (m_localScenes)
476 { 512 {
477 if (scene.RegionInfo.RegionID == regionID) 513 foreach (Scene scene in m_localScenes)
478 { 514 {
479 return scene.RegionInfo; 515 if (scene.RegionInfo.RegionID == regionID)
516 {
517 return scene.RegionInfo;
518 }
480 } 519 }
481 } 520 }
482 521
@@ -495,11 +534,14 @@ namespace OpenSim.Region.Framework.Scenes
495 534
496 public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) 535 public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar)
497 { 536 {
498 foreach (Scene scene in m_localScenes) 537 lock (m_localScenes)
499 { 538 {
500 if (scene.TryGetScenePresence(avatarId, out avatar)) 539 foreach (Scene scene in m_localScenes)
501 { 540 {
502 return true; 541 if (scene.TryGetScenePresence(avatarId, out avatar))
542 {
543 return true;
544 }
503 } 545 }
504 } 546 }
505 547
@@ -510,12 +552,16 @@ namespace OpenSim.Region.Framework.Scenes
510 public bool TryGetAvatarsScene(UUID avatarId, out Scene scene) 552 public bool TryGetAvatarsScene(UUID avatarId, out Scene scene)
511 { 553 {
512 ScenePresence avatar = null; 554 ScenePresence avatar = null;
513 foreach (Scene mScene in m_localScenes) 555
556 lock (m_localScenes)
514 { 557 {
515 if (mScene.TryGetScenePresence(avatarId, out avatar)) 558 foreach (Scene mScene in m_localScenes)
516 { 559 {
517 scene = mScene; 560 if (mScene.TryGetScenePresence(avatarId, out avatar))
518 return true; 561 {
562 scene = mScene;
563 return true;
564 }
519 } 565 }
520 } 566 }
521 567
@@ -525,17 +571,22 @@ namespace OpenSim.Region.Framework.Scenes
525 571
526 public void CloseScene(Scene scene) 572 public void CloseScene(Scene scene)
527 { 573 {
528 m_localScenes.Remove(scene); 574 lock (m_localScenes)
575 m_localScenes.Remove(scene);
576
529 scene.Close(); 577 scene.Close();
530 } 578 }
531 579
532 public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) 580 public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
533 { 581 {
534 foreach (Scene scene in m_localScenes) 582 lock (m_localScenes)
535 { 583 {
536 if (scene.TryGetAvatarByName(avatarName, out avatar)) 584 foreach (Scene scene in m_localScenes)
537 { 585 {
538 return true; 586 if (scene.TryGetAvatarByName(avatarName, out avatar))
587 {
588 return true;
589 }
539 } 590 }
540 } 591 }
541 592
@@ -545,7 +596,8 @@ namespace OpenSim.Region.Framework.Scenes
545 596
546 public void ForEachScene(Action<Scene> action) 597 public void ForEachScene(Action<Scene> action)
547 { 598 {
548 m_localScenes.ForEach(action); 599 lock (m_localScenes)
600 m_localScenes.ForEach(action);
549 } 601 }
550 } 602 }
551} 603}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 57baa99..fe96152 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes
1650 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); 1650 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
1651 if (avatar != null) 1651 if (avatar != null)
1652 { 1652 {
1653 avatar.MoveToTarget(target); 1653 avatar.MoveToTarget(target, false);
1654 } 1654 }
1655 } 1655 }
1656 else 1656 else
@@ -2253,7 +2253,7 @@ namespace OpenSim.Region.Framework.Scenes
2253 /// <param name="objectGroup"></param> 2253 /// <param name="objectGroup"></param>
2254 public virtual void DetachFromBackup() 2254 public virtual void DetachFromBackup()
2255 { 2255 {
2256 if (m_isBackedUp) 2256 if (m_isBackedUp && Scene != null)
2257 m_scene.EventManager.OnBackup -= ProcessBackup; 2257 m_scene.EventManager.OnBackup -= ProcessBackup;
2258 2258
2259 m_isBackedUp = false; 2259 m_isBackedUp = false;
@@ -2520,7 +2520,7 @@ namespace OpenSim.Region.Framework.Scenes
2520 { 2520 {
2521 SceneObjectPart selectionPart = GetChildPart(localID); 2521 SceneObjectPart selectionPart = GetChildPart(localID);
2522 2522
2523 if (SetTemporary) 2523 if (SetTemporary && Scene != null)
2524 { 2524 {
2525 DetachFromBackup(); 2525 DetachFromBackup();
2526 // Remove from database and parcel prim count 2526 // Remove from database and parcel prim count
@@ -2532,15 +2532,19 @@ namespace OpenSim.Region.Framework.Scenes
2532 if (selectionPart != null) 2532 if (selectionPart != null)
2533 { 2533 {
2534 SceneObjectPart[] parts = m_parts.GetArray(); 2534 SceneObjectPart[] parts = m_parts.GetArray();
2535 for (int i = 0; i < parts.Length; i++) 2535
2536 if (Scene != null)
2536 { 2537 {
2537 SceneObjectPart part = parts[i]; 2538 for (int i = 0; i < parts.Length; i++)
2538 if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax ||
2539 part.Scale.Y > m_scene.RegionInfo.PhysPrimMax ||
2540 part.Scale.Z > m_scene.RegionInfo.PhysPrimMax)
2541 { 2539 {
2542 UsePhysics = false; // Reset physics 2540 SceneObjectPart part = parts[i];
2543 break; 2541 if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax ||
2542 part.Scale.Y > m_scene.RegionInfo.PhysPrimMax ||
2543 part.Scale.Z > m_scene.RegionInfo.PhysPrimMax)
2544 {
2545 UsePhysics = false; // Reset physics
2546 break;
2547 }
2544 } 2548 }
2545 } 2549 }
2546 2550
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 90ad34e..a0e87d0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -261,12 +261,9 @@ namespace OpenSim.Region.Framework.Scenes
261 } 261 }
262 protected SceneObjectPartInventory m_inventory; 262 protected SceneObjectPartInventory m_inventory;
263 263
264
265 public bool Undoing; 264 public bool Undoing;
266
267 265
268 public bool IgnoreUndoUpdate = false; 266 public bool IgnoreUndoUpdate = false;
269
270 267
271 private PrimFlags LocalFlags; 268 private PrimFlags LocalFlags;
272 269
@@ -1606,7 +1603,6 @@ namespace OpenSim.Region.Framework.Scenes
1606 RotationOffset, 1603 RotationOffset,
1607 RigidBody, 1604 RigidBody,
1608 m_localId); 1605 m_localId);
1609 PhysActor.SetMaterial(Material);
1610 } 1606 }
1611 catch 1607 catch
1612 { 1608 {
@@ -1618,6 +1614,7 @@ namespace OpenSim.Region.Framework.Scenes
1618 { 1614 {
1619 PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info 1615 PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info
1620 PhysActor.SOPDescription = this.Description; 1616 PhysActor.SOPDescription = this.Description;
1617 PhysActor.SetMaterial(Material);
1621 DoPhysicsPropertyUpdate(RigidBody, true); 1618 DoPhysicsPropertyUpdate(RigidBody, true);
1622 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1619 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1623 } 1620 }
@@ -2970,22 +2967,6 @@ namespace OpenSim.Region.Framework.Scenes
2970 } 2967 }
2971 } 2968 }
2972 2969
2973 public void ScriptSetPhantomStatus(bool Phantom)
2974 {
2975 if (m_parentGroup != null)
2976 {
2977 m_parentGroup.ScriptSetPhantomStatus(Phantom);
2978 }
2979 }
2980
2981 public void ScriptSetTemporaryStatus(bool Temporary)
2982 {
2983 if (m_parentGroup != null)
2984 {
2985 m_parentGroup.ScriptSetTemporaryStatus(Temporary);
2986 }
2987 }
2988
2989 public void ScriptSetPhysicsStatus(bool UsePhysics) 2970 public void ScriptSetPhysicsStatus(bool UsePhysics)
2990 { 2971 {
2991 if (m_parentGroup == null) 2972 if (m_parentGroup == null)
@@ -2994,15 +2975,6 @@ namespace OpenSim.Region.Framework.Scenes
2994 m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); 2975 m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
2995 } 2976 }
2996 2977
2997 public void ScriptSetVolumeDetect(bool SetVD)
2998 {
2999
3000 if (m_parentGroup != null)
3001 {
3002 m_parentGroup.ScriptSetVolumeDetect(SetVD);
3003 }
3004 }
3005
3006 /// <summary> 2978 /// <summary>
3007 /// Set sculpt and mesh data, and tell the physics engine to process the change. 2979 /// Set sculpt and mesh data, and tell the physics engine to process the change.
3008 /// </summary> 2980 /// </summary>
@@ -4542,6 +4514,9 @@ namespace OpenSim.Region.Framework.Scenes
4542 { 4514 {
4543 RemFlag(PrimFlags.Phantom); 4515 RemFlag(PrimFlags.Phantom);
4544 4516
4517 if (ParentGroup.Scene == null)
4518 return;
4519
4545 PhysicsActor pa = PhysActor; 4520 PhysicsActor pa = PhysActor;
4546 4521
4547 if (pa == null) 4522 if (pa == null)
@@ -4555,11 +4530,11 @@ namespace OpenSim.Region.Framework.Scenes
4555 RotationOffset, 4530 RotationOffset,
4556 UsePhysics, 4531 UsePhysics,
4557 m_localId); 4532 m_localId);
4558 PhysActor.SetMaterial(Material);
4559 4533
4560 pa = PhysActor; 4534 pa = PhysActor;
4561 if (pa != null) 4535 if (pa != null)
4562 { 4536 {
4537 PhysActor.SetMaterial(Material);
4563 DoPhysicsPropertyUpdate(UsePhysics, true); 4538 DoPhysicsPropertyUpdate(UsePhysics, true);
4564 4539
4565 if (m_parentGroup != null) 4540 if (m_parentGroup != null)
@@ -4645,6 +4620,8 @@ namespace OpenSim.Region.Framework.Scenes
4645 4620
4646 ParentGroup.HasGroupChanged = true; 4621 ParentGroup.HasGroupChanged = true;
4647 ScheduleFullUpdate(); 4622 ScheduleFullUpdate();
4623
4624// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
4648 } 4625 }
4649 4626
4650 public void UpdateRotation(Quaternion rot) 4627 public void UpdateRotation(Quaternion rot)
@@ -4864,7 +4841,7 @@ namespace OpenSim.Region.Framework.Scenes
4864 // m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; 4841 // m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting;
4865 //} 4842 //}
4866 4843
4867 LocalFlags=(PrimFlags)objectflagupdate; 4844 LocalFlags = (PrimFlags)objectflagupdate;
4868 4845
4869 if (m_parentGroup != null && m_parentGroup.RootPart == this) 4846 if (m_parentGroup != null && m_parentGroup.RootPart == this)
4870 { 4847 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d354c0a..719f2da 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -75,6 +75,11 @@ namespace OpenSim.Region.Framework.Scenes
75 75
76 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 76 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
77 77
78 /// <summary>
79 /// What type of presence is this? User, NPC, etc.
80 /// </summary>
81 public PresenceType PresenceType { get; private set; }
82
78// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); 83// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
79 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); 84 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
80 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); 85 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
@@ -173,7 +178,7 @@ namespace OpenSim.Region.Framework.Scenes
173 178
174 private float m_speedModifier = 1.0f; 179 private float m_speedModifier = 1.0f;
175 180
176 private Quaternion m_bodyRot= Quaternion.Identity; 181 private Quaternion m_bodyRot = Quaternion.Identity;
177 182
178 private Quaternion m_bodyRotPrevious = Quaternion.Identity; 183 private Quaternion m_bodyRotPrevious = Quaternion.Identity;
179 184
@@ -708,15 +713,13 @@ namespace OpenSim.Region.Framework.Scenes
708 713
709 #region Constructor(s) 714 #region Constructor(s)
710 715
711 public ScenePresence() 716 public ScenePresence(
717 IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type)
712 { 718 {
713 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 719 m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
714 CreateSceneViewer(); 720 m_sceneViewer = new SceneViewer(this);
715 m_animator = new ScenePresenceAnimator(this); 721 m_animator = new ScenePresenceAnimator(this);
716 } 722 PresenceType = type;
717
718 private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this()
719 {
720 m_DrawDistance = world.DefaultDrawDistance; 723 m_DrawDistance = world.DefaultDrawDistance;
721 m_rootRegionHandle = reginfo.RegionHandle; 724 m_rootRegionHandle = reginfo.RegionHandle;
722 m_controllingClient = client; 725 m_controllingClient = client;
@@ -762,19 +765,10 @@ namespace OpenSim.Region.Framework.Scenes
762 765
763 RegisterToEvents(); 766 RegisterToEvents();
764 SetDirectionVectors(); 767 SetDirectionVectors();
765 }
766 768
767 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance)
768 : this(client, world, reginfo)
769 {
770 m_appearance = appearance; 769 m_appearance = appearance;
771 } 770 }
772 771
773 private void CreateSceneViewer()
774 {
775 m_sceneViewer = new SceneViewer(this);
776 }
777
778 public void RegisterToEvents() 772 public void RegisterToEvents()
779 { 773 {
780 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; 774 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
@@ -1144,10 +1138,14 @@ namespace OpenSim.Region.Framework.Scenes
1144 1138
1145 /// <summary> 1139 /// <summary>
1146 /// Complete Avatar's movement into the region. 1140 /// Complete Avatar's movement into the region.
1147 /// This is called upon a very important packet sent from the client,
1148 /// so it's client-controlled. Never call this method directly.
1149 /// </summary> 1141 /// </summary>
1150 public void CompleteMovement(IClientAPI client) 1142 /// <param name="client"></param>
1143 /// <param name="openChildAgents">
1144 /// If true, send notification to neighbour regions to expect
1145 /// a child agent from the client. These neighbours can be some distance away, depending right now on the
1146 /// configuration of DefaultDrawDistance in the [Startup] section of config
1147 /// </param>
1148 public void CompleteMovement(IClientAPI client, bool openChildAgents)
1151 { 1149 {
1152// DateTime startTime = DateTime.Now; 1150// DateTime startTime = DateTime.Now;
1153 1151
@@ -1188,15 +1186,11 @@ namespace OpenSim.Region.Framework.Scenes
1188 SendInitialData(); 1186 SendInitialData();
1189 1187
1190 // Create child agents in neighbouring regions 1188 // Create child agents in neighbouring regions
1191 if (!m_isChildAgent) 1189 if (openChildAgents && !m_isChildAgent)
1192 { 1190 {
1193 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1191 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1194 if (m_agentTransfer != null) 1192 if (m_agentTransfer != null)
1195 m_agentTransfer.EnableChildAgents(this); 1193 m_agentTransfer.EnableChildAgents(this);
1196 else
1197 m_log.DebugFormat(
1198 "[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active for region {0}",
1199 m_scene.RegionInfo.RegionName);
1200 1194
1201 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); 1195 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
1202 if (friendsModule != null) 1196 if (friendsModule != null)
@@ -1294,7 +1288,6 @@ namespace OpenSim.Region.Framework.Scenes
1294 #region Inputs 1288 #region Inputs
1295 1289
1296 AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; 1290 AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags;
1297 Quaternion bodyRotation = agentData.BodyRotation;
1298 1291
1299 // Camera location in world. We'll need to raytrace 1292 // Camera location in world. We'll need to raytrace
1300 // from this location from time to time. 1293 // from this location from time to time.
@@ -1380,6 +1373,15 @@ namespace OpenSim.Region.Framework.Scenes
1380 1373
1381 if (m_allowMovement && !SitGround) 1374 if (m_allowMovement && !SitGround)
1382 { 1375 {
1376 Quaternion bodyRotation = agentData.BodyRotation;
1377 bool update_rotation = false;
1378
1379 if (bodyRotation != m_bodyRot)
1380 {
1381 Rotation = bodyRotation;
1382 update_rotation = true;
1383 }
1384
1383 bool update_movementflag = false; 1385 bool update_movementflag = false;
1384 1386
1385 if (agentData.UseClientAgentPosition) 1387 if (agentData.UseClientAgentPosition)
@@ -1389,11 +1391,8 @@ namespace OpenSim.Region.Framework.Scenes
1389 } 1391 }
1390 1392
1391 int i = 0; 1393 int i = 0;
1392
1393 bool update_rotation = false;
1394 bool DCFlagKeyPressed = false; 1394 bool DCFlagKeyPressed = false;
1395 Vector3 agent_control_v3 = Vector3.Zero; 1395 Vector3 agent_control_v3 = Vector3.Zero;
1396 Quaternion q = bodyRotation;
1397 1396
1398 bool oldflying = PhysicsActor.Flying; 1397 bool oldflying = PhysicsActor.Flying;
1399 1398
@@ -1407,12 +1406,6 @@ namespace OpenSim.Region.Framework.Scenes
1407 if (actor.Flying != oldflying) 1406 if (actor.Flying != oldflying)
1408 update_movementflag = true; 1407 update_movementflag = true;
1409 1408
1410 if (q != m_bodyRot)
1411 {
1412 m_bodyRot = q;
1413 update_rotation = true;
1414 }
1415
1416 if (m_parentID == 0) 1409 if (m_parentID == 0)
1417 { 1410 {
1418 bool bAllowUpdateMoveToPosition = false; 1411 bool bAllowUpdateMoveToPosition = false;
@@ -1464,8 +1457,8 @@ namespace OpenSim.Region.Framework.Scenes
1464 ) // This or is for Nudge forward 1457 ) // This or is for Nudge forward
1465 { 1458 {
1466 m_movementflag -= ((byte)(uint)DCF); 1459 m_movementflag -= ((byte)(uint)DCF);
1467
1468 update_movementflag = true; 1460 update_movementflag = true;
1461
1469 /* 1462 /*
1470 if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) 1463 if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE)
1471 && ((m_movementflag & (byte)nudgehack) == nudgehack)) 1464 && ((m_movementflag & (byte)nudgehack) == nudgehack))
@@ -1493,7 +1486,7 @@ namespace OpenSim.Region.Framework.Scenes
1493 } 1486 }
1494 else if (bAllowUpdateMoveToPosition) 1487 else if (bAllowUpdateMoveToPosition)
1495 { 1488 {
1496 if (HandleMoveToTargetUpdate(ref agent_control_v3, bodyRotation)) 1489 if (HandleMoveToTargetUpdate(ref agent_control_v3))
1497 update_movementflag = true; 1490 update_movementflag = true;
1498 } 1491 }
1499 } 1492 }
@@ -1531,13 +1524,10 @@ namespace OpenSim.Region.Framework.Scenes
1531 // m_log.DebugFormat( 1524 // m_log.DebugFormat(
1532 // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); 1525 // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
1533 1526
1534 AddNewMovement(agent_control_v3, q); 1527 AddNewMovement(agent_control_v3);
1535 } 1528 }
1536 1529
1537 if (update_movementflag 1530 if (update_movementflag && m_parentID == 0)
1538 && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0)
1539 && (m_parentID == 0)
1540 && !SitGround)
1541 Animator.UpdateMovementAnimations(); 1531 Animator.UpdateMovementAnimations();
1542 } 1532 }
1543 1533
@@ -1553,9 +1543,8 @@ namespace OpenSim.Region.Framework.Scenes
1553 /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3. 1543 /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3.
1554 /// </remarks> 1544 /// </remarks>
1555 /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param> 1545 /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param>
1556 /// <param value="bodyRotation">New body rotation of the avatar.</param>
1557 /// <returns>True if movement has been updated in some way. False otherwise.</returns> 1546 /// <returns>True if movement has been updated in some way. False otherwise.</returns>
1558 public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3, Quaternion bodyRotation) 1547 public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3)
1559 { 1548 {
1560// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); 1549// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
1561 1550
@@ -1591,7 +1580,7 @@ namespace OpenSim.Region.Framework.Scenes
1591 // to such forces, but the following simple approach seems to works fine. 1580 // to such forces, but the following simple approach seems to works fine.
1592 Vector3 LocalVectorToTarget3D = 1581 Vector3 LocalVectorToTarget3D =
1593 (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords 1582 (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
1594 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords 1583 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(Rotation)); // change to avatar coords
1595 // Ignore z component of vector 1584 // Ignore z component of vector
1596// Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); 1585// Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
1597 LocalVectorToTarget3D.Normalize(); 1586 LocalVectorToTarget3D.Normalize();
@@ -1680,7 +1669,12 @@ namespace OpenSim.Region.Framework.Scenes
1680 /// Move to the given target over time. 1669 /// Move to the given target over time.
1681 /// </summary> 1670 /// </summary>
1682 /// <param name="pos"></param> 1671 /// <param name="pos"></param>
1683 public void MoveToTarget(Vector3 pos) 1672 /// <param name="noFly">
1673 /// If true, then don't allow the avatar to fly to the target, even if it's up in the air.
1674 /// This is to allow movement to targets that are known to be on an elevated platform with a continuous path
1675 /// from start to finish.
1676 /// </param>
1677 public void MoveToTarget(Vector3 pos, bool noFly)
1684 { 1678 {
1685// m_log.DebugFormat( 1679// m_log.DebugFormat(
1686// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", 1680// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
@@ -1714,15 +1708,17 @@ namespace OpenSim.Region.Framework.Scenes
1714 "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", 1708 "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
1715 Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); 1709 Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
1716 1710
1717 if (pos.Z > terrainHeight) 1711 if (noFly)
1712 PhysicsActor.Flying = false;
1713 else if (pos.Z > terrainHeight)
1718 PhysicsActor.Flying = true; 1714 PhysicsActor.Flying = true;
1719 1715
1720 MovingToTarget = true; 1716 MovingToTarget = true;
1721 MoveToPositionTarget = pos; 1717 MoveToPositionTarget = pos;
1722 1718
1723 Vector3 agent_control_v3 = new Vector3(); 1719 Vector3 agent_control_v3 = new Vector3();
1724 HandleMoveToTargetUpdate(ref agent_control_v3, Rotation); 1720 HandleMoveToTargetUpdate(ref agent_control_v3);
1725 AddNewMovement(agent_control_v3, Rotation); 1721 AddNewMovement(agent_control_v3);
1726 } 1722 }
1727 1723
1728 /// <summary> 1724 /// <summary>
@@ -1734,6 +1730,12 @@ namespace OpenSim.Region.Framework.Scenes
1734 1730
1735 MovingToTarget = false; 1731 MovingToTarget = false;
1736 MoveToPositionTarget = Vector3.Zero; 1732 MoveToPositionTarget = Vector3.Zero;
1733
1734 // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct
1735 // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag.
1736 // However, the line is here rather than in the NPC module since it also appears necessary to stop a
1737 // viewer that uses "go here" from juddering on all subsequent avatar movements.
1738 AgentControlFlags = (uint)AgentManager.ControlFlags.NONE;
1737 } 1739 }
1738 1740
1739 private void CheckAtSitTarget() 1741 private void CheckAtSitTarget()
@@ -2295,20 +2297,11 @@ namespace OpenSim.Region.Framework.Scenes
2295 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector 2297 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector
2296 /// </summary> 2298 /// </summary>
2297 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> 2299 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
2298 /// <param name="rotation">The direction in which this avatar should now face. 2300 public void AddNewMovement(Vector3 vec)
2299 public void AddNewMovement(Vector3 vec, Quaternion rotation)
2300 { 2301 {
2301 if (m_isChildAgent)
2302 {
2303 // WHAT???
2304 m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!");
2305 return;
2306 }
2307
2308 m_perfMonMS = Util.EnvironmentTickCount(); 2302 m_perfMonMS = Util.EnvironmentTickCount();
2309 2303
2310 Rotation = rotation; 2304 Vector3 direc = vec * Rotation;
2311 Vector3 direc = vec * rotation;
2312 direc.Normalize(); 2305 direc.Normalize();
2313 2306
2314 direc *= 0.03f * 128f * m_speedModifier; 2307 direc *= 0.03f * 128f * m_speedModifier;
@@ -2513,13 +2506,7 @@ namespace OpenSim.Region.Framework.Scenes
2513 // We have an appearance but we may not have the baked textures. Check the asset cache 2506 // We have an appearance but we may not have the baked textures. Check the asset cache
2514 // to see if all the baked textures are already here. 2507 // to see if all the baked textures are already here.
2515 if (m_scene.AvatarFactory != null) 2508 if (m_scene.AvatarFactory != null)
2516 {
2517 cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient); 2509 cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient);
2518 }
2519 else
2520 {
2521 m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name);
2522 }
2523 2510
2524 // If we aren't using a cached appearance, then clear out the baked textures 2511 // If we aren't using a cached appearance, then clear out the baked textures
2525 if (!cachedappearance) 2512 if (!cachedappearance)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
deleted file mode 100644
index 5586c65..0000000
--- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
+++ /dev/null
@@ -1,172 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using System.Threading;
33using System.Timers;
34using Timer=System.Timers.Timer;
35using Nini.Config;
36using NUnit.Framework;
37using OpenMetaverse;
38using OpenSim.Framework;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.CoreModules.World.Serialiser;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock;
46
47namespace OpenSim.Region.Framework.Scenes.Tests
48{
49 /// <summary>
50 /// Attachment tests
51 /// </summary>
52 [TestFixture]
53 public class AttachmentTests
54 {
55 public Scene scene, scene2;
56 public UUID agent1;
57 public static Random random;
58 public ulong region1, region2;
59 public AgentCircuitData acd1;
60 public SceneObjectGroup sog1, sog2, sog3;
61
62 [TestFixtureSetUp]
63 public void Init()
64 {
65 TestHelper.InMethod();
66
67 scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
68 scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
69
70 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
71 interregionComms.Initialise(new IniConfigSource());
72 interregionComms.PostInitialise();
73 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
74 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
75
76 agent1 = UUID.Random();
77 random = new Random();
78 sog1 = NewSOG(UUID.Random(), scene, agent1);
79 sog2 = NewSOG(UUID.Random(), scene, agent1);
80 sog3 = NewSOG(UUID.Random(), scene, agent1);
81
82 //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
83 region1 = scene.RegionInfo.RegionHandle;
84 region2 = scene2.RegionInfo.RegionHandle;
85
86 SceneSetupHelpers.AddClient(scene, agent1);
87 }
88
89 [Test]
90 public void T030_TestAddAttachments()
91 {
92 TestHelper.InMethod();
93
94 ScenePresence presence = scene.GetScenePresence(agent1);
95
96 presence.AddAttachment(sog1);
97 presence.AddAttachment(sog2);
98 presence.AddAttachment(sog3);
99
100 Assert.That(presence.HasAttachments(), Is.True);
101 Assert.That(presence.ValidateAttachments(), Is.True);
102 }
103
104 [Test]
105 public void T031_RemoveAttachments()
106 {
107 TestHelper.InMethod();
108
109 ScenePresence presence = scene.GetScenePresence(agent1);
110 presence.RemoveAttachment(sog1);
111 presence.RemoveAttachment(sog2);
112 presence.RemoveAttachment(sog3);
113 Assert.That(presence.HasAttachments(), Is.False);
114 }
115
116 // I'm commenting this test because scene setup NEEDS InventoryService to
117 // be non-null
118 //[Test]
119 public void T032_CrossAttachments()
120 {
121 TestHelper.InMethod();
122
123 ScenePresence presence = scene.GetScenePresence(agent1);
124 ScenePresence presence2 = scene2.GetScenePresence(agent1);
125 presence2.AddAttachment(sog1);
126 presence2.AddAttachment(sog2);
127
128 ISharedRegionModule serialiser = new SerialiserModule();
129 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
130 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);
131
132 Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
133
134 //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
135 Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
136 Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
137 }
138
139 private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent)
140 {
141 SceneObjectPart sop = new SceneObjectPart();
142 sop.Name = RandomName();
143 sop.Description = RandomName();
144 sop.Text = RandomName();
145 sop.SitName = RandomName();
146 sop.TouchName = RandomName();
147 sop.UUID = uuid;
148 sop.Shape = PrimitiveBaseShape.Default;
149 sop.Shape.State = 1;
150 sop.OwnerID = agent;
151
152 SceneObjectGroup sog = new SceneObjectGroup(sop);
153 sog.SetScene(scene);
154
155 return sog;
156 }
157
158 private static string RandomName()
159 {
160 StringBuilder name = new StringBuilder();
161 int size = random.Next(5,12);
162 char ch;
163 for (int i = 0; i < size; i++)
164 {
165 ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
166 name.Append(ch);
167 }
168
169 return name.ToString();
170 }
171 }
172} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
index 3a0dd00..ab6311b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
41 [Test] 41 [Test]
42 public void TestCross() 42 public void TestCross()
43 { 43 {
44 TestHelper.InMethod(); 44 TestHelpers.InMethod();
45 45
46 List<Border> testborders = new List<Border>(); 46 List<Border> testborders = new List<Border>();
47 47
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
99 [Test] 99 [Test]
100 public void TestCrossSquare512() 100 public void TestCrossSquare512()
101 { 101 {
102 TestHelper.InMethod(); 102 TestHelpers.InMethod();
103 103
104 List<Border> testborders = new List<Border>(); 104 List<Border> testborders = new List<Border>();
105 105
@@ -179,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
179 [Test] 179 [Test]
180 public void TestCrossRectangle512x256() 180 public void TestCrossRectangle512x256()
181 { 181 {
182 TestHelper.InMethod(); 182 TestHelpers.InMethod();
183 183
184 List<Border> testborders = new List<Border>(); 184 List<Border> testborders = new List<Border>();
185 185
@@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
259 [Test] 259 [Test]
260 public void TestCrossOdd512x512w256hole() 260 public void TestCrossOdd512x512w256hole()
261 { 261 {
262 TestHelper.InMethod(); 262 TestHelpers.InMethod();
263 263
264 List<Border> testborders = new List<Border>(); 264 List<Border> testborders = new List<Border>();
265 // 512____ 265 // 512____
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index f69a4b4..a5d2b23 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -45,12 +45,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
45 { 45 {
46 static public Random random; 46 static public Random random;
47 SceneObjectGroup found; 47 SceneObjectGroup found;
48 Scene scene = SceneSetupHelpers.SetupScene(); 48 Scene scene = SceneHelpers.SetupScene();
49 49
50 [Test] 50 [Test]
51 public void T010_AddObjects() 51 public void T010_AddObjects()
52 { 52 {
53 TestHelper.InMethod(); 53 TestHelpers.InMethod();
54 54
55 random = new Random(); 55 random = new Random();
56 SceneObjectGroup found; 56 SceneObjectGroup found;
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
85 [Test] 85 [Test]
86 public void T011_ThreadAddRemoveTest() 86 public void T011_ThreadAddRemoveTest()
87 { 87 {
88 TestHelper.InMethod(); 88 TestHelpers.InMethod();
89 89
90 // This test adds and removes with mutiple threads, attempting to break the 90 // This test adds and removes with mutiple threads, attempting to break the
91 // uuid and localid dictionary coherence. 91 // uuid and localid dictionary coherence.
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index 895f2bb..9a60e50 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -43,8 +43,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
43 [Test] 43 [Test]
44 public void TestDuplicateObject() 44 public void TestDuplicateObject()
45 { 45 {
46 TestHelper.InMethod(); 46 TestHelpers.InMethod();
47 Scene scene = SceneSetupHelpers.SetupScene(); 47 Scene scene = SceneHelpers.SetupScene();
48 48
49 UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); 49 UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010");
50 string part1Name = "part1"; 50 string part1Name = "part1";
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 260d1c0..1ea2329 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -49,9 +49,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
49 [Test] 49 [Test]
50 public void TestAddSceneObject() 50 public void TestAddSceneObject()
51 { 51 {
52 TestHelper.InMethod(); 52 TestHelpers.InMethod();
53 53
54 Scene scene = SceneSetupHelpers.SetupScene(); 54 Scene scene = SceneHelpers.SetupScene();
55 55
56 string objName = "obj1"; 56 string objName = "obj1";
57 UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); 57 UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
@@ -76,9 +76,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
76 /// </summary> 76 /// </summary>
77 public void TestAddExistingSceneObjectUuid() 77 public void TestAddExistingSceneObjectUuid()
78 { 78 {
79 TestHelper.InMethod(); 79 TestHelpers.InMethod();
80 80
81 Scene scene = SceneSetupHelpers.SetupScene(); 81 Scene scene = SceneHelpers.SetupScene();
82 82
83 string obj1Name = "Alfred"; 83 string obj1Name = "Alfred";
84 string obj2Name = "Betty"; 84 string obj2Name = "Betty";
@@ -110,10 +110,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
110 [Test] 110 [Test]
111 public void TestDeleteSceneObject() 111 public void TestDeleteSceneObject()
112 { 112 {
113 TestHelper.InMethod(); 113 TestHelpers.InMethod();
114 114
115 TestScene scene = SceneSetupHelpers.SetupScene(); 115 TestScene scene = SceneHelpers.SetupScene();
116 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 116 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
117 scene.DeleteSceneObject(part.ParentGroup, false); 117 scene.DeleteSceneObject(part.ParentGroup, false);
118 118
119 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 119 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
@@ -126,20 +126,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests
126 [Test] 126 [Test]
127 public void TestDeleteSceneObjectAsync() 127 public void TestDeleteSceneObjectAsync()
128 { 128 {
129 TestHelper.InMethod(); 129 TestHelpers.InMethod();
130 //log4net.Config.XmlConfigurator.Configure(); 130 //log4net.Config.XmlConfigurator.Configure();
131 131
132 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 132 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
133 133
134 TestScene scene = SceneSetupHelpers.SetupScene(); 134 TestScene scene = SceneHelpers.SetupScene();
135 135
136 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 136 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
137 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 137 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
138 sogd.Enabled = false; 138 sogd.Enabled = false;
139 139
140 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 140 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
141 141
142 IClientAPI client = SceneSetupHelpers.AddClient(scene, agentId); 142 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
143 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); 143 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
144 144
145 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 145 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 1b8c100..654b1a2 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -56,17 +56,17 @@ namespace OpenSim.Region.Framework.Scenes.Tests
56 [Test] 56 [Test]
57 public void TestDeRezSceneObject() 57 public void TestDeRezSceneObject()
58 { 58 {
59 TestHelper.InMethod(); 59 TestHelpers.InMethod();
60// log4net.Config.XmlConfigurator.Configure(); 60// log4net.Config.XmlConfigurator.Configure();
61 61
62 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); 62 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
63 63
64 TestScene scene = SceneSetupHelpers.SetupScene(); 64 TestScene scene = SceneHelpers.SetupScene();
65 IConfigSource configSource = new IniConfigSource(); 65 IConfigSource configSource = new IniConfigSource();
66 IConfig config = configSource.AddConfig("Startup"); 66 IConfig config = configSource.AddConfig("Startup");
67 config.Set("serverside_object_permissions", true); 67 config.Set("serverside_object_permissions", true);
68 SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); 68 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
69 TestClient client = SceneSetupHelpers.AddClient(scene, userId); 69 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
70 70
71 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 71 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
72 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 72 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
@@ -94,18 +94,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests
94 [Test] 94 [Test]
95 public void TestDeRezSceneObjectNotOwner() 95 public void TestDeRezSceneObjectNotOwner()
96 { 96 {
97 TestHelper.InMethod(); 97 TestHelpers.InMethod();
98// log4net.Config.XmlConfigurator.Configure(); 98// log4net.Config.XmlConfigurator.Configure();
99 99
100 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); 100 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
101 UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); 101 UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001");
102 102
103 TestScene scene = SceneSetupHelpers.SetupScene(); 103 TestScene scene = SceneHelpers.SetupScene();
104 IConfigSource configSource = new IniConfigSource(); 104 IConfigSource configSource = new IniConfigSource();
105 IConfig config = configSource.AddConfig("Startup"); 105 IConfig config = configSource.AddConfig("Startup");
106 config.Set("serverside_object_permissions", true); 106 config.Set("serverside_object_permissions", true);
107 SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); 107 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
108 TestClient client = SceneSetupHelpers.AddClient(scene, userId); 108 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
109 109
110 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 110 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
111 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 111 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index cb1d531..2912a46 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -50,14 +50,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
50 [Test] 50 [Test]
51 public void TestLinkDelink2SceneObjects() 51 public void TestLinkDelink2SceneObjects()
52 { 52 {
53 TestHelper.InMethod(); 53 TestHelpers.InMethod();
54 54
55 bool debugtest = false; 55 bool debugtest = false;
56 56
57 Scene scene = SceneSetupHelpers.SetupScene(); 57 Scene scene = SceneHelpers.SetupScene();
58 SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); 58 SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
59 SceneObjectGroup grp1 = part1.ParentGroup; 59 SceneObjectGroup grp1 = part1.ParentGroup;
60 SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); 60 SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
61 SceneObjectGroup grp2 = part2.ParentGroup; 61 SceneObjectGroup grp2 = part2.ParentGroup;
62 62
63 grp1.AbsolutePosition = new Vector3(10, 10, 10); 63 grp1.AbsolutePosition = new Vector3(10, 10, 10);
@@ -132,18 +132,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests
132 [Test] 132 [Test]
133 public void TestLinkDelink2groups4SceneObjects() 133 public void TestLinkDelink2groups4SceneObjects()
134 { 134 {
135 TestHelper.InMethod(); 135 TestHelpers.InMethod();
136 136
137 bool debugtest = false; 137 bool debugtest = false;
138 138
139 Scene scene = SceneSetupHelpers.SetupScene(); 139 Scene scene = SceneHelpers.SetupScene();
140 SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); 140 SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
141 SceneObjectGroup grp1 = part1.ParentGroup; 141 SceneObjectGroup grp1 = part1.ParentGroup;
142 SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); 142 SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
143 SceneObjectGroup grp2 = part2.ParentGroup; 143 SceneObjectGroup grp2 = part2.ParentGroup;
144 SceneObjectPart part3 = SceneSetupHelpers.AddSceneObject(scene); 144 SceneObjectPart part3 = SceneHelpers.AddSceneObject(scene);
145 SceneObjectGroup grp3 = part3.ParentGroup; 145 SceneObjectGroup grp3 = part3.ParentGroup;
146 SceneObjectPart part4 = SceneSetupHelpers.AddSceneObject(scene); 146 SceneObjectPart part4 = SceneHelpers.AddSceneObject(scene);
147 SceneObjectGroup grp4 = part4.ParentGroup; 147 SceneObjectGroup grp4 = part4.ParentGroup;
148 148
149 grp1.AbsolutePosition = new Vector3(10, 10, 10); 149 grp1.AbsolutePosition = new Vector3(10, 10, 10);
@@ -266,10 +266,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
266 [Test] 266 [Test]
267 public void TestNewSceneObjectLinkPersistence() 267 public void TestNewSceneObjectLinkPersistence()
268 { 268 {
269 TestHelper.InMethod(); 269 TestHelpers.InMethod();
270 //log4net.Config.XmlConfigurator.Configure(); 270 //log4net.Config.XmlConfigurator.Configure();
271 271
272 TestScene scene = SceneSetupHelpers.SetupScene(); 272 TestScene scene = SceneHelpers.SetupScene();
273 273
274 string rootPartName = "rootpart"; 274 string rootPartName = "rootpart";
275 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); 275 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
@@ -305,10 +305,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
305 [Test] 305 [Test]
306 public void TestDelinkPersistence() 306 public void TestDelinkPersistence()
307 { 307 {
308 TestHelper.InMethod(); 308 TestHelpers.InMethod();
309 //log4net.Config.XmlConfigurator.Configure(); 309 //log4net.Config.XmlConfigurator.Configure();
310 310
311 TestScene scene = SceneSetupHelpers.SetupScene(); 311 TestScene scene = SceneHelpers.SetupScene();
312 312
313 string rootPartName = "rootpart"; 313 string rootPartName = "rootpart";
314 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); 314 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
index c4047ee..b49c6e7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
@@ -49,11 +49,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
49 [Test] 49 [Test]
50 public void TestResizeSceneObject() 50 public void TestResizeSceneObject()
51 { 51 {
52 TestHelper.InMethod(); 52 TestHelpers.InMethod();
53// log4net.Config.XmlConfigurator.Configure(); 53// log4net.Config.XmlConfigurator.Configure();
54 54
55 Scene scene = SceneSetupHelpers.SetupScene(); 55 Scene scene = SceneHelpers.SetupScene();
56 SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup; 56 SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup;
57 57
58 g1.GroupResize(new Vector3(2, 3, 4)); 58 g1.GroupResize(new Vector3(2, 3, 4));
59 59
@@ -72,12 +72,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
72 [Test] 72 [Test]
73 public void TestResizeSceneObjectPart() 73 public void TestResizeSceneObjectPart()
74 { 74 {
75 TestHelper.InMethod(); 75 TestHelpers.InMethod();
76 //log4net.Config.XmlConfigurator.Configure(); 76 //log4net.Config.XmlConfigurator.Configure();
77 77
78 Scene scene = SceneSetupHelpers.SetupScene(); 78 Scene scene = SceneHelpers.SetupScene();
79 79
80 SceneObjectGroup g1 = SceneSetupHelpers.CreateSceneObject(2, UUID.Zero); 80 SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero);
81 g1.RootPart.Scale = new Vector3(2, 3, 4); 81 g1.RootPart.Scale = new Vector3(2, 3, 4);
82 g1.Parts[1].Scale = new Vector3(5, 6, 7); 82 g1.Parts[1].Scale = new Vector3(5, 6, 7);
83 83
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
new file mode 100644
index 0000000..2a342d5
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -0,0 +1,66 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using NUnit.Framework;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Mock;
37
38namespace OpenSim.Region.Framework.Scenes.Tests
39{
40 /// <summary>
41 /// Basic scene object status tests
42 /// </summary>
43 [TestFixture]
44 public class SceneObjectStatusTests
45 {
46 [Test]
47 public void TestSetPhantom()
48 {
49 TestHelpers.InMethod();
50
51// Scene scene = SceneSetupHelpers.SetupScene();
52 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
53 SceneObjectPart rootPart = so.RootPart;
54 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
55
56 so.ScriptSetPhantomStatus(true);
57
58// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
59 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
60
61 so.ScriptSetPhantomStatus(false);
62
63 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
64 }
65 }
66} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
index 8425d37..c13d82e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
@@ -53,12 +53,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
53 [Test] 53 [Test]
54 public void TestShareWithGroup() 54 public void TestShareWithGroup()
55 { 55 {
56 TestHelper.InMethod(); 56 TestHelpers.InMethod();
57// log4net.Config.XmlConfigurator.Configure(); 57// log4net.Config.XmlConfigurator.Configure();
58 58
59 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); 59 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
60 60
61 TestScene scene = SceneSetupHelpers.SetupScene(); 61 TestScene scene = SceneHelpers.SetupScene();
62 IConfigSource configSource = new IniConfigSource(); 62 IConfigSource configSource = new IniConfigSource();
63 63
64 IConfig startupConfig = configSource.AddConfig("Startup"); 64 IConfig startupConfig = configSource.AddConfig("Startup");
@@ -69,13 +69,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
69 groupsConfig.Set("Module", "GroupsModule"); 69 groupsConfig.Set("Module", "GroupsModule");
70 groupsConfig.Set("DebugEnabled", true); 70 groupsConfig.Set("DebugEnabled", true);
71 71
72 SceneSetupHelpers.SetupSceneModules( 72 SceneHelpers.SetupSceneModules(
73 scene, configSource, new object[] 73 scene, configSource, new object[]
74 { new PermissionsModule(), 74 { new PermissionsModule(),
75 new GroupsModule(), 75 new GroupsModule(),
76 new MockGroupsServicesConnector() }); 76 new MockGroupsServicesConnector() });
77 77
78 TestClient client = SceneSetupHelpers.AddClient(scene, userId); 78 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
79 79
80 IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>(); 80 IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>();
81 81
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index a37b338..35b41fb 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
51 /// Scene presence tests 51 /// Scene presence tests
52 /// </summary> 52 /// </summary>
53 [TestFixture] 53 [TestFixture]
54 public class ScenePresenceTests 54 public class ScenePresenceAgentTests
55 { 55 {
56 public Scene scene, scene2, scene3; 56 public Scene scene, scene2, scene3;
57 public UUID agent1, agent2, agent3; 57 public UUID agent1, agent2, agent3;
@@ -64,90 +64,140 @@ namespace OpenSim.Region.Framework.Scenes.Tests
64 [TestFixtureSetUp] 64 [TestFixtureSetUp]
65 public void Init() 65 public void Init()
66 { 66 {
67 TestHelper.InMethod(); 67 TestHelpers.InMethod();
68 68
69 scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); 69 scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
70 scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); 70 scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
71 scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); 71 scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
72 72
73 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); 73 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
74 interregionComms.Initialise(new IniConfigSource()); 74 interregionComms.Initialise(new IniConfigSource());
75 interregionComms.PostInitialise(); 75 interregionComms.PostInitialise();
76 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); 76 SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
77 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); 77 SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
78 SceneSetupHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); 78 SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
79 79
80 agent1 = UUID.Random(); 80 agent1 = UUID.Random();
81 agent2 = UUID.Random(); 81 agent2 = UUID.Random();
82 agent3 = UUID.Random(); 82 agent3 = UUID.Random();
83 random = new Random(); 83 random = new Random();
84 sog1 = NewSOG(UUID.Random(), scene, agent1); 84 sog1 = SceneHelpers.CreateSceneObject(1, agent1);
85 sog2 = NewSOG(UUID.Random(), scene, agent1); 85 scene.AddSceneObject(sog1);
86 sog3 = NewSOG(UUID.Random(), scene, agent1); 86 sog2 = SceneHelpers.CreateSceneObject(1, agent1);
87 scene.AddSceneObject(sog2);
88 sog3 = SceneHelpers.CreateSceneObject(1, agent1);
89 scene.AddSceneObject(sog3);
87 90
88 //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
89 region1 = scene.RegionInfo.RegionHandle; 91 region1 = scene.RegionInfo.RegionHandle;
90 region2 = scene2.RegionInfo.RegionHandle; 92 region2 = scene2.RegionInfo.RegionHandle;
91 region3 = scene3.RegionInfo.RegionHandle; 93 region3 = scene3.RegionInfo.RegionHandle;
92 } 94 }
93 95
94 /// <summary>
95 /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
96 /// </summary>
97 [Test] 96 [Test]
98 public void T010_TestAddRootAgent() 97 public void TestCloseAgent()
99 { 98 {
100 TestHelper.InMethod(); 99 TestHelpers.InMethod();
101 100// log4net.Config.XmlConfigurator.Configure();
102 string firstName = "testfirstname";
103
104 AgentCircuitData agent = new AgentCircuitData();
105 agent.AgentID = agent1;
106 agent.firstname = firstName;
107 agent.lastname = "testlastname";
108 agent.SessionID = UUID.Random();
109 agent.SecureSessionID = UUID.Random();
110 agent.circuitcode = 123;
111 agent.BaseFolder = UUID.Zero;
112 agent.InventoryFolder = UUID.Zero;
113 agent.startpos = Vector3.Zero;
114 agent.CapsPath = GetRandomCapsObjectPath();
115 agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
116 agent.child = true;
117 101
118 scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); 102 TestScene scene = SceneHelpers.SetupScene();
103 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
119 104
120 string reason; 105 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null);
121 scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
122 testclient = new TestClient(agent, scene);
123 scene.AddNewClient(testclient);
124 106
125 ScenePresence presence = scene.GetScenePresence(agent1); 107 scene.IncomingCloseAgent(sp.UUID);
126 108
127 Assert.That(presence, Is.Not.Null, "presence is null"); 109 Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
128 Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same"); 110 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null);
129 acd1 = agent;
130 } 111 }
131 112
132 /// <summary> 113 /// <summary>
133 /// Test removing an uncrossed root agent from a scene. 114 /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
134 /// </summary> 115 /// </summary>
116 /// <remarks>
117 /// Please note that unlike the other tests here, this doesn't rely on structures
118 /// </remarks>
135 [Test] 119 [Test]
136 public void T011_TestRemoveRootAgent() 120 public void TestChildAgentEstablished()
137 { 121 {
138 TestHelper.InMethod(); 122 TestHelpers.InMethod();
139 123// log4net.Config.XmlConfigurator.Configure();
140 scene.RemoveClient(agent1); 124
141 125 UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
142 ScenePresence presence = scene.GetScenePresence(agent1); 126
127 TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
128// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
129
130 IConfigSource configSource = new IniConfigSource();
131 configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
132 EntityTransferModule etm = new EntityTransferModule();
133
134 SceneHelpers.SetupSceneModules(myScene1, configSource, etm);
135
136 SceneHelpers.AddScenePresence(myScene1, agent1Id);
137// ScenePresence childPresence = myScene2.GetScenePresence(agent1);
143 138
144 Assert.That(presence, Is.Null, "presence is not null"); 139 // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
140// Assert.That(childPresence, Is.Not.Null);
141// Assert.That(childPresence.IsChildAgent, Is.True);
145 } 142 }
146 143
144// /// <summary>
145// /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
146// /// </summary>
147// [Test]
148// public void T010_TestAddRootAgent()
149// {
150// TestHelpers.InMethod();
151//
152// string firstName = "testfirstname";
153//
154// AgentCircuitData agent = new AgentCircuitData();
155// agent.AgentID = agent1;
156// agent.firstname = firstName;
157// agent.lastname = "testlastname";
158// agent.SessionID = UUID.Random();
159// agent.SecureSessionID = UUID.Random();
160// agent.circuitcode = 123;
161// agent.BaseFolder = UUID.Zero;
162// agent.InventoryFolder = UUID.Zero;
163// agent.startpos = Vector3.Zero;
164// agent.CapsPath = GetRandomCapsObjectPath();
165// agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
166// agent.child = true;
167//
168// scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
169//
170// string reason;
171// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
172// testclient = new TestClient(agent, scene);
173// scene.AddNewClient(testclient);
174//
175// ScenePresence presence = scene.GetScenePresence(agent1);
176//
177// Assert.That(presence, Is.Not.Null, "presence is null");
178// Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same");
179// acd1 = agent;
180// }
181//
182// /// <summary>
183// /// Test removing an uncrossed root agent from a scene.
184// /// </summary>
185// [Test]
186// public void T011_TestRemoveRootAgent()
187// {
188// TestHelpers.InMethod();
189//
190// scene.RemoveClient(agent1);
191//
192// ScenePresence presence = scene.GetScenePresence(agent1);
193//
194// Assert.That(presence, Is.Null, "presence is not null");
195// }
196
147 [Test] 197 [Test]
148 public void T012_TestAddNeighbourRegion() 198 public void T012_TestAddNeighbourRegion()
149 { 199 {
150 TestHelper.InMethod(); 200 TestHelpers.InMethod();
151 201
152 string reason; 202 string reason;
153 203
@@ -157,7 +207,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
157 scene.NewUserConnection(acd1, 0, out reason); 207 scene.NewUserConnection(acd1, 0, out reason);
158 if (testclient == null) 208 if (testclient == null)
159 testclient = new TestClient(acd1, scene); 209 testclient = new TestClient(acd1, scene);
160 scene.AddNewClient(testclient); 210 scene.AddNewClient(testclient, PresenceType.User);
161 211
162 ScenePresence presence = scene.GetScenePresence(agent1); 212 ScenePresence presence = scene.GetScenePresence(agent1);
163 presence.MakeRootAgent(new Vector3(90,90,90),false); 213 presence.MakeRootAgent(new Vector3(90,90,90),false);
@@ -175,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
175 [Test] 225 [Test]
176 public void T013_TestRemoveNeighbourRegion() 226 public void T013_TestRemoveNeighbourRegion()
177 { 227 {
178 TestHelper.InMethod(); 228 TestHelpers.InMethod();
179 229
180 ScenePresence presence = scene.GetScenePresence(agent1); 230 ScenePresence presence = scene.GetScenePresence(agent1);
181 presence.RemoveNeighbourRegion(region3); 231 presence.RemoveNeighbourRegion(region3);
@@ -188,37 +238,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
188 CompleteAvatarMovement 238 CompleteAvatarMovement
189 */ 239 */
190 } 240 }
191
192 /// <summary>
193 /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
194 /// </summary>
195 /// <remarks>
196 /// Please note that unlike the other tests here, this doesn't rely on structures
197 /// </remarks>
198 [Test]
199 public void TestChildAgentEstablished()
200 {
201 TestHelper.InMethod();
202// log4net.Config.XmlConfigurator.Configure();
203
204 UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
205
206 TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
207 TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
208
209 IConfigSource configSource = new IniConfigSource();
210 configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
211 EntityTransferModule etm = new EntityTransferModule();
212
213 SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm);
214
215 SceneSetupHelpers.AddClient(myScene1, agent1Id);
216 ScenePresence childPresence = myScene2.GetScenePresence(agent1);
217
218 // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
219// Assert.That(childPresence, Is.Not.Null);
220// Assert.That(childPresence.IsChildAgent, Is.True);
221 }
222 241
223 // I'm commenting this test because it does not represent 242 // I'm commenting this test because it does not represent
224 // crossings. The Thread.Sleep's in here are not meaningful mocks, 243 // crossings. The Thread.Sleep's in here are not meaningful mocks,
@@ -230,7 +249,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
230 //[Test] 249 //[Test]
231 public void T021_TestCrossToNewRegion() 250 public void T021_TestCrossToNewRegion()
232 { 251 {
233 TestHelper.InMethod(); 252 TestHelpers.InMethod();
234 253
235 scene.RegisterRegionWithGrid(); 254 scene.RegisterRegionWithGrid();
236 scene2.RegisterRegionWithGrid(); 255 scene2.RegisterRegionWithGrid();
@@ -238,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
238 // Adding child agent to region 1001 257 // Adding child agent to region 1001
239 string reason; 258 string reason;
240 scene2.NewUserConnection(acd1,0, out reason); 259 scene2.NewUserConnection(acd1,0, out reason);
241 scene2.AddNewClient(testclient); 260 scene2.AddNewClient(testclient, PresenceType.User);
242 261
243 ScenePresence presence = scene.GetScenePresence(agent1); 262 ScenePresence presence = scene.GetScenePresence(agent1);
244 presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); 263 presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
@@ -349,37 +368,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
349 capsPath = capsPath.Remove(capsPath.Length - 4, 4); 368 capsPath = capsPath.Remove(capsPath.Length - 4, 4);
350 return capsPath; 369 return capsPath;
351 } 370 }
352
353 private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent)
354 {
355 SceneObjectPart sop = new SceneObjectPart();
356 sop.Name = RandomName();
357 sop.Description = RandomName();
358 sop.Text = RandomName();
359 sop.SitName = RandomName();
360 sop.TouchName = RandomName();
361 sop.UUID = uuid;
362 sop.Shape = PrimitiveBaseShape.Default;
363 sop.Shape.State = 1;
364 sop.OwnerID = agent;
365
366 SceneObjectGroup sog = new SceneObjectGroup(sop);
367 sog.SetScene(scene);
368
369 return sog;
370 }
371
372 private static string RandomName()
373 {
374 StringBuilder name = new StringBuilder();
375 int size = random.Next(5,12);
376 char ch ;
377 for (int i=0; i<size; i++)
378 {
379 ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
380 name.Append(ch);
381 }
382 return name.ToString();
383 }
384 } 371 }
385} \ No newline at end of file 372} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 4074f5d..39bb43a 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
44 /// Teleport tests in a standalone OpenSim 44 /// Teleport tests in a standalone OpenSim
45 /// </summary> 45 /// </summary>
46 [TestFixture] 46 [TestFixture]
47 public class StandaloneTeleportTests 47 public class ScenePresenceTeleportTests
48 { 48 {
49 /// <summary> 49 /// <summary>
50 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. 50 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
54 //[Test, LongRunning] 54 //[Test, LongRunning]
55 public void TestSimpleNotNeighboursTeleport() 55 public void TestSimpleNotNeighboursTeleport()
56 { 56 {
57 TestHelper.InMethod(); 57 TestHelpers.InMethod();
58 ThreadRunResults results = new ThreadRunResults(); 58 ThreadRunResults results = new ThreadRunResults();
59 results.Result = false; 59 results.Result = false;
60 results.Message = "Test did not run"; 60 results.Message = "Test did not run";
@@ -116,16 +116,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
116 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); 116 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
117 117
118 118
119 Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); 119 Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010);
120 SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); 120 SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
121 sceneB.RegisterRegionWithGrid(); 121 sceneB.RegisterRegionWithGrid();
122 122
123 Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); 123 Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000);
124 SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); 124 SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
125 sceneA.RegisterRegionWithGrid(); 125 sceneA.RegisterRegionWithGrid();
126 126
127 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); 127 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
128 TestClient client = SceneSetupHelpers.AddClient(sceneA, agentId); 128 TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient;
129 129
130 ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); 130 ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>();
131 131
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index 13d93f9..8b8aea5 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -58,9 +58,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
58 [Test] 58 [Test]
59 public void TestUpdateScene() 59 public void TestUpdateScene()
60 { 60 {
61 TestHelper.InMethod(); 61 TestHelpers.InMethod();
62 62
63 Scene scene = SceneSetupHelpers.SetupScene(); 63 Scene scene = SceneHelpers.SetupScene();
64 scene.Update(); 64 scene.Update();
65 65
66 Assert.That(scene.Frame, Is.EqualTo(1)); 66 Assert.That(scene.Frame, Is.EqualTo(1));
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index f4e14d4..1abef8d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -55,12 +55,12 @@ namespace OpenSim.Region.Framework.Tests
55 [Test] 55 [Test]
56 public void TestRezObjectFromInventoryItem() 56 public void TestRezObjectFromInventoryItem()
57 { 57 {
58 TestHelper.InMethod(); 58 TestHelpers.InMethod();
59// log4net.Config.XmlConfigurator.Configure(); 59// log4net.Config.XmlConfigurator.Configure();
60 60
61 Scene scene = SceneSetupHelpers.SetupScene(); 61 Scene scene = SceneHelpers.SetupScene();
62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); 62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
63 SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); 63 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
64 SceneObjectPart sop1 = sog1.RootPart; 64 SceneObjectPart sop1 = sog1.RootPart;
65 65
66 // Create an object embedded inside the first 66 // Create an object embedded inside the first
@@ -98,12 +98,12 @@ namespace OpenSim.Region.Framework.Tests
98 [Test] 98 [Test]
99 public void TestMoveTaskInventoryItem() 99 public void TestMoveTaskInventoryItem()
100 { 100 {
101 TestHelper.InMethod(); 101 TestHelpers.InMethod();
102// log4net.Config.XmlConfigurator.Configure(); 102// log4net.Config.XmlConfigurator.Configure();
103 103
104 Scene scene = SceneSetupHelpers.SetupScene(); 104 Scene scene = SceneHelpers.SetupScene();
105 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); 105 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
106 SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); 106 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
107 SceneObjectPart sop1 = sog1.RootPart; 107 SceneObjectPart sop1 = sog1.RootPart;
108 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); 108 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
109 109
@@ -125,12 +125,12 @@ namespace OpenSim.Region.Framework.Tests
125 [Test] 125 [Test]
126 public void TestMoveTaskInventoryItemNoParent() 126 public void TestMoveTaskInventoryItemNoParent()
127 { 127 {
128 TestHelper.InMethod(); 128 TestHelpers.InMethod();
129// log4net.Config.XmlConfigurator.Configure(); 129// log4net.Config.XmlConfigurator.Configure();
130 130
131 Scene scene = SceneSetupHelpers.SetupScene(); 131 Scene scene = SceneHelpers.SetupScene();
132 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); 132 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
133 SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); 133 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
134 SceneObjectPart sop1 = sog1.RootPart; 134 SceneObjectPart sop1 = sog1.RootPart;
135 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); 135 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
136 136
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
index abca792..55fc1e7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
@@ -55,12 +55,12 @@ namespace OpenSim.Region.Framework.Tests
55 [Test] 55 [Test]
56 public void TestGiveInventoryItem() 56 public void TestGiveInventoryItem()
57 { 57 {
58 TestHelper.InMethod(); 58 TestHelpers.InMethod();
59// log4net.Config.XmlConfigurator.Configure(); 59// log4net.Config.XmlConfigurator.Configure();
60 60
61 Scene scene = SceneSetupHelpers.SetupScene(); 61 Scene scene = SceneHelpers.SetupScene();
62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); 62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
63 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); 63 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
64 InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); 64 InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID);
65 65
66 scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); 66 scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID);
@@ -82,12 +82,12 @@ namespace OpenSim.Region.Framework.Tests
82 [Test] 82 [Test]
83 public void TestGiveInventoryFolder() 83 public void TestGiveInventoryFolder()
84 { 84 {
85 TestHelper.InMethod(); 85 TestHelpers.InMethod();
86// log4net.Config.XmlConfigurator.Configure(); 86// log4net.Config.XmlConfigurator.Configure();
87 87
88 Scene scene = SceneSetupHelpers.SetupScene(); 88 Scene scene = SceneHelpers.SetupScene();
89 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); 89 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
90 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); 90 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
91 InventoryFolderBase folder1 91 InventoryFolderBase folder1
92 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); 92 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1");
93 93
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 4da8df1..24de56e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
47 public void Init() 47 public void Init()
48 { 48 {
49 // FIXME: We don't need a full scene here - it would be enough to set up the asset service. 49 // FIXME: We don't need a full scene here - it would be enough to set up the asset service.
50 Scene scene = SceneSetupHelpers.SetupScene(); 50 Scene scene = SceneHelpers.SetupScene();
51 m_assetService = scene.AssetService; 51 m_assetService = scene.AssetService;
52 m_uuidGatherer = new UuidGatherer(m_assetService); 52 m_uuidGatherer = new UuidGatherer(m_assetService);
53 } 53 }
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
55 [Test] 55 [Test]
56 public void TestCorruptAsset() 56 public void TestCorruptAsset()
57 { 57 {
58 TestHelper.InMethod(); 58 TestHelpers.InMethod();
59 59
60 UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); 60 UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
61 AssetBase corruptAsset 61 AssetBase corruptAsset
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
75 [Test] 75 [Test]
76 public void TestMissingAsset() 76 public void TestMissingAsset()
77 { 77 {
78 TestHelper.InMethod(); 78 TestHelpers.InMethod();
79 79
80 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); 80 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
81 IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>(); 81 IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();