aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorBlueWall2012-11-25 17:03:14 -0500
committerBlueWall2012-11-25 17:03:14 -0500
commitc754003944d0166bf50b4f94b0c0eea642503bb0 (patch)
treedfa1c2020d5500d510519d5b2b3236600692f277 /OpenSim/Region/Framework
parentMerge branch 'master' into connector_plugin (diff)
parentCombine TestDeleteSceneObjectAsync() with TestDeRezSceneObject() as they are ... (diff)
downloadopensim-SC-c754003944d0166bf50b4f94b0c0eea642503bb0.zip
opensim-SC-c754003944d0166bf50b4f94b0c0eea642503bb0.tar.gz
opensim-SC-c754003944d0166bf50b4f94b0c0eea642503bb0.tar.bz2
opensim-SC-c754003944d0166bf50b4f94b0c0eea642503bb0.tar.xz
Merge branch 'master' into connector_plugin
Conflicts: OpenSim/Server/Base/ServicesServerBase.cs
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/ICloudModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IDialogModule.cs157
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs13
-rw-r--r--OpenSim/Region/Framework/Interfaces/ILightShareModule.cs (renamed from OpenSim/Region/Framework/Interfaces/IRegionModule.cs)26
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs114
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISoundModule.cs93
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISunModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWindModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWorldComm.cs26
-rw-r--r--OpenSim/Region/Framework/ModuleLoader.cs262
-rw-r--r--OpenSim/Region/Framework/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs98
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs80
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs64
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs133
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs52
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs50
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs58
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs83
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs83
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs2
41 files changed, 773 insertions, 786 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
index 7296ac3..54172bd 100644
--- a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
@@ -27,7 +27,7 @@
27 27
28namespace OpenSim.Region.Framework.Interfaces 28namespace OpenSim.Region.Framework.Interfaces
29{ 29{
30 public interface ICloudModule : IRegionModule 30 public interface ICloudModule
31 { 31 {
32 /// <summary> 32 /// <summary>
33 /// Retrieves the cloud density at the given region coordinates 33 /// Retrieves the cloud density at the given region coordinates
diff --git a/OpenSim/Region/Framework/Interfaces/IDialogModule.cs b/OpenSim/Region/Framework/Interfaces/IDialogModule.cs
index be9764a..4d35c1c 100644
--- a/OpenSim/Region/Framework/Interfaces/IDialogModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IDialogModule.cs
@@ -33,95 +33,140 @@ namespace OpenSim.Region.Framework.Interfaces
33 public interface IDialogModule 33 public interface IDialogModule
34 { 34 {
35 /// <summary> 35 /// <summary>
36 /// Send a non-modal alert message to a particular user. This can disappear from the user's view after a 36 /// Send a non-modal alert message to a particular user. This can
37 /// small interval. 37 /// disappear from the user's view after a small interval.
38 /// </summary> 38 /// </summary>
39 /// <param name="client"></param> 39 /// <param name="client">
40 /// <param name="message"></param> 40 /// IClientAPI object representing the user.
41 /// </param>
42 /// <param name="message">Message text to send to the user.</param>
41 void SendAlertToUser(IClientAPI client, string message); 43 void SendAlertToUser(IClientAPI client, string message);
42 44
43 /// <summary> 45 /// <summary>
44 /// Send an alert message to a particular user. 46 /// Send an alert message to a particular user.
45 /// </summary> 47 /// </summary>
46 /// <param name="client"></param> 48 /// <param name="client">
47 /// <param name="message"></param> 49 /// IClientAPI object representing the user.
48 /// <param name="modal"></param> 50 /// </param>
51 /// <param name="message">Message text to send to the user.</param>
52 /// <param name="modal">Flag to control modality.</param>
49 void SendAlertToUser(IClientAPI client, string message, bool modal); 53 void SendAlertToUser(IClientAPI client, string message, bool modal);
50 54
51 /// <summary> 55 /// <summary>
52 /// Send a non-modal alert message to a particular user. 56 /// Send a non-modal alert message to a particular user.
53 /// </summary> 57 /// </summary>
54 /// <param name="agentID"></param> 58 /// <param name="agentID">UUID of agent representing the user.</param>
55 /// <param name="message"></param> 59 /// <param name="message">Message text to send to the user.</param>
56 void SendAlertToUser(UUID agentID, string message); 60 void SendAlertToUser(UUID agentID, string message);
57 61
58 /// <summary> 62 /// <summary>
59 /// Send an alert message to a particular user. 63 /// Send an alert message to a particular user.
60 /// </summary> 64 /// </summary>
61 /// <param name="agentID"></param> 65 /// <param name="agentID">UUID of agent representing the user.</param>
62 /// <param name="message"></param> 66 /// <param name="message">Message text to send to the user.</param>
63 /// <param name="modal"></param> 67 /// <param name="modal">Flag to control modality.</param>
64 void SendAlertToUser(UUID agentID, string message, bool modal); 68 void SendAlertToUser(UUID agentID, string message, bool modal);
65 69
66 /// <summary> 70 /// <summary>
67 /// Send an alert message to a particular user. 71 /// Send an alert message to a particular user.
68 /// </summary> 72 /// </summary>
69 /// <param name="firstName"></param> 73 /// <param name="firstName">Account first name</param>
70 /// <param name="lastName"></param> 74 /// <param name="lastName">Account last name</param>
71 /// <param name="message"></param> 75 /// <param name="message">Message text to send to the user.</param>
72 /// <param name="modal"></param> 76 /// <param name="modal">Flag to control modality.</param>
73 void SendAlertToUser(string firstName, string lastName, string message, bool modal); 77 void SendAlertToUser(string firstName, string lastName,
74 78 string message, bool modal);
79
75 /// <summary> 80 /// <summary>
76 /// Send an alert message to all users in the scene. 81 /// Send an alert message to all users in the scene.
77 /// </summary> 82 /// </summary>
78 /// <param name="message"></param> 83 /// <param name="message">Message text to send to all users.</param>
79 void SendGeneralAlert(string message); 84 void SendGeneralAlert(string message);
80 85
81 /// <summary> 86 /// <summary>
82 /// Send a dialog box to a particular user. 87 /// Send a dialog box to a particular user.
83 /// </summary> 88 /// </summary>
84 /// <param name="avatarID"></param> 89 /// <param name="avatarID">
85 /// <param name="objectName"></param> 90 /// UUID of the avatar representing the user.
86 /// <param name="objectID"></param> 91 /// </param>
87 /// <param name="ownerID"></param> 92 /// <param name="objectName">
88 /// <param name="message"></param> 93 /// Name of the object sending the dialog.
89 /// <param name="textureID"></param> 94 /// </param>
90 /// <param name="ch"></param> 95 /// <param name="objectID">
91 /// <param name="buttonlabels"></param> 96 /// UUID of the object sending the dialog.
92 void SendDialogToUser( 97 /// </param>
93 UUID avatarID, string objectName, UUID objectID, UUID ownerID, 98 /// <param name="ownerID">
94 string message, UUID textureID, int ch, string[] buttonlabels); 99 /// UUID of the user that owns the object.
95 100 /// </param>
101 /// <param name="message">Message text to send to the user.</param>
102 /// <param name="textureID">
103 /// Texture UUID to pass along with the dialog.
104 /// </param>
105 /// <param name="ch">
106 /// Channel on which the selected button text should be broadcast.
107 /// </param>
108 /// <param name="buttonlabels">Dialog button text.</param>
109 void SendDialogToUser(UUID avatarID, string objectName, UUID objectID,
110 UUID ownerID, string message, UUID textureID, int ch,
111 string[] buttonlabels);
112
96 /// <summary> 113 /// <summary>
97 /// Send a url to a particular user. 114 /// Send a url to a particular user.
98 /// </summary> 115 /// </summary>
99 /// <param name="avatarID"></param> 116 /// <param name="avatarID">
100 /// <param name="objectName"></param> 117 /// UUID of the avatar representing the user.
101 /// <param name="objectID"></param> 118 /// </param>
102 /// <param name="ownerID"></param> 119 /// <param name="objectName">
103 /// <param name="groupOwned"></param> 120 /// Name of the object sending the dialog.
104 /// <param name="message"></param> 121 /// </param>
105 /// <param name="url"></param> 122 /// <param name="objectID">
106 void SendUrlToUser( 123 /// UUID of the object sending the dialog.
107 UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url); 124 /// </param>
108 125 /// <param name="ownerID">
126 /// UUID of the user that owns the object.
127 /// </param>
128 /// <param name="groupOwned">
129 /// Flag indicating whether or not the object is group-owned.
130 /// </param>
131 /// <param name="message">Message text to send to the user.</param>
132 /// <param name="url">Url to send to the user.</param>
133 void SendUrlToUser(UUID avatarID, string objectName, UUID objectID,
134 UUID ownerID, bool groupOwned, string message, string url);
135
109 /// <summary> 136 /// <summary>
110 /// Send a notification to all users in the scene. This notification should remain around until the 137 /// Send a notification to all users in the scene. This notification
111 /// user explicitly dismisses it. 138 /// should remain around until the user explicitly dismisses it.
112 /// </summary> 139 /// </summary>
113 /// 140 /// <remarks>
114 /// On the Linden Labs Second Client (as of 1.21), this is a big blue box message on the upper right of the 141 /// On the Linden Labs Second Client (as of 1.21), this is a big blue
115 /// screen. 142 /// box message on the upper right of the screen.
116 /// 143 /// </remarks>
117 /// <param name="fromAvatarID">The user sending the message</param> 144 /// <param name="fromAvatarID">The user sending the message</param>
118 /// <param name="fromAvatarName">The name of the user doing the sending</param> 145 /// <param name="fromAvatarName">
146 /// The name of the user doing the sending
147 /// </param>
119 /// <param name="message">The message being sent to the user</param> 148 /// <param name="message">The message being sent to the user</param>
120 void SendNotificationToUsersInRegion(UUID fromAvatarID, string fromAvatarName, string message); 149 void SendNotificationToUsersInRegion(UUID fromAvatarID,
121 150 string fromAvatarName, string message);
151
122 /// <summary> 152 /// <summary>
123 /// Send a textbox entry for the client to respond to 153 /// Send a textbox entry for the client to respond to
124 /// </summary> 154 /// </summary>
125 void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid); 155 /// <param name="avatarID">
156 /// UUID of the avatar representing the user.
157 /// </param>
158 /// <param name="message">Message text to send to the user.</param>
159 /// <param name="chatChannel">
160 /// Chat channel that the user's input should be broadcast on.
161 /// </param>
162 /// <param name="name">Name of the object sending the dialog.</param>
163 /// <param name="objectid">
164 /// UUID of the object sending the dialog.
165 /// </param>
166 /// <param name="ownerid">
167 /// UUID of the user that owns the object.
168 /// </param>
169 void SendTextBoxToUser(UUID avatarid, string message, int chatChannel,
170 string name, UUID objectid, UUID ownerid);
126 } 171 }
127} 172}
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index c457b2f..150193d 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -150,6 +150,19 @@ namespace OpenSim.Region.Framework.Interfaces
150 void StopScriptInstance(UUID itemId); 150 void StopScriptInstance(UUID itemId);
151 151
152 /// <summary> 152 /// <summary>
153 /// Try to get the script running status.
154 /// </summary>
155 /// <returns>
156 /// Returns true if a script for the item was found in one of the simulator's script engines. In this case,
157 /// the running parameter will reflect the running status.
158 /// Returns false if the item could not be found, if the item is not a script or if a script instance for the
159 /// item was not found in any of the script engines. In this case, running status is irrelevant.
160 /// </returns>
161 /// <param name='itemId'></param>
162 /// <param name='running'></param>
163 bool TryGetScriptInstanceRunning(UUID itemId, out bool running);
164
165 /// <summary>
153 /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative 166 /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative
154 /// name is chosen. 167 /// name is chosen.
155 /// </summary> 168 /// </summary>
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs b/OpenSim/Region/Framework/Interfaces/ILightShareModule.cs
index 2bb0c75..b5fd24f 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ILightShareModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -25,29 +25,9 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using Nini.Config;
29using OpenSim.Region.Framework.Scenes;
30
31namespace OpenSim.Region.Framework.Interfaces 28namespace OpenSim.Region.Framework.Interfaces
32{ 29{
33 /// <summary> 30 public interface ILightShareModule
34 /// DEPRECATED! Use INonSharedRegionModule or ISharedRegionModule instead
35 /// </summary>
36 public interface IRegionModule
37 { 31 {
38 /// <summary>
39 /// Initialize the module.
40 /// </summary>
41 /// <remarks>
42 /// For a shared module this can be called multiple times - once per scene.
43 /// </remarks>
44 /// <param name="scene"></param>
45 /// <param name="source">Configuration information. For a shared module this will be identical on every scene call</param>
46 void Initialise(Scene scene, IConfigSource source);
47
48 void PostInitialise();
49 void Close();
50 string Name { get; }
51 bool IsSharedModule { get; }
52 } 32 }
53} 33} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index d582149..9817cf7 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -32,14 +32,16 @@ using OpenSim.Region.Framework.Scenes;
32namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// Temporary interface. More methods to come at some point to make NPCs more object oriented rather than 35 /// Temporary interface. More methods to come at some point to make NPCs
36 /// controlling purely through module level interface calls (e.g. sit/stand). 36 /// more object oriented rather than controlling purely through module
37 /// level interface calls (e.g. sit/stand).
37 /// </summary> 38 /// </summary>
38 public interface INPC 39 public interface INPC
39 { 40 {
40 /// <summary> 41 /// <summary>
41 /// Should this NPC be sensed by LSL sensors as an 'agent' (interpreted here to mean a normal user) 42 /// Should this NPC be sensed by LSL sensors as an 'agent'
42 /// rather than an OpenSim specific NPC extension? 43 /// (interpreted here to mean a normal user) rather than an OpenSim
44 /// specific NPC extension?
43 /// </summary> 45 /// </summary>
44 bool SenseAsAgent { get; } 46 bool SenseAsAgent { get; }
45 } 47 }
@@ -53,35 +55,42 @@ namespace OpenSim.Region.Framework.Interfaces
53 /// <param name="lastname"></param> 55 /// <param name="lastname"></param>
54 /// <param name="position"></param> 56 /// <param name="position"></param>
55 /// <param name="senseAsAgent"> 57 /// <param name="senseAsAgent">
56 /// Make the NPC show up as an agent on LSL sensors. The default is that they 58 /// Make the NPC show up as an agent on LSL sensors. The default is
57 /// show up as the NPC type instead, but this is currently an OpenSim-only extension. 59 /// that they show up as the NPC type instead, but this is currently
60 /// an OpenSim-only extension.
58 /// </param> 61 /// </param>
59 /// <param name="scene"></param> 62 /// <param name="scene"></param>
60 /// <param name="appearance">The avatar appearance to use for the new NPC.</param> 63 /// <param name="appearance">
61 /// <returns>The UUID of the ScenePresence created. UUID.Zero if there was a failure.</returns> 64 /// The avatar appearance to use for the new NPC.
62 UUID CreateNPC( 65 /// </param>
63 string firstname, 66 /// <returns>
64 string lastname, 67 /// The UUID of the ScenePresence created. UUID.Zero if there was a
65 Vector3 position, 68 /// failure.
66 UUID owner, 69 /// </returns>
67 bool senseAsAgent, 70 UUID CreateNPC(string firstname, string lastname, Vector3 position,
68 Scene scene, 71 UUID owner, bool senseAsAgent, Scene scene,
69 AvatarAppearance appearance); 72 AvatarAppearance appearance);
70 73
71 /// <summary> 74 /// <summary>
72 /// Check if the agent is an NPC. 75 /// Check if the agent is an NPC.
73 /// </summary> 76 /// </summary>
74 /// <param name="agentID"></param> 77 /// <param name="agentID"></param>
75 /// <param name="scene"></param> 78 /// <param name="scene"></param>
76 /// <returns>True if the agent is an NPC in the given scene. False otherwise.</returns> 79 /// <returns>
80 /// True if the agent is an NPC in the given scene. False otherwise.
81 /// </returns>
77 bool IsNPC(UUID agentID, Scene scene); 82 bool IsNPC(UUID agentID, Scene scene);
78 83
79 /// <summary> 84 /// <summary>
80 /// Get the NPC. This is not currently complete - manipulation of NPCs still occurs through the region interface 85 /// Get the NPC.
81 /// </summary> 86 /// </summary>
87 /// <remarks>
88 /// This is not currently complete - manipulation of NPCs still occurs
89 /// through the region interface.
90 /// </remarks>
82 /// <param name="agentID"></param> 91 /// <param name="agentID"></param>
83 /// <param name="scene"></param> 92 /// <param name="scene"></param>
84 /// <returns>The NPC. null if it does not exist.</returns> 93 /// <returns>The NPC. null if it does not exist.</returns>
85 INPC GetNPC(UUID agentID, Scene scene); 94 INPC GetNPC(UUID agentID, Scene scene);
86 95
87 /// <summary> 96 /// <summary>
@@ -89,7 +98,10 @@ namespace OpenSim.Region.Framework.Interfaces
89 /// </summary> 98 /// </summary>
90 /// <param name="npcID"></param> 99 /// <param name="npcID"></param>
91 /// <param name="callerID"></param> 100 /// <param name="callerID"></param>
92 /// <returns>true if they do, false if they don't or if there's no NPC with the given ID.</returns> 101 /// <returns>
102 /// true if they do, false if they don't or if there's no NPC with the
103 /// given ID.
104 /// </returns>
93 bool CheckPermissions(UUID npcID, UUID callerID); 105 bool CheckPermissions(UUID npcID, UUID callerID);
94 106
95 /// <summary> 107 /// <summary>
@@ -98,8 +110,12 @@ namespace OpenSim.Region.Framework.Interfaces
98 /// <param name="agentID"></param> 110 /// <param name="agentID"></param>
99 /// <param name="appearance"></param> 111 /// <param name="appearance"></param>
100 /// <param name="scene"></param> 112 /// <param name="scene"></param>
101 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 113 /// <returns>
102 bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene); 114 /// True if the operation succeeded, false if there was no such agent
115 /// or the agent was not an NPC.
116 /// </returns>
117 bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance,
118 Scene scene);
103 119
104 /// <summary> 120 /// <summary>
105 /// Move an NPC to a target over time. 121 /// Move an NPC to a target over time.
@@ -108,23 +124,29 @@ namespace OpenSim.Region.Framework.Interfaces
108 /// <param name="scene"></param> 124 /// <param name="scene"></param>
109 /// <param name="pos"></param> 125 /// <param name="pos"></param>
110 /// <param name="noFly"> 126 /// <param name="noFly">
111 /// If true, then the avatar will attempt to walk to the location even if it's up in the air. 127 /// If true, then the avatar will attempt to walk to the location even
112 /// This is to allow walking on prims. 128 /// if it's up in the air. This is to allow walking on prims.
113 /// </param> 129 /// </param>
114 /// <param name="landAtTarget"> 130 /// <param name="landAtTarget">
115 /// If true and the avatar is flying when it reaches the target, land. 131 /// If true and the avatar is flying when it reaches the target, land.
116 /// </param> name="running"> 132 /// </param> name="running">
117 /// If true, NPC moves with running speed. 133 /// If true, NPC moves with running speed.
118 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 134 /// <returns>
119 /// 135 /// True if the operation succeeded, false if there was no such agent
120 bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running); 136 /// or the agent was not an NPC.
137 /// </returns>
138 bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly,
139 bool landAtTarget, bool running);
121 140
122 /// <summary> 141 /// <summary>
123 /// Stop the NPC's current movement. 142 /// Stop the NPC's current movement.
124 /// </summary> 143 /// </summary>
125 /// <param name="agentID">The UUID of the NPC</param> 144 /// <param name="agentID">The UUID of the NPC</param>
126 /// <param name="scene"></param> 145 /// <param name="scene"></param>
127 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 146 /// <returns>
147 /// True if the operation succeeded, false if there was no such agent
148 /// or the agent was not an NPC.
149 /// </returns>
128 bool StopMoveToTarget(UUID agentID, Scene scene); 150 bool StopMoveToTarget(UUID agentID, Scene scene);
129 151
130 /// <summary> 152 /// <summary>
@@ -133,7 +155,10 @@ namespace OpenSim.Region.Framework.Interfaces
133 /// <param name="agentID">The UUID of the NPC</param> 155 /// <param name="agentID">The UUID of the NPC</param>
134 /// <param name="scene"></param> 156 /// <param name="scene"></param>
135 /// <param name="text"></param> 157 /// <param name="text"></param>
136 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 158 /// <returns>
159 /// True if the operation succeeded, false if there was no such agent
160 /// or the agent was not an NPC.
161 /// </returns>
137 bool Say(UUID agentID, Scene scene, string text); 162 bool Say(UUID agentID, Scene scene, string text);
138 163
139 /// <summary> 164 /// <summary>
@@ -143,7 +168,10 @@ namespace OpenSim.Region.Framework.Interfaces
143 /// <param name="scene"></param> 168 /// <param name="scene"></param>
144 /// <param name="text"></param> 169 /// <param name="text"></param>
145 /// <param name="channel"></param> 170 /// <param name="channel"></param>
146 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 171 /// <returns>
172 /// True if the operation succeeded, false if there was no such agent
173 /// or the agent was not an NPC.
174 /// </returns>
147 bool Say(UUID agentID, Scene scene, string text, int channel); 175 bool Say(UUID agentID, Scene scene, string text, int channel);
148 176
149 /// <summary> 177 /// <summary>
@@ -153,7 +181,10 @@ namespace OpenSim.Region.Framework.Interfaces
153 /// <param name="scene"></param> 181 /// <param name="scene"></param>
154 /// <param name="text"></param> 182 /// <param name="text"></param>
155 /// <param name="channel"></param> 183 /// <param name="channel"></param>
156 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 184 /// <returns>
185 /// True if the operation succeeded, false if there was no such agent
186 /// or the agent was not an NPC.
187 /// </returns>
157 bool Shout(UUID agentID, Scene scene, string text, int channel); 188 bool Shout(UUID agentID, Scene scene, string text, int channel);
158 189
159 /// <summary> 190 /// <summary>
@@ -163,7 +194,10 @@ namespace OpenSim.Region.Framework.Interfaces
163 /// <param name="scene"></param> 194 /// <param name="scene"></param>
164 /// <param name="text"></param> 195 /// <param name="text"></param>
165 /// <param name="channel"></param> 196 /// <param name="channel"></param>
166 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 197 /// <returns>
198 /// True if the operation succeeded, false if there was no such agent
199 /// or the agent was not an NPC.
200 /// </returns>
167 bool Whisper(UUID agentID, Scene scene, string text, int channel); 201 bool Whisper(UUID agentID, Scene scene, string text, int channel);
168 202
169 /// <summary> 203 /// <summary>
@@ -188,7 +222,9 @@ namespace OpenSim.Region.Framework.Interfaces
188 /// </summary> 222 /// </summary>
189 /// <param name="agentID"></param> 223 /// <param name="agentID"></param>
190 /// <param name="partID"></param> 224 /// <param name="partID"></param>
191 /// <returns>true if the touch is actually attempted, false if not</returns> 225 /// <returns>
226 /// true if the touch is actually attempted, false if not.
227 /// </returns>
192 bool Touch(UUID agentID, UUID partID); 228 bool Touch(UUID agentID, UUID partID);
193 229
194 /// <summary> 230 /// <summary>
@@ -196,14 +232,20 @@ namespace OpenSim.Region.Framework.Interfaces
196 /// </summary> 232 /// </summary>
197 /// <param name="agentID">The UUID of the NPC</param> 233 /// <param name="agentID">The UUID of the NPC</param>
198 /// <param name="scene"></param> 234 /// <param name="scene"></param>
199 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 235 /// <returns>
236 /// True if the operation succeeded, false if there was no such agent
237 /// or the agent was not an NPC.
238 /// </returns>
200 bool DeleteNPC(UUID agentID, Scene scene); 239 bool DeleteNPC(UUID agentID, Scene scene);
201 240
202 /// <summary> 241 /// <summary>
203 /// Get the owner of a NPC 242 /// Get the owner of a NPC
204 /// </summary> 243 /// </summary>
205 /// <param name="agentID">The UUID of the NPC</param> 244 /// <param name="agentID">The UUID of the NPC</param>
206 /// <returns>UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC</returns> 245 /// <returns>
246 /// UUID of owner if the NPC exists, UUID.Zero if there was no such
247 /// agent, the agent is unowned or the agent was not an NPC.
248 /// </returns>
207 UUID GetOwner(UUID agentID); 249 UUID GetOwner(UUID agentID);
208 } 250 }
209} \ No newline at end of file 251}
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
index 93930ce..70ff954 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using System.Collections.Generic;
30using OpenMetaverse; 31using OpenMetaverse;
31 32
32namespace OpenSim.Region.Framework.Interfaces 33namespace OpenSim.Region.Framework.Interfaces
@@ -131,6 +132,7 @@ namespace OpenSim.Region.Framework.Interfaces
131 /// <param name="cname">Name of constant</param> 132 /// <param name="cname">Name of constant</param>
132 /// <returns>Value of constant or null if none found.</returns> 133 /// <returns>Value of constant or null if none found.</returns>
133 object LookupModConstant(string cname); 134 object LookupModConstant(string cname);
135 Dictionary<string, object> GetConstants();
134 136
135 // For use ONLY by the script API 137 // For use ONLY by the script API
136 void RaiseEvent(UUID script, string id, string module, string command, string key); 138 void RaiseEvent(UUID script, string id, string module, string command, string key);
diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
index 6117a80..68af492 100644
--- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
@@ -32,9 +32,96 @@ namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public interface ISoundModule 33 public interface ISoundModule
34 { 34 {
35 void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius); 35 /// <summary>
36 36 /// Maximum distance between a sound source and a recipient.
37 /// </summary>
38 float MaxDistance { get; }
39
40 /// <summary>
41 /// Play a sound from an object.
42 /// </summary>
43 /// <param name="soundID">Sound asset ID</param>
44 /// <param name="ownerID">Sound source owner</param>
45 /// <param name="objectID">Sound source ID</param>
46 /// <param name="gain">Sound volume</param>
47 /// <param name="position">Sound source position</param>
48 /// <param name="flags">Sound flags</param>
49 /// <param name="radius">
50 /// Radius used to affect gain over distance.
51 /// </param>
52 void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID,
53 double gain, Vector3 position, byte flags, float radius);
54
55 /// <summary>
56 /// Trigger a sound in the scene.
57 /// </summary>
58 /// <param name="soundId">Sound asset ID</param>
59 /// <param name="ownerID">Sound source owner</param>
60 /// <param name="objectID">Sound source ID</param>
61 /// <param name="parentID">Sound source parent.</param>
62 /// <param name="gain">Sound volume</param>
63 /// <param name="position">Sound source position</param>
64 /// <param name="handle"></param>
65 /// <param name="radius">
66 /// Radius used to affect gain over distance.
67 /// </param>
37 void TriggerSound( 68 void TriggerSound(
38 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius); 69 UUID soundId, UUID ownerID, UUID objectID, UUID parentID,
70 double gain, Vector3 position, UInt64 handle, float radius);
71
72 /// <summary>
73 /// Stop sounds eminating from an object.
74 /// </summary>
75 /// <param name="objectID">Sound source ID</param>
76 void StopSound(UUID objectID);
77
78 /// <summary>
79 /// Preload sound to viewers within range.
80 /// </summary>
81 /// <param name="objectID">Sound source ID</param>
82 /// <param name="soundID">Sound asset ID</param>
83 /// <param name="radius">
84 /// Radius used to determine which viewers should preload the sound.
85 /// </param>
86 void PreloadSound(UUID objectID, UUID soundID, float radius);
87
88 /// <summary>
89 /// Loop specified sound at specified volume with specified radius,
90 /// optionally declaring object as new sync master.
91 /// </summary>
92 /// <param name="objectID">Sound source ID</param>
93 /// <param name="soundID">Sound asset ID</param>
94 /// <param name="gain">Sound volume</param>
95 /// <param name="radius">Sound radius</param>
96 /// <param name="isMaster">Set object to sync master if true</param>
97 void LoopSound(UUID objectID, UUID soundID, double gain,
98 double radius, bool isMaster);
99
100 /// <summary>
101 /// Trigger or play an attached sound in this part's inventory.
102 /// </summary>
103 /// <param name="objectID">Sound source ID</param>
104 /// <param name="sound">Sound asset ID</param>
105 /// <param name="volume">Sound volume</param>
106 /// <param name="triggered">Triggered or not.</param>
107 /// <param name="flags"></param>
108 /// <param name="radius">Sound radius</param>
109 /// <param name="useMaster">Play using sound master</param>
110 /// <param name="isMaster">Play as sound master</param>
111 void SendSound(UUID objectID, UUID sound, double volume,
112 bool triggered, byte flags, float radius, bool useMaster,
113 bool isMaster);
114
115 /// <summary>
116 /// Trigger a sound to be played to all agents within an axis-aligned
117 /// bounding box.
118 /// </summary>
119 /// <param name="objectID">Sound source ID</param>
120 /// <param name="sound">Sound asset ID</param>
121 /// <param name="volume">Sound volume</param>
122 /// <param name="min">AABB bottom south-west corner</param>
123 /// <param name="max">AABB top north-east corner</param>
124 void TriggerSoundLimited(UUID objectID, UUID sound, double volume,
125 Vector3 min, Vector3 max);
39 } 126 }
40} \ No newline at end of file 127} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/ISunModule.cs b/OpenSim/Region/Framework/Interfaces/ISunModule.cs
index 819ae11..8231716 100644
--- a/OpenSim/Region/Framework/Interfaces/ISunModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISunModule.cs
@@ -29,7 +29,7 @@ using OpenMetaverse;
29 29
30namespace OpenSim.Region.Framework.Interfaces 30namespace OpenSim.Region.Framework.Interfaces
31{ 31{
32 public interface ISunModule : IRegionModule 32 public interface ISunModule : INonSharedRegionModule
33 { 33 {
34 double GetSunParameter(string param); 34 double GetSunParameter(string param);
35 35
diff --git a/OpenSim/Region/Framework/Interfaces/IWindModule.cs b/OpenSim/Region/Framework/Interfaces/IWindModule.cs
index 10ecc32..4a26a71 100644
--- a/OpenSim/Region/Framework/Interfaces/IWindModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWindModule.cs
@@ -29,7 +29,7 @@ using OpenMetaverse;
29 29
30namespace OpenSim.Region.Framework.Interfaces 30namespace OpenSim.Region.Framework.Interfaces
31{ 31{
32 public interface IWindModule : IRegionModule 32 public interface IWindModule : INonSharedRegionModule
33 { 33 {
34 34
35 /// <summary> 35 /// <summary>
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
index 4e74781..d76a0d7 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
@@ -45,6 +45,13 @@ namespace OpenSim.Region.Framework.Interfaces
45 void Deactivate(); 45 void Deactivate();
46 void Activate(); 46 void Activate();
47 UUID GetID(); 47 UUID GetID();
48
49 /// <summary>
50 /// Bitfield indicating which strings should be processed as regex.
51 /// 1 corresponds to IWorldCommListenerInfo::GetName()
52 /// 2 corresponds to IWorldCommListenerInfo::GetMessage()
53 /// </summary>
54 int RegexBitfield { get; }
48 } 55 }
49 56
50 public interface IWorldComm 57 public interface IWorldComm
@@ -60,7 +67,7 @@ namespace OpenSim.Region.Framework.Interfaces
60 /// the script during 'peek' time. Parameter hostID is needed to 67 /// the script during 'peek' time. Parameter hostID is needed to
61 /// determine the position of the script. 68 /// determine the position of the script.
62 /// </summary> 69 /// </summary>
63 /// <param name="localID">localID of the script engine</param> 70 /// <param name="LocalID">localID of the script engine</param>
64 /// <param name="itemID">UUID of the script engine</param> 71 /// <param name="itemID">UUID of the script engine</param>
65 /// <param name="hostID">UUID of the SceneObjectPart</param> 72 /// <param name="hostID">UUID of the SceneObjectPart</param>
66 /// <param name="channel">channel to listen on</param> 73 /// <param name="channel">channel to listen on</param>
@@ -70,6 +77,23 @@ namespace OpenSim.Region.Framework.Interfaces
70 /// <returns>number of the scripts handle</returns> 77 /// <returns>number of the scripts handle</returns>
71 int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg); 78 int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg);
72 79
80 /// <summary>
81 /// Create a listen event callback with the specified filters.
82 /// The parameters localID,itemID are needed to uniquely identify
83 /// the script during 'peek' time. Parameter hostID is needed to
84 /// determine the position of the script.
85 /// </summary>
86 /// <param name="LocalID">localID of the script engine</param>
87 /// <param name="itemID">UUID of the script engine</param>
88 /// <param name="hostID">UUID of the SceneObjectPart</param>
89 /// <param name="channel">channel to listen on</param>
90 /// <param name="name">name to filter on</param>
91 /// <param name="id">key to filter on (user given, could be totally faked)</param>
92 /// <param name="msg">msg to filter on</param>
93 /// <param name="regexBitfield">Bitfield indicating which strings should be processed as regex.</param>
94 /// <returns>number of the scripts handle</returns>
95 int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg, int regexBitfield);
96
73 /// <summary> 97 /// <summary>
74 /// This method scans over the objects which registered an interest in listen callbacks. 98 /// This method scans over the objects which registered an interest in listen callbacks.
75 /// For everyone it finds, it checks if it fits the given filter. If it does, then 99 /// For everyone it finds, it checks if it fits the given filter. If it does, then
diff --git a/OpenSim/Region/Framework/ModuleLoader.cs b/OpenSim/Region/Framework/ModuleLoader.cs
deleted file mode 100644
index 14ecd44..0000000
--- a/OpenSim/Region/Framework/ModuleLoader.cs
+++ /dev/null
@@ -1,262 +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.IO;
31using System.Reflection;
32using log4net;
33using Nini.Config;
34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes;
36
37namespace OpenSim.Region.Framework
38{
39 public class ModuleLoader
40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
43 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
44
45 private readonly List<IRegionModule> m_loadedModules = new List<IRegionModule>();
46 private readonly Dictionary<string, IRegionModule> m_loadedSharedModules = new Dictionary<string, IRegionModule>();
47 private readonly IConfigSource m_config;
48
49 public ModuleLoader(IConfigSource config)
50 {
51 m_config = config;
52 }
53
54 public IRegionModule[] GetLoadedSharedModules
55 {
56 get
57 {
58 IRegionModule[] regionModules = new IRegionModule[m_loadedSharedModules.Count];
59 m_loadedSharedModules.Values.CopyTo(regionModules, 0);
60 return regionModules;
61 }
62 }
63
64 public List<IRegionModule> PickupModules(Scene scene, string moduleDir)
65 {
66 DirectoryInfo dir = new DirectoryInfo(moduleDir);
67 List<IRegionModule> modules = new List<IRegionModule>();
68
69 foreach (FileInfo fileInfo in dir.GetFiles("*.dll"))
70 {
71 modules.AddRange(LoadRegionModules(fileInfo.FullName, scene));
72 }
73 return modules;
74 }
75
76 public void LoadDefaultSharedModule(IRegionModule module)
77 {
78 if (m_loadedSharedModules.ContainsKey(module.Name))
79 {
80 m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module not added!", module.Name);
81 }
82 else
83 {
84 m_loadedSharedModules.Add(module.Name, module);
85 }
86 }
87
88
89 public void InitialiseSharedModules(Scene scene)
90 {
91 foreach (IRegionModule module in m_loadedSharedModules.Values)
92 {
93 module.Initialise(scene, m_config);
94 scene.AddModule(module.Name, module); //should be doing this?
95 }
96 }
97
98 public void InitializeModule(IRegionModule module, Scene scene)
99 {
100 module.Initialise(scene, m_config);
101 scene.AddModule(module.Name, module);
102 m_loadedModules.Add(module);
103 }
104
105 /// <summary>
106 /// Loads/initialises a Module instance that can be used by multiple Regions
107 /// </summary>
108 /// <param name="dllName"></param>
109 /// <param name="moduleName"></param>
110 public void LoadSharedModule(string dllName, string moduleName)
111 {
112 IRegionModule module = LoadModule(dllName, moduleName);
113
114 if (module != null)
115 LoadSharedModule(module);
116 }
117
118 /// <summary>
119 /// Loads/initialises a Module instance that can be used by multiple Regions
120 /// </summary>
121 /// <param name="module"></param>
122 public void LoadSharedModule(IRegionModule module)
123 {
124 if (!m_loadedSharedModules.ContainsKey(module.Name))
125 {
126 m_loadedSharedModules.Add(module.Name, module);
127 }
128 }
129
130 public List<IRegionModule> LoadRegionModules(string dllName, Scene scene)
131 {
132 IRegionModule[] modules = LoadModules(dllName);
133 List<IRegionModule> initializedModules = new List<IRegionModule>();
134
135 if (modules.Length > 0)
136 {
137 m_log.InfoFormat("[MODULES]: Found Module Library [{0}]", dllName);
138 foreach (IRegionModule module in modules)
139 {
140 if (!module.IsSharedModule)
141 {
142 m_log.InfoFormat("[MODULES]: [{0}]: Initializing.", module.Name);
143 InitializeModule(module, scene);
144 initializedModules.Add(module);
145 }
146 else
147 {
148 m_log.InfoFormat("[MODULES]: [{0}]: Loading Shared Module.", module.Name);
149 LoadSharedModule(module);
150 }
151 }
152 }
153 return initializedModules;
154 }
155
156 public void LoadRegionModule(string dllName, string moduleName, Scene scene)
157 {
158 IRegionModule module = LoadModule(dllName, moduleName);
159 if (module != null)
160 {
161 InitializeModule(module, scene);
162 }
163 }
164
165 /// <summary>
166 /// Loads a external Module (if not already loaded) and creates a new instance of it.
167 /// </summary>
168 /// <param name="dllName"></param>
169 /// <param name="moduleName"></param>
170 public IRegionModule LoadModule(string dllName, string moduleName)
171 {
172 IRegionModule[] modules = LoadModules(dllName);
173
174 foreach (IRegionModule module in modules)
175 {
176 if ((module != null) && (module.Name == moduleName))
177 {
178 return module;
179 }
180 }
181
182 return null;
183 }
184
185 public IRegionModule[] LoadModules(string dllName)
186 {
187 //m_log.DebugFormat("[MODULES]: Looking for modules in {0}", dllName);
188
189 List<IRegionModule> modules = new List<IRegionModule>();
190
191 Assembly pluginAssembly;
192 if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly))
193 {
194 try
195 {
196 pluginAssembly = Assembly.LoadFrom(dllName);
197 LoadedAssemblys.Add(dllName, pluginAssembly);
198 }
199 catch (BadImageFormatException)
200 {
201 //m_log.InfoFormat("[MODULES]: The file [{0}] is not a module assembly.", e.FileName);
202 }
203 }
204
205 if (pluginAssembly != null)
206 {
207 try
208 {
209 foreach (Type pluginType in pluginAssembly.GetTypes())
210 {
211 if (pluginType.IsPublic)
212 {
213 if (!pluginType.IsAbstract)
214 {
215 if (pluginType.GetInterface("IRegionModule") != null)
216 {
217 modules.Add((IRegionModule)Activator.CreateInstance(pluginType));
218 }
219 }
220 }
221 }
222 }
223 catch (Exception e)
224 {
225 m_log.ErrorFormat(
226 "[MODULES]: Could not load types for plugin DLL {0}. Exception {1} {2}",
227 pluginAssembly.FullName, e.Message, e.StackTrace);
228
229 // justincc: Right now this is fatal to really get the user's attention
230 throw e;
231 }
232 }
233
234 return modules.ToArray();
235 }
236
237 public void PostInitialise()
238 {
239 foreach (IRegionModule module in m_loadedSharedModules.Values)
240 {
241 module.PostInitialise();
242 }
243
244 foreach (IRegionModule module in m_loadedModules)
245 {
246 module.PostInitialise();
247 }
248 }
249
250 public void ClearCache()
251 {
252 LoadedAssemblys.Clear();
253 }
254
255 public void UnloadModule(IRegionModule rm)
256 {
257 rm.Close();
258
259 m_loadedModules.Remove(rm);
260 }
261 }
262}
diff --git a/OpenSim/Region/Framework/Properties/AssemblyInfo.cs b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..9b504c0
--- /dev/null
+++ b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Region.Framework")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("d25e7aed-7f55-4bb8-9970-0d7d978ea8a5")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
index ad421ee..65ae445 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
@@ -41,6 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
41 { 41 {
42// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 private OpenSim.Framework.Animation m_implicitDefaultAnimation = new OpenSim.Framework.Animation();
44 private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); 45 private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation();
45 private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>(); 46 private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>();
46 47
@@ -49,6 +50,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
49 get { return m_defaultAnimation; } 50 get { return m_defaultAnimation; }
50 } 51 }
51 52
53 public OpenSim.Framework.Animation ImplicitDefaultAnimation
54 {
55 get { return m_implicitDefaultAnimation; }
56 }
57
52 public AnimationSet() 58 public AnimationSet()
53 { 59 {
54 ResetDefaultAnimation(); 60 ResetDefaultAnimation();
@@ -119,11 +125,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation
119 if (m_defaultAnimation.AnimID != animID) 125 if (m_defaultAnimation.AnimID != animID)
120 { 126 {
121 m_defaultAnimation = new OpenSim.Framework.Animation(animID, sequenceNum, objectID); 127 m_defaultAnimation = new OpenSim.Framework.Animation(animID, sequenceNum, objectID);
128 m_implicitDefaultAnimation = m_defaultAnimation;
122 return true; 129 return true;
123 } 130 }
124 return false; 131 return false;
125 } 132 }
126 133
134 // Called from serialization only
135 public void SetImplicitDefaultAnimation(UUID animID, int sequenceNum, UUID objectID)
136 {
137 m_implicitDefaultAnimation = new OpenSim.Framework.Animation(animID, sequenceNum, objectID);
138 }
139
127 protected bool ResetDefaultAnimation() 140 protected bool ResetDefaultAnimation()
128 { 141 {
129 return TrySetDefaultAnimation("STAND", 1, UUID.Zero); 142 return TrySetDefaultAnimation("STAND", 1, UUID.Zero);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index b23ddb4..ad40d6b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1909,8 +1909,19 @@ namespace OpenSim.Region.Framework.Scenes
1909 } 1909 }
1910 } 1910 }
1911 1911
1912 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs, 1912 /// <summary>
1913 UUID groupID, DeRezAction action, UUID destinationID) 1913 /// Derez one or more objects from the scene.
1914 /// </summary>
1915 /// <remarks>
1916 /// Won't actually remove the scene object in the case where the object is being copied to a user inventory.
1917 /// </remarks>
1918 /// <param name='remoteClient'>Client requesting derez</param>
1919 /// <param name='localIDs'>Local ids of root parts of objects to delete.</param>
1920 /// <param name='groupID'>Not currently used. Here because the client passes this to us.</param>
1921 /// <param name='action'>DeRezAction</param>
1922 /// <param name='destinationID'>User folder ID to place derezzed object</param>
1923 public virtual void DeRezObjects(
1924 IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID)
1914 { 1925 {
1915 // First, see of we can perform the requested action and 1926 // First, see of we can perform the requested action and
1916 // build a list of eligible objects 1927 // build a list of eligible objects
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 6e53951..df43271 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -38,7 +38,18 @@ namespace OpenSim.Region.Framework.Scenes
38{ 38{
39 public partial class Scene 39 public partial class Scene
40 { 40 {
41 41 /// <summary>
42 /// Send chat to listeners.
43 /// </summary>
44 /// <param name='message'></param>
45 /// <param name='type'>/param>
46 /// <param name='channel'></param>
47 /// <param name='fromPos'></param>
48 /// <param name='fromName'></param>
49 /// <param name='fromID'></param>
50 /// <param name='targetID'></param>
51 /// <param name='fromAgent'></param>
52 /// <param name='broadcast'></param>
42 protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, 53 protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
43 UUID fromID, UUID targetID, bool fromAgent, bool broadcast) 54 UUID fromID, UUID targetID, bool fromAgent, bool broadcast)
44 { 55 {
@@ -66,6 +77,10 @@ namespace OpenSim.Region.Framework.Scenes
66 args.From = fromName; 77 args.From = fromName;
67 args.TargetUUID = targetID; 78 args.TargetUUID = targetID;
68 79
80// m_log.DebugFormat(
81// "[SCENE]: Sending message {0} on channel {1}, type {2} from {3}, broadcast {4}",
82// args.Message.Replace("\n", "\\n"), args.Channel, args.Type, fromName, broadcast);
83
69 if (broadcast) 84 if (broadcast)
70 EventManager.TriggerOnChatBroadcast(this, args); 85 EventManager.TriggerOnChatBroadcast(this, args);
71 else 86 else
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 5f45529..1ad5edd 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -176,7 +176,6 @@ namespace OpenSim.Region.Framework.Scenes
176 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); 176 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
177 protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); 177 protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
178 protected string m_simulatorVersion = "OpenSimulator Server"; 178 protected string m_simulatorVersion = "OpenSimulator Server";
179 protected ModuleLoader m_moduleLoader;
180 protected AgentCircuitManager m_authenticateHandler; 179 protected AgentCircuitManager m_authenticateHandler;
181 protected SceneCommunicationService m_sceneGridService; 180 protected SceneCommunicationService m_sceneGridService;
182 181
@@ -659,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes
659 public Scene(RegionInfo regInfo, AgentCircuitManager authen, 658 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
660 SceneCommunicationService sceneGridService, 659 SceneCommunicationService sceneGridService,
661 ISimulationDataService simDataService, IEstateDataService estateDataService, 660 ISimulationDataService simDataService, IEstateDataService estateDataService,
662 ModuleLoader moduleLoader, bool dumpAssetsToFile, 661 bool dumpAssetsToFile,
663 IConfigSource config, string simulatorVersion) 662 IConfigSource config, string simulatorVersion)
664 : this(regInfo) 663 : this(regInfo)
665 { 664 {
@@ -670,7 +669,6 @@ namespace OpenSim.Region.Framework.Scenes
670 Random random = new Random(); 669 Random random = new Random();
671 670
672 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); 671 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4);
673 m_moduleLoader = moduleLoader;
674 m_authenticateHandler = authen; 672 m_authenticateHandler = authen;
675 m_sceneGridService = sceneGridService; 673 m_sceneGridService = sceneGridService;
676 m_SimulationDataService = simDataService; 674 m_SimulationDataService = simDataService;
@@ -742,7 +740,12 @@ namespace OpenSim.Region.Framework.Scenes
742 // 740 //
743 // Out of memory 741 // Out of memory
744 // Operating system has killed the plugin 742 // Operating system has killed the plugin
745 m_sceneGraph.UnRecoverableError += RestartNow; 743 m_sceneGraph.UnRecoverableError
744 += () =>
745 {
746 m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name);
747 RestartNow();
748 };
746 749
747 RegisterDefaultSceneEvents(); 750 RegisterDefaultSceneEvents();
748 751
@@ -1136,15 +1139,9 @@ namespace OpenSim.Region.Framework.Scenes
1136 } 1139 }
1137 } 1140 }
1138 1141
1139 m_log.Error("[REGION]: Closing"); 1142 m_log.InfoFormat("[REGION]: Restarting region {0}", Name);
1140 Close();
1141 1143
1142 if (PhysicsScene != null) 1144 Close();
1143 {
1144 PhysicsScene.Dispose();
1145 }
1146
1147 m_log.Error("[REGION]: Firing Region Restart Message");
1148 1145
1149 base.Restart(); 1146 base.Restart();
1150 } 1147 }
@@ -1267,6 +1264,12 @@ namespace OpenSim.Region.Framework.Scenes
1267 // This is the method that shuts down the scene. 1264 // This is the method that shuts down the scene.
1268 public override void Close() 1265 public override void Close()
1269 { 1266 {
1267 if (m_shuttingDown)
1268 {
1269 m_log.WarnFormat("[SCENE]: Ignoring close request because already closing {0}", Name);
1270 return;
1271 }
1272
1270 m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); 1273 m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
1271 1274
1272 StatsReporter.Close(); 1275 StatsReporter.Close();
@@ -1310,6 +1313,14 @@ namespace OpenSim.Region.Framework.Scenes
1310 1313
1311 m_sceneGraph.Close(); 1314 m_sceneGraph.Close();
1312 1315
1316 if (!GridService.DeregisterRegion(RegionInfo.RegionID))
1317 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
1318
1319 base.Close();
1320
1321 // XEngine currently listens to the EventManager.OnShutdown event to trigger script stop and persistence.
1322 // Therefore. we must dispose of the PhysicsScene after this to prevent a window where script code can
1323 // attempt to reference a null or disposed physics scene.
1313 if (PhysicsScene != null) 1324 if (PhysicsScene != null)
1314 { 1325 {
1315 PhysicsScene phys = PhysicsScene; 1326 PhysicsScene phys = PhysicsScene;
@@ -1318,12 +1329,6 @@ namespace OpenSim.Region.Framework.Scenes
1318 phys.Dispose(); 1329 phys.Dispose();
1319 phys = null; 1330 phys = null;
1320 } 1331 }
1321
1322 if (!GridService.DeregisterRegion(RegionInfo.RegionID))
1323 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
1324
1325 // call the base class Close method.
1326 base.Close();
1327 } 1332 }
1328 1333
1329 /// <summary> 1334 /// <summary>
@@ -1684,12 +1689,19 @@ namespace OpenSim.Region.Framework.Scenes
1684 1689
1685 private void CheckAtTargets() 1690 private void CheckAtTargets()
1686 { 1691 {
1687 Dictionary<UUID, SceneObjectGroup>.ValueCollection objs; 1692 List<SceneObjectGroup> objs = null;
1693
1688 lock (m_groupsWithTargets) 1694 lock (m_groupsWithTargets)
1689 objs = m_groupsWithTargets.Values; 1695 {
1696 if (m_groupsWithTargets.Count != 0)
1697 objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values);
1698 }
1690 1699
1691 foreach (SceneObjectGroup entry in objs) 1700 if (objs != null)
1692 entry.checkAtTargets(); 1701 {
1702 foreach (SceneObjectGroup entry in objs)
1703 entry.checkAtTargets();
1704 }
1693 } 1705 }
1694 1706
1695 /// <summary> 1707 /// <summary>
@@ -3373,9 +3385,10 @@ namespace OpenSim.Region.Framework.Scenes
3373 } 3385 }
3374 else 3386 else
3375 { 3387 {
3376 // We remove the acd up here to avoid later raec conditions if two RemoveClient() calls occurred 3388 // We remove the acd up here to avoid later race conditions if two RemoveClient() calls occurred
3377 // simultaneously. 3389 // simultaneously.
3378 m_authenticateHandler.RemoveCircuit(acd.circuitcode); 3390 // We also need to remove by agent ID since NPCs will have no circuit code.
3391 m_authenticateHandler.RemoveCircuit(agentID);
3379 } 3392 }
3380 } 3393 }
3381 3394
@@ -3427,9 +3440,10 @@ namespace OpenSim.Region.Framework.Scenes
3427 if (closeChildAgents && CapsModule != null) 3440 if (closeChildAgents && CapsModule != null)
3428 CapsModule.RemoveCaps(agentID); 3441 CapsModule.RemoveCaps(agentID);
3429 3442
3430 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever 3443// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3431 // this method is doing is HORRIBLE!!! 3444// // this method is doing is HORRIBLE!!!
3432 avatar.Scene.NeedSceneCacheClear(avatar.UUID); 3445 // Commented pending deletion since this method no longer appears to do anything at all
3446// avatar.Scene.NeedSceneCacheClear(avatar.UUID);
3433 3447
3434 if (closeChildAgents && !isChildAgent) 3448 if (closeChildAgents && !isChildAgent)
3435 { 3449 {
@@ -4688,13 +4702,24 @@ namespace OpenSim.Region.Framework.Scenes
4688 /// Get a group via its UUID 4702 /// Get a group via its UUID
4689 /// </summary> 4703 /// </summary>
4690 /// <param name="fullID"></param> 4704 /// <param name="fullID"></param>
4691 /// <returns>null if no group with that name exists</returns> 4705 /// <returns>null if no group with that id exists</returns>
4692 public SceneObjectGroup GetSceneObjectGroup(UUID fullID) 4706 public SceneObjectGroup GetSceneObjectGroup(UUID fullID)
4693 { 4707 {
4694 return m_sceneGraph.GetSceneObjectGroup(fullID); 4708 return m_sceneGraph.GetSceneObjectGroup(fullID);
4695 } 4709 }
4696 4710
4697 /// <summary> 4711 /// <summary>
4712 /// Get a group via its local ID
4713 /// </summary>
4714 /// <remarks>This will only return a group if the local ID matches a root part</remarks>
4715 /// <param name="localID"></param>
4716 /// <returns>null if no group with that id exists</returns>
4717 public SceneObjectGroup GetSceneObjectGroup(uint localID)
4718 {
4719 return m_sceneGraph.GetSceneObjectGroup(localID);
4720 }
4721
4722 /// <summary>
4698 /// Get a group by name from the scene (will return the first 4723 /// Get a group by name from the scene (will return the first
4699 /// found, if there are more than one prim with the same name) 4724 /// found, if there are more than one prim with the same name)
4700 /// </summary> 4725 /// </summary>
@@ -4854,14 +4879,15 @@ namespace OpenSim.Region.Framework.Scenes
4854 client.SendRegionHandle(regionID, handle); 4879 client.SendRegionHandle(regionID, handle);
4855 } 4880 }
4856 4881
4857 public bool NeedSceneCacheClear(UUID agentID) 4882// Commented pending deletion since this method no longer appears to do anything at all
4858 { 4883// public bool NeedSceneCacheClear(UUID agentID)
4859 IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); 4884// {
4860 if (inv == null) 4885// IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>();
4861 return true; 4886// if (inv == null)
4862 4887// return true;
4863 return inv.NeedSceneCacheClear(agentID, this); 4888//
4864 } 4889// return inv.NeedSceneCacheClear(agentID, this);
4890// }
4865 4891
4866 public void CleanTempObjects() 4892 public void CleanTempObjects()
4867 { 4893 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index b87a38a..d3e968e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -67,12 +67,6 @@ namespace OpenSim.Region.Framework.Scenes
67 /// <value> 67 /// <value>
68 /// All the region modules attached to this scene. 68 /// All the region modules attached to this scene.
69 /// </value> 69 /// </value>
70 public Dictionary<string, IRegionModule> Modules
71 {
72 get { return m_modules; }
73 }
74 protected Dictionary<string, IRegionModule> m_modules = new Dictionary<string, IRegionModule>();
75
76 public Dictionary<string, IRegionModuleBase> RegionModules 70 public Dictionary<string, IRegionModuleBase> RegionModules
77 { 71 {
78 get { return m_regionModules; } 72 get { return m_regionModules; }
@@ -272,16 +266,6 @@ namespace OpenSim.Region.Framework.Scenes
272 /// </summary> 266 /// </summary>
273 public virtual void Close() 267 public virtual void Close()
274 { 268 {
275 // Shut down all non shared modules.
276 foreach (IRegionModule module in Modules.Values)
277 {
278 if (!module.IsSharedModule)
279 {
280 module.Close();
281 }
282 }
283 Modules.Clear();
284
285 try 269 try
286 { 270 {
287 EventManager.TriggerShutdown(); 271 EventManager.TriggerShutdown();
@@ -312,19 +296,6 @@ namespace OpenSim.Region.Framework.Scenes
312 #region Module Methods 296 #region Module Methods
313 297
314 /// <summary> 298 /// <summary>
315 /// Add a module to this scene.
316 /// </summary>
317 /// <param name="name"></param>
318 /// <param name="module"></param>
319 public void AddModule(string name, IRegionModule module)
320 {
321 if (!Modules.ContainsKey(name))
322 {
323 Modules.Add(name, module);
324 }
325 }
326
327 /// <summary>
328 /// Add a region-module to this scene. TODO: This will replace AddModule in the future. 299 /// Add a region-module to this scene. TODO: This will replace AddModule in the future.
329 /// </summary> 300 /// </summary>
330 /// <param name="name"></param> 301 /// <param name="name"></param>
@@ -508,9 +479,9 @@ namespace OpenSim.Region.Framework.Scenes
508 /// <param name="shorthelp"></param> 479 /// <param name="shorthelp"></param>
509 /// <param name="longhelp"></param> 480 /// <param name="longhelp"></param>
510 /// <param name="callback"></param> 481 /// <param name="callback"></param>
511 public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) 482 public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback)
512 { 483 {
513 AddCommand(mod, command, shorthelp, longhelp, string.Empty, callback); 484 AddCommand(module, command, shorthelp, longhelp, string.Empty, callback);
514 } 485 }
515 486
516 /// <summary> 487 /// <summary>
@@ -528,9 +499,9 @@ namespace OpenSim.Region.Framework.Scenes
528 /// <param name="longhelp"></param> 499 /// <param name="longhelp"></param>
529 /// <param name="callback"></param> 500 /// <param name="callback"></param>
530 public void AddCommand( 501 public void AddCommand(
531 string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) 502 string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback)
532 { 503 {
533 AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback); 504 AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback);
534 } 505 }
535 506
536 /// <summary> 507 /// <summary>
@@ -542,29 +513,14 @@ namespace OpenSim.Region.Framework.Scenes
542 /// <param name="longhelp"></param> 513 /// <param name="longhelp"></param>
543 /// <param name="descriptivehelp"></param> 514 /// <param name="descriptivehelp"></param>
544 /// <param name="callback"></param> 515 /// <param name="callback"></param>
545 public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) 516 public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
546 { 517 {
547 string moduleName = ""; 518 string moduleName = "";
548 519
549 if (mod != null) 520 if (module != null)
550 { 521 moduleName = module.Name;
551 if (mod is IRegionModule)
552 {
553 IRegionModule module = (IRegionModule)mod;
554 moduleName = module.Name;
555 }
556 else if (mod is IRegionModuleBase)
557 {
558 IRegionModuleBase module = (IRegionModuleBase)mod;
559 moduleName = module.Name;
560 }
561 else
562 {
563 throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
564 }
565 }
566 522
567 AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback); 523 AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback);
568 } 524 }
569 525
570 /// <summary> 526 /// <summary>
@@ -580,7 +536,7 @@ namespace OpenSim.Region.Framework.Scenes
580 /// <param name="descriptivehelp"></param> 536 /// <param name="descriptivehelp"></param>
581 /// <param name="callback"></param> 537 /// <param name="callback"></param>
582 public void AddCommand( 538 public void AddCommand(
583 string category, object mod, string command, 539 string category, IRegionModuleBase module, string command,
584 string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) 540 string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
585 { 541 {
586 if (MainConsole.Instance == null) 542 if (MainConsole.Instance == null)
@@ -588,22 +544,8 @@ namespace OpenSim.Region.Framework.Scenes
588 544
589 bool shared = false; 545 bool shared = false;
590 546
591 if (mod != null) 547 if (module != null)
592 { 548 shared = module is ISharedRegionModule;
593 if (mod is IRegionModule)
594 {
595 IRegionModule module = (IRegionModule)mod;
596 shared = module.IsSharedModule;
597 }
598 else if (mod is IRegionModuleBase)
599 {
600 shared = mod is ISharedRegionModule;
601 }
602 else
603 {
604 throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
605 }
606 }
607 549
608 MainConsole.Instance.Commands.AddCommand( 550 MainConsole.Instance.Commands.AddCommand(
609 category, shared, command, shorthelp, longhelp, descriptivehelp, callback); 551 category, shared, command, shorthelp, longhelp, descriptivehelp, callback);
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 209a770..a4383fd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -983,6 +983,30 @@ namespace OpenSim.Region.Framework.Scenes
983 } 983 }
984 984
985 /// <summary> 985 /// <summary>
986 /// Get a group in the scene
987 /// </summary>
988 /// <remarks>
989 /// This will only return a group if the local ID matches the root part, not other parts.
990 /// </remarks>
991 /// <param name="localID">Local id of the root part of the group</param>
992 /// <returns>null if no such group was found</returns>
993 protected internal SceneObjectGroup GetSceneObjectGroup(uint localID)
994 {
995 lock (SceneObjectGroupsByLocalPartID)
996 {
997 if (SceneObjectGroupsByLocalPartID.ContainsKey(localID))
998 {
999 SceneObjectGroup so = SceneObjectGroupsByLocalPartID[localID];
1000
1001 if (so.LocalId == localID)
1002 return so;
1003 }
1004 }
1005
1006 return null;
1007 }
1008
1009 /// <summary>
986 /// Get a group by name from the scene (will return the first 1010 /// Get a group by name from the scene (will return the first
987 /// found, if there are more than one prim with the same name) 1011 /// found, if there are more than one prim with the same name)
988 /// </summary> 1012 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index cb5b2ba..1e2e973 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -100,23 +100,25 @@ namespace OpenSim.Region.Framework.Scenes
100 } 100 }
101 101
102 private readonly List<Scene> m_localScenes = new List<Scene>(); 102 private readonly List<Scene> m_localScenes = new List<Scene>();
103 private Scene m_currentScene = null;
104 103
105 public List<Scene> Scenes 104 public List<Scene> Scenes
106 { 105 {
107 get { return new List<Scene>(m_localScenes); } 106 get { return new List<Scene>(m_localScenes); }
108 } 107 }
109 108
110 public Scene CurrentScene 109 /// <summary>
111 { 110 /// Scene selected from the console.
112 get { return m_currentScene; } 111 /// </summary>
113 } 112 /// <value>
113 /// If null, then all scenes are considered selected (signalled as "Root" on the console).
114 /// </value>
115 public Scene CurrentScene { get; private set; }
114 116
115 public Scene CurrentOrFirstScene 117 public Scene CurrentOrFirstScene
116 { 118 {
117 get 119 get
118 { 120 {
119 if (m_currentScene == null) 121 if (CurrentScene == null)
120 { 122 {
121 lock (m_localScenes) 123 lock (m_localScenes)
122 { 124 {
@@ -128,7 +130,7 @@ namespace OpenSim.Region.Framework.Scenes
128 } 130 }
129 else 131 else
130 { 132 {
131 return m_currentScene; 133 return CurrentScene;
132 } 134 }
133 } 135 }
134 } 136 }
@@ -141,31 +143,13 @@ namespace OpenSim.Region.Framework.Scenes
141 143
142 public void Close() 144 public void Close()
143 { 145 {
144 // collect known shared modules in sharedModules
145 Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>();
146
147 lock (m_localScenes) 146 lock (m_localScenes)
148 { 147 {
149 for (int i = 0; i < m_localScenes.Count; i++) 148 for (int i = 0; i < m_localScenes.Count; i++)
150 { 149 {
151 // extract known shared modules from scene
152 foreach (string k in m_localScenes[i].Modules.Keys)
153 {
154 if (m_localScenes[i].Modules[k].IsSharedModule &&
155 !sharedModules.ContainsKey(k))
156 sharedModules[k] = m_localScenes[i].Modules[k];
157 }
158 // close scene/region
159 m_localScenes[i].Close(); 150 m_localScenes[i].Close();
160 } 151 }
161 } 152 }
162
163 // all regions/scenes are now closed, we can now safely
164 // close all shared modules
165 foreach (IRegionModule mod in sharedModules.Values)
166 {
167 mod.Close();
168 }
169 } 153 }
170 154
171 public void Close(Scene cscene) 155 public void Close(Scene cscene)
@@ -196,8 +180,7 @@ namespace OpenSim.Region.Framework.Scenes
196 180
197 public void HandleRestart(RegionInfo rdata) 181 public void HandleRestart(RegionInfo rdata)
198 { 182 {
199 m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); 183 Scene restartedScene = null;
200 int RegionSceneElement = -1;
201 184
202 lock (m_localScenes) 185 lock (m_localScenes)
203 { 186 {
@@ -205,19 +188,18 @@ namespace OpenSim.Region.Framework.Scenes
205 { 188 {
206 if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName) 189 if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName)
207 { 190 {
208 RegionSceneElement = i; 191 restartedScene = m_localScenes[i];
192 m_localScenes.RemoveAt(i);
193 break;
209 } 194 }
210 } 195 }
211
212 // Now we make sure the region is no longer known about by the SceneManager
213 // Prevents duplicates.
214
215 if (RegionSceneElement >= 0)
216 {
217 m_localScenes.RemoveAt(RegionSceneElement);
218 }
219 } 196 }
220 197
198 // If the currently selected scene has been restarted, then we can't reselect here since we the scene
199 // hasn't yet been recreated. We will have to leave this to the caller.
200 if (CurrentScene == restartedScene)
201 CurrentScene = null;
202
221 // Send signal to main that we're restarting this sim. 203 // Send signal to main that we're restarting this sim.
222 OnRestartSim(rdata); 204 OnRestartSim(rdata);
223 } 205 }
@@ -359,14 +341,14 @@ namespace OpenSim.Region.Framework.Scenes
359 341
360 private void ForEachCurrentScene(Action<Scene> func) 342 private void ForEachCurrentScene(Action<Scene> func)
361 { 343 {
362 if (m_currentScene == null) 344 if (CurrentScene == null)
363 { 345 {
364 lock (m_localScenes) 346 lock (m_localScenes)
365 m_localScenes.ForEach(func); 347 m_localScenes.ForEach(func);
366 } 348 }
367 else 349 else
368 { 350 {
369 func(m_currentScene); 351 func(CurrentScene);
370 } 352 }
371 } 353 }
372 354
@@ -386,7 +368,7 @@ namespace OpenSim.Region.Framework.Scenes
386 || (String.Compare(regionName, "..") == 0) 368 || (String.Compare(regionName, "..") == 0)
387 || (String.Compare(regionName, "/") == 0)) 369 || (String.Compare(regionName, "/") == 0))
388 { 370 {
389 m_currentScene = null; 371 CurrentScene = null;
390 return true; 372 return true;
391 } 373 }
392 else 374 else
@@ -397,7 +379,7 @@ namespace OpenSim.Region.Framework.Scenes
397 { 379 {
398 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) 380 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
399 { 381 {
400 m_currentScene = scene; 382 CurrentScene = scene;
401 return true; 383 return true;
402 } 384 }
403 } 385 }
@@ -417,7 +399,7 @@ namespace OpenSim.Region.Framework.Scenes
417 { 399 {
418 if (scene.RegionInfo.RegionID == regionID) 400 if (scene.RegionInfo.RegionID == regionID)
419 { 401 {
420 m_currentScene = scene; 402 CurrentScene = scene;
421 return true; 403 return true;
422 } 404 }
423 } 405 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 27ef4c9..f79ac96 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2239,7 +2239,15 @@ namespace OpenSim.Region.Framework.Scenes
2239 2239
2240 // play the sound. 2240 // play the sound.
2241 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) 2241 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
2242 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); 2242 {
2243 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
2244 if (soundModule != null)
2245 {
2246 soundModule.SendSound(UUID, CollisionSound,
2247 CollisionSoundVolume, true, (byte)0, 0, false,
2248 false);
2249 }
2250 }
2243 2251
2244 SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); 2252 SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart);
2245 SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); 2253 SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding);
@@ -2287,37 +2295,6 @@ namespace OpenSim.Region.Framework.Scenes
2287 ScheduleTerseUpdate(); 2295 ScheduleTerseUpdate();
2288 } 2296 }
2289 2297
2290 public void PreloadSound(string sound)
2291 {
2292 // UUID ownerID = OwnerID;
2293 UUID objectID = ParentGroup.RootPart.UUID;
2294 UUID soundID = UUID.Zero;
2295
2296 if (!UUID.TryParse(sound, out soundID))
2297 {
2298 //Trys to fetch sound id from prim's inventory.
2299 //Prim's inventory doesn't support non script items yet
2300
2301 lock (TaskInventory)
2302 {
2303 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2304 {
2305 if (item.Value.Name == sound)
2306 {
2307 soundID = item.Value.ItemID;
2308 break;
2309 }
2310 }
2311 }
2312 }
2313
2314 ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
2315 {
2316 if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100))
2317 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2318 });
2319 }
2320
2321 public void RemFlag(PrimFlags flag) 2298 public void RemFlag(PrimFlags flag)
2322 { 2299 {
2323 // PrimFlags prevflag = Flags; 2300 // PrimFlags prevflag = Flags;
@@ -2676,98 +2653,6 @@ namespace OpenSim.Region.Framework.Scenes
2676 } 2653 }
2677 2654
2678 /// <summary> 2655 /// <summary>
2679 /// Trigger or play an attached sound in this part's inventory.
2680 /// </summary>
2681 /// <param name="sound"></param>
2682 /// <param name="volume"></param>
2683 /// <param name="triggered"></param>
2684 /// <param name="flags"></param>
2685 public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster)
2686 {
2687 if (volume > 1)
2688 volume = 1;
2689 if (volume < 0)
2690 volume = 0;
2691
2692 UUID ownerID = OwnerID;
2693 UUID objectID = ParentGroup.RootPart.UUID;
2694 UUID parentID = ParentGroup.UUID;
2695
2696 UUID soundID = UUID.Zero;
2697 Vector3 position = AbsolutePosition; // region local
2698 ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
2699
2700 if (!UUID.TryParse(sound, out soundID))
2701 {
2702 // search sound file from inventory
2703 lock (TaskInventory)
2704 {
2705 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2706 {
2707 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2708 {
2709 soundID = item.Value.ItemID;
2710 break;
2711 }
2712 }
2713 }
2714 }
2715
2716 if (soundID == UUID.Zero)
2717 return;
2718
2719 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
2720 if (soundModule != null)
2721 {
2722 if (useMaster)
2723 {
2724 if (isMaster)
2725 {
2726 if (triggered)
2727 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
2728 else
2729 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
2730 ParentGroup.PlaySoundMasterPrim = this;
2731 ownerID = OwnerID;
2732 objectID = ParentGroup.RootPart.UUID;
2733 parentID = ParentGroup.UUID;
2734 position = AbsolutePosition; // region local
2735 regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
2736 if (triggered)
2737 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
2738 else
2739 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
2740 foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims)
2741 {
2742 ownerID = prim.OwnerID;
2743 objectID = prim.ParentGroup.RootPart.UUID;
2744 parentID = prim.ParentGroup.UUID;
2745 position = prim.AbsolutePosition; // region local
2746 regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle;
2747 if (triggered)
2748 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
2749 else
2750 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
2751 }
2752 ParentGroup.PlaySoundSlavePrims.Clear();
2753 ParentGroup.PlaySoundMasterPrim = null;
2754 }
2755 else
2756 {
2757 ParentGroup.PlaySoundSlavePrims.Add(this);
2758 }
2759 }
2760 else
2761 {
2762 if (triggered)
2763 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
2764 else
2765 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
2766 }
2767 }
2768 }
2769
2770 /// <summary>
2771 /// Send a terse update to all clients 2656 /// Send a terse update to all clients
2772 /// </summary> 2657 /// </summary>
2773 public void SendTerseUpdateToAllClients() 2658 public void SendTerseUpdateToAllClients()
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index bdb0446..db723fa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -232,31 +232,49 @@ namespace OpenSim.Region.Framework.Scenes
232 if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null) 232 if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null)
233 return; 233 return;
234 234
235 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
236 if (engines == null) // No engine at all
237 return;
238
239 lock (Items) 235 lock (Items)
240 { 236 {
241 foreach (TaskInventoryItem item in Items.Values) 237 foreach (TaskInventoryItem item in Items.Values)
242 { 238 {
243 if (item.InvType == (int)InventoryType.LSL) 239 bool running;
244 { 240 if (TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running))
245 foreach (IScriptModule e in engines) 241 item.ScriptRunning = running;
246 {
247 bool running;
248
249 if (e.HasScript(item.ItemID, out running))
250 {
251 item.ScriptRunning = running;
252 break;
253 }
254 }
255 }
256 } 242 }
257 } 243 }
258 } 244 }
259 245
246 public bool TryGetScriptInstanceRunning(UUID itemId, out bool running)
247 {
248 running = false;
249
250 TaskInventoryItem item = GetInventoryItem(itemId);
251
252 if (item == null)
253 return false;
254
255 return TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running);
256 }
257
258 public static bool TryGetScriptInstanceRunning(Scene scene, TaskInventoryItem item, out bool running)
259 {
260 running = false;
261
262 if (item.InvType != (int)InventoryType.LSL)
263 return false;
264
265 IScriptModule[] engines = scene.RequestModuleInterfaces<IScriptModule>();
266 if (engines == null) // No engine at all
267 return false;
268
269 foreach (IScriptModule e in engines)
270 {
271 if (e.HasScript(item.ItemID, out running))
272 return true;
273 }
274
275 return false;
276 }
277
260 public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) 278 public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
261 { 279 {
262 int scriptsValidForStarting = 0; 280 int scriptsValidForStarting = 0;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1222ac6..6f36c0b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -68,14 +68,15 @@ namespace OpenSim.Region.Framework.Scenes
68 public ScriptControlled eventControls; 68 public ScriptControlled eventControls;
69 } 69 }
70 70
71 public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs); 71 public delegate void SendCoarseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs);
72 72
73 public class ScenePresence : EntityBase, IScenePresence 73 public class ScenePresence : EntityBase, IScenePresence
74 { 74 {
75// ~ScenePresence() 75// ~ScenePresence()
76// { 76// {
77// m_log.Debug("[SCENE PRESENCE] Destructor called"); 77// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name);
78// } 78// }
79
79 private void TriggerScenePresenceUpdated() 80 private void TriggerScenePresenceUpdated()
80 { 81 {
81 if (m_scene != null) 82 if (m_scene != null)
@@ -186,7 +187,7 @@ namespace OpenSim.Region.Framework.Scenes
186 /// </summary> 187 /// </summary>
187 public bool SitGround { get; private set; } 188 public bool SitGround { get; private set; }
188 189
189 private SendCourseLocationsMethod m_sendCourseLocationsMethod; 190 private SendCoarseLocationsMethod m_sendCoarseLocationsMethod;
190 191
191 //private Vector3 m_requestedSitOffset = new Vector3(); 192 //private Vector3 m_requestedSitOffset = new Vector3();
192 193
@@ -537,7 +538,7 @@ namespace OpenSim.Region.Framework.Scenes
537 { 538 {
538 try 539 try
539 { 540 {
540 PhysicsActor.Velocity = value; 541 PhysicsActor.TargetVelocity = value;
541 } 542 }
542 catch (Exception e) 543 catch (Exception e)
543 { 544 {
@@ -695,7 +696,7 @@ namespace OpenSim.Region.Framework.Scenes
695 AttachmentsSyncLock = new Object(); 696 AttachmentsSyncLock = new Object();
696 AllowMovement = true; 697 AllowMovement = true;
697 IsChildAgent = true; 698 IsChildAgent = true;
698 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 699 m_sendCoarseLocationsMethod = SendCoarseLocationsDefault;
699 Animator = new ScenePresenceAnimator(this); 700 Animator = new ScenePresenceAnimator(this);
700 PresenceType = type; 701 PresenceType = type;
701 DrawDistance = world.DefaultDrawDistance; 702 DrawDistance = world.DefaultDrawDistance;
@@ -1697,8 +1698,16 @@ namespace OpenSim.Region.Framework.Scenes
1697// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", 1698// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
1698// Name, pos, m_scene.RegionInfo.RegionName); 1699// Name, pos, m_scene.RegionInfo.RegionName);
1699 1700
1700 if (pos.X < 0 || pos.X >= Constants.RegionSize 1701 // Allow move to another sub-region within a megaregion
1701 || pos.Y < 0 || pos.Y >= Constants.RegionSize 1702 Vector2 regionSize;
1703 IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface<IRegionCombinerModule>();
1704 if (regionCombinerModule != null)
1705 regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
1706 else
1707 regionSize = new Vector2(Constants.RegionSize);
1708
1709 if (pos.X < 0 || pos.X >= regionSize.X
1710 || pos.Y < 0 || pos.Y >= regionSize.Y
1702 || pos.Z < 0) 1711 || pos.Z < 0)
1703 return; 1712 return;
1704 1713
@@ -1712,7 +1721,16 @@ namespace OpenSim.Region.Framework.Scenes
1712// pos.Z = AbsolutePosition.Z; 1721// pos.Z = AbsolutePosition.Z;
1713// } 1722// }
1714 1723
1715 float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 1724 // Get terrain height for sub-region in a megaregion if necessary
1725 int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X);
1726 int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y);
1727 UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID;
1728 Scene targetScene = m_scene;
1729
1730 if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene))
1731 targetScene = m_scene;
1732
1733 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)];
1716 pos.Z = Math.Max(terrainHeight, pos.Z); 1734 pos.Z = Math.Max(terrainHeight, pos.Z);
1717 1735
1718 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is 1736 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is
@@ -2432,17 +2450,17 @@ namespace OpenSim.Region.Framework.Scenes
2432 2450
2433 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2451 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
2434 { 2452 {
2435 SendCourseLocationsMethod d = m_sendCourseLocationsMethod; 2453 SendCoarseLocationsMethod d = m_sendCoarseLocationsMethod;
2436 if (d != null) 2454 if (d != null)
2437 { 2455 {
2438 d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs); 2456 d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs);
2439 } 2457 }
2440 } 2458 }
2441 2459
2442 public void SetSendCourseLocationMethod(SendCourseLocationsMethod d) 2460 public void SetSendCoarseLocationMethod(SendCoarseLocationsMethod d)
2443 { 2461 {
2444 if (d != null) 2462 if (d != null)
2445 m_sendCourseLocationsMethod = d; 2463 m_sendCoarseLocationsMethod = d;
2446 } 2464 }
2447 2465
2448 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2466 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
@@ -2646,7 +2664,7 @@ namespace OpenSim.Region.Framework.Scenes
2646 #region Significant Movement Method 2664 #region Significant Movement Method
2647 2665
2648 /// <summary> 2666 /// <summary>
2649 /// This checks for a significant movement and sends a courselocationchange update 2667 /// This checks for a significant movement and sends a coarselocationchange update
2650 /// </summary> 2668 /// </summary>
2651 protected void CheckForSignificantMovement() 2669 protected void CheckForSignificantMovement()
2652 { 2670 {
@@ -3074,6 +3092,8 @@ namespace OpenSim.Region.Framework.Scenes
3074 cAgent.Anims = Animator.Animations.ToArray(); 3092 cAgent.Anims = Animator.Animations.ToArray();
3075 } 3093 }
3076 catch { } 3094 catch { }
3095 cAgent.DefaultAnim = Animator.Animations.DefaultAnimation;
3096 cAgent.AnimState = Animator.Animations.ImplicitDefaultAnimation;
3077 3097
3078 if (Scene.AttachmentsModule != null) 3098 if (Scene.AttachmentsModule != null)
3079 Scene.AttachmentsModule.CopyAttachments(this, cAgent); 3099 Scene.AttachmentsModule.CopyAttachments(this, cAgent);
@@ -3145,6 +3165,10 @@ namespace OpenSim.Region.Framework.Scenes
3145 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? 3165 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object?
3146 if (cAgent.Anims != null) 3166 if (cAgent.Anims != null)
3147 Animator.Animations.FromArray(cAgent.Anims); 3167 Animator.Animations.FromArray(cAgent.Anims);
3168 if (cAgent.DefaultAnim != null)
3169 Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero);
3170 if (cAgent.AnimState != null)
3171 Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero);
3148 3172
3149 if (Scene.AttachmentsModule != null) 3173 if (Scene.AttachmentsModule != null)
3150 Scene.AttachmentsModule.CopyAttachments(cAgent, this); 3174 Scene.AttachmentsModule.CopyAttachments(cAgent, this);
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 2addb5b..b9d615e 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -245,11 +245,13 @@ namespace OpenSim.Region.Framework.Scenes
245 = new Stat( 245 = new Stat(
246 "SlowFrames", 246 "SlowFrames",
247 "Slow Frames", 247 "Slow Frames",
248 "Number of frames where frame time has been significantly longer than the desired frame time.",
248 " frames", 249 " frames",
249 "scene", 250 "scene",
250 m_scene.Name, 251 m_scene.Name,
251 StatVerbosity.Info, 252 StatType.Push,
252 "Number of frames where frame time has been significantly longer than the desired frame time."); 253 null,
254 StatVerbosity.Info);
253 255
254 StatsManager.RegisterStat(SlowFramesStat); 256 StatsManager.RegisterStat(SlowFramesStat);
255 } 257 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
index 4a21dc9..e209221 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
@@ -37,7 +37,7 @@ using OpenSim.Tests.Common;
37namespace OpenSim.Region.Framework.Scenes.Tests 37namespace OpenSim.Region.Framework.Scenes.Tests
38{ 38{
39 [TestFixture] 39 [TestFixture]
40 public class BorderTests 40 public class BorderTests : OpenSimTestCase
41 { 41 {
42 [Test] 42 [Test]
43 public void TestCross() 43 public void TestCross()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index ea9fc93..766ce83 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -41,7 +41,7 @@ using OpenSim.Tests.Common;
41namespace OpenSim.Region.Framework.Scenes.Tests 41namespace OpenSim.Region.Framework.Scenes.Tests
42{ 42{
43 [TestFixture, LongRunning] 43 [TestFixture, LongRunning]
44 public class EntityManagerTests 44 public class EntityManagerTests : OpenSimTestCase
45 { 45 {
46 static public Random random; 46 static public Random random;
47 SceneObjectGroup found; 47 SceneObjectGroup found;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index d23c965..575a081 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -40,7 +40,7 @@ using OpenSim.Tests.Common.Mock;
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 [TestFixture] 42 [TestFixture]
43 public class SceneGraphTests 43 public class SceneGraphTests : OpenSimTestCase
44 { 44 {
45 [Test] 45 [Test]
46 public void TestDuplicateObject() 46 public void TestDuplicateObject()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
new file mode 100644
index 0000000..2d831fa
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
@@ -0,0 +1,58 @@
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.Threading;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces;
38using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock;
40
41namespace OpenSim.Region.Framework.Scenes.Tests
42{
43 [TestFixture]
44 public class SceneManagerTests : OpenSimTestCase
45 {
46 [Test]
47 public void TestClose()
48 {
49 TestHelpers.InMethod();
50
51 SceneHelpers sh = new SceneHelpers();
52 Scene scene = sh.SetupScene();
53
54 sh.SceneManager.Close();
55 Assert.That(scene.ShuttingDown, Is.True);
56 }
57 }
58} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 3398a53..a07d64c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -26,13 +26,16 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using System.Threading; 31using System.Threading;
32using Nini.Config;
31using NUnit.Framework; 33using NUnit.Framework;
32using OpenMetaverse; 34using OpenMetaverse;
33using OpenSim.Framework; 35using OpenSim.Framework;
34using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces;
36using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock; 40using OpenSim.Tests.Common.Mock;
38 41
@@ -42,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
42 /// Basic scene object tests (create, read and delete but not update). 45 /// Basic scene object tests (create, read and delete but not update).
43 /// </summary> 46 /// </summary>
44 [TestFixture] 47 [TestFixture]
45 public class SceneObjectBasicTests 48 public class SceneObjectBasicTests : OpenSimTestCase
46 { 49 {
47// [TearDown] 50// [TearDown]
48// public void TearDown() 51// public void TearDown()
@@ -180,6 +183,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
180 /// <summary> 183 /// <summary>
181 /// Test deleting an object from a scene. 184 /// Test deleting an object from a scene.
182 /// </summary> 185 /// </summary>
186 /// <remarks>
187 /// This is the most basic form of delete. For all more sophisticated forms of derez (done asynchrnously
188 /// and where object can be taken to user inventory, etc.), see SceneObjectDeRezTests.
189 /// </remarks>
183 [Test] 190 [Test]
184 public void TestDeleteSceneObject() 191 public void TestDeleteSceneObject()
185 { 192 {
@@ -199,78 +206,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
199 } 206 }
200 207
201 /// <summary> 208 /// <summary>
202 /// Test deleting an object asynchronously
203 /// </summary>
204 [Test]
205 public void TestDeleteSceneObjectAsync()
206 {
207 TestHelpers.InMethod();
208 //log4net.Config.XmlConfigurator.Configure();
209
210 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
211
212 TestScene scene = new SceneHelpers().SetupScene();
213
214 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
215 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
216 sogd.Enabled = false;
217
218 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene);
219
220 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
221 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
222
223 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
224
225 Assert.That(retrievedPart, Is.Not.Null);
226
227 Assert.That(so.IsDeleted, Is.False);
228
229 sogd.InventoryDeQueueAndDelete();
230
231 Assert.That(so.IsDeleted, Is.True);
232
233 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
234 Assert.That(retrievedPart2, Is.Null);
235 }
236
237 /// <summary>
238 /// Test deleting an object asynchronously to user inventory.
239 /// </summary>
240 //[Test]
241 //public void TestDeleteSceneObjectAsyncToUserInventory()
242 //{
243 // TestHelper.InMethod();
244 // //log4net.Config.XmlConfigurator.Configure();
245
246 // UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
247 // string myObjectName = "Fred";
248
249 // TestScene scene = SceneSetupHelpers.SetupScene();
250 // SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName);
251
252 // Assert.That(
253 // scene.CommsManager.UserAdminService.AddUser(
254 // "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
255 // Is.EqualTo(agentId));
256
257 // IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId);
258
259 // CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId);
260 // Assert.That(userInfo, Is.Not.Null);
261 // Assert.That(userInfo.RootFolder, Is.Not.Null);
262
263 // SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
264
265 // // Check that we now have the taken part in our inventory
266 // Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name));
267
268 // // Check that the taken part has actually disappeared
269 // SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
270 // Assert.That(retrievedPart, Is.Null);
271 //}
272
273 /// <summary>
274 /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not 209 /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not
275 /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by 210 /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by
276 /// OpenSim. 211 /// OpenSim.
@@ -305,4 +240,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
305 Assert.That(sog.Parts.Length, Is.EqualTo(2)); 240 Assert.That(sog.Parts.Length, Is.EqualTo(2));
306 } 241 }
307 } 242 }
308} 243} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 0076f41..c1522e7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -33,22 +33,24 @@ using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Framework.InventoryAccess;
36using OpenSim.Region.CoreModules.World.Permissions; 37using OpenSim.Region.CoreModules.World.Permissions;
37using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces;
38using OpenSim.Tests.Common; 40using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock; 41using OpenSim.Tests.Common.Mock;
40 42
41namespace OpenSim.Region.Framework.Scenes.Tests 43namespace OpenSim.Region.Framework.Scenes.Tests
42{ 44{
43 /// <summary> 45 /// <summary>
44 /// Tests derez of scene objects by users. 46 /// Tests derez of scene objects.
45 /// </summary> 47 /// </summary>
46 /// <remarks> 48 /// <remarks>
47 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. 49 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
48 /// TODO: These tests are very incomplete - they only test for a few conditions. 50 /// TODO: These tests are incomplete - need to test more kinds of derez (e.g. return object).
49 /// </remarks> 51 /// </remarks>
50 [TestFixture] 52 [TestFixture]
51 public class SceneObjectDeRezTests 53 public class SceneObjectDeRezTests : OpenSimTestCase
52 { 54 {
53 /// <summary> 55 /// <summary>
54 /// Test deleting an object from a scene. 56 /// Test deleting an object from a scene.
@@ -76,14 +78,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests
76 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); 78 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
77 part.Name = "obj1"; 79 part.Name = "obj1";
78 scene.AddNewSceneObject(new SceneObjectGroup(part), false); 80 scene.AddNewSceneObject(new SceneObjectGroup(part), false);
81
79 List<uint> localIds = new List<uint>(); 82 List<uint> localIds = new List<uint>();
80 localIds.Add(part.LocalId); 83 localIds.Add(part.LocalId);
81
82 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); 84 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
85
86 // Check that object isn't deleted until we crank the sogd handle.
87 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
88 Assert.That(retrievedPart, Is.Not.Null);
89 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
90
83 sogd.InventoryDeQueueAndDelete(); 91 sogd.InventoryDeQueueAndDelete();
84 92
85 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 93 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
86 Assert.That(retrievedPart, Is.Null); 94 Assert.That(retrievedPart2, Is.Null);
87 } 95 }
88 96
89 /// <summary> 97 /// <summary>
@@ -124,6 +132,67 @@ namespace OpenSim.Region.Framework.Scenes.Tests
124 // Object should still be in the scene. 132 // Object should still be in the scene.
125 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 133 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
126 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); 134 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
127 } 135 }
136
137 /// <summary>
138 /// Test deleting an object asynchronously to user inventory.
139 /// </summary>
140 [Test]
141 public void TestDeleteSceneObjectAsyncToUserInventory()
142 {
143 TestHelpers.InMethod();
144// TestHelpers.EnableLogging();
145
146 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
147 string myObjectName = "Fred";
148
149 TestScene scene = new SceneHelpers().SetupScene();
150
151 IConfigSource configSource = new IniConfigSource();
152 IConfig config = configSource.AddConfig("Modules");
153 config.Set("InventoryAccessModule", "BasicInventoryAccessModule");
154 SceneHelpers.SetupSceneModules(
155 scene, configSource, new object[] { new BasicInventoryAccessModule() });
156
157 SceneHelpers.SetupSceneModules(scene, new object[] { });
158
159 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
160 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
161 sogd.Enabled = false;
162
163 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
164
165 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
166 InventoryFolderBase folder1
167 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1");
168
169 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
170 scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
171
172 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
173
174 Assert.That(retrievedPart, Is.Not.Null);
175 Assert.That(so.IsDeleted, Is.False);
176
177 sogd.InventoryDeQueueAndDelete();
178
179 Assert.That(so.IsDeleted, Is.True);
180
181 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
182 Assert.That(retrievedPart2, Is.Null);
183
184// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
185
186 InventoryItemBase retrievedItem
187 = UserInventoryHelpers.GetInventoryItem(
188 scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName);
189
190 // Check that we now have the taken part in our inventory
191 Assert.That(retrievedItem, Is.Not.Null);
192
193 // Check that the taken part has actually disappeared
194// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
195// Assert.That(retrievedPart, Is.Null);
196 }
128 } 197 }
129} \ No newline at end of file 198} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 0e525c9..9378e20 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -40,7 +40,7 @@ using log4net;
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 [TestFixture] 42 [TestFixture]
43 public class SceneObjectLinkingTests 43 public class SceneObjectLinkingTests : OpenSimTestCase
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
index 89647d6..c264433 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
41 /// Basic scene object resize tests 41 /// Basic scene object resize tests
42 /// </summary> 42 /// </summary>
43 [TestFixture] 43 [TestFixture]
44 public class SceneObjectResizeTests 44 public class SceneObjectResizeTests : OpenSimTestCase
45 { 45 {
46 /// <summary> 46 /// <summary>
47 /// Test resizing an object 47 /// Test resizing an object
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
index d2361f8..a58e735 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
@@ -40,7 +40,7 @@ using OpenSim.Tests.Common.Mock;
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 [TestFixture] 42 [TestFixture]
43 public class SceneObjectScriptTests 43 public class SceneObjectScriptTests : OpenSimTestCase
44 { 44 {
45 [Test] 45 [Test]
46 public void TestAddScript() 46 public void TestAddScript()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
index 6d255aa..abaa1d1 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
@@ -42,14 +42,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
42 /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.) 42 /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.)
43 /// </summary> 43 /// </summary>
44 [TestFixture] 44 [TestFixture]
45 public class SceneObjectSpatialTests 45 public class SceneObjectSpatialTests : OpenSimTestCase
46 { 46 {
47 TestScene m_scene; 47 TestScene m_scene;
48 UUID m_ownerId = TestHelpers.ParseTail(0x1); 48 UUID m_ownerId = TestHelpers.ParseTail(0x1);
49 49
50 [SetUp] 50 [SetUp]
51 public void SetUp() 51 public override void SetUp()
52 { 52 {
53 base.SetUp();
54
53 m_scene = new SceneHelpers().SetupScene(); 55 m_scene = new SceneHelpers().SetupScene();
54 } 56 }
55 57
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 742c769..093cbd2 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
42 /// Basic scene object status tests 42 /// Basic scene object status tests
43 /// </summary> 43 /// </summary>
44 [TestFixture] 44 [TestFixture]
45 public class SceneObjectStatusTests 45 public class SceneObjectStatusTests : OpenSimTestCase
46 { 46 {
47 private TestScene m_scene; 47 private TestScene m_scene;
48 private UUID m_ownerId = TestHelpers.ParseTail(0x1); 48 private UUID m_ownerId = TestHelpers.ParseTail(0x1);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
index 646e5fa..1cd8ae9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
51 /// Scene presence animation tests 51 /// Scene presence animation tests
52 /// </summary> 52 /// </summary>
53 [TestFixture] 53 [TestFixture]
54 public class ScenePresenceAnimationTests 54 public class ScenePresenceAnimationTests : OpenSimTestCase
55 { 55 {
56 [Test] 56 [Test]
57 public void TestFlyingAnimation() 57 public void TestFlyingAnimation()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
index 1d1ff88..d80afd3 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
@@ -42,7 +42,7 @@ using OpenSim.Tests.Common.Mock;
42namespace OpenSim.Region.Framework.Scenes.Tests 42namespace OpenSim.Region.Framework.Scenes.Tests
43{ 43{
44 [TestFixture] 44 [TestFixture]
45 public class ScenePresenceAutopilotTests 45 public class ScenePresenceAutopilotTests : OpenSimTestCase
46 { 46 {
47 private TestScene m_scene; 47 private TestScene m_scene;
48 48
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
index 493ab70..acaeb90 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
@@ -43,7 +43,7 @@ using System.Threading;
43namespace OpenSim.Region.Framework.Scenes.Tests 43namespace OpenSim.Region.Framework.Scenes.Tests
44{ 44{
45 [TestFixture] 45 [TestFixture]
46 public class ScenePresenceSitTests 46 public class ScenePresenceSitTests : OpenSimTestCase
47 { 47 {
48 private TestScene m_scene; 48 private TestScene m_scene;
49 private ScenePresence m_sp; 49 private ScenePresence m_sp;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 37b5184..8dd1f3d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
49 /// Teleport tests in a standalone OpenSim 49 /// Teleport tests in a standalone OpenSim
50 /// </summary> 50 /// </summary>
51 [TestFixture] 51 [TestFixture]
52 public class ScenePresenceTeleportTests 52 public class ScenePresenceTeleportTests : OpenSimTestCase
53 { 53 {
54 [TestFixtureSetUp] 54 [TestFixtureSetUp]
55 public void FixtureInit() 55 public void FixtureInit()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index d722a09..9d8eb0b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
50 /// Scene presence tests 50 /// Scene presence tests
51 /// </summary> 51 /// </summary>
52 [TestFixture] 52 [TestFixture]
53 public class SceneTests 53 public class SceneTests : OpenSimTestCase
54 { 54 {
55 /// <summary> 55 /// <summary>
56 /// Very basic scene update test. Should become more elaborate with time. 56 /// Very basic scene update test. Should become more elaborate with time.
@@ -65,5 +65,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests
65 65
66 Assert.That(scene.Frame, Is.EqualTo(1)); 66 Assert.That(scene.Frame, Is.EqualTo(1));
67 } 67 }
68
69 [Test]
70 public void TestShutdownScene()
71 {
72 TestHelpers.InMethod();
73
74 Scene scene = new SceneHelpers().SetupScene();
75 scene.Close();
76
77 Assert.That(scene.ShuttingDown, Is.True);
78 Assert.That(scene.Active, Is.False);
79
80 // Trying to update a shutdown scene should result in no update
81 scene.Update(1);
82
83 Assert.That(scene.Frame, Is.EqualTo(0));
84 }
68 } 85 }
69} \ No newline at end of file 86} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index a51e4e3..0b461f5 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -50,7 +50,7 @@ using OpenSim.Tests.Common.Mock;
50namespace OpenSim.Region.Framework.Tests 50namespace OpenSim.Region.Framework.Tests
51{ 51{
52 [TestFixture] 52 [TestFixture]
53 public class TaskInventoryTests 53 public class TaskInventoryTests : OpenSimTestCase
54 { 54 {
55 [Test] 55 [Test]
56 public void TestAddTaskInventoryItem() 56 public void TestAddTaskInventoryItem()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 198e487..dd27294 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -38,7 +38,7 @@ using OpenSim.Tests.Common.Mock;
38namespace OpenSim.Region.Framework.Scenes.Tests 38namespace OpenSim.Region.Framework.Scenes.Tests
39{ 39{
40 [TestFixture] 40 [TestFixture]
41 public class UuidGathererTests 41 public class UuidGathererTests : OpenSimTestCase
42 { 42 {
43 protected IAssetService m_assetService; 43 protected IAssetService m_assetService;
44 protected UuidGatherer m_uuidGatherer; 44 protected UuidGatherer m_uuidGatherer;