aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMic Bowman2011-08-19 14:49:16 -0700
committerMic Bowman2011-08-19 14:49:16 -0700
commit384cb79a1a27c47bb3fdbdef6d601a3dcb9dfb0f (patch)
tree5e557eac5d4d3d4ad95b9e3e70a2a661e5745ec3 /OpenSim
parentBulletSim: add runtime setting of physics parameters. Update default values. (diff)
parentGet rid of HttpServer.dll to avoid confusion since we use HttpServer_OpenSim.... (diff)
downloadopensim-SC_OLD-384cb79a1a27c47bb3fdbdef6d601a3dcb9dfb0f.zip
opensim-SC_OLD-384cb79a1a27c47bb3fdbdef6d601a3dcb9dfb0f.tar.gz
opensim-SC_OLD-384cb79a1a27c47bb3fdbdef6d601a3dcb9dfb0f.tar.bz2
opensim-SC_OLD-384cb79a1a27c47bb3fdbdef6d601a3dcb9dfb0f.tar.xz
Merge branch 'master' into bulletsim
Conflicts: OpenSim/Region/Framework/Scenes/SceneManager.cs
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs2
-rw-r--r--OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs45
-rw-r--r--OpenSim/Data/MSSQL/MSSQLMigration.cs2
-rw-r--r--OpenSim/Data/MSSQL/MSSQLXInventoryData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs9
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs2
-rw-r--r--OpenSim/Data/SQLite/Resources/XInventoryStore.migrations4
-rw-r--r--OpenSim/Data/Tests/AssetTests.cs6
-rw-r--r--OpenSim/Data/Tests/EstateTests.cs16
-rw-r--r--OpenSim/Data/Tests/InventoryTests.cs26
-rw-r--r--OpenSim/Data/Tests/RegionTests.cs40
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs14
-rw-r--r--OpenSim/Framework/IClientAPI.cs4
-rw-r--r--OpenSim/Framework/IScene.cs16
-rw-r--r--OpenSim/Framework/PresenceType.cs39
-rw-r--r--OpenSim/Framework/Tests/UtilTest.cs8
-rw-r--r--OpenSim/Framework/Util.cs11
-rw-r--r--OpenSim/Region/Application/OpenSim.cs16
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs9
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs16
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs80
-rw-r--r--OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs16
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs20
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs (renamed from OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs)128
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs125
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs12
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs22
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs36
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs14
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs45
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs10
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Access/AccessModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs18
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs50
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs212
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs6
-rw-r--r--OpenSim/Region/Examples/SimpleModule/RegionModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs3
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs47
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUserManagement.cs37
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs105
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs226
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs39
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs117
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs28
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs66
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs (renamed from OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs)223
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs (renamed from OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs)14
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs8
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs5
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs17
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs158
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs33
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs69
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs574
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs45
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs179
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs229
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs10
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs2
-rw-r--r--OpenSim/Services/GridService/GridService.cs5
-rw-r--r--OpenSim/Services/HypergridService/HGInstantMessageService.cs9
-rw-r--r--OpenSim/Services/Interfaces/IAssetService.cs8
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs19
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs4
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs (renamed from OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs)15
-rw-r--r--OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs2
-rw-r--r--OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs8
-rw-r--r--OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs37
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs13
-rw-r--r--OpenSim/Tests/Common/TestHelpers.cs (renamed from OpenSim/Tests/Common/TestHelper.cs)2
102 files changed, 2603 insertions, 1132 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs
index de2049f..1023108 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs
@@ -169,7 +169,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
169 float y = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Y]); 169 float y = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Y]);
170 float z = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Z]); 170 float z = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Z]);
171 Vector3 vector = new Vector3(x, y, z); 171 Vector3 vector = new Vector3(x, y, z);
172 presence.MoveToTarget(vector); 172 presence.MoveToTarget(vector, false);
173 } 173 }
174 catch (Exception e) 174 catch (Exception e)
175 { 175 {
diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs
index c60abb1..720640e 100644
--- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs
@@ -57,7 +57,6 @@ namespace OpenSim.Capabilities.Handlers
57 57
58 public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap) 58 public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
59 { 59 {
60
61 Hashtable responsedata = new Hashtable(); 60 Hashtable responsedata = new Hashtable();
62 responsedata["int_response_code"] = 400; //501; //410; //404; 61 responsedata["int_response_code"] = 400; //501; //410; //404;
63 responsedata["content_type"] = "text/plain"; 62 responsedata["content_type"] = "text/plain";
@@ -69,7 +68,6 @@ namespace OpenSim.Capabilities.Handlers
69 if (request.ContainsKey("mesh_id")) 68 if (request.ContainsKey("mesh_id"))
70 meshStr = request["mesh_id"].ToString(); 69 meshStr = request["mesh_id"].ToString();
71 70
72
73 UUID meshID = UUID.Zero; 71 UUID meshID = UUID.Zero;
74 if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID)) 72 if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID))
75 { 73 {
@@ -82,12 +80,11 @@ namespace OpenSim.Capabilities.Handlers
82 return responsedata; 80 return responsedata;
83 } 81 }
84 82
85 AssetBase mesh; 83 AssetBase mesh = m_assetService.Get(meshID.ToString());
86 // Only try to fetch locally cached textures. Misses are redirected 84
87 mesh = m_assetService.GetCached(meshID.ToString());
88 if (mesh != null) 85 if (mesh != null)
89 { 86 {
90 if (mesh.Type == (SByte)AssetType.Mesh) 87 if (mesh.Type == (SByte)AssetType.Mesh)
91 { 88 {
92 responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); 89 responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
93 responsedata["content_type"] = "application/vnd.ll.mesh"; 90 responsedata["content_type"] = "application/vnd.ll.mesh";
@@ -105,39 +102,15 @@ namespace OpenSim.Capabilities.Handlers
105 } 102 }
106 else 103 else
107 { 104 {
108 mesh = m_assetService.Get(meshID.ToString()); 105 responsedata["int_response_code"] = 404; //501; //410; //404;
109 if (mesh != null) 106 responsedata["content_type"] = "text/plain";
110 { 107 responsedata["keepalive"] = false;
111 if (mesh.Type == (SByte)AssetType.Mesh) 108 responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
112 { 109 return responsedata;
113 responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
114 responsedata["content_type"] = "application/vnd.ll.mesh";
115 responsedata["int_response_code"] = 200;
116 }
117 // Optionally add additional mesh types here
118 else
119 {
120 responsedata["int_response_code"] = 404; //501; //410; //404;
121 responsedata["content_type"] = "text/plain";
122 responsedata["keepalive"] = false;
123 responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
124 return responsedata;
125 }
126 }
127
128 else
129 {
130 responsedata["int_response_code"] = 404; //501; //410; //404;
131 responsedata["content_type"] = "text/plain";
132 responsedata["keepalive"] = false;
133 responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
134 return responsedata;
135 }
136 } 110 }
137
138 } 111 }
139 112
140 return responsedata; 113 return responsedata;
141 } 114 }
142 } 115 }
143} 116} \ No newline at end of file
diff --git a/OpenSim/Data/MSSQL/MSSQLMigration.cs b/OpenSim/Data/MSSQL/MSSQLMigration.cs
index 1aa96c7..c2fecef 100644
--- a/OpenSim/Data/MSSQL/MSSQLMigration.cs
+++ b/OpenSim/Data/MSSQL/MSSQLMigration.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Data.MSSQL
88 cmd.ExecuteNonQuery(); 88 cmd.ExecuteNonQuery();
89 } 89 }
90 } 90 }
91 catch (Exception ex) 91 catch (Exception)
92 { 92 {
93 throw new Exception(sql); 93 throw new Exception(sql);
94 94
diff --git a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs
index 10b0f29..b19a0da 100644
--- a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs
@@ -191,7 +191,7 @@ namespace OpenSim.Data.MSSQL
191 { 191 {
192 cmd.ExecuteNonQuery(); 192 cmd.ExecuteNonQuery();
193 } 193 }
194 catch (Exception e) 194 catch (Exception)
195 { 195 {
196 return false; 196 return false;
197 } 197 }
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index e740232..a743479 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -251,12 +251,14 @@ namespace OpenSim.Data.MySQL
251 } 251 }
252 252
253 /// <summary> 253 /// <summary>
254 /// check if the asset UUID exist in database 254 /// Check if the asset exists in the database
255 /// </summary> 255 /// </summary>
256 /// <param name="uuid">The asset UUID</param> 256 /// <param name="uuid">The asset UUID</param>
257 /// <returns>true if exist.</returns> 257 /// <returns>true if it exists, false otherwise.</returns>
258 override public bool ExistsAsset(UUID uuid) 258 override public bool ExistsAsset(UUID uuid)
259 { 259 {
260// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
261
260 bool assetExists = false; 262 bool assetExists = false;
261 263
262 lock (m_dbLock) 264 lock (m_dbLock)
@@ -273,7 +275,10 @@ namespace OpenSim.Data.MySQL
273 using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) 275 using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
274 { 276 {
275 if (dbReader.Read()) 277 if (dbReader.Read())
278 {
279// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
276 assetExists = true; 280 assetExists = true;
281 }
277 } 282 }
278 } 283 }
279 catch (Exception e) 284 catch (Exception e)
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs
index 53e5207..11013c1 100644
--- a/OpenSim/Data/Null/NullRegionData.cs
+++ b/OpenSim/Data/Null/NullRegionData.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Data.Null
97 97
98 foreach (RegionData r in m_regionData.Values) 98 foreach (RegionData r in m_regionData.Values)
99 { 99 {
100 m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower()); 100// m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
101 if (queryMatch(r.RegionName.ToLower())) 101 if (queryMatch(r.RegionName.ToLower()))
102 ret.Add(r); 102 ret.Add(r);
103 } 103 }
diff --git a/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations b/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations
index d5b3019..de44982 100644
--- a/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations
@@ -41,11 +41,9 @@ COMMIT;
41 41
42:VERSION 2 42:VERSION 2
43 43
44ATTACH 'inventoryStore.db' AS old;
45
46BEGIN TRANSACTION; 44BEGIN TRANSACTION;
47 45
48INSERT INTO inventoryfolders (folderName, type, version, folderID, agentID, parentFolderID) SELECT `name` AS folderName, `type` AS type, `version` AS version, `UUID` AS folderID, `agentID` AS agentID, `parentID` AS parentFolderID from old.inventoryfolders; 46INSERT INTO inventoryfolders (folderName, type, version, folderID, agentID, parentFolderID) SELECT `name` AS folderName, `type` AS type, `version` AS version, `UUID` AS folderID, `agentID` AS agentID, `parentID` AS parentFolderID from old.inventoryfolders;
49INSERT INTO inventoryitems (assetID, assetType, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryID, parentFolderID, avatarID, inventoryGroupPermissions) SELECT `assetID`, `assetType` AS assetType, `inventoryName` AS inventoryName, `inventoryDescription` AS inventoryDescription, `inventoryNextPermissions` AS inventoryNextPermissions, `inventoryCurrentPermissions` AS inventoryCurrentPermissions, `invType` AS invType, `creatorsID` AS creatorID, `inventoryBasePermissions` AS inventoryBasePermissions, `inventoryEveryOnePermissions` AS inventoryEveryOnePermissions, `salePrice` AS salePrice, `saleType` AS saleType, `creationDate` AS creationDate, `groupID` AS groupID, `groupOwned` AS groupOwned, `flags` AS flags, `UUID` AS inventoryID, `parentFolderID` AS parentFolderID, `avatarID` AS avatarID, `inventoryGroupPermissions` AS inventoryGroupPermissions FROM old.inventoryitems; 47INSERT INTO inventoryitems (assetID, assetType, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryID, parentFolderID, avatarID, inventoryGroupPermissions) SELECT `assetID`, `assetType` AS assetType, `inventoryName` AS inventoryName, `inventoryDescription` AS inventoryDescription, `inventoryNextPermissions` AS inventoryNextPermissions, `inventoryCurrentPermissions` AS inventoryCurrentPermissions, `invType` AS invType, `creatorsID` AS creatorID, `inventoryBasePermissions` AS inventoryBasePermissions, `inventoryEveryOnePermissions` AS inventoryEveryOnePermissions, `salePrice` AS salePrice, `saleType` AS saleType, `creationDate` AS creationDate, `groupID` AS groupID, `groupOwned` AS groupOwned, `flags` AS flags, `UUID` AS inventoryID, `parentFolderID` AS parentFolderID, `avatarID` AS avatarID, `inventoryGroupPermissions` AS inventoryGroupPermissions FROM old.inventoryitems;
50 48
51COMMIT; \ No newline at end of file 49COMMIT;
diff --git a/OpenSim/Data/Tests/AssetTests.cs b/OpenSim/Data/Tests/AssetTests.cs
index b5ae244..1174e2f 100644
--- a/OpenSim/Data/Tests/AssetTests.cs
+++ b/OpenSim/Data/Tests/AssetTests.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Data.Tests
106 [Test] 106 [Test]
107 public void T001_LoadEmpty() 107 public void T001_LoadEmpty()
108 { 108 {
109 TestHelper.InMethod(); 109 TestHelpers.InMethod();
110 110
111 Assert.That(m_db.ExistsAsset(uuid1), Is.False); 111 Assert.That(m_db.ExistsAsset(uuid1), Is.False);
112 Assert.That(m_db.ExistsAsset(uuid2), Is.False); 112 Assert.That(m_db.ExistsAsset(uuid2), Is.False);
@@ -116,7 +116,7 @@ namespace OpenSim.Data.Tests
116 [Test] 116 [Test]
117 public void T010_StoreReadVerifyAssets() 117 public void T010_StoreReadVerifyAssets()
118 { 118 {
119 TestHelper.InMethod(); 119 TestHelpers.InMethod();
120 120
121 AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString()); 121 AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString());
122 AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString()); 122 AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString());
@@ -183,7 +183,7 @@ namespace OpenSim.Data.Tests
183 [Test] 183 [Test]
184 public void T020_CheckForWeirdCreatorID() 184 public void T020_CheckForWeirdCreatorID()
185 { 185 {
186 TestHelper.InMethod(); 186 TestHelpers.InMethod();
187 187
188 // It is expected that eventually the CreatorID might be an arbitrary string (an URI) 188 // It is expected that eventually the CreatorID might be an arbitrary string (an URI)
189 // rather than a valid UUID (?). This test is to make sure that the database layer does not 189 // rather than a valid UUID (?). This test is to make sure that the database layer does not
diff --git a/OpenSim/Data/Tests/EstateTests.cs b/OpenSim/Data/Tests/EstateTests.cs
index 8d332da..3e47bcf 100644
--- a/OpenSim/Data/Tests/EstateTests.cs
+++ b/OpenSim/Data/Tests/EstateTests.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Data.Tests
107 [Test] 107 [Test]
108 public void T010_EstateSettingsSimpleStorage_MinimumParameterSet() 108 public void T010_EstateSettingsSimpleStorage_MinimumParameterSet()
109 { 109 {
110 TestHelper.InMethod(); 110 TestHelpers.InMethod();
111 111
112 EstateSettingsSimpleStorage( 112 EstateSettingsSimpleStorage(
113 REGION_ID, 113 REGION_ID,
@@ -140,7 +140,7 @@ namespace OpenSim.Data.Tests
140 [Test] 140 [Test]
141 public void T011_EstateSettingsSimpleStorage_MaximumParameterSet() 141 public void T011_EstateSettingsSimpleStorage_MaximumParameterSet()
142 { 142 {
143 TestHelper.InMethod(); 143 TestHelpers.InMethod();
144 144
145 EstateSettingsSimpleStorage( 145 EstateSettingsSimpleStorage(
146 REGION_ID, 146 REGION_ID,
@@ -173,7 +173,7 @@ namespace OpenSim.Data.Tests
173 [Test] 173 [Test]
174 public void T012_EstateSettingsSimpleStorage_AccurateParameterSet() 174 public void T012_EstateSettingsSimpleStorage_AccurateParameterSet()
175 { 175 {
176 TestHelper.InMethod(); 176 TestHelpers.InMethod();
177 177
178 EstateSettingsSimpleStorage( 178 EstateSettingsSimpleStorage(
179 REGION_ID, 179 REGION_ID,
@@ -206,7 +206,7 @@ namespace OpenSim.Data.Tests
206 [Test] 206 [Test]
207 public void T012_EstateSettingsRandomStorage() 207 public void T012_EstateSettingsRandomStorage()
208 { 208 {
209 TestHelper.InMethod(); 209 TestHelpers.InMethod();
210 210
211 // Letting estate store generate rows to database for us 211 // Letting estate store generate rows to database for us
212 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 212 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
@@ -227,7 +227,7 @@ namespace OpenSim.Data.Tests
227 [Test] 227 [Test]
228 public void T020_EstateSettingsManagerList() 228 public void T020_EstateSettingsManagerList()
229 { 229 {
230 TestHelper.InMethod(); 230 TestHelpers.InMethod();
231 231
232 // Letting estate store generate rows to database for us 232 // Letting estate store generate rows to database for us
233 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 233 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
@@ -248,7 +248,7 @@ namespace OpenSim.Data.Tests
248 [Test] 248 [Test]
249 public void T021_EstateSettingsUserList() 249 public void T021_EstateSettingsUserList()
250 { 250 {
251 TestHelper.InMethod(); 251 TestHelpers.InMethod();
252 252
253 // Letting estate store generate rows to database for us 253 // Letting estate store generate rows to database for us
254 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 254 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
@@ -269,7 +269,7 @@ namespace OpenSim.Data.Tests
269 [Test] 269 [Test]
270 public void T022_EstateSettingsGroupList() 270 public void T022_EstateSettingsGroupList()
271 { 271 {
272 TestHelper.InMethod(); 272 TestHelpers.InMethod();
273 273
274 // Letting estate store generate rows to database for us 274 // Letting estate store generate rows to database for us
275 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 275 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
@@ -290,7 +290,7 @@ namespace OpenSim.Data.Tests
290 [Test] 290 [Test]
291 public void T022_EstateSettingsBanList() 291 public void T022_EstateSettingsBanList()
292 { 292 {
293 TestHelper.InMethod(); 293 TestHelpers.InMethod();
294 294
295 // Letting estate store generate rows to database for us 295 // Letting estate store generate rows to database for us
296 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 296 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs
index cf3bac1..5b6b61b 100644
--- a/OpenSim/Data/Tests/InventoryTests.cs
+++ b/OpenSim/Data/Tests/InventoryTests.cs
@@ -114,7 +114,7 @@ namespace OpenSim.Data.Tests
114 [Test] 114 [Test]
115 public void T001_LoadEmpty() 115 public void T001_LoadEmpty()
116 { 116 {
117 TestHelper.InMethod(); 117 TestHelpers.InMethod();
118 118
119 Assert.That(db.getInventoryFolder(zero), Is.Null); 119 Assert.That(db.getInventoryFolder(zero), Is.Null);
120 Assert.That(db.getInventoryFolder(folder1), Is.Null); 120 Assert.That(db.getInventoryFolder(folder1), Is.Null);
@@ -134,7 +134,7 @@ namespace OpenSim.Data.Tests
134 [Test] 134 [Test]
135 public void T010_FolderNonParent() 135 public void T010_FolderNonParent()
136 { 136 {
137 TestHelper.InMethod(); 137 TestHelpers.InMethod();
138 138
139 InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2); 139 InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2);
140 // the folder will go in 140 // the folder will go in
@@ -146,7 +146,7 @@ namespace OpenSim.Data.Tests
146 [Test] 146 [Test]
147 public void T011_FolderCreate() 147 public void T011_FolderCreate()
148 { 148 {
149 TestHelper.InMethod(); 149 TestHelpers.InMethod();
150 150
151 InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1); 151 InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1);
152 // TODO: this is probably wrong behavior, but is what we have 152 // TODO: this is probably wrong behavior, but is what we have
@@ -171,7 +171,7 @@ namespace OpenSim.Data.Tests
171 [Test] 171 [Test]
172 public void T012_FolderList() 172 public void T012_FolderList()
173 { 173 {
174 TestHelper.InMethod(); 174 TestHelpers.InMethod();
175 175
176 InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); 176 InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3);
177 db.addInventoryFolder(f2); 177 db.addInventoryFolder(f2);
@@ -187,7 +187,7 @@ namespace OpenSim.Data.Tests
187 [Test] 187 [Test]
188 public void T013_FolderHierarchy() 188 public void T013_FolderHierarchy()
189 { 189 {
190 TestHelper.InMethod(); 190 TestHelpers.InMethod();
191 191
192 int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) 192 int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned)
193 Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); 193 Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
@@ -202,7 +202,7 @@ namespace OpenSim.Data.Tests
202 [Test] 202 [Test]
203 public void T014_MoveFolder() 203 public void T014_MoveFolder()
204 { 204 {
205 TestHelper.InMethod(); 205 TestHelpers.InMethod();
206 206
207 InventoryFolderBase f2 = db.getInventoryFolder(folder2); 207 InventoryFolderBase f2 = db.getInventoryFolder(folder2);
208 f2.ParentID = folder3; 208 f2.ParentID = folder3;
@@ -218,7 +218,7 @@ namespace OpenSim.Data.Tests
218 [Test] 218 [Test]
219 public void T015_FolderHierarchy() 219 public void T015_FolderHierarchy()
220 { 220 {
221 TestHelper.InMethod(); 221 TestHelpers.InMethod();
222 222
223 Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); 223 Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
224 Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); 224 Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))");
@@ -231,7 +231,7 @@ namespace OpenSim.Data.Tests
231 [Test] 231 [Test]
232 public void T100_NoItems() 232 public void T100_NoItems()
233 { 233 {
234 TestHelper.InMethod(); 234 TestHelpers.InMethod();
235 235
236 Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); 236 Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))");
237 Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))"); 237 Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))");
@@ -245,7 +245,7 @@ namespace OpenSim.Data.Tests
245 [Test] 245 [Test]
246 public void T101_CreatItems() 246 public void T101_CreatItems()
247 { 247 {
248 TestHelper.InMethod(); 248 TestHelpers.InMethod();
249 249
250 db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1)); 250 db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1));
251 db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2)); 251 db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2));
@@ -256,7 +256,7 @@ namespace OpenSim.Data.Tests
256 [Test] 256 [Test]
257 public void T102_CompareItems() 257 public void T102_CompareItems()
258 { 258 {
259 TestHelper.InMethod(); 259 TestHelpers.InMethod();
260 260
261 InventoryItemBase i1 = db.getInventoryItem(item1); 261 InventoryItemBase i1 = db.getInventoryItem(item1);
262 InventoryItemBase i2 = db.getInventoryItem(item2); 262 InventoryItemBase i2 = db.getInventoryItem(item2);
@@ -275,7 +275,7 @@ namespace OpenSim.Data.Tests
275 [Test] 275 [Test]
276 public void T103_UpdateItem() 276 public void T103_UpdateItem()
277 { 277 {
278 TestHelper.InMethod(); 278 TestHelpers.InMethod();
279 279
280 // TODO: probably shouldn't have the ability to have an 280 // TODO: probably shouldn't have the ability to have an
281 // owner of an item in a folder not owned by the user 281 // owner of an item in a folder not owned by the user
@@ -295,7 +295,7 @@ namespace OpenSim.Data.Tests
295 [Test] 295 [Test]
296 public void T104_RandomUpdateItem() 296 public void T104_RandomUpdateItem()
297 { 297 {
298 TestHelper.InMethod(); 298 TestHelpers.InMethod();
299 299
300 PropertyScrambler<InventoryFolderBase> folderScrambler = 300 PropertyScrambler<InventoryFolderBase> folderScrambler =
301 new PropertyScrambler<InventoryFolderBase>() 301 new PropertyScrambler<InventoryFolderBase>()
@@ -354,7 +354,7 @@ namespace OpenSim.Data.Tests
354 [Test] 354 [Test]
355 public void T999_StillNull() 355 public void T999_StillNull()
356 { 356 {
357 TestHelper.InMethod(); 357 TestHelpers.InMethod();
358 358
359 // After all tests are run, these should still return no results 359 // After all tests are run, these should still return no results
360 Assert.That(db.getInventoryFolder(zero), Is.Null); 360 Assert.That(db.getInventoryFolder(zero), Is.Null);
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs
index 44cf1ab..2b8fa59 100644
--- a/OpenSim/Data/Tests/RegionTests.cs
+++ b/OpenSim/Data/Tests/RegionTests.cs
@@ -151,7 +151,7 @@ namespace OpenSim.Data.Tests
151 [Test] 151 [Test]
152 public void T001_LoadEmpty() 152 public void T001_LoadEmpty()
153 { 153 {
154 TestHelper.InMethod(); 154 TestHelpers.InMethod();
155 155
156 List<SceneObjectGroup> objs = db.LoadObjects(region1); 156 List<SceneObjectGroup> objs = db.LoadObjects(region1);
157 List<SceneObjectGroup> objs3 = db.LoadObjects(region3); 157 List<SceneObjectGroup> objs3 = db.LoadObjects(region3);
@@ -169,7 +169,7 @@ namespace OpenSim.Data.Tests
169 [Test] 169 [Test]
170 public void T010_StoreSimpleObject() 170 public void T010_StoreSimpleObject()
171 { 171 {
172 TestHelper.InMethod(); 172 TestHelpers.InMethod();
173 173
174 SceneObjectGroup sog = NewSOG("object1", prim1, region1); 174 SceneObjectGroup sog = NewSOG("object1", prim1, region1);
175 SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); 175 SceneObjectGroup sog2 = NewSOG("object2", prim2, region1);
@@ -204,7 +204,7 @@ namespace OpenSim.Data.Tests
204 [Test] 204 [Test]
205 public void T011_ObjectNames() 205 public void T011_ObjectNames()
206 { 206 {
207 TestHelper.InMethod(); 207 TestHelpers.InMethod();
208 208
209 List<SceneObjectGroup> objs = db.LoadObjects(region1); 209 List<SceneObjectGroup> objs = db.LoadObjects(region1);
210 foreach (SceneObjectGroup sog in objs) 210 foreach (SceneObjectGroup sog in objs)
@@ -218,7 +218,7 @@ namespace OpenSim.Data.Tests
218 [Test] 218 [Test]
219 public void T012_SceneParts() 219 public void T012_SceneParts()
220 { 220 {
221 TestHelper.InMethod(); 221 TestHelpers.InMethod();
222 222
223 UUID tmp0 = UUID.Random(); 223 UUID tmp0 = UUID.Random();
224 UUID tmp1 = UUID.Random(); 224 UUID tmp1 = UUID.Random();
@@ -253,7 +253,7 @@ namespace OpenSim.Data.Tests
253 [Test] 253 [Test]
254 public void T013_DatabasePersistency() 254 public void T013_DatabasePersistency()
255 { 255 {
256 TestHelper.InMethod(); 256 TestHelpers.InMethod();
257 257
258 // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data 258 // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data
259 // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored 259 // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored
@@ -430,7 +430,7 @@ namespace OpenSim.Data.Tests
430 [Test] 430 [Test]
431 public void T014_UpdateObject() 431 public void T014_UpdateObject()
432 { 432 {
433 TestHelper.InMethod(); 433 TestHelpers.InMethod();
434 434
435 string text1 = "object1 text"; 435 string text1 = "object1 text";
436 SceneObjectGroup sog = FindSOG("object1", region1); 436 SceneObjectGroup sog = FindSOG("object1", region1);
@@ -540,7 +540,7 @@ namespace OpenSim.Data.Tests
540 [Test] 540 [Test]
541 public void T015_LargeSceneObjects() 541 public void T015_LargeSceneObjects()
542 { 542 {
543 TestHelper.InMethod(); 543 TestHelpers.InMethod();
544 544
545 UUID id = UUID.Random(); 545 UUID id = UUID.Random();
546 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); 546 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>();
@@ -587,7 +587,7 @@ namespace OpenSim.Data.Tests
587 //[Test] 587 //[Test]
588 public void T016_RandomSogWithSceneParts() 588 public void T016_RandomSogWithSceneParts()
589 { 589 {
590 TestHelper.InMethod(); 590 TestHelpers.InMethod();
591 591
592 PropertyScrambler<SceneObjectPart> scrambler = 592 PropertyScrambler<SceneObjectPart> scrambler =
593 new PropertyScrambler<SceneObjectPart>() 593 new PropertyScrambler<SceneObjectPart>()
@@ -663,7 +663,7 @@ namespace OpenSim.Data.Tests
663 [Test] 663 [Test]
664 public void T020_PrimInventoryEmpty() 664 public void T020_PrimInventoryEmpty()
665 { 665 {
666 TestHelper.InMethod(); 666 TestHelpers.InMethod();
667 667
668 SceneObjectGroup sog = GetMySOG("object1"); 668 SceneObjectGroup sog = GetMySOG("object1");
669 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); 669 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
@@ -687,7 +687,7 @@ namespace OpenSim.Data.Tests
687 [Test] 687 [Test]
688 public void T021_PrimInventoryBasic() 688 public void T021_PrimInventoryBasic()
689 { 689 {
690 TestHelper.InMethod(); 690 TestHelpers.InMethod();
691 691
692 SceneObjectGroup sog = GetMySOG("object1"); 692 SceneObjectGroup sog = GetMySOG("object1");
693 InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); 693 InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero);
@@ -727,7 +727,7 @@ namespace OpenSim.Data.Tests
727 [Test] 727 [Test]
728 public void T025_PrimInventoryPersistency() 728 public void T025_PrimInventoryPersistency()
729 { 729 {
730 TestHelper.InMethod(); 730 TestHelpers.InMethod();
731 731
732 InventoryItemBase i = new InventoryItemBase(); 732 InventoryItemBase i = new InventoryItemBase();
733 UUID id = UUID.Random(); 733 UUID id = UUID.Random();
@@ -800,7 +800,7 @@ namespace OpenSim.Data.Tests
800 [ExpectedException(typeof(ArgumentException))] 800 [ExpectedException(typeof(ArgumentException))]
801 public void T026_PrimInventoryMany() 801 public void T026_PrimInventoryMany()
802 { 802 {
803 TestHelper.InMethod(); 803 TestHelpers.InMethod();
804 804
805 UUID i1,i2,i3,i4; 805 UUID i1,i2,i3,i4;
806 i1 = UUID.Random(); 806 i1 = UUID.Random();
@@ -832,7 +832,7 @@ namespace OpenSim.Data.Tests
832 [Test] 832 [Test]
833 public void T052_RemoveObject() 833 public void T052_RemoveObject()
834 { 834 {
835 TestHelper.InMethod(); 835 TestHelpers.InMethod();
836 836
837 db.RemoveObject(prim1, region1); 837 db.RemoveObject(prim1, region1);
838 SceneObjectGroup sog = FindSOG("object1", region1); 838 SceneObjectGroup sog = FindSOG("object1", region1);
@@ -842,7 +842,7 @@ namespace OpenSim.Data.Tests
842 [Test] 842 [Test]
843 public void T100_DefaultRegionInfo() 843 public void T100_DefaultRegionInfo()
844 { 844 {
845 TestHelper.InMethod(); 845 TestHelpers.InMethod();
846 846
847 RegionSettings r1 = db.LoadRegionSettings(region1); 847 RegionSettings r1 = db.LoadRegionSettings(region1);
848 Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); 848 Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))");
@@ -854,7 +854,7 @@ namespace OpenSim.Data.Tests
854 [Test] 854 [Test]
855 public void T101_UpdateRegionInfo() 855 public void T101_UpdateRegionInfo()
856 { 856 {
857 TestHelper.InMethod(); 857 TestHelpers.InMethod();
858 858
859 int agentlimit = random.Next(); 859 int agentlimit = random.Next();
860 double objectbonus = random.Next(); 860 double objectbonus = random.Next();
@@ -960,7 +960,7 @@ namespace OpenSim.Data.Tests
960 [Test] 960 [Test]
961 public void T300_NoTerrain() 961 public void T300_NoTerrain()
962 { 962 {
963 TestHelper.InMethod(); 963 TestHelpers.InMethod();
964 964
965 Assert.That(db.LoadTerrain(zero), Is.Null); 965 Assert.That(db.LoadTerrain(zero), Is.Null);
966 Assert.That(db.LoadTerrain(region1), Is.Null); 966 Assert.That(db.LoadTerrain(region1), Is.Null);
@@ -971,7 +971,7 @@ namespace OpenSim.Data.Tests
971 [Test] 971 [Test]
972 public void T301_CreateTerrain() 972 public void T301_CreateTerrain()
973 { 973 {
974 TestHelper.InMethod(); 974 TestHelpers.InMethod();
975 975
976 double[,] t1 = GenTerrain(height1); 976 double[,] t1 = GenTerrain(height1);
977 db.StoreTerrain(t1, region1); 977 db.StoreTerrain(t1, region1);
@@ -985,7 +985,7 @@ namespace OpenSim.Data.Tests
985 [Test] 985 [Test]
986 public void T302_FetchTerrain() 986 public void T302_FetchTerrain()
987 { 987 {
988 TestHelper.InMethod(); 988 TestHelpers.InMethod();
989 989
990 double[,] baseterrain1 = GenTerrain(height1); 990 double[,] baseterrain1 = GenTerrain(height1);
991 double[,] baseterrain2 = GenTerrain(height2); 991 double[,] baseterrain2 = GenTerrain(height2);
@@ -997,7 +997,7 @@ namespace OpenSim.Data.Tests
997 [Test] 997 [Test]
998 public void T303_UpdateTerrain() 998 public void T303_UpdateTerrain()
999 { 999 {
1000 TestHelper.InMethod(); 1000 TestHelpers.InMethod();
1001 1001
1002 double[,] baseterrain1 = GenTerrain(height1); 1002 double[,] baseterrain1 = GenTerrain(height1);
1003 double[,] baseterrain2 = GenTerrain(height2); 1003 double[,] baseterrain2 = GenTerrain(height2);
@@ -1011,7 +1011,7 @@ namespace OpenSim.Data.Tests
1011 [Test] 1011 [Test]
1012 public void T400_EmptyLand() 1012 public void T400_EmptyLand()
1013 { 1013 {
1014 TestHelper.InMethod(); 1014 TestHelpers.InMethod();
1015 1015
1016 Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); 1016 Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))");
1017 Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); 1017 Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))");
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 73b068d..ab4ed66 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -412,12 +412,20 @@ namespace OpenSim.Framework
412 } 412 }
413 413
414 /// <summary> 414 /// <summary>
415 /// Add an attachment, if the attachpoint has the 415 /// Add an attachment
416 /// </summary>
417 /// <remarks>
418 /// If the attachpoint has the
416 /// 0x80 bit set then we assume this is an append 419 /// 0x80 bit set then we assume this is an append
417 /// operation otherwise we replace whatever is 420 /// operation otherwise we replace whatever is
418 /// currently attached at the attachpoint 421 /// currently attached at the attachpoint
422 /// </remarks>
423 /// <param name="attachpoint"></param>
424 /// <param name="item">If UUID.Zero, then an any attachment at the attachpoint is removed.</param>
425 /// <param name="asset"></param>
426 /// <returns>
419 /// return true if something actually changed 427 /// return true if something actually changed
420 /// </summary> 428 /// </returns>
421 public bool SetAttachment(int attachpoint, UUID item, UUID asset) 429 public bool SetAttachment(int attachpoint, UUID item, UUID asset)
422 { 430 {
423 if (attachpoint == 0) 431 if (attachpoint == 0)
@@ -539,7 +547,7 @@ namespace OpenSim.Framework
539 /// </summary> 547 /// </summary>
540 public void Unpack(OSDMap data) 548 public void Unpack(OSDMap data)
541 { 549 {
542 if ((data != null) && (data["serial"] != null)) 550 if ((data != null) && (data["serial"] != null))
543 m_serial = data["serial"].AsInteger(); 551 m_serial = data["serial"].AsInteger();
544 if ((data != null) && (data["height"] != null)) 552 if ((data != null) && (data["height"] != null))
545 m_avatarHeight = (float)data["height"].AsReal(); 553 m_avatarHeight = (float)data["height"].AsReal();
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 481e1bb..a0d10ed 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -786,7 +786,7 @@ namespace OpenSim.Framework
786 event DeRezObject OnDeRezObject; 786 event DeRezObject OnDeRezObject;
787 event Action<IClientAPI> OnRegionHandShakeReply; 787 event Action<IClientAPI> OnRegionHandShakeReply;
788 event GenericCall1 OnRequestWearables; 788 event GenericCall1 OnRequestWearables;
789 event GenericCall1 OnCompleteMovementToRegion; 789 event Action<IClientAPI, bool> OnCompleteMovementToRegion;
790 event UpdateAgent OnPreAgentUpdate; 790 event UpdateAgent OnPreAgentUpdate;
791 event UpdateAgent OnAgentUpdate; 791 event UpdateAgent OnAgentUpdate;
792 event AgentRequestSit OnAgentRequestSit; 792 event AgentRequestSit OnAgentRequestSit;
@@ -935,7 +935,7 @@ namespace OpenSim.Framework
935 event ScriptReset OnScriptReset; 935 event ScriptReset OnScriptReset;
936 event GetScriptRunning OnGetScriptRunning; 936 event GetScriptRunning OnGetScriptRunning;
937 event SetScriptRunning OnSetScriptRunning; 937 event SetScriptRunning OnSetScriptRunning;
938 event Action<Vector3> OnAutoPilotGo; 938 event Action<Vector3, bool> OnAutoPilotGo;
939 939
940 event TerrainUnacked OnUnackedTerrain; 940 event TerrainUnacked OnUnackedTerrain;
941 event ActivateGesture OnActivateGesture; 941 event ActivateGesture OnActivateGesture;
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 1298f26..8f7a2e5 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -70,8 +70,20 @@ namespace OpenSim.Framework
70 70
71 event restart OnRestart; 71 event restart OnRestart;
72 72
73 void AddNewClient(IClientAPI client); 73 /// <summary>
74 void RemoveClient(UUID agentID); 74 /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing
75 /// will promote it to a root agent.
76 /// </summary>
77 /// <param name="client"></param>
78 /// <param name="type">The type of agent to add.</param>
79 void AddNewClient(IClientAPI client, PresenceType type);
80
81 /// <summary>
82 /// Remove the given client from the scene.
83 /// </summary>
84 /// <param name="agentID"></param>
85 /// <param name="closeChildAgents">Close the neighbour child agents associated with this client.</param>
86 void RemoveClient(UUID agentID, bool closeChildAgents);
75 87
76 void Restart(); 88 void Restart();
77 //RegionInfo OtherRegionUp(RegionInfo thisRegion); 89 //RegionInfo OtherRegionUp(RegionInfo thisRegion);
diff --git a/OpenSim/Framework/PresenceType.cs b/OpenSim/Framework/PresenceType.cs
new file mode 100644
index 0000000..8c4c6e6
--- /dev/null
+++ b/OpenSim/Framework/PresenceType.cs
@@ -0,0 +1,39 @@
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 */
27using System;
28
29namespace OpenSim.Framework
30{
31 /// <summary>
32 /// Indicate the type of ScenePresence.
33 /// </summary>
34 public enum PresenceType
35 {
36 User,
37 Npc
38 }
39} \ No newline at end of file
diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs
index 5eac411..c5a20e7 100644
--- a/OpenSim/Framework/Tests/UtilTest.cs
+++ b/OpenSim/Framework/Tests/UtilTest.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Framework.Tests
61 "Magnitude of vector was incorrect."); 61 "Magnitude of vector was incorrect.");
62 62
63 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; 63 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); };
64 bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); 64 bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
65 Assert.That(causesArgumentException, Is.True, 65 Assert.That(causesArgumentException, Is.True,
66 "Getting magnitude of null vector did not cause argument exception."); 66 "Getting magnitude of null vector did not cause argument exception.");
67 67
@@ -94,12 +94,12 @@ namespace OpenSim.Framework.Tests
94 "Magnitude of vector was incorrect."); 94 "Magnitude of vector was incorrect.");
95 95
96 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; 96 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); };
97 bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); 97 bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
98 Assert.That(causesArgumentException, Is.True, 98 Assert.That(causesArgumentException, Is.True,
99 "Getting magnitude of null vector did not cause argument exception."); 99 "Getting magnitude of null vector did not cause argument exception.");
100 100
101 d = delegate() { Util.GetNormalizedVector(v2); }; 101 d = delegate() { Util.GetNormalizedVector(v2); };
102 causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); 102 causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
103 Assert.That(causesArgumentException, Is.True, 103 Assert.That(causesArgumentException, Is.True,
104 "Getting magnitude of null vector did not cause argument exception."); 104 "Getting magnitude of null vector did not cause argument exception.");
105 } 105 }
@@ -122,7 +122,7 @@ namespace OpenSim.Framework.Tests
122 "Magnitude of vector was incorrect."); 122 "Magnitude of vector was incorrect.");
123 123
124 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; 124 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); };
125 bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); 125 bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
126 Assert.That(causesArgumentException, Is.True, 126 Assert.That(causesArgumentException, Is.True,
127 "Getting magnitude of null vector did not cause argument exception."); 127 "Getting magnitude of null vector did not cause argument exception.");
128 128
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 984a7a8..51ced7b 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -56,8 +56,13 @@ namespace OpenSim.Framework
56 /// <summary> 56 /// <summary>
57 /// The method used by Util.FireAndForget for asynchronously firing events 57 /// The method used by Util.FireAndForget for asynchronously firing events
58 /// </summary> 58 /// </summary>
59 /// <remarks>
60 /// None is used to execute the method in the same thread that made the call. It should only be used by regression
61 /// test code that relies on predictable event ordering.
62 /// </remarks>
59 public enum FireAndForgetMethod 63 public enum FireAndForgetMethod
60 { 64 {
65 None,
61 UnsafeQueueUserWorkItem, 66 UnsafeQueueUserWorkItem,
62 QueueUserWorkItem, 67 QueueUserWorkItem,
63 BeginInvoke, 68 BeginInvoke,
@@ -89,7 +94,8 @@ namespace OpenSim.Framework
89 public static readonly Regex UUIDPattern 94 public static readonly Regex UUIDPattern
90 = new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); 95 = new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");
91 96
92 public static FireAndForgetMethod FireAndForgetMethod = FireAndForgetMethod.SmartThreadPool; 97 public static FireAndForgetMethod DefaultFireAndForgetMethod = FireAndForgetMethod.SmartThreadPool;
98 public static FireAndForgetMethod FireAndForgetMethod = DefaultFireAndForgetMethod;
93 99
94 /// <summary> 100 /// <summary>
95 /// Gets the name of the directory where the current running executable 101 /// Gets the name of the directory where the current running executable
@@ -1506,6 +1512,9 @@ namespace OpenSim.Framework
1506 1512
1507 switch (FireAndForgetMethod) 1513 switch (FireAndForgetMethod)
1508 { 1514 {
1515 case FireAndForgetMethod.None:
1516 realCallback.Invoke(obj);
1517 break;
1509 case FireAndForgetMethod.UnsafeQueueUserWorkItem: 1518 case FireAndForgetMethod.UnsafeQueueUserWorkItem:
1510 ThreadPool.UnsafeQueueUserWorkItem(realCallback, obj); 1519 ThreadPool.UnsafeQueueUserWorkItem(realCallback, obj);
1511 break; 1520 break;
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 259d753..fe1525b 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -549,6 +549,7 @@ namespace OpenSim
549 { 549 {
550 string regionName = string.Empty; 550 string regionName = string.Empty;
551 string regionFile = string.Empty; 551 string regionFile = string.Empty;
552
552 if (cmd.Length == 3) 553 if (cmd.Length == 3)
553 { 554 {
554 regionFile = cmd[2]; 555 regionFile = cmd[2];
@@ -558,14 +559,17 @@ namespace OpenSim
558 regionName = cmd[2]; 559 regionName = cmd[2];
559 regionFile = cmd[3]; 560 regionFile = cmd[3];
560 } 561 }
562
561 string extension = Path.GetExtension(regionFile).ToLower(); 563 string extension = Path.GetExtension(regionFile).ToLower();
562 bool isXml = extension.Equals(".xml"); 564 bool isXml = extension.Equals(".xml");
563 bool isIni = extension.Equals(".ini"); 565 bool isIni = extension.Equals(".ini");
566
564 if (!isXml && !isIni) 567 if (!isXml && !isIni)
565 { 568 {
566 MainConsole.Instance.Output("Usage: create region [\"region name\"] <region_file.ini>"); 569 MainConsole.Instance.Output("Usage: create region [\"region name\"] <region_file.ini>");
567 return; 570 return;
568 } 571 }
572
569 if (!Path.IsPathRooted(regionFile)) 573 if (!Path.IsPathRooted(regionFile))
570 { 574 {
571 string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); 575 string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim();
@@ -582,8 +586,18 @@ namespace OpenSim
582 regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); 586 regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
583 } 587 }
584 588
585 IScene scene; 589 Scene existingScene;
590 if (SceneManager.TryGetScene(regInfo.RegionID, out existingScene))
591 {
592 MainConsole.Instance.OutputFormat(
593 "ERROR: Cannot create region {0} with ID {1}, this ID is already assigned to region {2}",
594 regInfo.RegionName, regInfo.RegionID, existingScene.RegionInfo.RegionName);
595
596 return;
597 }
598
586 PopulateRegionEstateInfo(regInfo); 599 PopulateRegionEstateInfo(regInfo);
600 IScene scene;
587 CreateRegion(regInfo, true, out scene); 601 CreateRegion(regInfo, true, out scene);
588 regInfo.EstateSettings.Save(); 602 regInfo.EstateSettings.Save();
589 } 603 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 8db4e67..ff889ea 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -232,7 +232,7 @@ namespace OpenSim.Region.ClientStack.Linden
232 public string SeedCapRequest(string request, string path, string param, 232 public string SeedCapRequest(string request, string path, string param,
233 OSHttpRequest httpRequest, OSHttpResponse httpResponse) 233 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
234 { 234 {
235 m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); 235// m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
236 236
237 if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) 237 if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
238 { 238 {
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index e0807ee..e7bd2e7 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -50,8 +50,8 @@ namespace OpenSim.Region.ClientStack.Linden
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class GetMeshModule : INonSharedRegionModule 51 public class GetMeshModule : INonSharedRegionModule
52 { 52 {
53 private static readonly ILog m_log = 53// private static readonly ILog m_log =
54 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 private Scene m_scene; 56 private Scene m_scene;
57 private IAssetService m_AssetService; 57 private IAssetService m_AssetService;
@@ -113,12 +113,12 @@ namespace OpenSim.Region.ClientStack.Linden
113 113
114 public void RegisterCaps(UUID agentID, Caps caps) 114 public void RegisterCaps(UUID agentID, Caps caps)
115 { 115 {
116 UUID capID = UUID.Random(); 116// UUID capID = UUID.Random();
117 117
118 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); 118 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
119 if (m_URL == "localhost") 119 if (m_URL == "localhost")
120 { 120 {
121 m_log.InfoFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); 121// m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
122 GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); 122 GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
123 IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), 123 IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(),
124 delegate(Hashtable m_dhttpMethod) 124 delegate(Hashtable m_dhttpMethod)
@@ -130,7 +130,7 @@ namespace OpenSim.Region.ClientStack.Linden
130 } 130 }
131 else 131 else
132 { 132 {
133 m_log.InfoFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); 133// m_log.DebugFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
134 caps.RegisterHandler("GetMesh", m_URL); 134 caps.RegisterHandler("GetMesh", m_URL);
135 } 135 }
136 } 136 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index 35eedb4..fffcee2 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -54,8 +54,9 @@ namespace OpenSim.Region.ClientStack.Linden
54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
55 public class GetTextureModule : INonSharedRegionModule 55 public class GetTextureModule : INonSharedRegionModule
56 { 56 {
57 private static readonly ILog m_log = 57// private static readonly ILog m_log =
58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59
59 private Scene m_scene; 60 private Scene m_scene;
60 private IAssetService m_assetService; 61 private IAssetService m_assetService;
61 62
@@ -128,12 +129,12 @@ namespace OpenSim.Region.ClientStack.Linden
128 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); 129 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
129 if (m_URL == "localhost") 130 if (m_URL == "localhost")
130 { 131 {
131 m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); 132// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
132 caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); 133 caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService));
133 } 134 }
134 else 135 else
135 { 136 {
136 m_log.InfoFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); 137// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
137 caps.RegisterHandler("GetTexture", m_URL); 138 caps.RegisterHandler("GetTexture", m_URL);
138 } 139 }
139 } 140 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 4a36b5d..f71871e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
90 public event ObjectAttach OnObjectAttach; 90 public event ObjectAttach OnObjectAttach;
91 public event ObjectDeselect OnObjectDetach; 91 public event ObjectDeselect OnObjectDetach;
92 public event ObjectDrop OnObjectDrop; 92 public event ObjectDrop OnObjectDrop;
93 public event GenericCall1 OnCompleteMovementToRegion; 93 public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
94 public event UpdateAgent OnPreAgentUpdate; 94 public event UpdateAgent OnPreAgentUpdate;
95 public event UpdateAgent OnAgentUpdate; 95 public event UpdateAgent OnAgentUpdate;
96 public event AgentRequestSit OnAgentRequestSit; 96 public event AgentRequestSit OnAgentRequestSit;
@@ -231,7 +231,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
231 public event ScriptReset OnScriptReset; 231 public event ScriptReset OnScriptReset;
232 public event GetScriptRunning OnGetScriptRunning; 232 public event GetScriptRunning OnGetScriptRunning;
233 public event SetScriptRunning OnSetScriptRunning; 233 public event SetScriptRunning OnSetScriptRunning;
234 public event Action<Vector3> OnAutoPilotGo; 234 public event Action<Vector3, bool> OnAutoPilotGo;
235 public event TerrainUnacked OnUnackedTerrain; 235 public event TerrainUnacked OnUnackedTerrain;
236 public event ActivateGesture OnActivateGesture; 236 public event ActivateGesture OnActivateGesture;
237 public event DeactivateGesture OnDeactivateGesture; 237 public event DeactivateGesture OnDeactivateGesture;
@@ -512,7 +512,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
512 m_udpServer.Flush(m_udpClient); 512 m_udpServer.Flush(m_udpClient);
513 513
514 // Remove ourselves from the scene 514 // Remove ourselves from the scene
515 m_scene.RemoveClient(AgentId); 515 m_scene.RemoveClient(AgentId, true);
516 516
517 // We can't reach into other scenes and close the connection 517 // We can't reach into other scenes and close the connection
518 // We need to do this over grid communications 518 // We need to do this over grid communications
@@ -692,7 +692,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
692 692
693 public virtual void Start() 693 public virtual void Start()
694 { 694 {
695 m_scene.AddNewClient(this); 695 m_scene.AddNewClient(this, PresenceType.User);
696 696
697 RefreshGroupMembership(); 697 RefreshGroupMembership();
698 } 698 }
@@ -6195,10 +6195,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6195 6195
6196 private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) 6196 private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack)
6197 { 6197 {
6198 GenericCall1 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; 6198 Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
6199 if (handlerCompleteMovementToRegion != null) 6199 if (handlerCompleteMovementToRegion != null)
6200 { 6200 {
6201 handlerCompleteMovementToRegion(sender); 6201 handlerCompleteMovementToRegion(sender, true);
6202 } 6202 }
6203 handlerCompleteMovementToRegion = null; 6203 handlerCompleteMovementToRegion = null;
6204 6204
@@ -11628,9 +11628,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11628 locy = Convert.ToSingle(args[1]) - (float)regionY; 11628 locy = Convert.ToSingle(args[1]) - (float)regionY;
11629 locz = Convert.ToSingle(args[2]); 11629 locz = Convert.ToSingle(args[2]);
11630 11630
11631 Action<Vector3> handlerAutoPilotGo = OnAutoPilotGo; 11631 Action<Vector3, bool> handlerAutoPilotGo = OnAutoPilotGo;
11632 if (handlerAutoPilotGo != null) 11632 if (handlerAutoPilotGo != null)
11633 handlerAutoPilotGo(new Vector3(locx, locy, locz)); 11633 handlerAutoPilotGo(new Vector3(locx, locy, locz), false);
11634 } 11634 }
11635 11635
11636 /// <summary> 11636 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index da39202..22c301b 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -357,8 +357,6 @@ namespace Flotsam.RegionModules.AssetCache
357 357
358 asset = (AssetBase)bformatter.Deserialize(stream); 358 asset = (AssetBase)bformatter.Deserialize(stream);
359 359
360 UpdateMemoryCache(id, asset);
361
362 m_DiskHits++; 360 m_DiskHits++;
363 } 361 }
364 catch (System.Runtime.Serialization.SerializationException e) 362 catch (System.Runtime.Serialization.SerializationException e)
@@ -419,9 +417,15 @@ namespace Flotsam.RegionModules.AssetCache
419 417
420 if (m_MemoryCacheEnabled) 418 if (m_MemoryCacheEnabled)
421 asset = GetFromMemoryCache(id); 419 asset = GetFromMemoryCache(id);
420
422 if (asset == null && m_FileCacheEnabled) 421 if (asset == null && m_FileCacheEnabled)
422 {
423 asset = GetFromFileCache(id); 423 asset = GetFromFileCache(id);
424 424
425 if (m_MemoryCacheEnabled && asset != null)
426 UpdateMemoryCache(id, asset);
427 }
428
425 if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0)) 429 if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0))
426 { 430 {
427 m_HitRateFile = (double)m_DiskHits / m_Requests * 100.0; 431 m_HitRateFile = (double)m_DiskHits / m_Requests * 100.0;
@@ -589,33 +593,59 @@ namespace Flotsam.RegionModules.AssetCache
589 593
590 try 594 try
591 { 595 {
592 if (!Directory.Exists(directory)) 596 try
593 { 597 {
594 Directory.CreateDirectory(directory); 598 if (!Directory.Exists(directory))
599 {
600 Directory.CreateDirectory(directory);
601 }
602
603 stream = File.Open(tempname, FileMode.Create);
604 BinaryFormatter bformatter = new BinaryFormatter();
605 bformatter.Serialize(stream, asset);
595 } 606 }
607 catch (IOException e)
608 {
609 m_log.ErrorFormat(
610 "[FLOTSAM ASSET CACHE]: Failed to write asset {0} to temporary location {1} (final {2}) on cache in {3}. Exception {4} {5}.",
611 asset.ID, tempname, filename, directory, e.Message, e.StackTrace);
596 612
597 stream = File.Open(tempname, FileMode.Create); 613 return;
598 BinaryFormatter bformatter = new BinaryFormatter(); 614 }
599 bformatter.Serialize(stream, asset); 615 finally
600 stream.Close(); 616 {
601 617 if (stream != null)
602 // Now that it's written, rename it so that it can be found. 618 stream.Close();
603 File.Move(tempname, filename); 619 }
604 620
605 if (m_LogLevel >= 2) 621 try
606 m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID); 622 {
607 } 623 // Now that it's written, rename it so that it can be found.
608 catch (Exception e) 624 //
609 { 625 // File.Copy(tempname, filename, true);
610 m_log.ErrorFormat( 626 // File.Delete(tempname);
611 "[FLOTSAM ASSET CACHE]: Failed to write asset {0} to cache. Directory {1}, tempname {2}, filename {3}. Exception {4} {5}.", 627 //
612 asset.ID, directory, tempname, filename, e.Message, e.StackTrace); 628 // For a brief period, this was done as a separate copy and then temporary file delete operation to
629 // avoid an IOException caused by move if some competing thread had already written the file.
630 // However, this causes exceptions on Windows when other threads attempt to read a file
631 // which is still being copied. So instead, go back to moving the file and swallow any IOException.
632 //
633 // This situation occurs fairly rarely anyway. We assume in this that moves are atomic on the
634 // filesystem.
635 File.Move(tempname, filename);
636
637 if (m_LogLevel >= 2)
638 m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID);
639 }
640 catch (IOException)
641 {
642 // If we see an IOException here it's likely that some other competing thread has written the
643 // cache file first, so ignore. Other IOException errors (e.g. filesystem full) should be
644 // signally by the earlier temporary file writing code.
645 }
613 } 646 }
614 finally 647 finally
615 { 648 {
616 if (stream != null)
617 stream.Close();
618
619 // Even if the write fails with an exception, we need to make sure 649 // Even if the write fails with an exception, we need to make sure
620 // that we release the lock on that file, otherwise it'll never get 650 // that we release the lock on that file, otherwise it'll never get
621 // cached 651 // cached
@@ -629,13 +659,9 @@ namespace Flotsam.RegionModules.AssetCache
629 waitEvent.Set(); 659 waitEvent.Set();
630 } 660 }
631#else 661#else
632 if (m_CurrentlyWriting.Contains(filename)) 662 m_CurrentlyWriting.Remove(filename);
633 {
634 m_CurrentlyWriting.Remove(filename);
635 }
636#endif 663#endif
637 } 664 }
638
639 } 665 }
640 } 666 }
641 667
diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs
index 63b0c31..2ff1920 100644
--- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs
+++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs
@@ -65,18 +65,18 @@ namespace OpenSim.Region.CoreModules.Asset.Tests
65 config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true"); 65 config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true");
66 66
67 m_cache = new FlotsamAssetCache(); 67 m_cache = new FlotsamAssetCache();
68 m_scene = SceneSetupHelpers.SetupScene(); 68 m_scene = SceneHelpers.SetupScene();
69 SceneSetupHelpers.SetupSceneModules(m_scene, config, m_cache); 69 SceneHelpers.SetupSceneModules(m_scene, config, m_cache);
70 } 70 }
71 71
72 [Test] 72 [Test]
73 public void TestCacheAsset() 73 public void TestCacheAsset()
74 { 74 {
75 TestHelper.InMethod(); 75 TestHelpers.InMethod();
76// log4net.Config.XmlConfigurator.Configure(); 76// log4net.Config.XmlConfigurator.Configure();
77 77
78 AssetBase asset = AssetHelpers.CreateAsset(); 78 AssetBase asset = AssetHelpers.CreateAsset();
79 asset.ID = TestHelper.ParseTail(0x1).ToString(); 79 asset.ID = TestHelpers.ParseTail(0x1).ToString();
80 80
81 // Check we don't get anything before the asset is put in the cache 81 // Check we don't get anything before the asset is put in the cache
82 AssetBase retrievedAsset = m_cache.Get(asset.ID.ToString()); 82 AssetBase retrievedAsset = m_cache.Get(asset.ID.ToString());
@@ -93,11 +93,11 @@ namespace OpenSim.Region.CoreModules.Asset.Tests
93 [Test] 93 [Test]
94 public void TestExpireAsset() 94 public void TestExpireAsset()
95 { 95 {
96 TestHelper.InMethod(); 96 TestHelpers.InMethod();
97// log4net.Config.XmlConfigurator.Configure(); 97// log4net.Config.XmlConfigurator.Configure();
98 98
99 AssetBase asset = AssetHelpers.CreateAsset(); 99 AssetBase asset = AssetHelpers.CreateAsset();
100 asset.ID = TestHelper.ParseTail(0x2).ToString(); 100 asset.ID = TestHelpers.ParseTail(0x2).ToString();
101 101
102 m_cache.Store(asset); 102 m_cache.Store(asset);
103 103
@@ -110,11 +110,11 @@ namespace OpenSim.Region.CoreModules.Asset.Tests
110 [Test] 110 [Test]
111 public void TestClearCache() 111 public void TestClearCache()
112 { 112 {
113 TestHelper.InMethod(); 113 TestHelpers.InMethod();
114// log4net.Config.XmlConfigurator.Configure(); 114// log4net.Config.XmlConfigurator.Configure();
115 115
116 AssetBase asset = AssetHelpers.CreateAsset(); 116 AssetBase asset = AssetHelpers.CreateAsset();
117 asset.ID = TestHelper.ParseTail(0x2).ToString(); 117 asset.ID = TestHelpers.ParseTail(0x2).ToString();
118 118
119 m_cache.Store(asset); 119 m_cache.Store(asset);
120 120
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 1e09610..97a1be6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -101,7 +101,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
101 /// <param name="silent"></param> 101 /// <param name="silent"></param>
102 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) 102 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
103 { 103 {
104 m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); 104// m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject");
105 105
106 try 106 try
107 { 107 {
@@ -226,9 +226,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
226 public UUID RezSingleAttachmentFromInventory( 226 public UUID RezSingleAttachmentFromInventory(
227 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) 227 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
228 { 228 {
229 m_log.DebugFormat( 229// m_log.DebugFormat(
230 "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", 230// "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}",
231 (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); 231// (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name);
232 232
233 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should 233 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
234 // be removed when that functionality is implemented in opensim 234 // be removed when that functionality is implemented in opensim
@@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
261 false, false, remoteClient.AgentId, true); 261 false, false, remoteClient.AgentId, true);
262 262
263// m_log.DebugFormat( 263// m_log.DebugFormat(
264// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", 264// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
265// objatt.Name, remoteClient.Name, AttachmentPt); 265// objatt.Name, remoteClient.Name, AttachmentPt);
266 266
267 if (objatt != null) 267 if (objatt != null)
@@ -466,7 +466,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
466 { 466 {
467 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); 467 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
468 group.DetachToInventoryPrep(); 468 group.DetachToInventoryPrep();
469 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); 469// m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
470 470
471 // If an item contains scripts, it's always changed. 471 // If an item contains scripts, it's always changed.
472 // This ensures script state is saved on detach 472 // This ensures script state is saved on detach
@@ -501,10 +501,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
501 /// <summary> 501 /// <summary>
502 /// Update the attachment asset for the new sog details if they have changed. 502 /// Update the attachment asset for the new sog details if they have changed.
503 /// </summary> 503 /// </summary>
504 /// 504 /// <remarks>
505 /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects, 505 /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects,
506 /// these details are not stored on the region. 506 /// these details are not stored on the region.
507 /// 507 /// </remarks>
508 /// <param name="remoteClient"></param> 508 /// <param name="remoteClient"></param>
509 /// <param name="grp"></param> 509 /// <param name="grp"></param>
510 /// <param name="itemID"></param> 510 /// <param name="itemID"></param>
@@ -566,8 +566,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
566 /// <param name="silent"></param> 566 /// <param name="silent"></param>
567 protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) 567 protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
568 { 568 {
569 m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name, 569// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}",
570 attachmentpoint, attachOffset, so.RootPart.AttachedPos); 570// so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos);
571 571
572 so.DetachFromBackup(); 572 so.DetachFromBackup();
573 573
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 5586c65..5bac4c6 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -37,104 +37,132 @@ using NUnit.Framework;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.CoreModules.Avatar.Attachments;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.CoreModules.Framework.InventoryAccess;
42using OpenSim.Region.CoreModules.World.Serialiser; 42using OpenSim.Region.CoreModules.World.Serialiser;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock; 47using OpenSim.Tests.Common.Mock;
46 48
47namespace OpenSim.Region.Framework.Scenes.Tests 49namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
48{ 50{
49 /// <summary> 51 /// <summary>
50 /// Attachment tests 52 /// Attachment tests
51 /// </summary> 53 /// </summary>
52 [TestFixture] 54 [TestFixture]
53 public class AttachmentTests 55 public class AttachmentsModuleTests
54 { 56 {
55 public Scene scene, scene2; 57 public Scene scene;
56 public UUID agent1; 58 public UUID agent1;
57 public static Random random; 59 public static Random random;
58 public ulong region1, region2;
59 public AgentCircuitData acd1; 60 public AgentCircuitData acd1;
60 public SceneObjectGroup sog1, sog2, sog3; 61 public SceneObjectGroup sog1, sog2;
61 62
62 [TestFixtureSetUp] 63 [SetUp]
63 public void Init() 64 public void Init()
64 { 65 {
65 TestHelper.InMethod(); 66 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
66 67 Util.FireAndForgetMethod = FireAndForgetMethod.None;
67 scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); 68
68 scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); 69 IConfigSource config = new IniConfigSource();
70 config.AddConfig("Modules");
71 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
69 72
70 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); 73 scene = SceneHelpers.SetupScene();
71 interregionComms.Initialise(new IniConfigSource()); 74 SceneHelpers.SetupSceneModules(scene, config, new AttachmentsModule(), new BasicInventoryAccessModule());
72 interregionComms.PostInitialise();
73 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
74 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
75 75
76 agent1 = UUID.Random(); 76 agent1 = UUID.Random();
77 random = new Random(); 77 random = new Random();
78 sog1 = NewSOG(UUID.Random(), scene, agent1); 78 sog1 = NewSOG(UUID.Random(), scene, agent1);
79 sog2 = NewSOG(UUID.Random(), scene, agent1); 79 sog2 = NewSOG(UUID.Random(), scene, agent1);
80 sog3 = NewSOG(UUID.Random(), scene, agent1); 80 }
81 81
82 //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); 82 [TearDown]
83 region1 = scene.RegionInfo.RegionHandle; 83 public void TearDown()
84 region2 = scene2.RegionInfo.RegionHandle; 84 {
85 85 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
86 SceneSetupHelpers.AddClient(scene, agent1); 86 // threads. Possibly, later tests should be rewritten not to worry about such things.
87 } 87 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
88 }
88 89
89 [Test] 90 [Test]
90 public void T030_TestAddAttachments() 91 public void TestAddAttachments()
91 { 92 {
92 TestHelper.InMethod(); 93 TestHelpers.InMethod();
93
94 ScenePresence presence = scene.GetScenePresence(agent1);
95 94
95 ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1);
96 presence.AddAttachment(sog1); 96 presence.AddAttachment(sog1);
97 presence.AddAttachment(sog2); 97 presence.AddAttachment(sog2);
98 presence.AddAttachment(sog3);
99 98
100 Assert.That(presence.HasAttachments(), Is.True); 99 Assert.That(presence.HasAttachments(), Is.True);
101 Assert.That(presence.ValidateAttachments(), Is.True); 100 Assert.That(presence.ValidateAttachments(), Is.True);
102 } 101 }
103 102
104 [Test] 103 [Test]
105 public void T031_RemoveAttachments() 104 public void TestRemoveAttachments()
106 { 105 {
107 TestHelper.InMethod(); 106 TestHelpers.InMethod();
108 107
109 ScenePresence presence = scene.GetScenePresence(agent1); 108 ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1);
109 presence.AddAttachment(sog1);
110 presence.AddAttachment(sog2);
110 presence.RemoveAttachment(sog1); 111 presence.RemoveAttachment(sog1);
111 presence.RemoveAttachment(sog2); 112 presence.RemoveAttachment(sog2);
112 presence.RemoveAttachment(sog3);
113 Assert.That(presence.HasAttachments(), Is.False); 113 Assert.That(presence.HasAttachments(), Is.False);
114 } 114 }
115 115
116 // I'm commenting this test because scene setup NEEDS InventoryService to 116 [Test]
117 // be non-null 117 public void TestRezAttachmentsOnAvatarEntrance()
118 //[Test]
119 public void T032_CrossAttachments()
120 { 118 {
121 TestHelper.InMethod(); 119 TestHelpers.InMethod();
120// log4net.Config.XmlConfigurator.Configure();
121
122 UUID userId = TestHelpers.ParseTail(0x1);
123 UUID attItemId = TestHelpers.ParseTail(0x2);
124 UUID attAssetId = TestHelpers.ParseTail(0x3);
125 string attName = "att";
122 126
123 ScenePresence presence = scene.GetScenePresence(agent1); 127 UserAccountHelpers.CreateUserWithInventory(scene, userId);
124 ScenePresence presence2 = scene2.GetScenePresence(agent1); 128 InventoryItemBase attItem
125 presence2.AddAttachment(sog1); 129 = UserInventoryHelpers.CreateInventoryItem(
126 presence2.AddAttachment(sog2); 130 scene, attName, attItemId, attAssetId, userId, InventoryType.Object);
127 131
128 ISharedRegionModule serialiser = new SerialiserModule(); 132 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
129 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); 133 acd.Appearance = new AvatarAppearance();
130 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); 134 acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
135 ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
131 136
132 Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); 137 Assert.That(presence.HasAttachments(), Is.True);
138 List<SceneObjectGroup> attachments = presence.Attachments;
139
140 Assert.That(attachments.Count, Is.EqualTo(1));
141 Assert.That(attachments[0].Name, Is.EqualTo(attName));
142 }
133 143
134 //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); 144 // I'm commenting this test because scene setup NEEDS InventoryService to
135 Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); 145 // be non-null
136 Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); 146 //[Test]
137 } 147// public void T032_CrossAttachments()
148// {
149// TestHelpers.InMethod();
150//
151// ScenePresence presence = scene.GetScenePresence(agent1);
152// ScenePresence presence2 = scene2.GetScenePresence(agent1);
153// presence2.AddAttachment(sog1);
154// presence2.AddAttachment(sog2);
155//
156// ISharedRegionModule serialiser = new SerialiserModule();
157// SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
158// SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);
159//
160// Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
161//
162// //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
163// Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
164// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
165// }
138 166
139 private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) 167 private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent)
140 { 168 {
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index e3e3452..4627701 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
104 public void NewClient(IClientAPI client) 104 public void NewClient(IClientAPI client)
105 { 105 {
106 client.OnRequestWearables += SendWearables; 106 client.OnRequestWearables += SendWearables;
107 client.OnSetAppearance += SetAppearance; 107 client.OnSetAppearance += SetAppearanceFromClient;
108 client.OnAvatarNowWearing += AvatarIsWearing; 108 client.OnAvatarNowWearing += AvatarIsWearing;
109 } 109 }
110 110
@@ -189,7 +189,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
189 /// <param name="client"></param> 189 /// <param name="client"></param>
190 /// <param name="texture"></param> 190 /// <param name="texture"></param>
191 /// <param name="visualParam"></param> 191 /// <param name="visualParam"></param>
192 public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) 192 public void SetAppearanceFromClient(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams)
193 { 193 {
194 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 194 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
195 if (sp == null) 195 if (sp == null)
@@ -257,6 +257,85 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
257 return true; 257 return true;
258 } 258 }
259 259
260 public bool SaveBakedTextures(UUID agentId)
261 {
262 ScenePresence sp = m_scene.GetScenePresence(agentId);
263
264 if (sp == null || sp.IsChildAgent)
265 return false;
266
267 AvatarAppearance appearance = sp.Appearance;
268 Primitive.TextureEntryFace[] faceTextures = appearance.Texture.FaceTextures;
269
270 m_log.DebugFormat(
271 "[AV FACTORY]: Permanently saving baked textures for {0} in {1}",
272 sp.Name, m_scene.RegionInfo.RegionName);
273
274 foreach (int i in Enum.GetValues(typeof(BakeType)))
275 {
276 BakeType bakeType = (BakeType)i;
277
278 if (bakeType == BakeType.Unknown)
279 continue;
280
281// m_log.DebugFormat(
282// "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}",
283// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
284
285 int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType);
286 Primitive.TextureEntryFace bakedTextureFace = faceTextures[ftIndex];
287
288 if (bakedTextureFace == null)
289 {
290 m_log.WarnFormat(
291 "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently",
292 bakeType, sp.Name, m_scene.RegionInfo.RegionName);
293
294 continue;
295 }
296
297 AssetBase asset = m_scene.AssetService.Get(bakedTextureFace.TextureID.ToString());
298
299 if (asset != null)
300 {
301 asset.Temporary = false;
302 m_scene.AssetService.Store(asset);
303 }
304 else
305 {
306 m_log.WarnFormat(
307 "[AV FACTORY]: Baked texture id {0} not found for bake {1} for avatar {2} in {3} when trying to save permanently",
308 bakedTextureFace.TextureID, bakeType, sp.Name, m_scene.RegionInfo.RegionName);
309 }
310 }
311
312// for (int i = 0; i < faceTextures.Length; i++)
313// {
314//// m_log.DebugFormat(
315//// "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}",
316//// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
317//
318// if (faceTextures[i] == null)
319// continue;
320//
321// AssetBase asset = m_scene.AssetService.Get(faceTextures[i].TextureID.ToString());
322//
323// if (asset != null)
324// {
325// asset.Temporary = false;
326// m_scene.AssetService.Store(asset);
327// }
328// else
329// {
330// m_log.WarnFormat(
331// "[AV FACTORY]: Baked texture {0} for {1} in {2} not found when trying to save permanently",
332// faceTextures[i].TextureID, sp.Name, m_scene.RegionInfo.RegionName);
333// }
334// }
335
336 return true;
337 }
338
260 #region UpdateAppearanceTimer 339 #region UpdateAppearanceTimer
261 340
262 /// <summary> 341 /// <summary>
@@ -289,25 +368,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
289 } 368 }
290 } 369 }
291 370
292 private void HandleAppearanceSend(UUID agentid) 371 private void SaveAppearance(UUID agentid)
293 {
294 ScenePresence sp = m_scene.GetScenePresence(agentid);
295 if (sp == null)
296 {
297 m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid);
298 return;
299 }
300
301 // m_log.WarnFormat("[AVFACTORY]: Handle appearance send for {0}", agentid);
302
303 // Send the appearance to everyone in the scene
304 sp.SendAppearanceToAllOtherAgents();
305
306 // Send animations back to the avatar as well
307 sp.Animator.SendAnimPack();
308 }
309
310 private void HandleAppearanceSave(UUID agentid)
311 { 372 {
312 // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved 373 // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved
313 // in a culture where decimal points are commas and then reloaded in a culture which just treats them as 374 // in a culture where decimal points are commas and then reloaded in a culture which just treats them as
@@ -337,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
337 { 398 {
338 if (kvp.Value < now) 399 if (kvp.Value < now)
339 { 400 {
340 Util.FireAndForget(delegate(object o) { HandleAppearanceSend(kvp.Key); }); 401 Util.FireAndForget(delegate(object o) { SendAppearance(kvp.Key); });
341 m_sendqueue.Remove(kvp.Key); 402 m_sendqueue.Remove(kvp.Key);
342 } 403 }
343 } 404 }
@@ -350,7 +411,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
350 { 411 {
351 if (kvp.Value < now) 412 if (kvp.Value < now)
352 { 413 {
353 Util.FireAndForget(delegate(object o) { HandleAppearanceSave(kvp.Key); }); 414 Util.FireAndForget(delegate(object o) { SaveAppearance(kvp.Key); });
354 m_savequeue.Remove(kvp.Key); 415 m_savequeue.Remove(kvp.Key);
355 } 416 }
356 } 417 }
@@ -427,6 +488,24 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
427 } 488 }
428 } 489 }
429 490
491 public bool SendAppearance(UUID agentId)
492 {
493 ScenePresence sp = m_scene.GetScenePresence(agentId);
494 if (sp == null)
495 {
496 m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId);
497 return false;
498 }
499
500 // Send the appearance to everyone in the scene
501 sp.SendAppearanceToAllOtherAgents();
502
503 // Send animations back to the avatar as well
504 sp.Animator.SendAnimPack();
505
506 return true;
507 }
508
430 private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) 509 private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)
431 { 510 {
432 IInventoryService invService = m_scene.InventoryService; 511 IInventoryService invService = m_scene.InventoryService;
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
index 07de908..b831b31 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
@@ -44,21 +44,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
44 [Test] 44 [Test]
45 public void TestSetAppearance() 45 public void TestSetAppearance()
46 { 46 {
47 TestHelper.InMethod(); 47 TestHelpers.InMethod();
48// log4net.Config.XmlConfigurator.Configure(); 48// log4net.Config.XmlConfigurator.Configure();
49 49
50 UUID userId = TestHelper.ParseTail(0x1); 50 UUID userId = TestHelpers.ParseTail(0x1);
51 51
52 AvatarFactoryModule afm = new AvatarFactoryModule(); 52 AvatarFactoryModule afm = new AvatarFactoryModule();
53 TestScene scene = SceneSetupHelpers.SetupScene(); 53 TestScene scene = SceneHelpers.SetupScene();
54 SceneSetupHelpers.SetupSceneModules(scene, afm); 54 SceneHelpers.SetupSceneModules(scene, afm);
55 TestClient tc = SceneSetupHelpers.AddClient(scene, userId); 55 IClientAPI tc = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
56 56
57 byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT]; 57 byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT];
58 for (byte i = 0; i < visualParams.Length; i++) 58 for (byte i = 0; i < visualParams.Length; i++)
59 visualParams[i] = i; 59 visualParams[i] = i;
60 60
61 afm.SetAppearance(tc, new Primitive.TextureEntry(TestHelper.ParseTail(0x10)), visualParams); 61 afm.SetAppearanceFromClient(tc, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams);
62 62
63 ScenePresence sp = scene.GetScenePresence(userId); 63 ScenePresence sp = scene.GetScenePresence(userId);
64 64
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
index aadeedb..19ef571 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
@@ -100,8 +100,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
100// log4net.Config.XmlConfigurator.Configure(); 100// log4net.Config.XmlConfigurator.Configure();
101 101
102 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 102 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
103 Scene scene = SceneSetupHelpers.SetupScene(); 103 Scene scene = SceneHelpers.SetupScene();
104 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 104 SceneHelpers.SetupSceneModules(scene, archiverModule);
105 105
106 UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); 106 UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
107 107
@@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
109 109
110 // Create scene object asset 110 // Create scene object asset
111 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); 111 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
112 SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); 112 SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50);
113 113
114 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 114 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
115 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); 115 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
@@ -127,10 +127,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
127 scene.AddInventoryItem(item1); 127 scene.AddInventoryItem(item1);
128 128
129 // Create coalesced objects asset 129 // Create coalesced objects asset
130 SceneObjectGroup cobj1 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120); 130 SceneObjectGroup cobj1 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120);
131 cobj1.AbsolutePosition = new Vector3(15, 30, 45); 131 cobj1.AbsolutePosition = new Vector3(15, 30, 45);
132 132
133 SceneObjectGroup cobj2 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140); 133 SceneObjectGroup cobj2 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140);
134 cobj2.AbsolutePosition = new Vector3(25, 50, 75); 134 cobj2.AbsolutePosition = new Vector3(25, 50, 75);
135 135
136 CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2); 136 CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index ae3ab21..e409c8e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -61,14 +61,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
61 SerialiserModule serialiserModule = new SerialiserModule(); 61 SerialiserModule serialiserModule = new SerialiserModule();
62 m_archiverModule = new InventoryArchiverModule(); 62 m_archiverModule = new InventoryArchiverModule();
63 63
64 m_scene = SceneSetupHelpers.SetupScene(); 64 m_scene = SceneHelpers.SetupScene();
65 SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); 65 SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
66 } 66 }
67 67
68 [Test] 68 [Test]
69 public void TestLoadCoalesecedItem() 69 public void TestLoadCoalesecedItem()
70 { 70 {
71 TestHelper.InMethod(); 71 TestHelpers.InMethod();
72// log4net.Config.XmlConfigurator.Configure(); 72// log4net.Config.XmlConfigurator.Configure();
73 73
74 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); 74 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password");
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
104 [Test] 104 [Test]
105 public void TestOrder() 105 public void TestOrder()
106 { 106 {
107 TestHelper.InMethod(); 107 TestHelpers.InMethod();
108// log4net.Config.XmlConfigurator.Configure(); 108// log4net.Config.XmlConfigurator.Configure();
109 109
110 MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes); 110 MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes);
@@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
129 [Test] 129 [Test]
130 public void TestSaveItemToIar() 130 public void TestSaveItemToIar()
131 { 131 {
132 TestHelper.InMethod(); 132 TestHelpers.InMethod();
133// log4net.Config.XmlConfigurator.Configure(); 133// log4net.Config.XmlConfigurator.Configure();
134 134
135 // Create user 135 // Create user
@@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
141 141
142 // Create asset 142 // Create asset
143 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); 143 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
144 SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); 144 SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50);
145 145
146 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 146 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
147 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); 147 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
@@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
224 [Test] 224 [Test]
225 public void TestSaveItemToIarNoAssets() 225 public void TestSaveItemToIarNoAssets()
226 { 226 {
227 TestHelper.InMethod(); 227 TestHelpers.InMethod();
228// log4net.Config.XmlConfigurator.Configure(); 228// log4net.Config.XmlConfigurator.Configure();
229 229
230 // Create user 230 // Create user
@@ -236,7 +236,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
236 236
237 // Create asset 237 // Create asset
238 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); 238 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
239 SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); 239 SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50);
240 240
241 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 241 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
242 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); 242 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
@@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
325 [Test] 325 [Test]
326 public void TestLoadIarCreatorAccountPresent() 326 public void TestLoadIarCreatorAccountPresent()
327 { 327 {
328 TestHelper.InMethod(); 328 TestHelpers.InMethod();
329// log4net.Config.XmlConfigurator.Configure(); 329// log4net.Config.XmlConfigurator.Configure();
330 330
331 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); 331 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood");
@@ -357,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
357 [Test] 357 [Test]
358 public void TestLoadIarV0_1SameNameCreator() 358 public void TestLoadIarV0_1SameNameCreator()
359 { 359 {
360 TestHelper.InMethod(); 360 TestHelpers.InMethod();
361// log4net.Config.XmlConfigurator.Configure(); 361// log4net.Config.XmlConfigurator.Configure();
362 362
363 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); 363 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
@@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
390 [Test] 390 [Test]
391 public void TestLoadIarV0_1AbsentCreator() 391 public void TestLoadIarV0_1AbsentCreator()
392 { 392 {
393 TestHelper.InMethod(); 393 TestHelpers.InMethod();
394// log4net.Config.XmlConfigurator.Configure(); 394// log4net.Config.XmlConfigurator.Configure();
395 395
396 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); 396 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password");
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs
index 127d5f8..417c20c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs
@@ -57,13 +57,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
57 [Test] 57 [Test]
58 public void TestSavePathToIarV0_1() 58 public void TestSavePathToIarV0_1()
59 { 59 {
60 TestHelper.InMethod(); 60 TestHelpers.InMethod();
61// log4net.Config.XmlConfigurator.Configure(); 61// log4net.Config.XmlConfigurator.Configure();
62 62
63 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 63 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
64 64
65 Scene scene = SceneSetupHelpers.SetupScene(); 65 Scene scene = SceneHelpers.SetupScene();
66 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 66 SceneHelpers.SetupSceneModules(scene, archiverModule);
67 67
68 // Create user 68 // Create user
69 string userFirstName = "Jock"; 69 string userFirstName = "Jock";
@@ -172,16 +172,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
172 [Test] 172 [Test]
173 public void TestLoadIarToInventoryPaths() 173 public void TestLoadIarToInventoryPaths()
174 { 174 {
175 TestHelper.InMethod(); 175 TestHelpers.InMethod();
176// log4net.Config.XmlConfigurator.Configure(); 176// log4net.Config.XmlConfigurator.Configure();
177 177
178 SerialiserModule serialiserModule = new SerialiserModule(); 178 SerialiserModule serialiserModule = new SerialiserModule();
179 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 179 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
180 180
181 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene 181 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
182 Scene scene = SceneSetupHelpers.SetupScene(); 182 Scene scene = SceneHelpers.SetupScene();
183 183
184 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 184 SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
185 185
186 UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood"); 186 UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood");
187 UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); 187 UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
@@ -217,13 +217,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
217 [Test] 217 [Test]
218 public void TestLoadIarPathStartsWithSlash() 218 public void TestLoadIarPathStartsWithSlash()
219 { 219 {
220 TestHelper.InMethod(); 220 TestHelpers.InMethod();
221// log4net.Config.XmlConfigurator.Configure(); 221// log4net.Config.XmlConfigurator.Configure();
222 222
223 SerialiserModule serialiserModule = new SerialiserModule(); 223 SerialiserModule serialiserModule = new SerialiserModule();
224 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 224 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
225 Scene scene = SceneSetupHelpers.SetupScene(); 225 Scene scene = SceneHelpers.SetupScene();
226 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 226 SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
227 227
228 UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); 228 UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password");
229 archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); 229 archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream);
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
238 [Test] 238 [Test]
239 public void TestLoadIarPathWithEscapedChars() 239 public void TestLoadIarPathWithEscapedChars()
240 { 240 {
241 TestHelper.InMethod(); 241 TestHelpers.InMethod();
242// log4net.Config.XmlConfigurator.Configure(); 242// log4net.Config.XmlConfigurator.Configure();
243 243
244 string itemName = "You & you are a mean/man/"; 244 string itemName = "You & you are a mean/man/";
@@ -247,8 +247,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
247 247
248 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 248 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
249 249
250 Scene scene = SceneSetupHelpers.SetupScene(); 250 Scene scene = SceneHelpers.SetupScene();
251 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 251 SceneHelpers.SetupSceneModules(scene, archiverModule);
252 252
253 // Create user 253 // Create user
254 string userFirstName = "Jock"; 254 string userFirstName = "Jock";
@@ -323,10 +323,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
323 [Test] 323 [Test]
324 public void TestNewIarPath() 324 public void TestNewIarPath()
325 { 325 {
326 TestHelper.InMethod(); 326 TestHelpers.InMethod();
327// log4net.Config.XmlConfigurator.Configure(); 327// log4net.Config.XmlConfigurator.Configure();
328 328
329 Scene scene = SceneSetupHelpers.SetupScene(); 329 Scene scene = SceneHelpers.SetupScene();
330 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); 330 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
331 331
332 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); 332 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
@@ -390,10 +390,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
390 [Test] 390 [Test]
391 public void TestPartExistingIarPath() 391 public void TestPartExistingIarPath()
392 { 392 {
393 TestHelper.InMethod(); 393 TestHelpers.InMethod();
394 //log4net.Config.XmlConfigurator.Configure(); 394 //log4net.Config.XmlConfigurator.Configure();
395 395
396 Scene scene = SceneSetupHelpers.SetupScene(); 396 Scene scene = SceneHelpers.SetupScene();
397 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); 397 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
398 398
399 string folder1ExistingName = "a"; 399 string folder1ExistingName = "a";
@@ -441,10 +441,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
441 [Test] 441 [Test]
442 public void TestMergeIarPath() 442 public void TestMergeIarPath()
443 { 443 {
444 TestHelper.InMethod(); 444 TestHelpers.InMethod();
445// log4net.Config.XmlConfigurator.Configure(); 445// log4net.Config.XmlConfigurator.Configure();
446 446
447 Scene scene = SceneSetupHelpers.SetupScene(); 447 Scene scene = SceneHelpers.SetupScene();
448 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); 448 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
449 449
450 string folder1ExistingName = "a"; 450 string folder1ExistingName = "a";
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 457ee33..f5d49c5 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1065,10 +1065,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1065 #endregion 1065 #endregion
1066 1066
1067 #region Enable Child Agent 1067 #region Enable Child Agent
1068
1068 /// <summary> 1069 /// <summary>
1069 /// This informs a single neighbouring region about agent "avatar". 1070 /// This informs a single neighbouring region about agent "avatar".
1070 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 1071 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
1071 /// </summary> 1072 /// </summary>
1073 /// <param name="sp"></param>
1074 /// <param name="region"></param>
1072 public void EnableChildAgent(ScenePresence sp, GridRegion region) 1075 public void EnableChildAgent(ScenePresence sp, GridRegion region)
1073 { 1076 {
1074 m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName); 1077 m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName);
@@ -1126,6 +1129,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1126 /// This informs all neighbouring regions about agent "avatar". 1129 /// This informs all neighbouring regions about agent "avatar".
1127 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 1130 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
1128 /// </summary> 1131 /// </summary>
1132 /// <param name="sp"></param>
1129 public void EnableChildAgents(ScenePresence sp) 1133 public void EnableChildAgents(ScenePresence sp)
1130 { 1134 {
1131 List<GridRegion> neighbours = new List<GridRegion>(); 1135 List<GridRegion> neighbours = new List<GridRegion>();
@@ -1312,7 +1316,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1312 Utils.LongToUInts(reg.RegionHandle, out x, out y); 1316 Utils.LongToUInts(reg.RegionHandle, out x, out y);
1313 x = x / Constants.RegionSize; 1317 x = x / Constants.RegionSize;
1314 y = y / Constants.RegionSize; 1318 y = y / Constants.RegionSize;
1315 m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); 1319 m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint + ")");
1316 1320
1317 string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); 1321 string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);
1318 1322
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 4933147..65ba87b 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -964,8 +964,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
964 } 964 }
965 } 965 }
966 } 966 }
967 else
968 {
969 m_log.WarnFormat(
970 "[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()", item.AssetID, item.Name, item.ID, remoteClient.Name);
971 }
972
967 return group; 973 return group;
968 } 974 }
975 else
976 {
977 m_log.WarnFormat(
978 "[InventoryAccessModule]: Could not find item {0} for {1} in RezObject()",
979 itemID, remoteClient.Name);
980 }
969 981
970 return null; 982 return null;
971 } 983 }
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
index 733ad25..e74310c 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -65,8 +65,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
65 config.AddConfig("Modules"); 65 config.AddConfig("Modules");
66 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); 66 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
67 67
68 m_scene = SceneSetupHelpers.SetupScene(); 68 m_scene = SceneHelpers.SetupScene();
69 SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam); 69 SceneHelpers.SetupSceneModules(m_scene, config, m_iam);
70 70
71 // Create user 71 // Create user
72 string userFirstName = "Jock"; 72 string userFirstName = "Jock";
@@ -82,14 +82,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
82 [Test] 82 [Test]
83 public void TestRezCoalescedObject() 83 public void TestRezCoalescedObject()
84 { 84 {
85 TestHelper.InMethod(); 85 TestHelpers.InMethod();
86// log4net.Config.XmlConfigurator.Configure(); 86// log4net.Config.XmlConfigurator.Configure();
87 87
88 // Create asset 88 // Create asset
89 SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20); 89 SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20);
90 object1.AbsolutePosition = new Vector3(15, 30, 45); 90 object1.AbsolutePosition = new Vector3(15, 30, 45);
91 91
92 SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40); 92 SceneObjectGroup object2 = SceneHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40);
93 object2.AbsolutePosition = new Vector3(25, 50, 75); 93 object2.AbsolutePosition = new Vector3(25, 50, 75);
94 94
95 CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2); 95 CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2);
@@ -138,11 +138,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
138 [Test] 138 [Test]
139 public void TestRezObject() 139 public void TestRezObject()
140 { 140 {
141 TestHelper.InMethod(); 141 TestHelpers.InMethod();
142// log4net.Config.XmlConfigurator.Configure(); 142// log4net.Config.XmlConfigurator.Configure();
143 143
144 // Create asset 144 // Create asset
145 SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40); 145 SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40);
146 146
147 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 147 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
148 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); 148 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index a4861ec..b0b35e4 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -186,7 +186,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
186 } 186 }
187 } 187 }
188 188
189
190 private string[] GetUserNames(UUID uuid) 189 private string[] GetUserNames(UUID uuid)
191 { 190 {
192 string[] returnstring = new string[2]; 191 string[] returnstring = new string[2];
@@ -292,6 +291,25 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
292 return userID.ToString(); 291 return userID.ToString();
293 } 292 }
294 293
294 public void AddUser(UUID uuid, string first, string last)
295 {
296 if (m_UserCache.ContainsKey(uuid))
297 return;
298
299 UserData user = new UserData();
300 user.Id = uuid;
301 user.FirstName = first;
302 user.LastName = last;
303 // user.ProfileURL = we should initialize this to the default
304
305 AddUserInternal(user);
306 }
307
308 public void AddUser(UUID uuid, string first, string last, string profileURL)
309 {
310 AddUser(uuid, profileURL + ";" + first + " " + last);
311 }
312
295 public void AddUser(UUID id, string creatorData) 313 public void AddUser(UUID id, string creatorData)
296 { 314 {
297 if (m_UserCache.ContainsKey(id)) 315 if (m_UserCache.ContainsKey(id))
@@ -299,18 +317,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
299 317
300// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData); 318// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData);
301 319
302 UserData user = new UserData();
303 user.Id = id;
304 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); 320 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
305 321
306 if (account != null) 322 if (account != null)
307 { 323 {
308 user.FirstName = account.FirstName; 324 AddUser(id, account.FirstName, account.LastName);
309 user.LastName = account.LastName;
310 // user.ProfileURL = we should initialize this to the default
311 } 325 }
312 else 326 else
313 { 327 {
328 UserData user = new UserData();
329 user.Id = id;
330
314 if (creatorData != null && creatorData != string.Empty) 331 if (creatorData != null && creatorData != string.Empty)
315 { 332 {
316 //creatorData = <endpoint>;<name> 333 //creatorData = <endpoint>;<name>
@@ -338,17 +355,19 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
338 user.FirstName = "Unknown"; 355 user.FirstName = "Unknown";
339 user.LastName = "User"; 356 user.LastName = "User";
340 } 357 }
341 }
342 358
343 lock (m_UserCache) 359 AddUserInternal(user);
344 m_UserCache[id] = user; 360 }
345
346 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.HomeURL);
347 } 361 }
348 362
349 public void AddUser(UUID uuid, string first, string last, string profileURL) 363 void AddUserInternal(UserData user)
350 { 364 {
351 AddUser(uuid, profileURL + ";" + first + " " + last); 365 lock (m_UserCache)
366 m_UserCache[user.Id] = user;
367
368 m_log.DebugFormat(
369 "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}",
370 user.Id, user.FirstName, user.LastName, user.HomeURL);
352 } 371 }
353 372
354 //public void AddUser(UUID uuid, string userData) 373 //public void AddUser(UUID uuid, string userData)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
index 6543845..d6063ad 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
@@ -93,7 +93,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
93 lookat = ((ScenePresence)sp).Lookat; 93 lookat = ((ScenePresence)sp).Lookat;
94 } 94 }
95 } 95 }
96 m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); 96
97// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
97 m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat); 98 m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat);
98 } 99 }
99 100
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 698fd56..72ae3363 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -211,11 +211,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
211 return; 211 return;
212 } 212 }
213 } 213 }
214 else 214// else
215 { 215// {
216 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID); 216// m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID);
217 return; 217// return;
218 } 218// }
219 } 219 }
220 } 220 }
221 if (sp == null) 221 if (sp == null)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
index fa5b873..59a407f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
94 } 94 }
95 } 95 }
96 96
97 m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); 97// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
98 m_PresenceService.LogoutAgent(client.SessionId); 98 m_PresenceService.LogoutAgent(client.SessionId);
99 } 99 }
100 100
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
index c355b13..2399134 100644
--- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
+++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
@@ -129,14 +129,12 @@ namespace OpenSim.Region.CoreModules.World
129 switch (cmd[1]) 129 switch (cmd[1])
130 { 130 {
131 case "enable": 131 case "enable":
132 if (scene.LoginsDisabled)
133 MainConsole.Instance.Output(String.Format("Enabling logins for region {0}", scene.RegionInfo.RegionName));
134 scene.LoginsDisabled = false; 132 scene.LoginsDisabled = false;
133 MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName));
135 break; 134 break;
136 case "disable": 135 case "disable":
137 if (!scene.LoginsDisabled)
138 MainConsole.Instance.Output(String.Format("Disabling logins for region {0}", scene.RegionInfo.RegionName));
139 scene.LoginsDisabled = true; 136 scene.LoginsDisabled = true;
137 MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName));
140 break; 138 break;
141 case "status": 139 case "status":
142 if (scene.LoginsDisabled) 140 if (scene.LoginsDisabled)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 6ba3459..b185d9b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -68,8 +68,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
68 SerialiserModule serialiserModule = new SerialiserModule(); 68 SerialiserModule serialiserModule = new SerialiserModule();
69 TerrainModule terrainModule = new TerrainModule(); 69 TerrainModule terrainModule = new TerrainModule();
70 70
71 m_scene = SceneSetupHelpers.SetupScene(); 71 m_scene = SceneHelpers.SetupScene();
72 SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); 72 SceneHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
73 } 73 }
74 74
75 private void LoadCompleted(Guid requestId, string errorMessage) 75 private void LoadCompleted(Guid requestId, string errorMessage)
@@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
125 [Test] 125 [Test]
126 public void TestSaveOar() 126 public void TestSaveOar()
127 { 127 {
128 TestHelper.InMethod(); 128 TestHelpers.InMethod();
129// log4net.Config.XmlConfigurator.Configure(); 129// log4net.Config.XmlConfigurator.Configure();
130 130
131 SceneObjectPart part1 = CreateSceneObjectPart1(); 131 SceneObjectPart part1 = CreateSceneObjectPart1();
@@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
217 [Test] 217 [Test]
218 public void TestSaveOarNoAssets() 218 public void TestSaveOarNoAssets()
219 { 219 {
220 TestHelper.InMethod(); 220 TestHelpers.InMethod();
221// log4net.Config.XmlConfigurator.Configure(); 221// log4net.Config.XmlConfigurator.Configure();
222 222
223 SceneObjectPart part1 = CreateSceneObjectPart1(); 223 SceneObjectPart part1 = CreateSceneObjectPart1();
@@ -300,7 +300,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
300 [Test] 300 [Test]
301 public void TestLoadOar() 301 public void TestLoadOar()
302 { 302 {
303 TestHelper.InMethod(); 303 TestHelpers.InMethod();
304// log4net.Config.XmlConfigurator.Configure(); 304// log4net.Config.XmlConfigurator.Configure();
305 305
306 MemoryStream archiveWriteStream = new MemoryStream(); 306 MemoryStream archiveWriteStream = new MemoryStream();
@@ -409,7 +409,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
409 [Test] 409 [Test]
410 public void TestLoadOarRegionSettings() 410 public void TestLoadOarRegionSettings()
411 { 411 {
412 TestHelper.InMethod(); 412 TestHelpers.InMethod();
413 //log4net.Config.XmlConfigurator.Configure(); 413 //log4net.Config.XmlConfigurator.Configure();
414 414
415 MemoryStream archiveWriteStream = new MemoryStream(); 415 MemoryStream archiveWriteStream = new MemoryStream();
@@ -505,7 +505,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
505 //[Test] 505 //[Test]
506 public void TestMergeOar() 506 public void TestMergeOar()
507 { 507 {
508 TestHelper.InMethod(); 508 TestHelpers.InMethod();
509 //XmlConfigurator.Configure(); 509 //XmlConfigurator.Configure();
510 510
511 MemoryStream archiveWriteStream = new MemoryStream(); 511 MemoryStream archiveWriteStream = new MemoryStream();
@@ -524,8 +524,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
524 SerialiserModule serialiserModule = new SerialiserModule(); 524 SerialiserModule serialiserModule = new SerialiserModule();
525 TerrainModule terrainModule = new TerrainModule(); 525 TerrainModule terrainModule = new TerrainModule();
526 526
527 Scene scene = SceneSetupHelpers.SetupScene(); 527 Scene scene = SceneHelpers.SetupScene();
528 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); 528 SceneHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
529 529
530 m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); 530 m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
531 531
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index a3aa38d..e553ffa 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -64,8 +64,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
64 { 64 {
65 m_pcm = new PrimCountModule(); 65 m_pcm = new PrimCountModule();
66 LandManagementModule lmm = new LandManagementModule(); 66 LandManagementModule lmm = new LandManagementModule();
67 m_scene = SceneSetupHelpers.SetupScene(); 67 m_scene = SceneHelpers.SetupScene();
68 SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); 68 SceneHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
69 69
70 int xParcelDivider = (int)Constants.RegionSize - 1; 70 int xParcelDivider = (int)Constants.RegionSize - 1;
71 71
@@ -106,12 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
106 [Test] 106 [Test]
107 public void TestAddOwnerObject() 107 public void TestAddOwnerObject()
108 { 108 {
109 TestHelper.InMethod(); 109 TestHelpers.InMethod();
110// log4net.Config.XmlConfigurator.Configure(); 110// log4net.Config.XmlConfigurator.Configure();
111 111
112 IPrimCounts pc = m_lo.PrimCounts; 112 IPrimCounts pc = m_lo.PrimCounts;
113 113
114 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); 114 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
115 m_scene.AddNewSceneObject(sog, false); 115 m_scene.AddNewSceneObject(sog, false);
116 116
117 Assert.That(pc.Owner, Is.EqualTo(3)); 117 Assert.That(pc.Owner, Is.EqualTo(3));
@@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
124 Assert.That(pc.Simulator, Is.EqualTo(3)); 124 Assert.That(pc.Simulator, Is.EqualTo(3));
125 125
126 // Add a second object and retest 126 // Add a second object and retest
127 SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); 127 SceneObjectGroup sog2 = SceneHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
128 m_scene.AddNewSceneObject(sog2, false); 128 m_scene.AddNewSceneObject(sog2, false);
129 129
130 Assert.That(pc.Owner, Is.EqualTo(5)); 130 Assert.That(pc.Owner, Is.EqualTo(5));
@@ -143,12 +143,12 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
143 [Test] 143 [Test]
144 public void TestCopyOwnerObject() 144 public void TestCopyOwnerObject()
145 { 145 {
146 TestHelper.InMethod(); 146 TestHelpers.InMethod();
147// log4net.Config.XmlConfigurator.Configure(); 147// log4net.Config.XmlConfigurator.Configure();
148 148
149 IPrimCounts pc = m_lo.PrimCounts; 149 IPrimCounts pc = m_lo.PrimCounts;
150 150
151 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); 151 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
152 m_scene.AddNewSceneObject(sog, false); 152 m_scene.AddNewSceneObject(sog, false);
153 m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); 153 m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity);
154 154
@@ -169,12 +169,12 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
169 [Test] 169 [Test]
170 public void TestMoveOwnerObject() 170 public void TestMoveOwnerObject()
171 { 171 {
172 TestHelper.InMethod(); 172 TestHelpers.InMethod();
173// log4net.Config.XmlConfigurator.Configure(); 173// log4net.Config.XmlConfigurator.Configure();
174 174
175 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); 175 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
176 m_scene.AddNewSceneObject(sog, false); 176 m_scene.AddNewSceneObject(sog, false);
177 SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); 177 SceneObjectGroup sog2 = SceneHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
178 m_scene.AddNewSceneObject(sog2, false); 178 m_scene.AddNewSceneObject(sog2, false);
179 179
180 // Move the first scene object to the eastern strip parcel 180 // Move the first scene object to the eastern strip parcel
@@ -230,13 +230,13 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
230 [Test] 230 [Test]
231 public void TestRemoveOwnerObject() 231 public void TestRemoveOwnerObject()
232 { 232 {
233 TestHelper.InMethod(); 233 TestHelpers.InMethod();
234// log4net.Config.XmlConfigurator.Configure(); 234// log4net.Config.XmlConfigurator.Configure();
235 235
236 IPrimCounts pc = m_lo.PrimCounts; 236 IPrimCounts pc = m_lo.PrimCounts;
237 237
238 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false); 238 m_scene.AddNewSceneObject(SceneHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false);
239 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); 239 SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
240 m_scene.AddNewSceneObject(sogToDelete, false); 240 m_scene.AddNewSceneObject(sogToDelete, false);
241 m_scene.DeleteSceneObject(sogToDelete, false); 241 m_scene.DeleteSceneObject(sogToDelete, false);
242 242
@@ -253,14 +253,14 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
253 [Test] 253 [Test]
254 public void TestAddGroupObject() 254 public void TestAddGroupObject()
255 { 255 {
256 TestHelper.InMethod(); 256 TestHelpers.InMethod();
257// log4net.Config.XmlConfigurator.Configure(); 257// log4net.Config.XmlConfigurator.Configure();
258 258
259 m_lo.DeedToGroup(m_groupId); 259 m_lo.DeedToGroup(m_groupId);
260 260
261 IPrimCounts pc = m_lo.PrimCounts; 261 IPrimCounts pc = m_lo.PrimCounts;
262 262
263 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); 263 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
264 sog.GroupID = m_groupId; 264 sog.GroupID = m_groupId;
265 m_scene.AddNewSceneObject(sog, false); 265 m_scene.AddNewSceneObject(sog, false);
266 266
@@ -284,18 +284,18 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
284 [Test] 284 [Test]
285 public void TestRemoveGroupObject() 285 public void TestRemoveGroupObject()
286 { 286 {
287 TestHelper.InMethod(); 287 TestHelpers.InMethod();
288// log4net.Config.XmlConfigurator.Configure(); 288// log4net.Config.XmlConfigurator.Configure();
289 289
290 m_lo.DeedToGroup(m_groupId); 290 m_lo.DeedToGroup(m_groupId);
291 291
292 IPrimCounts pc = m_lo.PrimCounts; 292 IPrimCounts pc = m_lo.PrimCounts;
293 293
294 SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1); 294 SceneObjectGroup sogToKeep = SceneHelpers.CreateSceneObject(1, m_userId, "a", 0x1);
295 sogToKeep.GroupID = m_groupId; 295 sogToKeep.GroupID = m_groupId;
296 m_scene.AddNewSceneObject(sogToKeep, false); 296 m_scene.AddNewSceneObject(sogToKeep, false);
297 297
298 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); 298 SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
299 m_scene.AddNewSceneObject(sogToDelete, false); 299 m_scene.AddNewSceneObject(sogToDelete, false);
300 m_scene.DeleteSceneObject(sogToDelete, false); 300 m_scene.DeleteSceneObject(sogToDelete, false);
301 301
@@ -313,12 +313,12 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
313 [Test] 313 [Test]
314 public void TestAddOthersObject() 314 public void TestAddOthersObject()
315 { 315 {
316 TestHelper.InMethod(); 316 TestHelpers.InMethod();
317// log4net.Config.XmlConfigurator.Configure(); 317// log4net.Config.XmlConfigurator.Configure();
318 318
319 IPrimCounts pc = m_lo.PrimCounts; 319 IPrimCounts pc = m_lo.PrimCounts;
320 320
321 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); 321 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
322 m_scene.AddNewSceneObject(sog, false); 322 m_scene.AddNewSceneObject(sog, false);
323 323
324 Assert.That(pc.Owner, Is.EqualTo(0)); 324 Assert.That(pc.Owner, Is.EqualTo(0));
@@ -334,13 +334,13 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
334 [Test] 334 [Test]
335 public void TestRemoveOthersObject() 335 public void TestRemoveOthersObject()
336 { 336 {
337 TestHelper.InMethod(); 337 TestHelpers.InMethod();
338// log4net.Config.XmlConfigurator.Configure(); 338// log4net.Config.XmlConfigurator.Configure();
339 339
340 IPrimCounts pc = m_lo.PrimCounts; 340 IPrimCounts pc = m_lo.PrimCounts;
341 341
342 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false); 342 m_scene.AddNewSceneObject(SceneHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false);
343 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10); 343 SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10);
344 m_scene.AddNewSceneObject(sogToDelete, false); 344 m_scene.AddNewSceneObject(sogToDelete, false);
345 m_scene.DeleteSceneObject(sogToDelete, false); 345 m_scene.DeleteSceneObject(sogToDelete, false);
346 346
@@ -360,10 +360,10 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
360 [Test] 360 [Test]
361 public void TestTaint() 361 public void TestTaint()
362 { 362 {
363 TestHelper.InMethod(); 363 TestHelpers.InMethod();
364 IPrimCounts pc = m_lo.PrimCounts; 364 IPrimCounts pc = m_lo.PrimCounts;
365 365
366 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); 366 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
367 m_scene.AddNewSceneObject(sog, false); 367 m_scene.AddNewSceneObject(sog, false);
368 368
369 m_pcm.TaintPrimCount(); 369 m_pcm.TaintPrimCount();
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
index aa14054..1d2141e 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
@@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
173 private Bitmap fetchTexture(UUID id) 173 private Bitmap fetchTexture(UUID id)
174 { 174 {
175 AssetBase asset = m_scene.AssetService.Get(id.ToString()); 175 AssetBase asset = m_scene.AssetService.Get(id.ToString());
176 m_log.DebugFormat("Fetched texture {0}, found: {1}", id, asset != null); 176 m_log.DebugFormat("[TexturedMapTileRenderer]: Fetched texture {0}, found: {1}", id, asset != null);
177 if (asset == null) return null; 177 if (asset == null) return null;
178 178
179 ManagedImage managedImage; 179 ManagedImage managedImage;
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
index d5b7082..4326606 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
@@ -53,17 +53,17 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
53 public void SetUp() 53 public void SetUp()
54 { 54 {
55 m_module = new MoapModule(); 55 m_module = new MoapModule();
56 m_scene = SceneSetupHelpers.SetupScene(); 56 m_scene = SceneHelpers.SetupScene();
57 SceneSetupHelpers.SetupSceneModules(m_scene, m_module); 57 SceneHelpers.SetupSceneModules(m_scene, m_module);
58 } 58 }
59 59
60 [Test] 60 [Test]
61 public void TestClearMediaUrl() 61 public void TestClearMediaUrl()
62 { 62 {
63 TestHelper.InMethod(); 63 TestHelpers.InMethod();
64// log4net.Config.XmlConfigurator.Configure(); 64// log4net.Config.XmlConfigurator.Configure();
65 65
66 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene); 66 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
67 MediaEntry me = new MediaEntry(); 67 MediaEntry me = new MediaEntry();
68 68
69 m_module.SetMediaEntry(part, 1, me); 69 m_module.SetMediaEntry(part, 1, me);
@@ -84,11 +84,11 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
84 [Test] 84 [Test]
85 public void TestSetMediaUrl() 85 public void TestSetMediaUrl()
86 { 86 {
87 TestHelper.InMethod(); 87 TestHelpers.InMethod();
88 88
89 string homeUrl = "opensimulator.org"; 89 string homeUrl = "opensimulator.org";
90 90
91 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene); 91 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
92 MediaEntry me = new MediaEntry() { HomeURL = homeUrl }; 92 MediaEntry me = new MediaEntry() { HomeURL = homeUrl };
93 93
94 m_module.SetMediaEntry(part, 1, me); 94 m_module.SetMediaEntry(part, 1, me);
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index 4f752ab..d5b585a 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
@@ -236,14 +236,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
236 public void Init() 236 public void Init()
237 { 237 {
238 m_serialiserModule = new SerialiserModule(); 238 m_serialiserModule = new SerialiserModule();
239 m_scene = SceneSetupHelpers.SetupScene(); 239 m_scene = SceneHelpers.SetupScene();
240 SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); 240 SceneHelpers.SetupSceneModules(m_scene, m_serialiserModule);
241 } 241 }
242 242
243 [Test] 243 [Test]
244 public void TestDeserializeXml() 244 public void TestDeserializeXml()
245 { 245 {
246 TestHelper.InMethod(); 246 TestHelpers.InMethod();
247 //log4net.Config.XmlConfigurator.Configure(); 247 //log4net.Config.XmlConfigurator.Configure();
248 248
249 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(xml); 249 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(xml);
@@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
259 [Test] 259 [Test]
260 public void TestSerializeXml() 260 public void TestSerializeXml()
261 { 261 {
262 TestHelper.InMethod(); 262 TestHelpers.InMethod();
263 //log4net.Config.XmlConfigurator.Configure(); 263 //log4net.Config.XmlConfigurator.Configure();
264 264
265 string rpName = "My Little Donkey"; 265 string rpName = "My Little Donkey";
@@ -334,7 +334,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
334 [Test] 334 [Test]
335 public void TestDeserializeXml2() 335 public void TestDeserializeXml2()
336 { 336 {
337 TestHelper.InMethod(); 337 TestHelpers.InMethod();
338 //log4net.Config.XmlConfigurator.Configure(); 338 //log4net.Config.XmlConfigurator.Configure();
339 339
340 SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(xml2); 340 SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(xml2);
@@ -350,7 +350,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
350 [Test] 350 [Test]
351 public void TestSerializeXml2() 351 public void TestSerializeXml2()
352 { 352 {
353 TestHelper.InMethod(); 353 TestHelpers.InMethod();
354 //log4net.Config.XmlConfigurator.Configure(); 354 //log4net.Config.XmlConfigurator.Configure();
355 355
356 string rpName = "My Little Pony"; 356 string rpName = "My Little Pony";
diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
index c2ad7b8..ab8e1bf 100644
--- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
+++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
@@ -100,15 +100,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
100 { 100 {
101 case Tree.Cypress1: 101 case Tree.Cypress1:
102 case Tree.Cypress2: 102 case Tree.Cypress2:
103 tree.Scale = new Vector3(4, 4, 10); 103 tree.Scale *= new Vector3(8, 8, 20);
104 break; 104 break;
105 105
106 // case... other tree types 106 // case... other tree types
107 // tree.Scale = new Vector3(?, ?, ?); 107 // tree.Scale *= new Vector3(?, ?, ?);
108 // break; 108 // break;
109 109
110 default: 110 default:
111 tree.Scale = new Vector3(4, 4, 4); 111 tree.Scale *= new Vector3(8, 8, 8);
112 break; 112 break;
113 } 113 }
114 } 114 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index fac2dab..710230a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -46,6 +46,7 @@ using OpenSim.Framework.Servers;
46using OpenSim.Framework.Servers.HttpServer; 46using OpenSim.Framework.Servers.HttpServer;
47using OpenSim.Region.Framework.Interfaces; 47using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes; 48using OpenSim.Region.Framework.Scenes;
49using OpenSim.Region.CoreModules.World.Land;
49using Caps=OpenSim.Framework.Capabilities.Caps; 50using Caps=OpenSim.Framework.Capabilities.Caps;
50using OSDArray=OpenMetaverse.StructuredData.OSDArray; 51using OSDArray=OpenMetaverse.StructuredData.OSDArray;
51using OSDMap=OpenMetaverse.StructuredData.OSDMap; 52using OSDMap=OpenMetaverse.StructuredData.OSDMap;
@@ -68,6 +69,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
68 protected Scene m_scene; 69 protected Scene m_scene;
69 private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); 70 private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>();
70 private int cachedTime = 0; 71 private int cachedTime = 0;
72 private int blacklistTimeout = 10*60*1000; // 10 minutes
71 private byte[] myMapImageJPEG; 73 private byte[] myMapImageJPEG;
72 protected volatile bool m_Enabled = false; 74 protected volatile bool m_Enabled = false;
73 private Dictionary<UUID, MapRequestState> m_openRequests = new Dictionary<UUID, MapRequestState>(); 75 private Dictionary<UUID, MapRequestState> m_openRequests = new Dictionary<UUID, MapRequestState>();
@@ -85,6 +87,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
85 IConfig startupConfig = config.Configs["Startup"]; 87 IConfig startupConfig = config.Configs["Startup"];
86 if (startupConfig.GetString("WorldMapModule", "WorldMap") == "WorldMap") 88 if (startupConfig.GetString("WorldMapModule", "WorldMap") == "WorldMap")
87 m_Enabled = true; 89 m_Enabled = true;
90
91 blacklistTimeout = startupConfig.GetInt("BlacklistTimeout", 10*60) * 1000;
88 } 92 }
89 93
90 public virtual void AddRegion (Scene scene) 94 public virtual void AddRegion (Scene scene)
@@ -159,11 +163,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
159 m_scene.EventManager.OnClientClosed += ClientLoggedOut; 163 m_scene.EventManager.OnClientClosed += ClientLoggedOut;
160 m_scene.EventManager.OnMakeChildAgent += MakeChildAgent; 164 m_scene.EventManager.OnMakeChildAgent += MakeChildAgent;
161 m_scene.EventManager.OnMakeRootAgent += MakeRootAgent; 165 m_scene.EventManager.OnMakeRootAgent += MakeRootAgent;
166 m_scene.EventManager.OnRegionUp += OnRegionUp;
167
168 StartThread(new object());
162 } 169 }
163 170
164 // this has to be called with a lock on m_scene 171 // this has to be called with a lock on m_scene
165 protected virtual void RemoveHandlers() 172 protected virtual void RemoveHandlers()
166 { 173 {
174 StopThread();
175
176 m_scene.EventManager.OnRegionUp -= OnRegionUp;
167 m_scene.EventManager.OnMakeRootAgent -= MakeRootAgent; 177 m_scene.EventManager.OnMakeRootAgent -= MakeRootAgent;
168 m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent; 178 m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent;
169 m_scene.EventManager.OnClientClosed -= ClientLoggedOut; 179 m_scene.EventManager.OnClientClosed -= ClientLoggedOut;
@@ -279,7 +289,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
279 /// <returns></returns> 289 /// <returns></returns>
280 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) 290 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
281 { 291 {
282 m_log.Debug("[WORLD MAP]: MapLayer Request in region: " + m_scene.RegionInfo.RegionName); 292 m_log.DebugFormat("[WORLD MAP]: MapLayer Request in region: {0}", m_scene.RegionInfo.RegionName);
283 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); 293 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
284 mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); 294 mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse());
285 return mapResponse; 295 return mapResponse;
@@ -321,8 +331,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
321 lock (m_rootAgents) 331 lock (m_rootAgents)
322 { 332 {
323 m_rootAgents.Remove(AgentId); 333 m_rootAgents.Remove(AgentId);
324 if (m_rootAgents.Count == 0)
325 StopThread();
326 } 334 }
327 } 335 }
328 #endregion 336 #endregion
@@ -362,6 +370,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
362 public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags, 370 public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags,
363 uint EstateID, bool godlike, uint itemtype, ulong regionhandle) 371 uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
364 { 372 {
373// m_log.DebugFormat("[WORLD MAP]: Handle MapItem request {0} {1}", regionhandle, itemtype);
374
365 lock (m_rootAgents) 375 lock (m_rootAgents)
366 { 376 {
367 if (!m_rootAgents.Contains(remoteClient.AgentId)) 377 if (!m_rootAgents.Contains(remoteClient.AgentId))
@@ -370,7 +380,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
370 uint xstart = 0; 380 uint xstart = 0;
371 uint ystart = 0; 381 uint ystart = 0;
372 Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); 382 Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
373 if (itemtype == 6) // we only sevice 6 right now (avatar green dots) 383 if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots)
374 { 384 {
375 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) 385 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
376 { 386 {
@@ -414,14 +424,58 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
414 // Remote Map Item Request 424 // Remote Map Item Request
415 425
416 // ensures that the blockingqueue doesn't get borked if the GetAgents() timing changes. 426 // ensures that the blockingqueue doesn't get borked if the GetAgents() timing changes.
417 // Note that we only start up a remote mapItem Request thread if there's users who could 427 RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle);
418 // be making requests 428 }
419 if (!threadrunning) 429 } else if (itemtype == 7) // Service 7 (MAP_ITEM_LAND_FOR_SALE)
430 {
431 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
432 {
433 // Parcels
434 ILandChannel landChannel = m_scene.LandChannel;
435 List<ILandObject> parcels = landChannel.AllParcels();
436
437 // Local Map Item Request
438 int tc = Environment.TickCount;
439 List<mapItemReply> mapitems = new List<mapItemReply>();
440 mapItemReply mapitem = new mapItemReply();
441 if ((parcels != null) && (parcels.Count >= 1))
420 { 442 {
421 m_log.Warn("[WORLD MAP]: Starting new remote request thread manually. This means that AvatarEnteringParcel never fired! This needs to be fixed! Don't Mantis this, as the developers can see it in this message"); 443 foreach (ILandObject parcel_interface in parcels)
422 StartThread(new object()); 444 {
445 // Play it safe
446 if (!(parcel_interface is LandObject))
447 continue;
448
449 LandObject land = (LandObject)parcel_interface;
450 LandData parcel = land.LandData;
451
452 // Show land for sale
453 if ((parcel.Flags & (uint)ParcelFlags.ForSale) == (uint)ParcelFlags.ForSale)
454 {
455 Vector3 min = parcel.AABBMin;
456 Vector3 max = parcel.AABBMax;
457 float x = (min.X+max.X)/2;
458 float y = (min.Y+max.Y)/2;
459
460 mapitem = new mapItemReply();
461 mapitem.x = (uint)(xstart + x);
462 mapitem.y = (uint)(ystart + y);
463 // mapitem.z = (uint)m_scene.GetGroundHeight(x,y);
464 mapitem.id = UUID.Zero;
465 mapitem.name = parcel.Name;
466 mapitem.Extra = parcel.Area;
467 mapitem.Extra2 = parcel.SalePrice;
468 mapitems.Add(mapitem);
469 }
470 }
423 } 471 }
472 remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
473 }
474 else
475 {
476 // Remote Map Item Request
424 477
478 // ensures that the blockingqueue doesn't get borked if the GetAgents() timing changes.
425 RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle); 479 RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle);
426 } 480 }
427 } 481 }
@@ -542,6 +596,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
542 } 596 }
543 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags); 597 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags);
544 } 598 }
599
600 // Service 7 (MAP_ITEM_LAND_FOR_SALE)
601 uint itemtype = 7;
602
603 if (response.ContainsKey(itemtype.ToString()))
604 {
605 List<mapItemReply> returnitems = new List<mapItemReply>();
606 OSDArray itemarray = (OSDArray)response[itemtype.ToString()];
607 for (int i = 0; i < itemarray.Count; i++)
608 {
609 OSDMap mapitem = (OSDMap)itemarray[i];
610 mapItemReply mi = new mapItemReply();
611 mi.x = (uint)mapitem["X"].AsInteger();
612 mi.y = (uint)mapitem["Y"].AsInteger();
613 mi.id = mapitem["ID"].AsUUID();
614 mi.Extra = mapitem["Extra"].AsInteger();
615 mi.Extra2 = mapitem["Extra2"].AsInteger();
616 mi.name = mapitem["Name"].AsString();
617 returnitems.Add(mi);
618 }
619 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
620 }
545 } 621 }
546 } 622 }
547 } 623 }
@@ -589,12 +665,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
589 private OSDMap RequestMapItemsAsync(UUID id, uint flags, 665 private OSDMap RequestMapItemsAsync(UUID id, uint flags,
590 uint EstateID, bool godlike, uint itemtype, ulong regionhandle) 666 uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
591 { 667 {
668// m_log.DebugFormat("[WORLDMAP]: RequestMapItemsAsync; region handle: {0} {1}", regionhandle, itemtype);
669
592 string httpserver = ""; 670 string httpserver = "";
593 bool blacklisted = false; 671 bool blacklisted = false;
594 lock (m_blacklistedregions) 672 lock (m_blacklistedregions)
595 { 673 {
596 if (m_blacklistedregions.ContainsKey(regionhandle)) 674 if (m_blacklistedregions.ContainsKey(regionhandle))
597 blacklisted = true; 675 {
676 if (Environment.TickCount > (m_blacklistedregions[regionhandle] + blacklistTimeout))
677 {
678 m_log.DebugFormat("[WORLDMAP]: Unblock blacklisted region {0}", regionhandle);
679
680 m_blacklistedregions.Remove(regionhandle);
681 }
682 else
683 blacklisted = true;
684 }
598 } 685 }
599 686
600 if (blacklisted) 687 if (blacklisted)
@@ -636,7 +723,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
636 lock (m_blacklistedurls) 723 lock (m_blacklistedurls)
637 { 724 {
638 if (m_blacklistedurls.ContainsKey(httpserver)) 725 if (m_blacklistedurls.ContainsKey(httpserver))
639 blacklisted = true; 726 {
727 if (Environment.TickCount > (m_blacklistedurls[httpserver] + blacklistTimeout))
728 {
729 m_log.DebugFormat("[WORLDMAP]: Unblock blacklisted URL {0}", httpserver);
730
731 m_blacklistedurls.Remove(httpserver);
732 }
733 else
734 blacklisted = true;
735 }
640 } 736 }
641 737
642 // Can't find the http server 738 // Can't find the http server
@@ -682,7 +778,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
682 mapitemsrequest.ContentLength = buffer.Length; //Count bytes to send 778 mapitemsrequest.ContentLength = buffer.Length; //Count bytes to send
683 os = mapitemsrequest.GetRequestStream(); 779 os = mapitemsrequest.GetRequestStream();
684 os.Write(buffer, 0, buffer.Length); //Send it 780 os.Write(buffer, 0, buffer.Length); //Send it
685 os.Close();
686 //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from {0}", httpserver); 781 //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from {0}", httpserver);
687 } 782 }
688 catch (WebException ex) 783 catch (WebException ex)
@@ -705,6 +800,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
705 responseMap["connect"] = OSD.FromBoolean(false); 800 responseMap["connect"] = OSD.FromBoolean(false);
706 return responseMap; 801 return responseMap;
707 } 802 }
803 finally
804 {
805 if (os != null)
806 os.Close();
807 }
708 808
709 string response_mapItems_reply = null; 809 string response_mapItems_reply = null;
710 { // get the response 810 { // get the response
@@ -1060,6 +1160,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1060 1160
1061 Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); 1161 Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart);
1062 1162
1163 // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots)
1164
1063 OSDMap responsemap = new OSDMap(); 1165 OSDMap responsemap = new OSDMap();
1064 int tc = Environment.TickCount; 1166 int tc = Environment.TickCount;
1065 if (m_scene.GetRootAgentCount() == 0) 1167 if (m_scene.GetRootAgentCount() == 0)
@@ -1092,6 +1194,60 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1092 }); 1194 });
1093 responsemap["6"] = responsearr; 1195 responsemap["6"] = responsearr;
1094 } 1196 }
1197
1198 // Service 7 (MAP_ITEM_LAND_FOR_SALE)
1199
1200 ILandChannel landChannel = m_scene.LandChannel;
1201 List<ILandObject> parcels = landChannel.AllParcels();
1202
1203 if ((parcels == null) || (parcels.Count == 0))
1204 {
1205 OSDMap responsemapdata = new OSDMap();
1206 responsemapdata["X"] = OSD.FromInteger((int)(xstart + 1));
1207 responsemapdata["Y"] = OSD.FromInteger((int)(ystart + 1));
1208 responsemapdata["ID"] = OSD.FromUUID(UUID.Zero);
1209 responsemapdata["Name"] = OSD.FromString("");
1210 responsemapdata["Extra"] = OSD.FromInteger(0);
1211 responsemapdata["Extra2"] = OSD.FromInteger(0);
1212 OSDArray responsearr = new OSDArray();
1213 responsearr.Add(responsemapdata);
1214
1215 responsemap["7"] = responsearr;
1216 }
1217 else
1218 {
1219 OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount());
1220 foreach (ILandObject parcel_interface in parcels)
1221 {
1222 // Play it safe
1223 if (!(parcel_interface is LandObject))
1224 continue;
1225
1226 LandObject land = (LandObject)parcel_interface;
1227 LandData parcel = land.LandData;
1228
1229 // Show land for sale
1230 if ((parcel.Flags & (uint)ParcelFlags.ForSale) == (uint)ParcelFlags.ForSale)
1231 {
1232 Vector3 min = parcel.AABBMin;
1233 Vector3 max = parcel.AABBMax;
1234 float x = (min.X+max.X)/2;
1235 float y = (min.Y+max.Y)/2;
1236
1237 OSDMap responsemapdata = new OSDMap();
1238 responsemapdata["X"] = OSD.FromInteger((int)(xstart + x));
1239 responsemapdata["Y"] = OSD.FromInteger((int)(ystart + y));
1240 // responsemapdata["Z"] = OSD.FromInteger((int)m_scene.GetGroundHeight(x,y));
1241 responsemapdata["ID"] = OSD.FromUUID(UUID.Zero);
1242 responsemapdata["Name"] = OSD.FromString(parcel.Name);
1243 responsemapdata["Extra"] = OSD.FromInteger(parcel.Area);
1244 responsemapdata["Extra2"] = OSD.FromInteger(parcel.SalePrice);
1245 responsearr.Add(responsemapdata);
1246 }
1247 }
1248 responsemap["7"] = responsearr;
1249 }
1250
1095 return responsemap; 1251 return responsemap;
1096 } 1252 }
1097 1253
@@ -1140,12 +1296,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1140 1296
1141 private void MakeRootAgent(ScenePresence avatar) 1297 private void MakeRootAgent(ScenePresence avatar)
1142 { 1298 {
1143 // You may ask, why this is in a threadpool to start with..
1144 // The reason is so we don't cause the thread to freeze waiting
1145 // for the 1 second it costs to start a thread manually.
1146 if (!threadrunning)
1147 Util.FireAndForget(this.StartThread);
1148
1149 lock (m_rootAgents) 1299 lock (m_rootAgents)
1150 { 1300 {
1151 if (!m_rootAgents.Contains(avatar.UUID)) 1301 if (!m_rootAgents.Contains(avatar.UUID))
@@ -1160,8 +1310,30 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1160 lock (m_rootAgents) 1310 lock (m_rootAgents)
1161 { 1311 {
1162 m_rootAgents.Remove(avatar.UUID); 1312 m_rootAgents.Remove(avatar.UUID);
1163 if (m_rootAgents.Count == 0) 1313 }
1164 StopThread(); 1314 }
1315
1316 public void OnRegionUp(GridRegion otherRegion)
1317 {
1318 ulong regionhandle = otherRegion.RegionHandle;
1319 string httpserver = otherRegion.ServerURI + "MAP/MapItems/" + regionhandle.ToString();
1320
1321 lock (m_blacklistedregions)
1322 {
1323 if (!m_blacklistedregions.ContainsKey(regionhandle))
1324 m_blacklistedregions.Remove(regionhandle);
1325 }
1326
1327 lock (m_blacklistedurls)
1328 {
1329 if (m_blacklistedurls.ContainsKey(httpserver))
1330 m_blacklistedurls.Remove(httpserver);
1331 }
1332
1333 lock (m_cachedRegionMapItemsAddress)
1334 {
1335 if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))
1336 m_cachedRegionMapItemsAddress.Remove(regionhandle);
1165 } 1337 }
1166 } 1338 }
1167 1339
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 4f58ab0..c87790f 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Region.Examples.SimpleModule
83 public event DeRezObject OnDeRezObject; 83 public event DeRezObject OnDeRezObject;
84 public event Action<IClientAPI> OnRegionHandShakeReply; 84 public event Action<IClientAPI> OnRegionHandShakeReply;
85 public event GenericCall1 OnRequestWearables; 85 public event GenericCall1 OnRequestWearables;
86 public event GenericCall1 OnCompleteMovementToRegion; 86 public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
87 public event UpdateAgent OnPreAgentUpdate; 87 public event UpdateAgent OnPreAgentUpdate;
88 public event UpdateAgent OnAgentUpdate; 88 public event UpdateAgent OnAgentUpdate;
89 public event AgentRequestSit OnAgentRequestSit; 89 public event AgentRequestSit OnAgentRequestSit;
@@ -222,7 +222,7 @@ namespace OpenSim.Region.Examples.SimpleModule
222 public event ScriptReset OnScriptReset; 222 public event ScriptReset OnScriptReset;
223 public event GetScriptRunning OnGetScriptRunning; 223 public event GetScriptRunning OnGetScriptRunning;
224 public event SetScriptRunning OnSetScriptRunning; 224 public event SetScriptRunning OnSetScriptRunning;
225 public event Action<Vector3> OnAutoPilotGo; 225 public event Action<Vector3, bool> OnAutoPilotGo;
226 226
227 public event TerrainUnacked OnUnackedTerrain; 227 public event TerrainUnacked OnUnackedTerrain;
228 228
@@ -663,7 +663,7 @@ namespace OpenSim.Region.Examples.SimpleModule
663 663
664 if (OnCompleteMovementToRegion != null) 664 if (OnCompleteMovementToRegion != null)
665 { 665 {
666 OnCompleteMovementToRegion(this); 666 OnCompleteMovementToRegion(this, true);
667 } 667 }
668 } 668 }
669 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) 669 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
diff --git a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs
index 088b818..3b8ce37 100644
--- a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs
+++ b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Region.Examples.SimpleModule
95 for (int i = 0; i < 1; i++) 95 for (int i = 0; i < 1; i++)
96 { 96 {
97 MyNpcCharacter m_character = new MyNpcCharacter(m_scene); 97 MyNpcCharacter m_character = new MyNpcCharacter(m_scene);
98 m_scene.AddNewClient(m_character); 98 m_scene.AddNewClient(m_character, PresenceType.Npc);
99 m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false); 99 m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false);
100 } 100 }
101 101
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 6cc64c6..4cb3df2 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -96,9 +96,10 @@ namespace OpenSim.Region.Framework.Interfaces
96 /// <summary> 96 /// <summary>
97 /// Detach an object from the avatar. 97 /// Detach an object from the avatar.
98 /// </summary> 98 /// </summary>
99 /// 99 /// <remarks>
100 /// This method is called in response to a client's detach request, so we only update the information in 100 /// This method is called in response to a client's detach request, so we only update the information in
101 /// inventory 101 /// inventory
102 /// </remarks>
102 /// <param name="objectLocalID"></param> 103 /// <param name="objectLocalID"></param>
103 /// <param name="remoteClient"></param> 104 /// <param name="remoteClient"></param>
104 void DetachObject(uint objectLocalID, IClientAPI remoteClient); 105 void DetachObject(uint objectLocalID, IClientAPI remoteClient);
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
index d0e5609..6817725 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
@@ -32,6 +32,14 @@ namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public interface IAvatarFactory 33 public interface IAvatarFactory
34 { 34 {
35 /// <summary>
36 /// Send the appearance of an avatar to others in the scene.
37 /// </summary>
38 /// <param name="agentId"></param>
39 /// <returns></returns>
40 bool SendAppearance(UUID agentId);
41
42 bool SaveBakedTextures(UUID agentId);
35 bool ValidateBakedTextureCache(IClientAPI client); 43 bool ValidateBakedTextureCache(IClientAPI client);
36 void QueueAppearanceSend(UUID agentid); 44 void QueueAppearanceSend(UUID agentid);
37 void QueueAppearanceSave(UUID agentid); 45 void QueueAppearanceSave(UUID agentid);
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index fa8d6b6..5e5c4a1 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework;
29using OpenSim.Region.Framework.Scenes; 30using OpenSim.Region.Framework.Scenes;
30 31
31namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
@@ -39,9 +40,26 @@ namespace OpenSim.Region.Framework.Interfaces
39 /// <param name="lastname"></param> 40 /// <param name="lastname"></param>
40 /// <param name="position"></param> 41 /// <param name="position"></param>
41 /// <param name="scene"></param> 42 /// <param name="scene"></param>
42 /// <param name="cloneAppearanceFrom">The UUID of the avatar from which to clone the NPC's appearance from.</param> 43 /// <param name="appearance">The avatar appearance to use for the new NPC.</param>
43 /// <returns>The UUID of the ScenePresence created.</returns> 44 /// <returns>The UUID of the ScenePresence created.</returns>
44 UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom); 45 UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, AvatarAppearance appearance);
46
47 /// <summary>
48 /// Check if the agent is an NPC.
49 /// </summary>
50 /// <param name="agentID"></param>
51 /// <param name="scene"></param>
52 /// <returns>True if the agent is an NPC in the given scene. False otherwise.</returns>
53 bool IsNPC(UUID agentID, Scene scene);
54
55 /// <summary>
56 /// Set the appearance for an NPC.
57 /// </summary>
58 /// <param name="agentID"></param>
59 /// <param name="appearance"></param>
60 /// <param name="scene"></param>
61 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
62 bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene);
45 63
46 /// <summary> 64 /// <summary>
47 /// Move an NPC to a target over time. 65 /// Move an NPC to a target over time.
@@ -49,7 +67,23 @@ namespace OpenSim.Region.Framework.Interfaces
49 /// <param name="agentID">The UUID of the NPC</param> 67 /// <param name="agentID">The UUID of the NPC</param>
50 /// <param name="scene"></param> 68 /// <param name="scene"></param>
51 /// <param name="pos"></param> 69 /// <param name="pos"></param>
52 void MoveToTarget(UUID agentID, Scene scene, Vector3 pos); 70 /// <param name="noFly">
71 /// If true, then the avatar will attempt to walk to the location even if it's up in the air.
72 /// This is to allow walking on prims.
73 /// </param>
74 /// <param name="landAtTarget">
75 /// If true and the avatar is flying when it reaches the target, land.
76 /// </param>
77 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
78 bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget);
79
80 /// <summary>
81 /// Stop the NPC's current movement.
82 /// </summary>
83 /// <param name="agentID">The UUID of the NPC</param>
84 /// <param name="scene"></param>
85 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
86 bool StopMoveToTarget(UUID agentID, Scene scene);
53 87
54 /// <summary> 88 /// <summary>
55 /// Get the NPC to say something. 89 /// Get the NPC to say something.
@@ -57,14 +91,15 @@ namespace OpenSim.Region.Framework.Interfaces
57 /// <param name="agentID">The UUID of the NPC</param> 91 /// <param name="agentID">The UUID of the NPC</param>
58 /// <param name="scene"></param> 92 /// <param name="scene"></param>
59 /// <param name="text"></param> 93 /// <param name="text"></param>
60 void Say(UUID agentID, Scene scene, string text); 94 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
61 95 bool Say(UUID agentID, Scene scene, string text);
62 96
63 /// <summary> 97 /// <summary>
64 /// Delete an NPC. 98 /// Delete an NPC.
65 /// </summary> 99 /// </summary>
66 /// <param name="agentID">The UUID of the NPC</param> 100 /// <param name="agentID">The UUID of the NPC</param>
67 /// <param name="scene"></param> 101 /// <param name="scene"></param>
68 void DeleteNPC(UUID agentID, Scene scene); 102 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
103 bool DeleteNPC(UUID agentID, Scene scene);
69 } 104 }
70} \ No newline at end of file 105} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index 5d30aa8..c66e053 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -5,13 +5,48 @@ using OpenMetaverse;
5 5
6namespace OpenSim.Region.Framework.Interfaces 6namespace OpenSim.Region.Framework.Interfaces
7{ 7{
8 /// <summary>
9 /// This maintains the relationship between a UUID and a user name.
10 /// </summary>
8 public interface IUserManagement 11 public interface IUserManagement
9 { 12 {
10 string GetUserName(UUID uuid); 13 string GetUserName(UUID uuid);
11 string GetUserHomeURL(UUID uuid); 14 string GetUserHomeURL(UUID uuid);
12 string GetUserUUI(UUID uuid); 15 string GetUserUUI(UUID uuid);
13 string GetUserServerURL(UUID uuid, string serverType); 16 string GetUserServerURL(UUID uuid, string serverType);
14 void AddUser(UUID uuid, string userData); 17
18 /// <summary>
19 /// Add a user.
20 /// </summary>
21 /// <remarks>
22 /// If an account is found for the UUID, then the names in this will be used rather than any information
23 /// extracted from creatorData.
24 /// </remarks>
25 /// <param name="uuid"></param>
26 /// <param name="creatorData">The creator data for this user.</param>
27 void AddUser(UUID uuid, string creatorData);
28
29 /// <summary>
30 /// Add a user.
31 /// </summary>
32 /// <remarks>
33 /// The UUID is related to the name without any other checks being performed, such as user account presence.
34 /// </remarks>
35 /// <param name="uuid"></param>
36 /// <param name="firstName"></param>
37 /// <param name="lastName"></param>
38 void AddUser(UUID uuid, string firstName, string lastName);
39
40 /// <summary>
41 /// Add a user.
42 /// </summary>
43 /// <remarks>
44 /// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the
45 /// AddUser(UUID uuid, string creatorData) method.
46 /// </remarks>
47 /// <param name="uuid"></param>
48 /// <param name="firstName"></param>
49 /// <param name="profileURL"></param>
15 void AddUser(UUID uuid, string firstName, string lastName, string profileURL); 50 void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
16 } 51 }
17} 52}
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 4ab818f..e07d8b4 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -77,6 +77,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
77 if (m_scenePresence.IsChildAgent) 77 if (m_scenePresence.IsChildAgent)
78 return; 78 return;
79 79
80// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
81
80 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) 82 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
81 SendAnimPack(); 83 SendAnimPack();
82 } 84 }
@@ -91,6 +93,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
91 if (animID == UUID.Zero) 93 if (animID == UUID.Zero)
92 return; 94 return;
93 95
96// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name);
97
94 AddAnimation(animID, objectID); 98 AddAnimation(animID, objectID);
95 } 99 }
96 100
@@ -127,13 +131,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
127 /// </summary> 131 /// </summary>
128 public void TrySetMovementAnimation(string anim) 132 public void TrySetMovementAnimation(string anim)
129 { 133 {
130 //m_log.DebugFormat("Updating movement animation to {0}", anim);
131
132 if (!m_scenePresence.IsChildAgent) 134 if (!m_scenePresence.IsChildAgent)
133 { 135 {
134 if (m_animations.TrySetDefaultAnimation( 136 if (m_animations.TrySetDefaultAnimation(
135 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) 137 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
136 { 138 {
139// m_log.DebugFormat(
140// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}",
141// anim, m_scenePresence.Name);
142
137 // 16384 is CHANGED_ANIMATION 143 // 16384 is CHANGED_ANIMATION
138 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); 144 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION});
139 SendAnimPack(); 145 SendAnimPack();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b3b6cbc..513c0ea 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -611,6 +611,10 @@ namespace OpenSim.Region.Framework.Scenes
611 "delete object name <name>", 611 "delete object name <name>",
612 "Delete object by name", HandleDeleteObject); 612 "Delete object by name", HandleDeleteObject);
613 613
614 MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside",
615 "delete object outside",
616 "Delete all objects outside boundaries", HandleDeleteObject);
617
614 //Bind Storage Manager functions to some land manager functions for this scene 618 //Bind Storage Manager functions to some land manager functions for this scene
615 EventManager.OnLandObjectAdded += 619 EventManager.OnLandObjectAdded +=
616 new EventManager.LandObjectAdded(simDataService.StoreLandObject); 620 new EventManager.LandObjectAdded(simDataService.StoreLandObject);
@@ -2539,10 +2543,11 @@ namespace OpenSim.Region.Framework.Scenes
2539 #region Add/Remove Avatar Methods 2543 #region Add/Remove Avatar Methods
2540 2544
2541 /// <summary> 2545 /// <summary>
2542 /// Adding a New Client and Create a Presence for it. 2546 /// Add a new client and create a child agent for it.
2543 /// </summary> 2547 /// </summary>
2544 /// <param name="client"></param> 2548 /// <param name="client"></param>
2545 public override void AddNewClient(IClientAPI client) 2549 /// <param name="type">The type of agent to add.</param>
2550 public override void AddNewClient(IClientAPI client, PresenceType type)
2546 { 2551 {
2547 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2552 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2548 bool vialogin = false; 2553 bool vialogin = false;
@@ -2562,7 +2567,7 @@ namespace OpenSim.Region.Framework.Scenes
2562 m_clientManager.Add(client); 2567 m_clientManager.Add(client);
2563 SubscribeToClientEvents(client); 2568 SubscribeToClientEvents(client);
2564 2569
2565 ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); 2570 ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
2566 m_eventManager.TriggerOnNewPresence(sp); 2571 m_eventManager.TriggerOnNewPresence(sp);
2567 2572
2568 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; 2573 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags;
@@ -2577,12 +2582,13 @@ namespace OpenSim.Region.Framework.Scenes
2577 } 2582 }
2578 } 2583 }
2579 2584
2580 if (GetScenePresence(client.AgentId) != null) 2585 ScenePresence createdSp = GetScenePresence(client.AgentId);
2586 if (createdSp != null)
2581 { 2587 {
2582 m_LastLogin = Util.EnvironmentTickCount(); 2588 m_LastLogin = Util.EnvironmentTickCount();
2583 2589
2584 // Cache the user's name 2590 // Cache the user's name
2585 CacheUserName(aCircuit); 2591 CacheUserName(createdSp, aCircuit);
2586 2592
2587 EventManager.TriggerOnNewClient(client); 2593 EventManager.TriggerOnNewClient(client);
2588 if (vialogin) 2594 if (vialogin)
@@ -2590,28 +2596,41 @@ namespace OpenSim.Region.Framework.Scenes
2590 } 2596 }
2591 } 2597 }
2592 2598
2593 private void CacheUserName(AgentCircuitData aCircuit) 2599 /// <summary>
2600 /// Cache the user name for later use.
2601 /// </summary>
2602 /// <param name="sp"></param>
2603 /// <param name="aCircuit"></param>
2604 private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit)
2594 { 2605 {
2595 IUserManagement uMan = RequestModuleInterface<IUserManagement>(); 2606 IUserManagement uMan = RequestModuleInterface<IUserManagement>();
2596 if (uMan != null) 2607 if (uMan != null)
2597 { 2608 {
2598 string homeURL = string.Empty;
2599 string first = aCircuit.firstname, last = aCircuit.lastname; 2609 string first = aCircuit.firstname, last = aCircuit.lastname;
2600 2610
2601 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 2611 if (sp.PresenceType == PresenceType.Npc)
2602 homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); 2612 {
2603 2613 uMan.AddUser(aCircuit.AgentID, first, last);
2604 if (aCircuit.lastname.StartsWith("@")) 2614 }
2615 else
2605 { 2616 {
2606 string[] parts = aCircuit.firstname.Split('.'); 2617 string homeURL = string.Empty;
2607 if (parts.Length >= 2) 2618
2619 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
2620 homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
2621
2622 if (aCircuit.lastname.StartsWith("@"))
2608 { 2623 {
2609 first = parts[0]; 2624 string[] parts = aCircuit.firstname.Split('.');
2610 last = parts[1]; 2625 if (parts.Length >= 2)
2626 {
2627 first = parts[0];
2628 last = parts[1];
2629 }
2611 } 2630 }
2612 }
2613 2631
2614 uMan.AddUser(aCircuit.AgentID, first, last, homeURL); 2632 uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
2633 }
2615 } 2634 }
2616 } 2635 }
2617 2636
@@ -3091,11 +3110,7 @@ namespace OpenSim.Region.Framework.Scenes
3091 } 3110 }
3092 } 3111 }
3093 3112
3094 /// <summary> 3113 public override void RemoveClient(UUID agentID, bool closeChildAgents)
3095 /// Remove the given client from the scene.
3096 /// </summary>
3097 /// <param name="agentID"></param>
3098 public override void RemoveClient(UUID agentID)
3099 { 3114 {
3100 CheckHeartbeat(); 3115 CheckHeartbeat();
3101 bool childagentYN = false; 3116 bool childagentYN = false;
@@ -3116,15 +3131,17 @@ namespace OpenSim.Region.Framework.Scenes
3116 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); 3131 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName);
3117 3132
3118 m_sceneGraph.removeUserCount(!childagentYN); 3133 m_sceneGraph.removeUserCount(!childagentYN);
3119 3134
3120 if (CapsModule != null) 3135 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop
3136 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI
3137 if (closeChildAgents && CapsModule != null)
3121 CapsModule.RemoveCaps(agentID); 3138 CapsModule.RemoveCaps(agentID);
3122 3139
3123 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever 3140 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3124 // this method is doing is HORRIBLE!!! 3141 // this method is doing is HORRIBLE!!!
3125 avatar.Scene.NeedSceneCacheClear(avatar.UUID); 3142 avatar.Scene.NeedSceneCacheClear(avatar.UUID);
3126 3143
3127 if (!avatar.IsChildAgent) 3144 if (closeChildAgents && !avatar.IsChildAgent)
3128 { 3145 {
3129 //List<ulong> childknownRegions = new List<ulong>(); 3146 //List<ulong> childknownRegions = new List<ulong>();
3130 //List<ulong> ckn = avatar.KnownChildRegionHandles; 3147 //List<ulong> ckn = avatar.KnownChildRegionHandles;
@@ -3136,6 +3153,7 @@ namespace OpenSim.Region.Framework.Scenes
3136 regions.Remove(RegionInfo.RegionHandle); 3153 regions.Remove(RegionInfo.RegionHandle);
3137 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); 3154 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
3138 } 3155 }
3156
3139 m_eventManager.TriggerClientClosed(agentID, this); 3157 m_eventManager.TriggerClientClosed(agentID, this);
3140 } 3158 }
3141 catch (NullReferenceException) 3159 catch (NullReferenceException)
@@ -3146,7 +3164,7 @@ namespace OpenSim.Region.Framework.Scenes
3146 3164
3147 m_eventManager.TriggerOnRemovePresence(agentID); 3165 m_eventManager.TriggerOnRemovePresence(agentID);
3148 3166
3149 if (avatar != null && (!avatar.IsChildAgent)) 3167 if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc)
3150 avatar.SaveChangedAttachments(); 3168 avatar.SaveChangedAttachments();
3151 3169
3152 ForEachClient( 3170 ForEachClient(
@@ -4942,11 +4960,19 @@ namespace OpenSim.Region.Framework.Scenes
4942 4960
4943 private void HandleDeleteObject(string module, string[] cmd) 4961 private void HandleDeleteObject(string module, string[] cmd)
4944 { 4962 {
4945 if (cmd.Length < 4) 4963 if (cmd.Length < 3)
4946 return; 4964 return;
4947 4965
4948 string mode = cmd[2]; 4966 string mode = cmd[2];
4949 string o = cmd[3]; 4967 string o = "";
4968
4969 if (mode != "outside")
4970 {
4971 if (cmd.Length < 4)
4972 return;
4973
4974 o = cmd[3];
4975 }
4950 4976
4951 List<SceneObjectGroup> deletes = new List<SceneObjectGroup>(); 4977 List<SceneObjectGroup> deletes = new List<SceneObjectGroup>();
4952 4978
@@ -4988,10 +5014,33 @@ namespace OpenSim.Region.Framework.Scenes
4988 deletes.Add(g); 5014 deletes.Add(g);
4989 }); 5015 });
4990 break; 5016 break;
5017 case "outside":
5018 ForEachSOG(delegate (SceneObjectGroup g)
5019 {
5020 SceneObjectPart rootPart = g.RootPart;
5021 bool delete = false;
5022
5023 if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0)
5024 {
5025 delete = true;
5026 } else {
5027 ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y);
5028
5029 if (parcel == null || parcel.LandData.Name == "NO LAND")
5030 delete = true;
5031 }
5032
5033 if (delete && !rootPart.IsAttachment && !deletes.Contains(g))
5034 deletes.Add(g);
5035 });
5036 break;
4991 } 5037 }
4992 5038
4993 foreach (SceneObjectGroup g in deletes) 5039 foreach (SceneObjectGroup g in deletes)
5040 {
5041 m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID);
4994 DeleteSceneObject(g, false); 5042 DeleteSceneObject(g, false);
5043 }
4995 } 5044 }
4996 5045
4997 private void HandleReloadEstate(string module, string[] cmd) 5046 private void HandleReloadEstate(string module, string[] cmd)
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index c4547f2..ec94f10 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -175,18 +175,8 @@ namespace OpenSim.Region.Framework.Scenes
175 175
176 #region Add/Remove Agent/Avatar 176 #region Add/Remove Agent/Avatar
177 177
178 /// <summary> 178 public abstract void AddNewClient(IClientAPI client, PresenceType type);
179 /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing 179 public abstract void RemoveClient(UUID agentID, bool closeChildAgents);
180 /// will promote it to a root agent during login.
181 /// </summary>
182 /// <param name="client"></param
183 public abstract void AddNewClient(IClientAPI client);
184
185 /// <summary>
186 /// Remove a client from the scene
187 /// </summary>
188 /// <param name="agentID"></param>
189 public abstract void RemoveClient(UUID agentID);
190 180
191 public bool TryGetScenePresence(UUID agentID, out object scenePresence) 181 public bool TryGetScenePresence(UUID agentID, out object scenePresence)
192 { 182 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 65dc2c9..f40b373 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -590,12 +590,13 @@ namespace OpenSim.Region.Framework.Scenes
590 } 590 }
591 } 591 }
592 592
593 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) 593 protected internal ScenePresence CreateAndAddChildScenePresence(
594 IClientAPI client, AvatarAppearance appearance, PresenceType type)
594 { 595 {
595 ScenePresence newAvatar = null; 596 ScenePresence newAvatar = null;
596 597
597 // ScenePresence always defaults to child agent 598 // ScenePresence always defaults to child agent
598 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); 599 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance, type);
599 600
600 AddScenePresence(newAvatar); 601 AddScenePresence(newAvatar);
601 602
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 97ee844..7fada4b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -53,12 +53,12 @@ namespace OpenSim.Region.Framework.Scenes
53 get { return m_instance; } 53 get { return m_instance; }
54 } 54 }
55 55
56 private readonly List<Scene> m_localScenes; 56 private readonly List<Scene> m_localScenes = new List<Scene>();
57 private Scene m_currentScene = null; 57 private Scene m_currentScene = null;
58 58
59 public List<Scene> Scenes 59 public List<Scene> Scenes
60 { 60 {
61 get { return m_localScenes; } 61 get { return new List<Scene>(m_localScenes); }
62 } 62 }
63 63
64 public Scene CurrentScene 64 public Scene CurrentScene
@@ -72,13 +72,12 @@ namespace OpenSim.Region.Framework.Scenes
72 { 72 {
73 if (m_currentScene == null) 73 if (m_currentScene == null)
74 { 74 {
75 if (m_localScenes.Count > 0) 75 lock (m_localScenes)
76 { 76 {
77 return m_localScenes[0]; 77 if (m_localScenes.Count > 0)
78 } 78 return m_localScenes[0];
79 else 79 else
80 { 80 return null;
81 return null;
82 } 81 }
83 } 82 }
84 else 83 else
@@ -98,17 +97,21 @@ namespace OpenSim.Region.Framework.Scenes
98 { 97 {
99 // collect known shared modules in sharedModules 98 // collect known shared modules in sharedModules
100 Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>(); 99 Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>();
101 for (int i = 0; i < m_localScenes.Count; i++) 100
101 lock (m_localScenes)
102 { 102 {
103 // extract known shared modules from scene 103 for (int i = 0; i < m_localScenes.Count; i++)
104 foreach (string k in m_localScenes[i].Modules.Keys)
105 { 104 {
106 if (m_localScenes[i].Modules[k].IsSharedModule && 105 // extract known shared modules from scene
107 !sharedModules.ContainsKey(k)) 106 foreach (string k in m_localScenes[i].Modules.Keys)
108 sharedModules[k] = m_localScenes[i].Modules[k]; 107 {
108 if (m_localScenes[i].Modules[k].IsSharedModule &&
109 !sharedModules.ContainsKey(k))
110 sharedModules[k] = m_localScenes[i].Modules[k];
111 }
112 // close scene/region
113 m_localScenes[i].Close();
109 } 114 }
110 // close scene/region
111 m_localScenes[i].Close();
112 } 115 }
113 116
114 // all regions/scenes are now closed, we can now safely 117 // all regions/scenes are now closed, we can now safely
@@ -121,13 +124,16 @@ namespace OpenSim.Region.Framework.Scenes
121 124
122 public void Close(Scene cscene) 125 public void Close(Scene cscene)
123 { 126 {
124 if (m_localScenes.Contains(cscene)) 127 lock (m_localScenes)
125 { 128 {
126 for (int i = 0; i < m_localScenes.Count; i++) 129 if (m_localScenes.Contains(cscene))
127 { 130 {
128 if (m_localScenes[i].Equals(cscene)) 131 for (int i = 0; i < m_localScenes.Count; i++)
129 { 132 {
130 m_localScenes[i].Close(); 133 if (m_localScenes[i].Equals(cscene))
134 {
135 m_localScenes[i].Close();
136 }
131 } 137 }
132 } 138 }
133 } 139 }
@@ -136,27 +142,33 @@ namespace OpenSim.Region.Framework.Scenes
136 public void Add(Scene scene) 142 public void Add(Scene scene)
137 { 143 {
138 scene.OnRestart += HandleRestart; 144 scene.OnRestart += HandleRestart;
139 m_localScenes.Add(scene); 145
146 lock (m_localScenes)
147 m_localScenes.Add(scene);
140 } 148 }
141 149
142 public void HandleRestart(RegionInfo rdata) 150 public void HandleRestart(RegionInfo rdata)
143 { 151 {
144 m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); 152 m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main");
145 int RegionSceneElement = -1; 153 int RegionSceneElement = -1;
146 for (int i = 0; i < m_localScenes.Count; i++) 154
155 lock (m_localScenes)
147 { 156 {
148 if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName) 157 for (int i = 0; i < m_localScenes.Count; i++)
149 { 158 {
150 RegionSceneElement = i; 159 if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName)
160 {
161 RegionSceneElement = i;
162 }
151 } 163 }
152 }
153 164
154 // Now we make sure the region is no longer known about by the SceneManager 165 // Now we make sure the region is no longer known about by the SceneManager
155 // Prevents duplicates. 166 // Prevents duplicates.
156 167
157 if (RegionSceneElement >= 0) 168 if (RegionSceneElement >= 0)
158 { 169 {
159 m_localScenes.RemoveAt(RegionSceneElement); 170 m_localScenes.RemoveAt(RegionSceneElement);
171 }
160 } 172 }
161 173
162 // Send signal to main that we're restarting this sim. 174 // Send signal to main that we're restarting this sim.
@@ -167,28 +179,32 @@ namespace OpenSim.Region.Framework.Scenes
167 { 179 {
168 RegionInfo Result = null; 180 RegionInfo Result = null;
169 181
170 for (int i = 0; i < m_localScenes.Count; i++) 182 lock (m_localScenes)
171 {
172 if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle)
173 {
174 // Inform other regions to tell their avatar about me
175 Result = m_localScenes[i].RegionInfo;
176 }
177 }
178 if (Result != null)
179 { 183 {
180 for (int i = 0; i < m_localScenes.Count; i++) 184 for (int i = 0; i < m_localScenes.Count; i++)
181 { 185 {
182 if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle) 186 if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle)
183 { 187 {
184 // Inform other regions to tell their avatar about me 188 // Inform other regions to tell their avatar about me
185 //m_localScenes[i].OtherRegionUp(Result); 189 Result = m_localScenes[i].RegionInfo;
186 } 190 }
187 } 191 }
188 } 192
189 else 193 if (Result != null)
190 { 194 {
191 m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up"); 195 for (int i = 0; i < m_localScenes.Count; i++)
196 {
197 if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle)
198 {
199 // Inform other regions to tell their avatar about me
200 //m_localScenes[i].OtherRegionUp(Result);
201 }
202 }
203 }
204 else
205 {
206 m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up");
207 }
192 } 208 }
193 } 209 }
194 210
@@ -292,7 +308,8 @@ namespace OpenSim.Region.Framework.Scenes
292 { 308 {
293 if (m_currentScene == null) 309 if (m_currentScene == null)
294 { 310 {
295 m_localScenes.ForEach(func); 311 lock (m_localScenes)
312 m_localScenes.ForEach(func);
296 } 313 }
297 else 314 else
298 { 315 {
@@ -321,12 +338,15 @@ namespace OpenSim.Region.Framework.Scenes
321 } 338 }
322 else 339 else
323 { 340 {
324 foreach (Scene scene in m_localScenes) 341 lock (m_localScenes)
325 { 342 {
326 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) 343 foreach (Scene scene in m_localScenes)
327 { 344 {
328 m_currentScene = scene; 345 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
329 return true; 346 {
347 m_currentScene = scene;
348 return true;
349 }
330 } 350 }
331 } 351 }
332 352
@@ -338,12 +358,15 @@ namespace OpenSim.Region.Framework.Scenes
338 { 358 {
339 m_log.Debug("Searching for Region: '" + regionID + "'"); 359 m_log.Debug("Searching for Region: '" + regionID + "'");
340 360
341 foreach (Scene scene in m_localScenes) 361 lock (m_localScenes)
342 { 362 {
343 if (scene.RegionInfo.RegionID == regionID) 363 foreach (Scene scene in m_localScenes)
344 { 364 {
345 m_currentScene = scene; 365 if (scene.RegionInfo.RegionID == regionID)
346 return true; 366 {
367 m_currentScene = scene;
368 return true;
369 }
347 } 370 }
348 } 371 }
349 372
@@ -352,26 +375,33 @@ namespace OpenSim.Region.Framework.Scenes
352 375
353 public bool TryGetScene(string regionName, out Scene scene) 376 public bool TryGetScene(string regionName, out Scene scene)
354 { 377 {
355 foreach (Scene mscene in m_localScenes) 378 lock (m_localScenes)
356 { 379 {
357 if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) 380 foreach (Scene mscene in m_localScenes)
358 { 381 {
359 scene = mscene; 382 if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0)
360 return true; 383 {
384 scene = mscene;
385 return true;
386 }
361 } 387 }
362 } 388 }
389
363 scene = null; 390 scene = null;
364 return false; 391 return false;
365 } 392 }
366 393
367 public bool TryGetScene(UUID regionID, out Scene scene) 394 public bool TryGetScene(UUID regionID, out Scene scene)
368 { 395 {
369 foreach (Scene mscene in m_localScenes) 396 lock (m_localScenes)
370 { 397 {
371 if (mscene.RegionInfo.RegionID == regionID) 398 foreach (Scene mscene in m_localScenes)
372 { 399 {
373 scene = mscene; 400 if (mscene.RegionInfo.RegionID == regionID)
374 return true; 401 {
402 scene = mscene;
403 return true;
404 }
375 } 405 }
376 } 406 }
377 407
@@ -381,13 +411,16 @@ namespace OpenSim.Region.Framework.Scenes
381 411
382 public bool TryGetScene(uint locX, uint locY, out Scene scene) 412 public bool TryGetScene(uint locX, uint locY, out Scene scene)
383 { 413 {
384 foreach (Scene mscene in m_localScenes) 414 lock (m_localScenes)
385 { 415 {
386 if (mscene.RegionInfo.RegionLocX == locX && 416 foreach (Scene mscene in m_localScenes)
387 mscene.RegionInfo.RegionLocY == locY)
388 { 417 {
389 scene = mscene; 418 if (mscene.RegionInfo.RegionLocX == locX &&
390 return true; 419 mscene.RegionInfo.RegionLocY == locY)
420 {
421 scene = mscene;
422 return true;
423 }
391 } 424 }
392 } 425 }
393 426
@@ -397,13 +430,16 @@ namespace OpenSim.Region.Framework.Scenes
397 430
398 public bool TryGetScene(IPEndPoint ipEndPoint, out Scene scene) 431 public bool TryGetScene(IPEndPoint ipEndPoint, out Scene scene)
399 { 432 {
400 foreach (Scene mscene in m_localScenes) 433 lock (m_localScenes)
401 { 434 {
402 if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) && 435 foreach (Scene mscene in m_localScenes)
403 (mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port))
404 { 436 {
405 scene = mscene; 437 if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) &&
406 return true; 438 (mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port))
439 {
440 scene = mscene;
441 return true;
442 }
407 } 443 }
408 } 444 }
409 445
@@ -472,11 +508,14 @@ namespace OpenSim.Region.Framework.Scenes
472 508
473 public RegionInfo GetRegionInfo(UUID regionID) 509 public RegionInfo GetRegionInfo(UUID regionID)
474 { 510 {
475 foreach (Scene scene in m_localScenes) 511 lock (m_localScenes)
476 { 512 {
477 if (scene.RegionInfo.RegionID == regionID) 513 foreach (Scene scene in m_localScenes)
478 { 514 {
479 return scene.RegionInfo; 515 if (scene.RegionInfo.RegionID == regionID)
516 {
517 return scene.RegionInfo;
518 }
480 } 519 }
481 } 520 }
482 521
@@ -495,11 +534,14 @@ namespace OpenSim.Region.Framework.Scenes
495 534
496 public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) 535 public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar)
497 { 536 {
498 foreach (Scene scene in m_localScenes) 537 lock (m_localScenes)
499 { 538 {
500 if (scene.TryGetScenePresence(avatarId, out avatar)) 539 foreach (Scene scene in m_localScenes)
501 { 540 {
502 return true; 541 if (scene.TryGetScenePresence(avatarId, out avatar))
542 {
543 return true;
544 }
503 } 545 }
504 } 546 }
505 547
@@ -510,12 +552,16 @@ namespace OpenSim.Region.Framework.Scenes
510 public bool TryGetAvatarsScene(UUID avatarId, out Scene scene) 552 public bool TryGetAvatarsScene(UUID avatarId, out Scene scene)
511 { 553 {
512 ScenePresence avatar = null; 554 ScenePresence avatar = null;
513 foreach (Scene mScene in m_localScenes) 555
556 lock (m_localScenes)
514 { 557 {
515 if (mScene.TryGetScenePresence(avatarId, out avatar)) 558 foreach (Scene mScene in m_localScenes)
516 { 559 {
517 scene = mScene; 560 if (mScene.TryGetScenePresence(avatarId, out avatar))
518 return true; 561 {
562 scene = mScene;
563 return true;
564 }
519 } 565 }
520 } 566 }
521 567
@@ -525,17 +571,22 @@ namespace OpenSim.Region.Framework.Scenes
525 571
526 public void CloseScene(Scene scene) 572 public void CloseScene(Scene scene)
527 { 573 {
528 m_localScenes.Remove(scene); 574 lock (m_localScenes)
575 m_localScenes.Remove(scene);
576
529 scene.Close(); 577 scene.Close();
530 } 578 }
531 579
532 public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) 580 public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
533 { 581 {
534 foreach (Scene scene in m_localScenes) 582 lock (m_localScenes)
535 { 583 {
536 if (scene.TryGetAvatarByName(avatarName, out avatar)) 584 foreach (Scene scene in m_localScenes)
537 { 585 {
538 return true; 586 if (scene.TryGetAvatarByName(avatarName, out avatar))
587 {
588 return true;
589 }
539 } 590 }
540 } 591 }
541 592
@@ -545,7 +596,8 @@ namespace OpenSim.Region.Framework.Scenes
545 596
546 public void ForEachScene(Action<Scene> action) 597 public void ForEachScene(Action<Scene> action)
547 { 598 {
548 m_localScenes.ForEach(action); 599 lock (m_localScenes)
600 m_localScenes.ForEach(action);
549 } 601 }
550 } 602 }
551} 603}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 57baa99..fe96152 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes
1650 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); 1650 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
1651 if (avatar != null) 1651 if (avatar != null)
1652 { 1652 {
1653 avatar.MoveToTarget(target); 1653 avatar.MoveToTarget(target, false);
1654 } 1654 }
1655 } 1655 }
1656 else 1656 else
@@ -2253,7 +2253,7 @@ namespace OpenSim.Region.Framework.Scenes
2253 /// <param name="objectGroup"></param> 2253 /// <param name="objectGroup"></param>
2254 public virtual void DetachFromBackup() 2254 public virtual void DetachFromBackup()
2255 { 2255 {
2256 if (m_isBackedUp) 2256 if (m_isBackedUp && Scene != null)
2257 m_scene.EventManager.OnBackup -= ProcessBackup; 2257 m_scene.EventManager.OnBackup -= ProcessBackup;
2258 2258
2259 m_isBackedUp = false; 2259 m_isBackedUp = false;
@@ -2520,7 +2520,7 @@ namespace OpenSim.Region.Framework.Scenes
2520 { 2520 {
2521 SceneObjectPart selectionPart = GetChildPart(localID); 2521 SceneObjectPart selectionPart = GetChildPart(localID);
2522 2522
2523 if (SetTemporary) 2523 if (SetTemporary && Scene != null)
2524 { 2524 {
2525 DetachFromBackup(); 2525 DetachFromBackup();
2526 // Remove from database and parcel prim count 2526 // Remove from database and parcel prim count
@@ -2532,15 +2532,19 @@ namespace OpenSim.Region.Framework.Scenes
2532 if (selectionPart != null) 2532 if (selectionPart != null)
2533 { 2533 {
2534 SceneObjectPart[] parts = m_parts.GetArray(); 2534 SceneObjectPart[] parts = m_parts.GetArray();
2535 for (int i = 0; i < parts.Length; i++) 2535
2536 if (Scene != null)
2536 { 2537 {
2537 SceneObjectPart part = parts[i]; 2538 for (int i = 0; i < parts.Length; i++)
2538 if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax ||
2539 part.Scale.Y > m_scene.RegionInfo.PhysPrimMax ||
2540 part.Scale.Z > m_scene.RegionInfo.PhysPrimMax)
2541 { 2539 {
2542 UsePhysics = false; // Reset physics 2540 SceneObjectPart part = parts[i];
2543 break; 2541 if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax ||
2542 part.Scale.Y > m_scene.RegionInfo.PhysPrimMax ||
2543 part.Scale.Z > m_scene.RegionInfo.PhysPrimMax)
2544 {
2545 UsePhysics = false; // Reset physics
2546 break;
2547 }
2544 } 2548 }
2545 } 2549 }
2546 2550
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 90ad34e..a0e87d0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -261,12 +261,9 @@ namespace OpenSim.Region.Framework.Scenes
261 } 261 }
262 protected SceneObjectPartInventory m_inventory; 262 protected SceneObjectPartInventory m_inventory;
263 263
264
265 public bool Undoing; 264 public bool Undoing;
266
267 265
268 public bool IgnoreUndoUpdate = false; 266 public bool IgnoreUndoUpdate = false;
269
270 267
271 private PrimFlags LocalFlags; 268 private PrimFlags LocalFlags;
272 269
@@ -1606,7 +1603,6 @@ namespace OpenSim.Region.Framework.Scenes
1606 RotationOffset, 1603 RotationOffset,
1607 RigidBody, 1604 RigidBody,
1608 m_localId); 1605 m_localId);
1609 PhysActor.SetMaterial(Material);
1610 } 1606 }
1611 catch 1607 catch
1612 { 1608 {
@@ -1618,6 +1614,7 @@ namespace OpenSim.Region.Framework.Scenes
1618 { 1614 {
1619 PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info 1615 PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info
1620 PhysActor.SOPDescription = this.Description; 1616 PhysActor.SOPDescription = this.Description;
1617 PhysActor.SetMaterial(Material);
1621 DoPhysicsPropertyUpdate(RigidBody, true); 1618 DoPhysicsPropertyUpdate(RigidBody, true);
1622 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1619 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1623 } 1620 }
@@ -2970,22 +2967,6 @@ namespace OpenSim.Region.Framework.Scenes
2970 } 2967 }
2971 } 2968 }
2972 2969
2973 public void ScriptSetPhantomStatus(bool Phantom)
2974 {
2975 if (m_parentGroup != null)
2976 {
2977 m_parentGroup.ScriptSetPhantomStatus(Phantom);
2978 }
2979 }
2980
2981 public void ScriptSetTemporaryStatus(bool Temporary)
2982 {
2983 if (m_parentGroup != null)
2984 {
2985 m_parentGroup.ScriptSetTemporaryStatus(Temporary);
2986 }
2987 }
2988
2989 public void ScriptSetPhysicsStatus(bool UsePhysics) 2970 public void ScriptSetPhysicsStatus(bool UsePhysics)
2990 { 2971 {
2991 if (m_parentGroup == null) 2972 if (m_parentGroup == null)
@@ -2994,15 +2975,6 @@ namespace OpenSim.Region.Framework.Scenes
2994 m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); 2975 m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
2995 } 2976 }
2996 2977
2997 public void ScriptSetVolumeDetect(bool SetVD)
2998 {
2999
3000 if (m_parentGroup != null)
3001 {
3002 m_parentGroup.ScriptSetVolumeDetect(SetVD);
3003 }
3004 }
3005
3006 /// <summary> 2978 /// <summary>
3007 /// Set sculpt and mesh data, and tell the physics engine to process the change. 2979 /// Set sculpt and mesh data, and tell the physics engine to process the change.
3008 /// </summary> 2980 /// </summary>
@@ -4542,6 +4514,9 @@ namespace OpenSim.Region.Framework.Scenes
4542 { 4514 {
4543 RemFlag(PrimFlags.Phantom); 4515 RemFlag(PrimFlags.Phantom);
4544 4516
4517 if (ParentGroup.Scene == null)
4518 return;
4519
4545 PhysicsActor pa = PhysActor; 4520 PhysicsActor pa = PhysActor;
4546 4521
4547 if (pa == null) 4522 if (pa == null)
@@ -4555,11 +4530,11 @@ namespace OpenSim.Region.Framework.Scenes
4555 RotationOffset, 4530 RotationOffset,
4556 UsePhysics, 4531 UsePhysics,
4557 m_localId); 4532 m_localId);
4558 PhysActor.SetMaterial(Material);
4559 4533
4560 pa = PhysActor; 4534 pa = PhysActor;
4561 if (pa != null) 4535 if (pa != null)
4562 { 4536 {
4537 PhysActor.SetMaterial(Material);
4563 DoPhysicsPropertyUpdate(UsePhysics, true); 4538 DoPhysicsPropertyUpdate(UsePhysics, true);
4564 4539
4565 if (m_parentGroup != null) 4540 if (m_parentGroup != null)
@@ -4645,6 +4620,8 @@ namespace OpenSim.Region.Framework.Scenes
4645 4620
4646 ParentGroup.HasGroupChanged = true; 4621 ParentGroup.HasGroupChanged = true;
4647 ScheduleFullUpdate(); 4622 ScheduleFullUpdate();
4623
4624// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
4648 } 4625 }
4649 4626
4650 public void UpdateRotation(Quaternion rot) 4627 public void UpdateRotation(Quaternion rot)
@@ -4864,7 +4841,7 @@ namespace OpenSim.Region.Framework.Scenes
4864 // m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; 4841 // m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting;
4865 //} 4842 //}
4866 4843
4867 LocalFlags=(PrimFlags)objectflagupdate; 4844 LocalFlags = (PrimFlags)objectflagupdate;
4868 4845
4869 if (m_parentGroup != null && m_parentGroup.RootPart == this) 4846 if (m_parentGroup != null && m_parentGroup.RootPart == this)
4870 { 4847 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d354c0a..719f2da 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -75,6 +75,11 @@ namespace OpenSim.Region.Framework.Scenes
75 75
76 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 76 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
77 77
78 /// <summary>
79 /// What type of presence is this? User, NPC, etc.
80 /// </summary>
81 public PresenceType PresenceType { get; private set; }
82
78// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); 83// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
79 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); 84 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
80 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); 85 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
@@ -173,7 +178,7 @@ namespace OpenSim.Region.Framework.Scenes
173 178
174 private float m_speedModifier = 1.0f; 179 private float m_speedModifier = 1.0f;
175 180
176 private Quaternion m_bodyRot= Quaternion.Identity; 181 private Quaternion m_bodyRot = Quaternion.Identity;
177 182
178 private Quaternion m_bodyRotPrevious = Quaternion.Identity; 183 private Quaternion m_bodyRotPrevious = Quaternion.Identity;
179 184
@@ -708,15 +713,13 @@ namespace OpenSim.Region.Framework.Scenes
708 713
709 #region Constructor(s) 714 #region Constructor(s)
710 715
711 public ScenePresence() 716 public ScenePresence(
717 IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type)
712 { 718 {
713 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 719 m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
714 CreateSceneViewer(); 720 m_sceneViewer = new SceneViewer(this);
715 m_animator = new ScenePresenceAnimator(this); 721 m_animator = new ScenePresenceAnimator(this);
716 } 722 PresenceType = type;
717
718 private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this()
719 {
720 m_DrawDistance = world.DefaultDrawDistance; 723 m_DrawDistance = world.DefaultDrawDistance;
721 m_rootRegionHandle = reginfo.RegionHandle; 724 m_rootRegionHandle = reginfo.RegionHandle;
722 m_controllingClient = client; 725 m_controllingClient = client;
@@ -762,19 +765,10 @@ namespace OpenSim.Region.Framework.Scenes
762 765
763 RegisterToEvents(); 766 RegisterToEvents();
764 SetDirectionVectors(); 767 SetDirectionVectors();
765 }
766 768
767 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance)
768 : this(client, world, reginfo)
769 {
770 m_appearance = appearance; 769 m_appearance = appearance;
771 } 770 }
772 771
773 private void CreateSceneViewer()
774 {
775 m_sceneViewer = new SceneViewer(this);
776 }
777
778 public void RegisterToEvents() 772 public void RegisterToEvents()
779 { 773 {
780 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; 774 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
@@ -1144,10 +1138,14 @@ namespace OpenSim.Region.Framework.Scenes
1144 1138
1145 /// <summary> 1139 /// <summary>
1146 /// Complete Avatar's movement into the region. 1140 /// Complete Avatar's movement into the region.
1147 /// This is called upon a very important packet sent from the client,
1148 /// so it's client-controlled. Never call this method directly.
1149 /// </summary> 1141 /// </summary>
1150 public void CompleteMovement(IClientAPI client) 1142 /// <param name="client"></param>
1143 /// <param name="openChildAgents">
1144 /// If true, send notification to neighbour regions to expect
1145 /// a child agent from the client. These neighbours can be some distance away, depending right now on the
1146 /// configuration of DefaultDrawDistance in the [Startup] section of config
1147 /// </param>
1148 public void CompleteMovement(IClientAPI client, bool openChildAgents)
1151 { 1149 {
1152// DateTime startTime = DateTime.Now; 1150// DateTime startTime = DateTime.Now;
1153 1151
@@ -1188,15 +1186,11 @@ namespace OpenSim.Region.Framework.Scenes
1188 SendInitialData(); 1186 SendInitialData();
1189 1187
1190 // Create child agents in neighbouring regions 1188 // Create child agents in neighbouring regions
1191 if (!m_isChildAgent) 1189 if (openChildAgents && !m_isChildAgent)
1192 { 1190 {
1193 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1191 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1194 if (m_agentTransfer != null) 1192 if (m_agentTransfer != null)
1195 m_agentTransfer.EnableChildAgents(this); 1193 m_agentTransfer.EnableChildAgents(this);
1196 else
1197 m_log.DebugFormat(
1198 "[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active for region {0}",
1199 m_scene.RegionInfo.RegionName);
1200 1194
1201 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); 1195 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
1202 if (friendsModule != null) 1196 if (friendsModule != null)
@@ -1294,7 +1288,6 @@ namespace OpenSim.Region.Framework.Scenes
1294 #region Inputs 1288 #region Inputs
1295 1289
1296 AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; 1290 AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags;
1297 Quaternion bodyRotation = agentData.BodyRotation;
1298 1291
1299 // Camera location in world. We'll need to raytrace 1292 // Camera location in world. We'll need to raytrace
1300 // from this location from time to time. 1293 // from this location from time to time.
@@ -1380,6 +1373,15 @@ namespace OpenSim.Region.Framework.Scenes
1380 1373
1381 if (m_allowMovement && !SitGround) 1374 if (m_allowMovement && !SitGround)
1382 { 1375 {
1376 Quaternion bodyRotation = agentData.BodyRotation;
1377 bool update_rotation = false;
1378
1379 if (bodyRotation != m_bodyRot)
1380 {
1381 Rotation = bodyRotation;
1382 update_rotation = true;
1383 }
1384
1383 bool update_movementflag = false; 1385 bool update_movementflag = false;
1384 1386
1385 if (agentData.UseClientAgentPosition) 1387 if (agentData.UseClientAgentPosition)
@@ -1389,11 +1391,8 @@ namespace OpenSim.Region.Framework.Scenes
1389 } 1391 }
1390 1392
1391 int i = 0; 1393 int i = 0;
1392
1393 bool update_rotation = false;
1394 bool DCFlagKeyPressed = false; 1394 bool DCFlagKeyPressed = false;
1395 Vector3 agent_control_v3 = Vector3.Zero; 1395 Vector3 agent_control_v3 = Vector3.Zero;
1396 Quaternion q = bodyRotation;
1397 1396
1398 bool oldflying = PhysicsActor.Flying; 1397 bool oldflying = PhysicsActor.Flying;
1399 1398
@@ -1407,12 +1406,6 @@ namespace OpenSim.Region.Framework.Scenes
1407 if (actor.Flying != oldflying) 1406 if (actor.Flying != oldflying)
1408 update_movementflag = true; 1407 update_movementflag = true;
1409 1408
1410 if (q != m_bodyRot)
1411 {
1412 m_bodyRot = q;
1413 update_rotation = true;
1414 }
1415
1416 if (m_parentID == 0) 1409 if (m_parentID == 0)
1417 { 1410 {
1418 bool bAllowUpdateMoveToPosition = false; 1411 bool bAllowUpdateMoveToPosition = false;
@@ -1464,8 +1457,8 @@ namespace OpenSim.Region.Framework.Scenes
1464 ) // This or is for Nudge forward 1457 ) // This or is for Nudge forward
1465 { 1458 {
1466 m_movementflag -= ((byte)(uint)DCF); 1459 m_movementflag -= ((byte)(uint)DCF);
1467
1468 update_movementflag = true; 1460 update_movementflag = true;
1461
1469 /* 1462 /*
1470 if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) 1463 if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE)
1471 && ((m_movementflag & (byte)nudgehack) == nudgehack)) 1464 && ((m_movementflag & (byte)nudgehack) == nudgehack))
@@ -1493,7 +1486,7 @@ namespace OpenSim.Region.Framework.Scenes
1493 } 1486 }
1494 else if (bAllowUpdateMoveToPosition) 1487 else if (bAllowUpdateMoveToPosition)
1495 { 1488 {
1496 if (HandleMoveToTargetUpdate(ref agent_control_v3, bodyRotation)) 1489 if (HandleMoveToTargetUpdate(ref agent_control_v3))
1497 update_movementflag = true; 1490 update_movementflag = true;
1498 } 1491 }
1499 } 1492 }
@@ -1531,13 +1524,10 @@ namespace OpenSim.Region.Framework.Scenes
1531 // m_log.DebugFormat( 1524 // m_log.DebugFormat(
1532 // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); 1525 // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
1533 1526
1534 AddNewMovement(agent_control_v3, q); 1527 AddNewMovement(agent_control_v3);
1535 } 1528 }
1536 1529
1537 if (update_movementflag 1530 if (update_movementflag && m_parentID == 0)
1538 && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0)
1539 && (m_parentID == 0)
1540 && !SitGround)
1541 Animator.UpdateMovementAnimations(); 1531 Animator.UpdateMovementAnimations();
1542 } 1532 }
1543 1533
@@ -1553,9 +1543,8 @@ namespace OpenSim.Region.Framework.Scenes
1553 /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3. 1543 /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3.
1554 /// </remarks> 1544 /// </remarks>
1555 /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param> 1545 /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param>
1556 /// <param value="bodyRotation">New body rotation of the avatar.</param>
1557 /// <returns>True if movement has been updated in some way. False otherwise.</returns> 1546 /// <returns>True if movement has been updated in some way. False otherwise.</returns>
1558 public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3, Quaternion bodyRotation) 1547 public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3)
1559 { 1548 {
1560// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); 1549// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
1561 1550
@@ -1591,7 +1580,7 @@ namespace OpenSim.Region.Framework.Scenes
1591 // to such forces, but the following simple approach seems to works fine. 1580 // to such forces, but the following simple approach seems to works fine.
1592 Vector3 LocalVectorToTarget3D = 1581 Vector3 LocalVectorToTarget3D =
1593 (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords 1582 (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
1594 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords 1583 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(Rotation)); // change to avatar coords
1595 // Ignore z component of vector 1584 // Ignore z component of vector
1596// Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); 1585// Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
1597 LocalVectorToTarget3D.Normalize(); 1586 LocalVectorToTarget3D.Normalize();
@@ -1680,7 +1669,12 @@ namespace OpenSim.Region.Framework.Scenes
1680 /// Move to the given target over time. 1669 /// Move to the given target over time.
1681 /// </summary> 1670 /// </summary>
1682 /// <param name="pos"></param> 1671 /// <param name="pos"></param>
1683 public void MoveToTarget(Vector3 pos) 1672 /// <param name="noFly">
1673 /// If true, then don't allow the avatar to fly to the target, even if it's up in the air.
1674 /// This is to allow movement to targets that are known to be on an elevated platform with a continuous path
1675 /// from start to finish.
1676 /// </param>
1677 public void MoveToTarget(Vector3 pos, bool noFly)
1684 { 1678 {
1685// m_log.DebugFormat( 1679// m_log.DebugFormat(
1686// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", 1680// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
@@ -1714,15 +1708,17 @@ namespace OpenSim.Region.Framework.Scenes
1714 "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", 1708 "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
1715 Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); 1709 Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
1716 1710
1717 if (pos.Z > terrainHeight) 1711 if (noFly)
1712 PhysicsActor.Flying = false;
1713 else if (pos.Z > terrainHeight)
1718 PhysicsActor.Flying = true; 1714 PhysicsActor.Flying = true;
1719 1715
1720 MovingToTarget = true; 1716 MovingToTarget = true;
1721 MoveToPositionTarget = pos; 1717 MoveToPositionTarget = pos;
1722 1718
1723 Vector3 agent_control_v3 = new Vector3(); 1719 Vector3 agent_control_v3 = new Vector3();
1724 HandleMoveToTargetUpdate(ref agent_control_v3, Rotation); 1720 HandleMoveToTargetUpdate(ref agent_control_v3);
1725 AddNewMovement(agent_control_v3, Rotation); 1721 AddNewMovement(agent_control_v3);
1726 } 1722 }
1727 1723
1728 /// <summary> 1724 /// <summary>
@@ -1734,6 +1730,12 @@ namespace OpenSim.Region.Framework.Scenes
1734 1730
1735 MovingToTarget = false; 1731 MovingToTarget = false;
1736 MoveToPositionTarget = Vector3.Zero; 1732 MoveToPositionTarget = Vector3.Zero;
1733
1734 // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct
1735 // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag.
1736 // However, the line is here rather than in the NPC module since it also appears necessary to stop a
1737 // viewer that uses "go here" from juddering on all subsequent avatar movements.
1738 AgentControlFlags = (uint)AgentManager.ControlFlags.NONE;
1737 } 1739 }
1738 1740
1739 private void CheckAtSitTarget() 1741 private void CheckAtSitTarget()
@@ -2295,20 +2297,11 @@ namespace OpenSim.Region.Framework.Scenes
2295 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector 2297 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector
2296 /// </summary> 2298 /// </summary>
2297 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> 2299 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
2298 /// <param name="rotation">The direction in which this avatar should now face. 2300 public void AddNewMovement(Vector3 vec)
2299 public void AddNewMovement(Vector3 vec, Quaternion rotation)
2300 { 2301 {
2301 if (m_isChildAgent)
2302 {
2303 // WHAT???
2304 m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!");
2305 return;
2306 }
2307
2308 m_perfMonMS = Util.EnvironmentTickCount(); 2302 m_perfMonMS = Util.EnvironmentTickCount();
2309 2303
2310 Rotation = rotation; 2304 Vector3 direc = vec * Rotation;
2311 Vector3 direc = vec * rotation;
2312 direc.Normalize(); 2305 direc.Normalize();
2313 2306
2314 direc *= 0.03f * 128f * m_speedModifier; 2307 direc *= 0.03f * 128f * m_speedModifier;
@@ -2513,13 +2506,7 @@ namespace OpenSim.Region.Framework.Scenes
2513 // We have an appearance but we may not have the baked textures. Check the asset cache 2506 // We have an appearance but we may not have the baked textures. Check the asset cache
2514 // to see if all the baked textures are already here. 2507 // to see if all the baked textures are already here.
2515 if (m_scene.AvatarFactory != null) 2508 if (m_scene.AvatarFactory != null)
2516 {
2517 cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient); 2509 cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient);
2518 }
2519 else
2520 {
2521 m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name);
2522 }
2523 2510
2524 // If we aren't using a cached appearance, then clear out the baked textures 2511 // If we aren't using a cached appearance, then clear out the baked textures
2525 if (!cachedappearance) 2512 if (!cachedappearance)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
index 3a0dd00..ab6311b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
41 [Test] 41 [Test]
42 public void TestCross() 42 public void TestCross()
43 { 43 {
44 TestHelper.InMethod(); 44 TestHelpers.InMethod();
45 45
46 List<Border> testborders = new List<Border>(); 46 List<Border> testborders = new List<Border>();
47 47
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
99 [Test] 99 [Test]
100 public void TestCrossSquare512() 100 public void TestCrossSquare512()
101 { 101 {
102 TestHelper.InMethod(); 102 TestHelpers.InMethod();
103 103
104 List<Border> testborders = new List<Border>(); 104 List<Border> testborders = new List<Border>();
105 105
@@ -179,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
179 [Test] 179 [Test]
180 public void TestCrossRectangle512x256() 180 public void TestCrossRectangle512x256()
181 { 181 {
182 TestHelper.InMethod(); 182 TestHelpers.InMethod();
183 183
184 List<Border> testborders = new List<Border>(); 184 List<Border> testborders = new List<Border>();
185 185
@@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
259 [Test] 259 [Test]
260 public void TestCrossOdd512x512w256hole() 260 public void TestCrossOdd512x512w256hole()
261 { 261 {
262 TestHelper.InMethod(); 262 TestHelpers.InMethod();
263 263
264 List<Border> testborders = new List<Border>(); 264 List<Border> testborders = new List<Border>();
265 // 512____ 265 // 512____
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index f69a4b4..a5d2b23 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -45,12 +45,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
45 { 45 {
46 static public Random random; 46 static public Random random;
47 SceneObjectGroup found; 47 SceneObjectGroup found;
48 Scene scene = SceneSetupHelpers.SetupScene(); 48 Scene scene = SceneHelpers.SetupScene();
49 49
50 [Test] 50 [Test]
51 public void T010_AddObjects() 51 public void T010_AddObjects()
52 { 52 {
53 TestHelper.InMethod(); 53 TestHelpers.InMethod();
54 54
55 random = new Random(); 55 random = new Random();
56 SceneObjectGroup found; 56 SceneObjectGroup found;
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
85 [Test] 85 [Test]
86 public void T011_ThreadAddRemoveTest() 86 public void T011_ThreadAddRemoveTest()
87 { 87 {
88 TestHelper.InMethod(); 88 TestHelpers.InMethod();
89 89
90 // This test adds and removes with mutiple threads, attempting to break the 90 // This test adds and removes with mutiple threads, attempting to break the
91 // uuid and localid dictionary coherence. 91 // uuid and localid dictionary coherence.
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index 895f2bb..9a60e50 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -43,8 +43,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
43 [Test] 43 [Test]
44 public void TestDuplicateObject() 44 public void TestDuplicateObject()
45 { 45 {
46 TestHelper.InMethod(); 46 TestHelpers.InMethod();
47 Scene scene = SceneSetupHelpers.SetupScene(); 47 Scene scene = SceneHelpers.SetupScene();
48 48
49 UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); 49 UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010");
50 string part1Name = "part1"; 50 string part1Name = "part1";
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 260d1c0..1ea2329 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -49,9 +49,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
49 [Test] 49 [Test]
50 public void TestAddSceneObject() 50 public void TestAddSceneObject()
51 { 51 {
52 TestHelper.InMethod(); 52 TestHelpers.InMethod();
53 53
54 Scene scene = SceneSetupHelpers.SetupScene(); 54 Scene scene = SceneHelpers.SetupScene();
55 55
56 string objName = "obj1"; 56 string objName = "obj1";
57 UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); 57 UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
@@ -76,9 +76,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
76 /// </summary> 76 /// </summary>
77 public void TestAddExistingSceneObjectUuid() 77 public void TestAddExistingSceneObjectUuid()
78 { 78 {
79 TestHelper.InMethod(); 79 TestHelpers.InMethod();
80 80
81 Scene scene = SceneSetupHelpers.SetupScene(); 81 Scene scene = SceneHelpers.SetupScene();
82 82
83 string obj1Name = "Alfred"; 83 string obj1Name = "Alfred";
84 string obj2Name = "Betty"; 84 string obj2Name = "Betty";
@@ -110,10 +110,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
110 [Test] 110 [Test]
111 public void TestDeleteSceneObject() 111 public void TestDeleteSceneObject()
112 { 112 {
113 TestHelper.InMethod(); 113 TestHelpers.InMethod();
114 114
115 TestScene scene = SceneSetupHelpers.SetupScene(); 115 TestScene scene = SceneHelpers.SetupScene();
116 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 116 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
117 scene.DeleteSceneObject(part.ParentGroup, false); 117 scene.DeleteSceneObject(part.ParentGroup, false);
118 118
119 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 119 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
@@ -126,20 +126,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests
126 [Test] 126 [Test]
127 public void TestDeleteSceneObjectAsync() 127 public void TestDeleteSceneObjectAsync()
128 { 128 {
129 TestHelper.InMethod(); 129 TestHelpers.InMethod();
130 //log4net.Config.XmlConfigurator.Configure(); 130 //log4net.Config.XmlConfigurator.Configure();
131 131
132 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 132 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
133 133
134 TestScene scene = SceneSetupHelpers.SetupScene(); 134 TestScene scene = SceneHelpers.SetupScene();
135 135
136 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 136 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
137 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 137 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
138 sogd.Enabled = false; 138 sogd.Enabled = false;
139 139
140 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 140 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
141 141
142 IClientAPI client = SceneSetupHelpers.AddClient(scene, agentId); 142 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
143 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); 143 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
144 144
145 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 145 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 1b8c100..654b1a2 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -56,17 +56,17 @@ namespace OpenSim.Region.Framework.Scenes.Tests
56 [Test] 56 [Test]
57 public void TestDeRezSceneObject() 57 public void TestDeRezSceneObject()
58 { 58 {
59 TestHelper.InMethod(); 59 TestHelpers.InMethod();
60// log4net.Config.XmlConfigurator.Configure(); 60// log4net.Config.XmlConfigurator.Configure();
61 61
62 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); 62 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
63 63
64 TestScene scene = SceneSetupHelpers.SetupScene(); 64 TestScene scene = SceneHelpers.SetupScene();
65 IConfigSource configSource = new IniConfigSource(); 65 IConfigSource configSource = new IniConfigSource();
66 IConfig config = configSource.AddConfig("Startup"); 66 IConfig config = configSource.AddConfig("Startup");
67 config.Set("serverside_object_permissions", true); 67 config.Set("serverside_object_permissions", true);
68 SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); 68 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
69 TestClient client = SceneSetupHelpers.AddClient(scene, userId); 69 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
70 70
71 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 71 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
72 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 72 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
@@ -94,18 +94,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests
94 [Test] 94 [Test]
95 public void TestDeRezSceneObjectNotOwner() 95 public void TestDeRezSceneObjectNotOwner()
96 { 96 {
97 TestHelper.InMethod(); 97 TestHelpers.InMethod();
98// log4net.Config.XmlConfigurator.Configure(); 98// log4net.Config.XmlConfigurator.Configure();
99 99
100 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); 100 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
101 UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); 101 UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001");
102 102
103 TestScene scene = SceneSetupHelpers.SetupScene(); 103 TestScene scene = SceneHelpers.SetupScene();
104 IConfigSource configSource = new IniConfigSource(); 104 IConfigSource configSource = new IniConfigSource();
105 IConfig config = configSource.AddConfig("Startup"); 105 IConfig config = configSource.AddConfig("Startup");
106 config.Set("serverside_object_permissions", true); 106 config.Set("serverside_object_permissions", true);
107 SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); 107 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
108 TestClient client = SceneSetupHelpers.AddClient(scene, userId); 108 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
109 109
110 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 110 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
111 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 111 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index cb1d531..2912a46 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -50,14 +50,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
50 [Test] 50 [Test]
51 public void TestLinkDelink2SceneObjects() 51 public void TestLinkDelink2SceneObjects()
52 { 52 {
53 TestHelper.InMethod(); 53 TestHelpers.InMethod();
54 54
55 bool debugtest = false; 55 bool debugtest = false;
56 56
57 Scene scene = SceneSetupHelpers.SetupScene(); 57 Scene scene = SceneHelpers.SetupScene();
58 SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); 58 SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
59 SceneObjectGroup grp1 = part1.ParentGroup; 59 SceneObjectGroup grp1 = part1.ParentGroup;
60 SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); 60 SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
61 SceneObjectGroup grp2 = part2.ParentGroup; 61 SceneObjectGroup grp2 = part2.ParentGroup;
62 62
63 grp1.AbsolutePosition = new Vector3(10, 10, 10); 63 grp1.AbsolutePosition = new Vector3(10, 10, 10);
@@ -132,18 +132,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests
132 [Test] 132 [Test]
133 public void TestLinkDelink2groups4SceneObjects() 133 public void TestLinkDelink2groups4SceneObjects()
134 { 134 {
135 TestHelper.InMethod(); 135 TestHelpers.InMethod();
136 136
137 bool debugtest = false; 137 bool debugtest = false;
138 138
139 Scene scene = SceneSetupHelpers.SetupScene(); 139 Scene scene = SceneHelpers.SetupScene();
140 SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); 140 SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
141 SceneObjectGroup grp1 = part1.ParentGroup; 141 SceneObjectGroup grp1 = part1.ParentGroup;
142 SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); 142 SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
143 SceneObjectGroup grp2 = part2.ParentGroup; 143 SceneObjectGroup grp2 = part2.ParentGroup;
144 SceneObjectPart part3 = SceneSetupHelpers.AddSceneObject(scene); 144 SceneObjectPart part3 = SceneHelpers.AddSceneObject(scene);
145 SceneObjectGroup grp3 = part3.ParentGroup; 145 SceneObjectGroup grp3 = part3.ParentGroup;
146 SceneObjectPart part4 = SceneSetupHelpers.AddSceneObject(scene); 146 SceneObjectPart part4 = SceneHelpers.AddSceneObject(scene);
147 SceneObjectGroup grp4 = part4.ParentGroup; 147 SceneObjectGroup grp4 = part4.ParentGroup;
148 148
149 grp1.AbsolutePosition = new Vector3(10, 10, 10); 149 grp1.AbsolutePosition = new Vector3(10, 10, 10);
@@ -266,10 +266,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
266 [Test] 266 [Test]
267 public void TestNewSceneObjectLinkPersistence() 267 public void TestNewSceneObjectLinkPersistence()
268 { 268 {
269 TestHelper.InMethod(); 269 TestHelpers.InMethod();
270 //log4net.Config.XmlConfigurator.Configure(); 270 //log4net.Config.XmlConfigurator.Configure();
271 271
272 TestScene scene = SceneSetupHelpers.SetupScene(); 272 TestScene scene = SceneHelpers.SetupScene();
273 273
274 string rootPartName = "rootpart"; 274 string rootPartName = "rootpart";
275 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); 275 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
@@ -305,10 +305,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
305 [Test] 305 [Test]
306 public void TestDelinkPersistence() 306 public void TestDelinkPersistence()
307 { 307 {
308 TestHelper.InMethod(); 308 TestHelpers.InMethod();
309 //log4net.Config.XmlConfigurator.Configure(); 309 //log4net.Config.XmlConfigurator.Configure();
310 310
311 TestScene scene = SceneSetupHelpers.SetupScene(); 311 TestScene scene = SceneHelpers.SetupScene();
312 312
313 string rootPartName = "rootpart"; 313 string rootPartName = "rootpart";
314 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); 314 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
index c4047ee..b49c6e7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
@@ -49,11 +49,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
49 [Test] 49 [Test]
50 public void TestResizeSceneObject() 50 public void TestResizeSceneObject()
51 { 51 {
52 TestHelper.InMethod(); 52 TestHelpers.InMethod();
53// log4net.Config.XmlConfigurator.Configure(); 53// log4net.Config.XmlConfigurator.Configure();
54 54
55 Scene scene = SceneSetupHelpers.SetupScene(); 55 Scene scene = SceneHelpers.SetupScene();
56 SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup; 56 SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup;
57 57
58 g1.GroupResize(new Vector3(2, 3, 4)); 58 g1.GroupResize(new Vector3(2, 3, 4));
59 59
@@ -72,12 +72,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
72 [Test] 72 [Test]
73 public void TestResizeSceneObjectPart() 73 public void TestResizeSceneObjectPart()
74 { 74 {
75 TestHelper.InMethod(); 75 TestHelpers.InMethod();
76 //log4net.Config.XmlConfigurator.Configure(); 76 //log4net.Config.XmlConfigurator.Configure();
77 77
78 Scene scene = SceneSetupHelpers.SetupScene(); 78 Scene scene = SceneHelpers.SetupScene();
79 79
80 SceneObjectGroup g1 = SceneSetupHelpers.CreateSceneObject(2, UUID.Zero); 80 SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero);
81 g1.RootPart.Scale = new Vector3(2, 3, 4); 81 g1.RootPart.Scale = new Vector3(2, 3, 4);
82 g1.Parts[1].Scale = new Vector3(5, 6, 7); 82 g1.Parts[1].Scale = new Vector3(5, 6, 7);
83 83
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
new file mode 100644
index 0000000..2a342d5
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -0,0 +1,66 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using NUnit.Framework;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Mock;
37
38namespace OpenSim.Region.Framework.Scenes.Tests
39{
40 /// <summary>
41 /// Basic scene object status tests
42 /// </summary>
43 [TestFixture]
44 public class SceneObjectStatusTests
45 {
46 [Test]
47 public void TestSetPhantom()
48 {
49 TestHelpers.InMethod();
50
51// Scene scene = SceneSetupHelpers.SetupScene();
52 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
53 SceneObjectPart rootPart = so.RootPart;
54 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
55
56 so.ScriptSetPhantomStatus(true);
57
58// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
59 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
60
61 so.ScriptSetPhantomStatus(false);
62
63 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
64 }
65 }
66} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
index 8425d37..c13d82e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
@@ -53,12 +53,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
53 [Test] 53 [Test]
54 public void TestShareWithGroup() 54 public void TestShareWithGroup()
55 { 55 {
56 TestHelper.InMethod(); 56 TestHelpers.InMethod();
57// log4net.Config.XmlConfigurator.Configure(); 57// log4net.Config.XmlConfigurator.Configure();
58 58
59 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); 59 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
60 60
61 TestScene scene = SceneSetupHelpers.SetupScene(); 61 TestScene scene = SceneHelpers.SetupScene();
62 IConfigSource configSource = new IniConfigSource(); 62 IConfigSource configSource = new IniConfigSource();
63 63
64 IConfig startupConfig = configSource.AddConfig("Startup"); 64 IConfig startupConfig = configSource.AddConfig("Startup");
@@ -69,13 +69,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
69 groupsConfig.Set("Module", "GroupsModule"); 69 groupsConfig.Set("Module", "GroupsModule");
70 groupsConfig.Set("DebugEnabled", true); 70 groupsConfig.Set("DebugEnabled", true);
71 71
72 SceneSetupHelpers.SetupSceneModules( 72 SceneHelpers.SetupSceneModules(
73 scene, configSource, new object[] 73 scene, configSource, new object[]
74 { new PermissionsModule(), 74 { new PermissionsModule(),
75 new GroupsModule(), 75 new GroupsModule(),
76 new MockGroupsServicesConnector() }); 76 new MockGroupsServicesConnector() });
77 77
78 TestClient client = SceneSetupHelpers.AddClient(scene, userId); 78 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
79 79
80 IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>(); 80 IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>();
81 81
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index a37b338..35b41fb 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
51 /// Scene presence tests 51 /// Scene presence tests
52 /// </summary> 52 /// </summary>
53 [TestFixture] 53 [TestFixture]
54 public class ScenePresenceTests 54 public class ScenePresenceAgentTests
55 { 55 {
56 public Scene scene, scene2, scene3; 56 public Scene scene, scene2, scene3;
57 public UUID agent1, agent2, agent3; 57 public UUID agent1, agent2, agent3;
@@ -64,90 +64,140 @@ namespace OpenSim.Region.Framework.Scenes.Tests
64 [TestFixtureSetUp] 64 [TestFixtureSetUp]
65 public void Init() 65 public void Init()
66 { 66 {
67 TestHelper.InMethod(); 67 TestHelpers.InMethod();
68 68
69 scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); 69 scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
70 scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); 70 scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
71 scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); 71 scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
72 72
73 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); 73 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
74 interregionComms.Initialise(new IniConfigSource()); 74 interregionComms.Initialise(new IniConfigSource());
75 interregionComms.PostInitialise(); 75 interregionComms.PostInitialise();
76 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); 76 SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
77 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); 77 SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
78 SceneSetupHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); 78 SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
79 79
80 agent1 = UUID.Random(); 80 agent1 = UUID.Random();
81 agent2 = UUID.Random(); 81 agent2 = UUID.Random();
82 agent3 = UUID.Random(); 82 agent3 = UUID.Random();
83 random = new Random(); 83 random = new Random();
84 sog1 = NewSOG(UUID.Random(), scene, agent1); 84 sog1 = SceneHelpers.CreateSceneObject(1, agent1);
85 sog2 = NewSOG(UUID.Random(), scene, agent1); 85 scene.AddSceneObject(sog1);
86 sog3 = NewSOG(UUID.Random(), scene, agent1); 86 sog2 = SceneHelpers.CreateSceneObject(1, agent1);
87 scene.AddSceneObject(sog2);
88 sog3 = SceneHelpers.CreateSceneObject(1, agent1);
89 scene.AddSceneObject(sog3);
87 90
88 //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
89 region1 = scene.RegionInfo.RegionHandle; 91 region1 = scene.RegionInfo.RegionHandle;
90 region2 = scene2.RegionInfo.RegionHandle; 92 region2 = scene2.RegionInfo.RegionHandle;
91 region3 = scene3.RegionInfo.RegionHandle; 93 region3 = scene3.RegionInfo.RegionHandle;
92 } 94 }
93 95
94 /// <summary>
95 /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
96 /// </summary>
97 [Test] 96 [Test]
98 public void T010_TestAddRootAgent() 97 public void TestCloseAgent()
99 { 98 {
100 TestHelper.InMethod(); 99 TestHelpers.InMethod();
101 100// log4net.Config.XmlConfigurator.Configure();
102 string firstName = "testfirstname";
103
104 AgentCircuitData agent = new AgentCircuitData();
105 agent.AgentID = agent1;
106 agent.firstname = firstName;
107 agent.lastname = "testlastname";
108 agent.SessionID = UUID.Random();
109 agent.SecureSessionID = UUID.Random();
110 agent.circuitcode = 123;
111 agent.BaseFolder = UUID.Zero;
112 agent.InventoryFolder = UUID.Zero;
113 agent.startpos = Vector3.Zero;
114 agent.CapsPath = GetRandomCapsObjectPath();
115 agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
116 agent.child = true;
117 101
118 scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); 102 TestScene scene = SceneHelpers.SetupScene();
103 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
119 104
120 string reason; 105 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null);
121 scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
122 testclient = new TestClient(agent, scene);
123 scene.AddNewClient(testclient);
124 106
125 ScenePresence presence = scene.GetScenePresence(agent1); 107 scene.IncomingCloseAgent(sp.UUID);
126 108
127 Assert.That(presence, Is.Not.Null, "presence is null"); 109 Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
128 Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same"); 110 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null);
129 acd1 = agent;
130 } 111 }
131 112
132 /// <summary> 113 /// <summary>
133 /// Test removing an uncrossed root agent from a scene. 114 /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
134 /// </summary> 115 /// </summary>
116 /// <remarks>
117 /// Please note that unlike the other tests here, this doesn't rely on structures
118 /// </remarks>
135 [Test] 119 [Test]
136 public void T011_TestRemoveRootAgent() 120 public void TestChildAgentEstablished()
137 { 121 {
138 TestHelper.InMethod(); 122 TestHelpers.InMethod();
139 123// log4net.Config.XmlConfigurator.Configure();
140 scene.RemoveClient(agent1); 124
141 125 UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
142 ScenePresence presence = scene.GetScenePresence(agent1); 126
127 TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
128// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
129
130 IConfigSource configSource = new IniConfigSource();
131 configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
132 EntityTransferModule etm = new EntityTransferModule();
133
134 SceneHelpers.SetupSceneModules(myScene1, configSource, etm);
135
136 SceneHelpers.AddScenePresence(myScene1, agent1Id);
137// ScenePresence childPresence = myScene2.GetScenePresence(agent1);
143 138
144 Assert.That(presence, Is.Null, "presence is not null"); 139 // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
140// Assert.That(childPresence, Is.Not.Null);
141// Assert.That(childPresence.IsChildAgent, Is.True);
145 } 142 }
146 143
144// /// <summary>
145// /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
146// /// </summary>
147// [Test]
148// public void T010_TestAddRootAgent()
149// {
150// TestHelpers.InMethod();
151//
152// string firstName = "testfirstname";
153//
154// AgentCircuitData agent = new AgentCircuitData();
155// agent.AgentID = agent1;
156// agent.firstname = firstName;
157// agent.lastname = "testlastname";
158// agent.SessionID = UUID.Random();
159// agent.SecureSessionID = UUID.Random();
160// agent.circuitcode = 123;
161// agent.BaseFolder = UUID.Zero;
162// agent.InventoryFolder = UUID.Zero;
163// agent.startpos = Vector3.Zero;
164// agent.CapsPath = GetRandomCapsObjectPath();
165// agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
166// agent.child = true;
167//
168// scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
169//
170// string reason;
171// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
172// testclient = new TestClient(agent, scene);
173// scene.AddNewClient(testclient);
174//
175// ScenePresence presence = scene.GetScenePresence(agent1);
176//
177// Assert.That(presence, Is.Not.Null, "presence is null");
178// Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same");
179// acd1 = agent;
180// }
181//
182// /// <summary>
183// /// Test removing an uncrossed root agent from a scene.
184// /// </summary>
185// [Test]
186// public void T011_TestRemoveRootAgent()
187// {
188// TestHelpers.InMethod();
189//
190// scene.RemoveClient(agent1);
191//
192// ScenePresence presence = scene.GetScenePresence(agent1);
193//
194// Assert.That(presence, Is.Null, "presence is not null");
195// }
196
147 [Test] 197 [Test]
148 public void T012_TestAddNeighbourRegion() 198 public void T012_TestAddNeighbourRegion()
149 { 199 {
150 TestHelper.InMethod(); 200 TestHelpers.InMethod();
151 201
152 string reason; 202 string reason;
153 203
@@ -157,7 +207,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
157 scene.NewUserConnection(acd1, 0, out reason); 207 scene.NewUserConnection(acd1, 0, out reason);
158 if (testclient == null) 208 if (testclient == null)
159 testclient = new TestClient(acd1, scene); 209 testclient = new TestClient(acd1, scene);
160 scene.AddNewClient(testclient); 210 scene.AddNewClient(testclient, PresenceType.User);
161 211
162 ScenePresence presence = scene.GetScenePresence(agent1); 212 ScenePresence presence = scene.GetScenePresence(agent1);
163 presence.MakeRootAgent(new Vector3(90,90,90),false); 213 presence.MakeRootAgent(new Vector3(90,90,90),false);
@@ -175,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
175 [Test] 225 [Test]
176 public void T013_TestRemoveNeighbourRegion() 226 public void T013_TestRemoveNeighbourRegion()
177 { 227 {
178 TestHelper.InMethod(); 228 TestHelpers.InMethod();
179 229
180 ScenePresence presence = scene.GetScenePresence(agent1); 230 ScenePresence presence = scene.GetScenePresence(agent1);
181 presence.RemoveNeighbourRegion(region3); 231 presence.RemoveNeighbourRegion(region3);
@@ -188,37 +238,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
188 CompleteAvatarMovement 238 CompleteAvatarMovement
189 */ 239 */
190 } 240 }
191
192 /// <summary>
193 /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
194 /// </summary>
195 /// <remarks>
196 /// Please note that unlike the other tests here, this doesn't rely on structures
197 /// </remarks>
198 [Test]
199 public void TestChildAgentEstablished()
200 {
201 TestHelper.InMethod();
202// log4net.Config.XmlConfigurator.Configure();
203
204 UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
205
206 TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
207 TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
208
209 IConfigSource configSource = new IniConfigSource();
210 configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
211 EntityTransferModule etm = new EntityTransferModule();
212
213 SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm);
214
215 SceneSetupHelpers.AddClient(myScene1, agent1Id);
216 ScenePresence childPresence = myScene2.GetScenePresence(agent1);
217
218 // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
219// Assert.That(childPresence, Is.Not.Null);
220// Assert.That(childPresence.IsChildAgent, Is.True);
221 }
222 241
223 // I'm commenting this test because it does not represent 242 // I'm commenting this test because it does not represent
224 // crossings. The Thread.Sleep's in here are not meaningful mocks, 243 // crossings. The Thread.Sleep's in here are not meaningful mocks,
@@ -230,7 +249,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
230 //[Test] 249 //[Test]
231 public void T021_TestCrossToNewRegion() 250 public void T021_TestCrossToNewRegion()
232 { 251 {
233 TestHelper.InMethod(); 252 TestHelpers.InMethod();
234 253
235 scene.RegisterRegionWithGrid(); 254 scene.RegisterRegionWithGrid();
236 scene2.RegisterRegionWithGrid(); 255 scene2.RegisterRegionWithGrid();
@@ -238,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
238 // Adding child agent to region 1001 257 // Adding child agent to region 1001
239 string reason; 258 string reason;
240 scene2.NewUserConnection(acd1,0, out reason); 259 scene2.NewUserConnection(acd1,0, out reason);
241 scene2.AddNewClient(testclient); 260 scene2.AddNewClient(testclient, PresenceType.User);
242 261
243 ScenePresence presence = scene.GetScenePresence(agent1); 262 ScenePresence presence = scene.GetScenePresence(agent1);
244 presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); 263 presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
@@ -349,37 +368,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
349 capsPath = capsPath.Remove(capsPath.Length - 4, 4); 368 capsPath = capsPath.Remove(capsPath.Length - 4, 4);
350 return capsPath; 369 return capsPath;
351 } 370 }
352
353 private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent)
354 {
355 SceneObjectPart sop = new SceneObjectPart();
356 sop.Name = RandomName();
357 sop.Description = RandomName();
358 sop.Text = RandomName();
359 sop.SitName = RandomName();
360 sop.TouchName = RandomName();
361 sop.UUID = uuid;
362 sop.Shape = PrimitiveBaseShape.Default;
363 sop.Shape.State = 1;
364 sop.OwnerID = agent;
365
366 SceneObjectGroup sog = new SceneObjectGroup(sop);
367 sog.SetScene(scene);
368
369 return sog;
370 }
371
372 private static string RandomName()
373 {
374 StringBuilder name = new StringBuilder();
375 int size = random.Next(5,12);
376 char ch ;
377 for (int i=0; i<size; i++)
378 {
379 ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
380 name.Append(ch);
381 }
382 return name.ToString();
383 }
384 } 371 }
385} \ No newline at end of file 372} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 4074f5d..39bb43a 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
44 /// Teleport tests in a standalone OpenSim 44 /// Teleport tests in a standalone OpenSim
45 /// </summary> 45 /// </summary>
46 [TestFixture] 46 [TestFixture]
47 public class StandaloneTeleportTests 47 public class ScenePresenceTeleportTests
48 { 48 {
49 /// <summary> 49 /// <summary>
50 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. 50 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
54 //[Test, LongRunning] 54 //[Test, LongRunning]
55 public void TestSimpleNotNeighboursTeleport() 55 public void TestSimpleNotNeighboursTeleport()
56 { 56 {
57 TestHelper.InMethod(); 57 TestHelpers.InMethod();
58 ThreadRunResults results = new ThreadRunResults(); 58 ThreadRunResults results = new ThreadRunResults();
59 results.Result = false; 59 results.Result = false;
60 results.Message = "Test did not run"; 60 results.Message = "Test did not run";
@@ -116,16 +116,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
116 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); 116 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
117 117
118 118
119 Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); 119 Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010);
120 SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); 120 SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
121 sceneB.RegisterRegionWithGrid(); 121 sceneB.RegisterRegionWithGrid();
122 122
123 Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); 123 Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000);
124 SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); 124 SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
125 sceneA.RegisterRegionWithGrid(); 125 sceneA.RegisterRegionWithGrid();
126 126
127 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); 127 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
128 TestClient client = SceneSetupHelpers.AddClient(sceneA, agentId); 128 TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient;
129 129
130 ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); 130 ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>();
131 131
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index 13d93f9..8b8aea5 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -58,9 +58,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
58 [Test] 58 [Test]
59 public void TestUpdateScene() 59 public void TestUpdateScene()
60 { 60 {
61 TestHelper.InMethod(); 61 TestHelpers.InMethod();
62 62
63 Scene scene = SceneSetupHelpers.SetupScene(); 63 Scene scene = SceneHelpers.SetupScene();
64 scene.Update(); 64 scene.Update();
65 65
66 Assert.That(scene.Frame, Is.EqualTo(1)); 66 Assert.That(scene.Frame, Is.EqualTo(1));
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index f4e14d4..1abef8d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -55,12 +55,12 @@ namespace OpenSim.Region.Framework.Tests
55 [Test] 55 [Test]
56 public void TestRezObjectFromInventoryItem() 56 public void TestRezObjectFromInventoryItem()
57 { 57 {
58 TestHelper.InMethod(); 58 TestHelpers.InMethod();
59// log4net.Config.XmlConfigurator.Configure(); 59// log4net.Config.XmlConfigurator.Configure();
60 60
61 Scene scene = SceneSetupHelpers.SetupScene(); 61 Scene scene = SceneHelpers.SetupScene();
62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); 62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
63 SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); 63 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
64 SceneObjectPart sop1 = sog1.RootPart; 64 SceneObjectPart sop1 = sog1.RootPart;
65 65
66 // Create an object embedded inside the first 66 // Create an object embedded inside the first
@@ -98,12 +98,12 @@ namespace OpenSim.Region.Framework.Tests
98 [Test] 98 [Test]
99 public void TestMoveTaskInventoryItem() 99 public void TestMoveTaskInventoryItem()
100 { 100 {
101 TestHelper.InMethod(); 101 TestHelpers.InMethod();
102// log4net.Config.XmlConfigurator.Configure(); 102// log4net.Config.XmlConfigurator.Configure();
103 103
104 Scene scene = SceneSetupHelpers.SetupScene(); 104 Scene scene = SceneHelpers.SetupScene();
105 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); 105 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
106 SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); 106 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
107 SceneObjectPart sop1 = sog1.RootPart; 107 SceneObjectPart sop1 = sog1.RootPart;
108 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); 108 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
109 109
@@ -125,12 +125,12 @@ namespace OpenSim.Region.Framework.Tests
125 [Test] 125 [Test]
126 public void TestMoveTaskInventoryItemNoParent() 126 public void TestMoveTaskInventoryItemNoParent()
127 { 127 {
128 TestHelper.InMethod(); 128 TestHelpers.InMethod();
129// log4net.Config.XmlConfigurator.Configure(); 129// log4net.Config.XmlConfigurator.Configure();
130 130
131 Scene scene = SceneSetupHelpers.SetupScene(); 131 Scene scene = SceneHelpers.SetupScene();
132 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); 132 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
133 SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); 133 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
134 SceneObjectPart sop1 = sog1.RootPart; 134 SceneObjectPart sop1 = sog1.RootPart;
135 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); 135 TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
136 136
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
index abca792..55fc1e7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
@@ -55,12 +55,12 @@ namespace OpenSim.Region.Framework.Tests
55 [Test] 55 [Test]
56 public void TestGiveInventoryItem() 56 public void TestGiveInventoryItem()
57 { 57 {
58 TestHelper.InMethod(); 58 TestHelpers.InMethod();
59// log4net.Config.XmlConfigurator.Configure(); 59// log4net.Config.XmlConfigurator.Configure();
60 60
61 Scene scene = SceneSetupHelpers.SetupScene(); 61 Scene scene = SceneHelpers.SetupScene();
62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); 62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
63 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); 63 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
64 InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); 64 InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID);
65 65
66 scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); 66 scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID);
@@ -82,12 +82,12 @@ namespace OpenSim.Region.Framework.Tests
82 [Test] 82 [Test]
83 public void TestGiveInventoryFolder() 83 public void TestGiveInventoryFolder()
84 { 84 {
85 TestHelper.InMethod(); 85 TestHelpers.InMethod();
86// log4net.Config.XmlConfigurator.Configure(); 86// log4net.Config.XmlConfigurator.Configure();
87 87
88 Scene scene = SceneSetupHelpers.SetupScene(); 88 Scene scene = SceneHelpers.SetupScene();
89 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); 89 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
90 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); 90 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
91 InventoryFolderBase folder1 91 InventoryFolderBase folder1
92 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); 92 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1");
93 93
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 4da8df1..24de56e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
47 public void Init() 47 public void Init()
48 { 48 {
49 // FIXME: We don't need a full scene here - it would be enough to set up the asset service. 49 // FIXME: We don't need a full scene here - it would be enough to set up the asset service.
50 Scene scene = SceneSetupHelpers.SetupScene(); 50 Scene scene = SceneHelpers.SetupScene();
51 m_assetService = scene.AssetService; 51 m_assetService = scene.AssetService;
52 m_uuidGatherer = new UuidGatherer(m_assetService); 52 m_uuidGatherer = new UuidGatherer(m_assetService);
53 } 53 }
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
55 [Test] 55 [Test]
56 public void TestCorruptAsset() 56 public void TestCorruptAsset()
57 { 57 {
58 TestHelper.InMethod(); 58 TestHelpers.InMethod();
59 59
60 UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); 60 UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
61 AssetBase corruptAsset 61 AssetBase corruptAsset
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
75 [Test] 75 [Test]
76 public void TestMissingAsset() 76 public void TestMissingAsset()
77 { 77 {
78 TestHelper.InMethod(); 78 TestHelpers.InMethod();
79 79
80 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); 80 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
81 IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>(); 81 IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index a0c1ab1..c413634 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -677,7 +677,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
677 public event DeRezObject OnDeRezObject; 677 public event DeRezObject OnDeRezObject;
678 public event Action<IClientAPI> OnRegionHandShakeReply; 678 public event Action<IClientAPI> OnRegionHandShakeReply;
679 public event GenericCall1 OnRequestWearables; 679 public event GenericCall1 OnRequestWearables;
680 public event GenericCall1 OnCompleteMovementToRegion; 680 public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
681 public event UpdateAgent OnPreAgentUpdate; 681 public event UpdateAgent OnPreAgentUpdate;
682 public event UpdateAgent OnAgentUpdate; 682 public event UpdateAgent OnAgentUpdate;
683 public event AgentRequestSit OnAgentRequestSit; 683 public event AgentRequestSit OnAgentRequestSit;
@@ -806,7 +806,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
806 public event ScriptReset OnScriptReset; 806 public event ScriptReset OnScriptReset;
807 public event GetScriptRunning OnGetScriptRunning; 807 public event GetScriptRunning OnGetScriptRunning;
808 public event SetScriptRunning OnSetScriptRunning; 808 public event SetScriptRunning OnSetScriptRunning;
809 public event Action<Vector3> OnAutoPilotGo; 809 public event Action<Vector3, bool> OnAutoPilotGo;
810 public event TerrainUnacked OnUnackedTerrain; 810 public event TerrainUnacked OnUnackedTerrain;
811 public event ActivateGesture OnActivateGesture; 811 public event ActivateGesture OnActivateGesture;
812 public event DeactivateGesture OnDeactivateGesture; 812 public event DeactivateGesture OnDeactivateGesture;
@@ -893,7 +893,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
893 893
894 public void Start() 894 public void Start()
895 { 895 {
896 Scene.AddNewClient(this); 896 Scene.AddNewClient(this, PresenceType.User);
897 897
898 // Mimicking LLClientView which gets always set appearance from client. 898 // Mimicking LLClientView which gets always set appearance from client.
899 Scene scene = (Scene)Scene; 899 Scene scene = (Scene)Scene;
@@ -913,7 +913,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
913 913
914 if (OnCompleteMovementToRegion != null) 914 if (OnCompleteMovementToRegion != null)
915 { 915 {
916 OnCompleteMovementToRegion(this); 916 OnCompleteMovementToRegion(this, true);
917 } 917 }
918 } 918 }
919 919
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
index ee52a39..d2f6327 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
@@ -47,16 +47,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
47 [Test] 47 [Test]
48 public void TestBasic() 48 public void TestBasic()
49 { 49 {
50 TestHelper.InMethod(); 50 TestHelpers.InMethod();
51// log4net.Config.XmlConfigurator.Configure(); 51// log4net.Config.XmlConfigurator.Configure();
52 52
53 TestScene scene = SceneSetupHelpers.SetupScene(); 53 TestScene scene = SceneHelpers.SetupScene();
54 IConfigSource configSource = new IniConfigSource(); 54 IConfigSource configSource = new IniConfigSource();
55 IConfig config = configSource.AddConfig("Groups"); 55 IConfig config = configSource.AddConfig("Groups");
56 config.Set("Enabled", true); 56 config.Set("Enabled", true);
57 config.Set("Module", "GroupsModule"); 57 config.Set("Module", "GroupsModule");
58 config.Set("DebugEnabled", true); 58 config.Set("DebugEnabled", true);
59 SceneSetupHelpers.SetupSceneModules( 59 SceneHelpers.SetupSceneModules(
60 scene, configSource, new object[] { new MockGroupsServicesConnector() }); 60 scene, configSource, new object[] { new MockGroupsServicesConnector() });
61 } 61 }
62 } 62 }
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 05c729a..963d1e2 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -126,6 +126,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
126 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; 126 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
127 m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; 127 m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded;
128 128
129 if(m_uri != string.Empty)
130 {
131 RRAlert("shutdown");
132 }
133
129 m_scene = null; 134 m_scene = null;
130 } 135 }
131 136
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index dfc624d..31e79fa 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -37,6 +37,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
37{ 37{
38 public class NPCAvatar : IClientAPI 38 public class NPCAvatar : IClientAPI
39 { 39 {
40 /// <summary>
41 /// Signal whether the avatar should land when it reaches a move target
42 /// </summary>
43 public bool LandAtTarget { get; set; }
44
40 private readonly string m_firstname; 45 private readonly string m_firstname;
41 private readonly string m_lastname; 46 private readonly string m_lastname;
42 private readonly Vector3 m_startPos; 47 private readonly Vector3 m_startPos;
@@ -190,7 +195,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
190 public event DeRezObject OnDeRezObject; 195 public event DeRezObject OnDeRezObject;
191 public event Action<IClientAPI> OnRegionHandShakeReply; 196 public event Action<IClientAPI> OnRegionHandShakeReply;
192 public event GenericCall1 OnRequestWearables; 197 public event GenericCall1 OnRequestWearables;
193 public event GenericCall1 OnCompleteMovementToRegion; 198 public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
194 public event UpdateAgent OnPreAgentUpdate; 199 public event UpdateAgent OnPreAgentUpdate;
195 public event UpdateAgent OnAgentUpdate; 200 public event UpdateAgent OnAgentUpdate;
196 public event AgentRequestSit OnAgentRequestSit; 201 public event AgentRequestSit OnAgentRequestSit;
@@ -328,7 +333,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
328 public event ScriptReset OnScriptReset; 333 public event ScriptReset OnScriptReset;
329 public event GetScriptRunning OnGetScriptRunning; 334 public event GetScriptRunning OnGetScriptRunning;
330 public event SetScriptRunning OnSetScriptRunning; 335 public event SetScriptRunning OnSetScriptRunning;
331 public event Action<Vector3> OnAutoPilotGo; 336 public event Action<Vector3, bool> OnAutoPilotGo;
332 337
333 public event TerrainUnacked OnUnackedTerrain; 338 public event TerrainUnacked OnUnackedTerrain;
334 339
@@ -745,12 +750,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
745 { 750 {
746 OnRegionHandShakeReply(this); 751 OnRegionHandShakeReply(this);
747 } 752 }
748
749 if (OnCompleteMovementToRegion != null)
750 {
751 OnCompleteMovementToRegion(this);
752 }
753 } 753 }
754
754 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) 755 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
755 { 756 {
756 } 757 }
@@ -841,6 +842,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
841 842
842 public void Close() 843 public void Close()
843 { 844 {
845 // Remove ourselves from the scene
846 m_scene.RemoveClient(AgentId, false);
844 } 847 }
845 848
846 public void Start() 849 public void Start()
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 4f21d9d..c1da803 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -45,7 +45,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
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
47 private Dictionary<UUID, NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); 47 private Dictionary<UUID, NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
48 private Dictionary<UUID, AvatarAppearance> m_appearanceCache = new Dictionary<UUID, AvatarAppearance>();
49 48
50 public void Initialise(Scene scene, IConfigSource source) 49 public void Initialise(Scene scene, IConfigSource source)
51 { 50 {
@@ -75,35 +74,44 @@ namespace OpenSim.Region.OptionalModules.World.NPC
75 // We are close enough to the target 74 // We are close enough to the target
76 m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name); 75 m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name);
77 76
78 if (presence.PhysicsActor.Flying)
79 {
80 Vector3 targetPos = presence.MoveToPositionTarget;
81 float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y];
82 if (targetPos.Z - terrainHeight < 0.2)
83 {
84 presence.PhysicsActor.Flying = false;
85 }
86 }
87
88 presence.Velocity = Vector3.Zero; 77 presence.Velocity = Vector3.Zero;
89 presence.AbsolutePosition = presence.MoveToPositionTarget; 78 presence.AbsolutePosition = presence.MoveToPositionTarget;
90 presence.ResetMoveToTarget(); 79 presence.ResetMoveToTarget();
91 80
92 // FIXME: This doesn't work
93 if (presence.PhysicsActor.Flying) 81 if (presence.PhysicsActor.Flying)
94 presence.Animator.TrySetMovementAnimation("HOVER"); 82 {
95 else 83 // A horrible hack to stop the NPC dead in its tracks rather than having them overshoot
96 presence.Animator.TrySetMovementAnimation("STAND"); 84 // the target if flying.
85 // We really need to be more subtle (slow the avatar as it approaches the target) or at
86 // least be able to set collision status once, rather than 5 times to give it enough
87 // weighting so that that PhysicsActor thinks it really is colliding.
88 for (int i = 0; i < 5; i++)
89 presence.PhysicsActor.IsColliding = true;
90
91// Vector3 targetPos = presence.MoveToPositionTarget;
92 if (m_avatars[presence.UUID].LandAtTarget)
93 presence.PhysicsActor.Flying = false;
94
95// float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y];
96// if (targetPos.Z - terrainHeight < 0.2)
97// {
98// presence.PhysicsActor.Flying = false;
99// }
100 }
101
102// m_log.DebugFormat(
103// "[NPC MODULE]: AgentControlFlags {0}, MovementFlag {1} for {2}",
104// presence.AgentControlFlags, presence.MovementFlag, presence.Name);
97 } 105 }
98 else 106 else
99 { 107 {
100 m_log.DebugFormat( 108// m_log.DebugFormat(
101 "[NPC MODULE]: Updating npc {0} at {1} for next movement to {2}", 109// "[NPC MODULE]: Updating npc {0} at {1} for next movement to {2}",
102 presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); 110// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
103 111
104 Vector3 agent_control_v3 = new Vector3(); 112 Vector3 agent_control_v3 = new Vector3();
105 presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation); 113 presence.HandleMoveToTargetUpdate(ref agent_control_v3);
106 presence.AddNewMovement(agent_control_v3, presence.Rotation); 114 presence.AddNewMovement(agent_control_v3);
107 } 115 }
108// 116//
109//// presence.DoMoveToPositionUpdate((0, presence.MoveToPositionTarget, null); 117//// presence.DoMoveToPositionUpdate((0, presence.MoveToPositionTarget, null);
@@ -115,29 +123,48 @@ namespace OpenSim.Region.OptionalModules.World.NPC
115 } 123 }
116 } 124 }
117 125
118 private AvatarAppearance GetAppearance(UUID target, Scene scene) 126 public bool IsNPC(UUID agentId, Scene scene)
127 {
128 ScenePresence sp = scene.GetScenePresence(agentId);
129 if (sp == null || sp.IsChildAgent)
130 return false;
131
132 lock (m_avatars)
133 return m_avatars.ContainsKey(agentId);
134 }
135
136 public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene)
119 { 137 {
120 if (m_appearanceCache.ContainsKey(target)) 138 ScenePresence sp = scene.GetScenePresence(agentId);
121 return m_appearanceCache[target]; 139 if (sp == null || sp.IsChildAgent)
140 return false;
122 141
123 ScenePresence originalPresence = scene.GetScenePresence(target); 142 lock (m_avatars)
143 if (!m_avatars.ContainsKey(agentId))
144 return false;
124 145
125 if (originalPresence != null) 146 // FIXME: An extremely bad bit of code that reaches directly into the attachments list and manipulates it
126 { 147 List<SceneObjectGroup> attachments = sp.Attachments;
127 AvatarAppearance originalAppearance = originalPresence.Appearance; 148 lock (attachments)
128 m_appearanceCache.Add(target, originalAppearance);
129 return originalAppearance;
130 }
131 else
132 { 149 {
133 m_log.DebugFormat( 150 foreach (SceneObjectGroup att in attachments)
134 "[NPC MODULE]: Avatar {0} is not in the scene for us to grab baked textures from them. Using defaults.", target); 151 scene.DeleteSceneObject(att, false);
135 152
136 return new AvatarAppearance(); 153 attachments.Clear();
137 } 154 }
155
156 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
157 sp.Appearance = npcAppearance;
158 sp.RezAttachments();
159
160 IAvatarFactory module = scene.RequestModuleInterface<IAvatarFactory>();
161 module.SendAppearance(sp.UUID);
162
163 return true;
138 } 164 }
139 165
140 public UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom) 166 public UUID CreateNPC(
167 string firstname, string lastname, Vector3 position, Scene scene, AvatarAppearance appearance)
141 { 168 {
142 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); 169 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene);
143 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue); 170 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
@@ -152,8 +179,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
152 acd.lastname = lastname; 179 acd.lastname = lastname;
153 acd.ServiceURLs = new Dictionary<string, object>(); 180 acd.ServiceURLs = new Dictionary<string, object>();
154 181
155 AvatarAppearance originalAppearance = GetAppearance(cloneAppearanceFrom, scene); 182 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
156 AvatarAppearance npcAppearance = new AvatarAppearance(originalAppearance, true);
157 acd.Appearance = npcAppearance; 183 acd.Appearance = npcAppearance;
158 184
159// for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++) 185// for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++)
@@ -164,7 +190,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
164// } 190// }
165 191
166 scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); 192 scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
167 scene.AddNewClient(npcAvatar); 193 scene.AddNewClient(npcAvatar, PresenceType.Npc);
168 194
169 ScenePresence sp; 195 ScenePresence sp;
170 if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) 196 if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
@@ -172,13 +198,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
172 m_log.DebugFormat( 198 m_log.DebugFormat(
173 "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); 199 "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
174 200
175 // Shouldn't call this - temporary. 201 sp.CompleteMovement(npcAvatar, false);
176 sp.CompleteMovement(npcAvatar);
177
178// sp.SendAppearanceToAllOtherAgents();
179//
180// // Send animations back to the avatar as well
181// sp.Animator.SendAnimPack();
182 } 202 }
183 else 203 else
184 { 204 {
@@ -193,7 +213,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
193 return npcAvatar.AgentId; 213 return npcAvatar.AgentId;
194 } 214 }
195 215
196 public void MoveToTarget(UUID agentID, Scene scene, Vector3 pos) 216 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget)
197 { 217 {
198 lock (m_avatars) 218 lock (m_avatars)
199 { 219 {
@@ -203,34 +223,70 @@ namespace OpenSim.Region.OptionalModules.World.NPC
203 scene.TryGetScenePresence(agentID, out sp); 223 scene.TryGetScenePresence(agentID, out sp);
204 224
205 m_log.DebugFormat( 225 m_log.DebugFormat(
206 "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); 226 "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}",
227 sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget);
228
229 m_avatars[agentID].LandAtTarget = landAtTarget;
230 sp.MoveToTarget(pos, noFly);
231
232 return true;
233 }
234 }
235
236 return false;
237 }
238
239 public bool StopMoveToTarget(UUID agentID, Scene scene)
240 {
241 lock (m_avatars)
242 {
243 if (m_avatars.ContainsKey(agentID))
244 {
245 ScenePresence sp;
246 scene.TryGetScenePresence(agentID, out sp);
207 247
208 sp.MoveToTarget(pos); 248 sp.Velocity = Vector3.Zero;
249 sp.ResetMoveToTarget();
250
251 return true;
209 } 252 }
210 } 253 }
254
255 return false;
211 } 256 }
212 257
213 public void Say(UUID agentID, Scene scene, string text) 258 public bool Say(UUID agentID, Scene scene, string text)
214 { 259 {
215 lock (m_avatars) 260 lock (m_avatars)
216 { 261 {
217 if (m_avatars.ContainsKey(agentID)) 262 if (m_avatars.ContainsKey(agentID))
218 { 263 {
264 ScenePresence sp;
265 scene.TryGetScenePresence(agentID, out sp);
266
219 m_avatars[agentID].Say(text); 267 m_avatars[agentID].Say(text);
268
269 return true;
220 } 270 }
221 } 271 }
272
273 return false;
222 } 274 }
223 275
224 public void DeleteNPC(UUID agentID, Scene scene) 276 public bool DeleteNPC(UUID agentID, Scene scene)
225 { 277 {
226 lock (m_avatars) 278 lock (m_avatars)
227 { 279 {
228 if (m_avatars.ContainsKey(agentID)) 280 if (m_avatars.ContainsKey(agentID))
229 { 281 {
230 scene.RemoveClient(agentID); 282 scene.RemoveClient(agentID, false);
231 m_avatars.Remove(agentID); 283 m_avatars.Remove(agentID);
284
285 return true;
232 } 286 }
233 } 287 }
288
289 return false;
234 } 290 }
235 291
236 public void PostInitialise() 292 public void PostInitialise()
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index c9dddba..78296a4 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -34,6 +34,7 @@ using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Avatar.AvatarFactory; 36using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
37using OpenSim.Region.CoreModules.Framework.UserManagement;
37using OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar; 38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
@@ -49,7 +50,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
49 [Test] 50 [Test]
50 public void TestCreate() 51 public void TestCreate()
51 { 52 {
52 TestHelper.InMethod(); 53 TestHelpers.InMethod();
53// log4net.Config.XmlConfigurator.Configure(); 54// log4net.Config.XmlConfigurator.Configure();
54 55
55 IConfigSource config = new IniConfigSource(); 56 IConfigSource config = new IniConfigSource();
@@ -57,13 +58,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
57 config.Configs["NPC"].Set("Enabled", "true"); 58 config.Configs["NPC"].Set("Enabled", "true");
58 59
59 AvatarFactoryModule afm = new AvatarFactoryModule(); 60 AvatarFactoryModule afm = new AvatarFactoryModule();
60 TestScene scene = SceneSetupHelpers.SetupScene(); 61 UserManagementModule umm = new UserManagementModule();
61 SceneSetupHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); 62
62 TestClient originalClient = SceneSetupHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); 63 TestScene scene = SceneHelpers.SetupScene();
64 SceneHelpers.SetupSceneModules(scene, config, afm, umm, new NPCModule());
65 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
63// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); 66// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
64 67
65 // 8 is the index of the first baked texture in AvatarAppearance 68 // 8 is the index of the first baked texture in AvatarAppearance
66 UUID originalFace8TextureId = TestHelper.ParseTail(0x10); 69 UUID originalFace8TextureId = TestHelpers.ParseTail(0x10);
67 Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero); 70 Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero);
68 Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8); 71 Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8);
69 originalTef.TextureID = originalFace8TextureId; 72 originalTef.TextureID = originalFace8TextureId;
@@ -72,21 +75,22 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
72 // ScenePresence.SendInitialData() to reset our entire appearance. 75 // ScenePresence.SendInitialData() to reset our entire appearance.
73 scene.AssetService.Store(AssetHelpers.CreateAsset(originalFace8TextureId)); 76 scene.AssetService.Store(AssetHelpers.CreateAsset(originalFace8TextureId));
74 77
75 afm.SetAppearance(originalClient, originalTe, null); 78 afm.SetAppearanceFromClient(sp.ControllingClient, originalTe, null);
76 79
77 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 80 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
78 UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, originalClient.AgentId); 81 UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, sp.Appearance);
79 82
80 ScenePresence npc = scene.GetScenePresence(npcId); 83 ScenePresence npc = scene.GetScenePresence(npcId);
81 84
82 Assert.That(npc, Is.Not.Null); 85 Assert.That(npc, Is.Not.Null);
83 Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); 86 Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId));
87 Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname)));
84 } 88 }
85 89
86 [Test] 90 [Test]
87 public void TestMove() 91 public void TestMove()
88 { 92 {
89 TestHelper.InMethod(); 93 TestHelpers.InMethod();
90// log4net.Config.XmlConfigurator.Configure(); 94// log4net.Config.XmlConfigurator.Configure();
91 95
92 IConfigSource config = new IniConfigSource(); 96 IConfigSource config = new IniConfigSource();
@@ -94,14 +98,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
94 config.AddConfig("NPC"); 98 config.AddConfig("NPC");
95 config.Configs["NPC"].Set("Enabled", "true"); 99 config.Configs["NPC"].Set("Enabled", "true");
96 100
97 TestScene scene = SceneSetupHelpers.SetupScene(); 101 TestScene scene = SceneHelpers.SetupScene();
98 SceneSetupHelpers.SetupSceneModules(scene, config, new NPCModule()); 102 SceneHelpers.SetupSceneModules(scene, config, new NPCModule());
99 TestClient originalClient = SceneSetupHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); 103 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
100// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); 104// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
101 105
102 Vector3 startPos = new Vector3(128, 128, 30); 106 Vector3 startPos = new Vector3(128, 128, 30);
103 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 107 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
104 UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, scene, originalClient.AgentId); 108 UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, scene, sp.Appearance);
105 109
106 ScenePresence npc = scene.GetScenePresence(npcId); 110 ScenePresence npc = scene.GetScenePresence(npcId);
107 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 111 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
@@ -113,7 +117,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
113 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 117 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
114 118
115 Vector3 targetPos = startPos + new Vector3(0, 0, 10); 119 Vector3 targetPos = startPos + new Vector3(0, 0, 10);
116 npcModule.MoveToTarget(npc.UUID, scene, targetPos); 120 npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false);
117 121
118 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 122 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
119 123
@@ -131,11 +135,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
131 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); 135 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
132 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); 136 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move");
133 Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); 137 Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos));
138 Assert.That(npc.AgentControlFlags, Is.EqualTo((uint)AgentManager.ControlFlags.NONE));
134 139
135 // Try a second movement 140 // Try a second movement
136 startPos = npc.AbsolutePosition; 141 startPos = npc.AbsolutePosition;
137 targetPos = startPos + new Vector3(10, 0, 0); 142 targetPos = startPos + new Vector3(10, 0, 0);
138 npcModule.MoveToTarget(npc.UUID, scene, targetPos); 143 npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false);
139 144
140 scene.Update(); 145 scene.Update();
141 146
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 4f461ad..0a0d13f 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -258,7 +258,11 @@ namespace OpenSim.Region.Physics.OdePlugin
258 public override bool Flying 258 public override bool Flying
259 { 259 {
260 get { return flying; } 260 get { return flying; }
261 set { flying = value; } 261 set
262 {
263 flying = value;
264// m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying);
265 }
262 } 266 }
263 267
264 /// <summary> 268 /// <summary>
@@ -305,10 +309,12 @@ namespace OpenSim.Region.Physics.OdePlugin
305 { 309 {
306 m_iscolliding = true; 310 m_iscolliding = true;
307 } 311 }
312
308 if (m_wascolliding != m_iscolliding) 313 if (m_wascolliding != m_iscolliding)
309 { 314 {
310 //base.SendCollisionUpdate(new CollisionEventUpdate()); 315 //base.SendCollisionUpdate(new CollisionEventUpdate());
311 } 316 }
317
312 m_wascolliding = m_iscolliding; 318 m_wascolliding = m_iscolliding;
313 } 319 }
314 } 320 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 26969a5..c84afee 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -369,7 +369,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
369 } 369 }
370 370
371 // convert a LSL_Rotation to a Quaternion 371 // convert a LSL_Rotation to a Quaternion
372 protected Quaternion Rot2Quaternion(LSL_Rotation r) 372 public static Quaternion Rot2Quaternion(LSL_Rotation r)
373 { 373 {
374 Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); 374 Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
375 q.Normalize(); 375 q.Normalize();
@@ -1204,10 +1204,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1204 1204
1205 if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) 1205 if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM)
1206 { 1206 {
1207 if (value != 0) 1207 if (m_host.ParentGroup != null)
1208 m_host.ScriptSetPhantomStatus(true); 1208 m_host.ParentGroup.ScriptSetPhantomStatus(value != 0);
1209 else
1210 m_host.ScriptSetPhantomStatus(false);
1211 } 1209 }
1212 1210
1213 if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) 1211 if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS)
@@ -2063,6 +2061,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2063 { 2061 {
2064 return llGetRootRotation(); 2062 return llGetRootRotation();
2065 } 2063 }
2064
2066 m_host.AddScriptLPS(1); 2065 m_host.AddScriptLPS(1);
2067 Quaternion q = m_host.GetWorldRotation(); 2066 Quaternion q = m_host.GetWorldRotation();
2068 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2067 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
@@ -6446,9 +6445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6446 if (m_host.ParentGroup != null) 6445 if (m_host.ParentGroup != null)
6447 { 6446 {
6448 if (!m_host.ParentGroup.IsDeleted) 6447 if (!m_host.ParentGroup.IsDeleted)
6449 { 6448 m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
6450 m_host.ParentGroup.RootPart.ScriptSetVolumeDetect(detect!=0);
6451 }
6452 } 6449 }
6453 } 6450 }
6454 6451
@@ -6456,7 +6453,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6456 /// This is a depecated function so this just replicates the result of 6453 /// This is a depecated function so this just replicates the result of
6457 /// invoking it in SL 6454 /// invoking it in SL
6458 /// </summary> 6455 /// </summary>
6459
6460 public void llRemoteLoadScript(string target, string name, int running, int start_param) 6456 public void llRemoteLoadScript(string target, string name, int running, int start_param)
6461 { 6457 {
6462 m_host.AddScriptLPS(1); 6458 m_host.AddScriptLPS(1);
@@ -7254,14 +7250,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7254 return; 7250 return;
7255 7251
7256 string ph = rules.Data[idx++].ToString(); 7252 string ph = rules.Data[idx++].ToString();
7257 bool phantom;
7258 7253
7259 if (ph.Equals("1")) 7254 if (m_host.ParentGroup != null)
7260 phantom = true; 7255 m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1"));
7261 else
7262 phantom = false;
7263 7256
7264 part.ScriptSetPhantomStatus(phantom);
7265 break; 7257 break;
7266 7258
7267 case (int)ScriptBaseClass.PRIM_PHYSICS: 7259 case (int)ScriptBaseClass.PRIM_PHYSICS:
@@ -7282,14 +7274,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7282 if (remain < 1) 7274 if (remain < 1)
7283 return; 7275 return;
7284 string temp = rules.Data[idx++].ToString(); 7276 string temp = rules.Data[idx++].ToString();
7285 bool tempOnRez;
7286 7277
7287 if (temp.Equals("1")) 7278 if (m_host.ParentGroup != null)
7288 tempOnRez = true; 7279 m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
7289 else
7290 tempOnRez = false;
7291 7280
7292 part.ScriptSetTemporaryStatus(tempOnRez);
7293 break; 7281 break;
7294 7282
7295 case (int)ScriptBaseClass.PRIM_TEXGEN: 7283 case (int)ScriptBaseClass.PRIM_TEXGEN:
@@ -7662,7 +7650,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7662 case ScriptBaseClass.PRIM_TYPE_BOX: 7650 case ScriptBaseClass.PRIM_TYPE_BOX:
7663 case ScriptBaseClass.PRIM_TYPE_CYLINDER: 7651 case ScriptBaseClass.PRIM_TYPE_CYLINDER:
7664 case ScriptBaseClass.PRIM_TYPE_PRISM: 7652 case ScriptBaseClass.PRIM_TYPE_PRISM:
7665 res.Add(new LSL_Integer(Shape.ProfileCurve)); 7653 res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
7666 res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); 7654 res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
7667 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); 7655 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
7668 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); 7656 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
@@ -7671,7 +7659,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7671 break; 7659 break;
7672 7660
7673 case ScriptBaseClass.PRIM_TYPE_SPHERE: 7661 case ScriptBaseClass.PRIM_TYPE_SPHERE:
7674 res.Add(new LSL_Integer(Shape.ProfileCurve)); 7662 res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
7675 res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); 7663 res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
7676 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); 7664 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
7677 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); 7665 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
@@ -7687,7 +7675,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7687 case ScriptBaseClass.PRIM_TYPE_TUBE: 7675 case ScriptBaseClass.PRIM_TYPE_TUBE:
7688 case ScriptBaseClass.PRIM_TYPE_TORUS: 7676 case ScriptBaseClass.PRIM_TYPE_TORUS:
7689 // holeshape 7677 // holeshape
7690 res.Add(new LSL_Integer(Shape.ProfileCurve)); 7678 res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
7691 7679
7692 // cut 7680 // cut
7693 res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); 7681 res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
@@ -10578,9 +10566,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10578 } 10566 }
10579 } 10567 }
10580 10568
10581 public static string GetLine(UUID assetID, int line, int maxLength) 10569 /// <summary>
10570 /// Get a notecard line.
10571 /// </summary>
10572 /// <param name="assetID"></param>
10573 /// <param name="line">Lines start at index 0</param>
10574 /// <returns></returns>
10575 public static string GetLine(UUID assetID, int lineNumber)
10582 { 10576 {
10583 if (line < 0) 10577 if (lineNumber < 0)
10584 return ""; 10578 return "";
10585 10579
10586 string data; 10580 string data;
@@ -10592,17 +10586,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10592 { 10586 {
10593 m_Notecards[assetID].lastRef = DateTime.Now; 10587 m_Notecards[assetID].lastRef = DateTime.Now;
10594 10588
10595 if (line >= m_Notecards[assetID].text.Length) 10589 if (lineNumber >= m_Notecards[assetID].text.Length)
10596 return "\n\n\n"; 10590 return "\n\n\n";
10597 10591
10598 data = m_Notecards[assetID].text[line]; 10592 data = m_Notecards[assetID].text[lineNumber];
10599 if (data.Length > maxLength)
10600 data = data.Substring(0, maxLength);
10601 10593
10602 return data; 10594 return data;
10603 } 10595 }
10604 } 10596 }
10605 10597
10598 /// <summary>
10599 /// Get a notecard line.
10600 /// </summary>
10601 /// <param name="assetID"></param>
10602 /// <param name="line">Lines start at index 0</param>
10603 /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para>
10604 /// <returns></returns>
10605 public static string GetLine(UUID assetID, int lineNumber, int maxLength)
10606 {
10607 string line = GetLine(assetID, lineNumber);
10608
10609 if (line.Length > maxLength)
10610 line = line.Substring(0, maxLength);
10611
10612 return line;
10613 }
10614
10606 public static void CacheCheck() 10615 public static void CacheCheck()
10607 { 10616 {
10608 foreach (UUID key in new List<UUID>(m_Notecards.Keys)) 10617 foreach (UUID key in new List<UUID>(m_Notecards.Keys))
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8093502..d791885 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -28,11 +28,16 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO;
32using System.Reflection;
31using System.Runtime.Remoting.Lifetime; 33using System.Runtime.Remoting.Lifetime;
32using System.Text; 34using System.Text;
33using System.Net; 35using System.Net;
34using System.Threading; 36using System.Threading;
37using System.Xml;
38using log4net;
35using OpenMetaverse; 39using OpenMetaverse;
40using OpenMetaverse.StructuredData;
36using Nini.Config; 41using Nini.Config;
37using OpenSim; 42using OpenSim;
38using OpenSim.Framework; 43using OpenSim.Framework;
@@ -119,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
119 [Serializable] 124 [Serializable]
120 public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi 125 public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi
121 { 126 {
127// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
128
122 internal IScriptEngine m_ScriptEngine; 129 internal IScriptEngine m_ScriptEngine;
123 internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there 130 internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there
124 internal SceneObjectPart m_host; 131 internal SceneObjectPart m_host;
@@ -348,20 +355,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
348 System.Threading.Thread.Sleep(delay); 355 System.Threading.Thread.Sleep(delay);
349 } 356 }
350 357
351 //
352 // OpenSim functions
353 //
354 public LSL_Integer osSetTerrainHeight(int x, int y, double val) 358 public LSL_Integer osSetTerrainHeight(int x, int y, double val)
355 { 359 {
356 CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight"); 360 CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight");
357 return SetTerrainHeight(x, y, val); 361 return SetTerrainHeight(x, y, val);
358 } 362 }
363
359 public LSL_Integer osTerrainSetHeight(int x, int y, double val) 364 public LSL_Integer osTerrainSetHeight(int x, int y, double val)
360 { 365 {
361 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); 366 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight");
362 OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight"); 367 OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight");
363 return SetTerrainHeight(x, y, val); 368 return SetTerrainHeight(x, y, val);
364 } 369 }
370
365 private LSL_Integer SetTerrainHeight(int x, int y, double val) 371 private LSL_Integer SetTerrainHeight(int x, int y, double val)
366 { 372 {
367 m_host.AddScriptLPS(1); 373 m_host.AddScriptLPS(1);
@@ -384,12 +390,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
384 CheckThreatLevel(ThreatLevel.None, "osGetTerrainHeight"); 390 CheckThreatLevel(ThreatLevel.None, "osGetTerrainHeight");
385 return GetTerrainHeight(x, y); 391 return GetTerrainHeight(x, y);
386 } 392 }
393
387 public LSL_Float osTerrainGetHeight(int x, int y) 394 public LSL_Float osTerrainGetHeight(int x, int y)
388 { 395 {
389 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); 396 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight");
390 OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight"); 397 OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight");
391 return GetTerrainHeight(x, y); 398 return GetTerrainHeight(x, y);
392 } 399 }
400
393 private LSL_Float GetTerrainHeight(int x, int y) 401 private LSL_Float GetTerrainHeight(int x, int y)
394 { 402 {
395 m_host.AddScriptLPS(1); 403 m_host.AddScriptLPS(1);
@@ -862,7 +870,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
862 ScenePresence target = (ScenePresence)World.Entities[avatarID]; 870 ScenePresence target = (ScenePresence)World.Entities[avatarID];
863 if (target != null) 871 if (target != null)
864 { 872 {
865 UUID animID=UUID.Zero; 873 UUID animID = UUID.Zero;
866 lock (m_host.TaskInventory) 874 lock (m_host.TaskInventory)
867 { 875 {
868 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 876 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
@@ -1021,6 +1029,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1021 drawList += "PenColor " + color + "; "; 1029 drawList += "PenColor " + color + "; ";
1022 return drawList; 1030 return drawList;
1023 } 1031 }
1032
1024 // Deprecated 1033 // Deprecated
1025 public string osSetPenColour(string drawList, string colour) 1034 public string osSetPenColour(string drawList, string colour)
1026 { 1035 {
@@ -1182,11 +1191,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1182 OSSLDeprecated("osSunGetParam", "osGetSunParam"); 1191 OSSLDeprecated("osSunGetParam", "osGetSunParam");
1183 return GetSunParam(param); 1192 return GetSunParam(param);
1184 } 1193 }
1194
1185 public double osGetSunParam(string param) 1195 public double osGetSunParam(string param)
1186 { 1196 {
1187 CheckThreatLevel(ThreatLevel.None, "osGetSunParam"); 1197 CheckThreatLevel(ThreatLevel.None, "osGetSunParam");
1188 return GetSunParam(param); 1198 return GetSunParam(param);
1189 } 1199 }
1200
1190 private double GetSunParam(string param) 1201 private double GetSunParam(string param)
1191 { 1202 {
1192 m_host.AddScriptLPS(1); 1203 m_host.AddScriptLPS(1);
@@ -1208,11 +1219,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1208 OSSLDeprecated("osSunSetParam", "osSetSunParam"); 1219 OSSLDeprecated("osSunSetParam", "osSetSunParam");
1209 SetSunParam(param, value); 1220 SetSunParam(param, value);
1210 } 1221 }
1222
1211 public void osSetSunParam(string param, double value) 1223 public void osSetSunParam(string param, double value)
1212 { 1224 {
1213 CheckThreatLevel(ThreatLevel.None, "osSetSunParam"); 1225 CheckThreatLevel(ThreatLevel.None, "osSetSunParam");
1214 SetSunParam(param, value); 1226 SetSunParam(param, value);
1215 } 1227 }
1228
1216 private void SetSunParam(string param, double value) 1229 private void SetSunParam(string param, double value)
1217 { 1230 {
1218 m_host.AddScriptLPS(1); 1231 m_host.AddScriptLPS(1);
@@ -1222,10 +1235,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1222 { 1235 {
1223 module.SetSunParameter(param, value); 1236 module.SetSunParameter(param, value);
1224 } 1237 }
1225
1226 } 1238 }
1227 1239
1228
1229 public string osWindActiveModelPluginName() 1240 public string osWindActiveModelPluginName()
1230 { 1241 {
1231 CheckThreatLevel(ThreatLevel.None, "osWindActiveModelPluginName"); 1242 CheckThreatLevel(ThreatLevel.None, "osWindActiveModelPluginName");
@@ -1304,12 +1315,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1304 OSSLDeprecated(functionName, "osSetParcelDetails"); 1315 OSSLDeprecated(functionName, "osSetParcelDetails");
1305 SetParcelDetails(pos, rules, functionName); 1316 SetParcelDetails(pos, rules, functionName);
1306 } 1317 }
1318
1307 public void osSetParcelDetails(LSL_Vector pos, LSL_List rules) 1319 public void osSetParcelDetails(LSL_Vector pos, LSL_List rules)
1308 { 1320 {
1309 const string functionName = "osSetParcelDetails"; 1321 const string functionName = "osSetParcelDetails";
1310 CheckThreatLevel(ThreatLevel.High, functionName); 1322 CheckThreatLevel(ThreatLevel.High, functionName);
1311 SetParcelDetails(pos, rules, functionName); 1323 SetParcelDetails(pos, rules, functionName);
1312 } 1324 }
1325
1313 private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName) 1326 private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName)
1314 { 1327 {
1315 m_host.AddScriptLPS(1); 1328 m_host.AddScriptLPS(1);
@@ -1429,8 +1442,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1429 voiceModule.setLandSIPAddress(SIPAddress,land.LandData.GlobalID); 1442 voiceModule.setLandSIPAddress(SIPAddress,land.LandData.GlobalID);
1430 else 1443 else
1431 OSSLError("osSetParcelSIPAddress: No voice module enabled for this land"); 1444 OSSLError("osSetParcelSIPAddress: No voice module enabled for this land");
1432
1433
1434 } 1445 }
1435 1446
1436 public string osGetScriptEngineName() 1447 public string osGetScriptEngineName()
@@ -1683,8 +1694,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1683 return jsondata; 1694 return jsondata;
1684 } 1695 }
1685 1696
1686 // send a message to to object identified by the given UUID, a script in the object must implement the dataserver function 1697 /// <summary>
1687 // the dataserver function is passed the ID of the calling function and a string message 1698 /// Send a message to to object identified by the given UUID
1699 /// </summary>
1700 /// <remarks>
1701 /// A script in the object must implement the dataserver function
1702 /// the dataserver function is passed the ID of the calling function and a string message
1703 /// </remarks>
1704 /// <param name="objectUUID"></param>
1705 /// <param name="message"></param>
1688 public void osMessageObject(LSL_Key objectUUID, string message) 1706 public void osMessageObject(LSL_Key objectUUID, string message)
1689 { 1707 {
1690 CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); 1708 CheckThreatLevel(ThreatLevel.Low, "osMessageObject");
@@ -1699,34 +1717,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1699 "dataserver", resobj, new DetectParams[0])); 1717 "dataserver", resobj, new DetectParams[0]));
1700 } 1718 }
1701 1719
1702 1720 /// <summary>
1703 // This needs ThreatLevel high. It is an excellent griefer tool, 1721 /// Write a notecard directly to the prim's inventory.
1704 // In a loop, it can cause asset bloat and DOS levels of asset 1722 /// </summary>
1705 // writes. 1723 /// <remarks>
1706 // 1724 /// This needs ThreatLevel high. It is an excellent griefer tool,
1725 /// In a loop, it can cause asset bloat and DOS levels of asset
1726 /// writes.
1727 /// </remarks>
1728 /// <param name="notecardName">The name of the notecard to write.</param>
1729 /// <param name="contents">The contents of the notecard.</param>
1707 public void osMakeNotecard(string notecardName, LSL_Types.list contents) 1730 public void osMakeNotecard(string notecardName, LSL_Types.list contents)
1708 { 1731 {
1709 CheckThreatLevel(ThreatLevel.High, "osMakeNotecard"); 1732 CheckThreatLevel(ThreatLevel.High, "osMakeNotecard");
1710 m_host.AddScriptLPS(1); 1733 m_host.AddScriptLPS(1);
1711 1734
1712 // Create new asset 1735 StringBuilder notecardData = new StringBuilder();
1713 AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString());
1714 asset.Description = "Script Generated Notecard";
1715 string notecardData = String.Empty;
1716 1736
1717 for (int i = 0; i < contents.Length; i++) { 1737 for (int i = 0; i < contents.Length; i++)
1718 notecardData += contents.GetLSLStringItem(i) + "\n"; 1738 notecardData.Append((string)(contents.GetLSLStringItem(i) + "\n"));
1719 } 1739
1740 SaveNotecard(notecardName, "Script generated notecard", notecardData.ToString(), false);
1741 }
1720 1742
1721 int textLength = notecardData.Length; 1743 /// <summary>
1722 notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " 1744 /// Save a notecard to prim inventory.
1723 + textLength.ToString() + "\n" + notecardData + "}\n"; 1745 /// </summary>
1746 /// <param name="name"></param>
1747 /// <param name="description">Description of notecard</param>
1748 /// <param name="notecardData"></param>
1749 /// <param name="forceSameName">
1750 /// If true, then if an item exists with the same name, it is replaced.
1751 /// If false, then a new item is created witha slightly different name (e.g. name 1)
1752 /// </param>
1753 /// <returns>Prim inventory item created.</returns>
1754 protected TaskInventoryItem SaveNotecard(string name, string description, string data, bool forceSameName)
1755 {
1756 // Create new asset
1757 AssetBase asset = new AssetBase(UUID.Random(), name, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString());
1758 asset.Description = description;
1724 1759
1725 asset.Data = Util.UTF8.GetBytes(notecardData); 1760 int textLength = data.Length;
1761 data
1762 = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length "
1763 + textLength.ToString() + "\n" + data + "}\n";
1764
1765 asset.Data = Util.UTF8.GetBytes(data);
1726 World.AssetService.Store(asset); 1766 World.AssetService.Store(asset);
1727 1767
1728 // Create Task Entry 1768 // Create Task Entry
1729 TaskInventoryItem taskItem=new TaskInventoryItem(); 1769 TaskInventoryItem taskItem = new TaskInventoryItem();
1730 1770
1731 taskItem.ResetIDs(m_host.UUID); 1771 taskItem.ResetIDs(m_host.UUID);
1732 taskItem.ParentID = m_host.UUID; 1772 taskItem.ParentID = m_host.UUID;
@@ -1748,28 +1788,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1748 taskItem.PermsMask = 0; 1788 taskItem.PermsMask = 0;
1749 taskItem.AssetID = asset.FullID; 1789 taskItem.AssetID = asset.FullID;
1750 1790
1751 m_host.Inventory.AddInventoryItem(taskItem, false); 1791 if (forceSameName)
1792 m_host.Inventory.AddInventoryItemExclusive(taskItem, false);
1793 else
1794 m_host.Inventory.AddInventoryItem(taskItem, false);
1795
1796 return taskItem;
1752 } 1797 }
1753 1798
1799 /// <summary>
1800 /// Load the notecard data found at the given prim inventory item name or asset uuid.
1801 /// </summary>
1802 /// <param name="notecardNameOrUuid"></param>
1803 /// <returns>The text loaded. Null if no notecard was found.</returns>
1804 protected string LoadNotecard(string notecardNameOrUuid)
1805 {
1806 UUID assetID = CacheNotecard(notecardNameOrUuid);
1807 StringBuilder notecardData = new StringBuilder();
1808
1809 for (int count = 0; count < NotecardCache.GetLines(assetID); count++)
1810 {
1811 string line = NotecardCache.GetLine(assetID, count) + "\n";
1812
1813// m_log.DebugFormat("[OSSL]: From notecard {0} loading line {1}", notecardNameOrUuid, line);
1754 1814
1755 /*Instead of using the LSL Dataserver event to pull notecard data, 1815 notecardData.Append(line);
1756 this will simply read the requested line and return its data as a string. 1816 }
1757 1817
1758 Warning - due to the synchronous method this function uses to fetch assets, its use 1818 return notecardData.ToString();
1759 may be dangerous and unreliable while running in grid mode. 1819 }
1760 */
1761 public string osGetNotecardLine(string name, int line)
1762 {
1763 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecardLine");
1764 m_host.AddScriptLPS(1);
1765 1820
1821 /// <summary>
1822 /// Cache a notecard's contents.
1823 /// </summary>
1824 /// <param name="notecardNameOrUuid"></param>
1825 /// <returns>
1826 /// The asset id of the notecard, which is used for retrieving the cached data.
1827 /// UUID.Zero if no asset could be found.
1828 /// </returns>
1829 protected UUID CacheNotecard(string notecardNameOrUuid)
1830 {
1766 UUID assetID = UUID.Zero; 1831 UUID assetID = UUID.Zero;
1767 1832
1768 if (!UUID.TryParse(name, out assetID)) 1833 if (!UUID.TryParse(notecardNameOrUuid, out assetID))
1769 { 1834 {
1770 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 1835 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
1771 { 1836 {
1772 if (item.Type == 7 && item.Name == name) 1837 if (item.Type == 7 && item.Name == notecardNameOrUuid)
1773 { 1838 {
1774 assetID = item.AssetID; 1839 assetID = item.AssetID;
1775 } 1840 }
@@ -1777,114 +1842,100 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1777 } 1842 }
1778 1843
1779 if (assetID == UUID.Zero) 1844 if (assetID == UUID.Zero)
1780 { 1845 return UUID.Zero;
1781 OSSLShoutError("Notecard '" + name + "' could not be found.");
1782 return "ERROR!";
1783 }
1784 1846
1785 if (!NotecardCache.IsCached(assetID)) 1847 if (!NotecardCache.IsCached(assetID))
1786 { 1848 {
1787 AssetBase a = World.AssetService.Get(assetID.ToString()); 1849 AssetBase a = World.AssetService.Get(assetID.ToString());
1788 if (a != null)
1789 {
1790 System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
1791 string data = enc.GetString(a.Data);
1792 NotecardCache.Cache(assetID, data);
1793 }
1794 else
1795 {
1796 OSSLShoutError("Notecard '" + name + "' could not be found.");
1797 return "ERROR!";
1798 }
1799 };
1800 1850
1801 return NotecardCache.GetLine(assetID, line, 255); 1851 if (a == null)
1852 return UUID.Zero;
1802 1853
1854 System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
1855 string data = enc.GetString(a.Data);
1856 NotecardCache.Cache(assetID, data);
1857 };
1803 1858
1859 return assetID;
1804 } 1860 }
1805 1861
1806 /*Instead of using the LSL Dataserver event to pull notecard data line by line, 1862 /// <summary>
1807 this will simply read the entire notecard and return its data as a string. 1863 /// Directly get an entire notecard at once.
1864 /// </summary>
1865 /// <remarks>
1866 /// Instead of using the LSL Dataserver event to pull notecard data
1867 /// this will simply read the entire notecard and return its data as a string.
1868 ///
1869 /// Warning - due to the synchronous method this function uses to fetch assets, its use
1870 /// may be dangerous and unreliable while running in grid mode.
1871 /// </remarks>
1872 /// <param name="name">Name of the notecard or its asset id</param>
1873 /// <param name="line">The line number to read. The first line is line 0</param>
1874 /// <returns>Notecard line</returns>
1875 public string osGetNotecardLine(string name, int line)
1876 {
1877 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecardLine");
1878 m_host.AddScriptLPS(1);
1879
1880 UUID assetID = CacheNotecard(name);
1881
1882 if (assetID == UUID.Zero)
1883 {
1884 OSSLShoutError("Notecard '" + name + "' could not be found.");
1885 return "ERROR!";
1886 }
1808 1887
1809 Warning - due to the synchronous method this function uses to fetch assets, its use 1888 return NotecardCache.GetLine(assetID, line);
1810 may be dangerous and unreliable while running in grid mode. 1889 }
1811 */
1812 1890
1891 /// <summary>
1892 /// Get an entire notecard at once.
1893 /// </summary>
1894 /// <remarks>
1895 /// Instead of using the LSL Dataserver event to pull notecard data line by line,
1896 /// this will simply read the entire notecard and return its data as a string.
1897 ///
1898 /// Warning - due to the synchronous method this function uses to fetch assets, its use
1899 /// may be dangerous and unreliable while running in grid mode.
1900 /// </remarks>
1901 /// <param name="name">Name of the notecard or its asset id</param>
1902 /// <returns>Notecard text</returns>
1813 public string osGetNotecard(string name) 1903 public string osGetNotecard(string name)
1814 { 1904 {
1815 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecard"); 1905 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecard");
1816 m_host.AddScriptLPS(1); 1906 m_host.AddScriptLPS(1);
1817 1907
1818 UUID assetID = UUID.Zero; 1908 string text = LoadNotecard(name);
1819 string NotecardData = "";
1820
1821 if (!UUID.TryParse(name, out assetID))
1822 {
1823 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
1824 {
1825 if (item.Type == 7 && item.Name == name)
1826 {
1827 assetID = item.AssetID;
1828 }
1829 }
1830 }
1831 1909
1832 if (assetID == UUID.Zero) 1910 if (text == null)
1833 { 1911 {
1834 OSSLShoutError("Notecard '" + name + "' could not be found."); 1912 OSSLShoutError("Notecard '" + name + "' could not be found.");
1835 return "ERROR!"; 1913 return "ERROR!";
1836 } 1914 }
1837 1915 else
1838 if (!NotecardCache.IsCached(assetID))
1839 {
1840 AssetBase a = World.AssetService.Get(assetID.ToString());
1841 if (a != null)
1842 {
1843 System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
1844 string data = enc.GetString(a.Data);
1845 NotecardCache.Cache(assetID, data);
1846 }
1847 else
1848 {
1849 OSSLShoutError("Notecard '" + name + "' could not be found.");
1850 return "ERROR!";
1851 }
1852 };
1853
1854 for (int count = 0; count < NotecardCache.GetLines(assetID); count++)
1855 { 1916 {
1856 NotecardData += NotecardCache.GetLine(assetID, count, 255) + "\n"; 1917 return text;
1857 } 1918 }
1858
1859 return NotecardData;
1860
1861
1862 } 1919 }
1863 1920
1864 /*Instead of using the LSL Dataserver event to pull notecard data, 1921 /// <summary>
1865 this will simply read the number of note card lines and return this data as an integer. 1922 /// Get the number of lines in the given notecard.
1866 1923 /// </summary>
1867 Warning - due to the synchronous method this function uses to fetch assets, its use 1924 /// <remarks>
1868 may be dangerous and unreliable while running in grid mode. 1925 /// Instead of using the LSL Dataserver event to pull notecard data,
1869 */ 1926 /// this will simply read the number of note card lines and return this data as an integer.
1870 1927 ///
1928 /// Warning - due to the synchronous method this function uses to fetch assets, its use
1929 /// may be dangerous and unreliable while running in grid mode.
1930 /// </remarks>
1931 /// <param name="name">Name of the notecard or its asset id</param>
1932 /// <returns></returns>
1871 public int osGetNumberOfNotecardLines(string name) 1933 public int osGetNumberOfNotecardLines(string name)
1872 { 1934 {
1873 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNumberOfNotecardLines"); 1935 CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNumberOfNotecardLines");
1874 m_host.AddScriptLPS(1); 1936 m_host.AddScriptLPS(1);
1875 1937
1876 UUID assetID = UUID.Zero; 1938 UUID assetID = CacheNotecard(name);
1877
1878 if (!UUID.TryParse(name, out assetID))
1879 {
1880 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
1881 {
1882 if (item.Type == 7 && item.Name == name)
1883 {
1884 assetID = item.AssetID;
1885 }
1886 }
1887 }
1888 1939
1889 if (assetID == UUID.Zero) 1940 if (assetID == UUID.Zero)
1890 { 1941 {
@@ -1892,22 +1943,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1892 return -1; 1943 return -1;
1893 } 1944 }
1894 1945
1895 if (!NotecardCache.IsCached(assetID))
1896 {
1897 AssetBase a = World.AssetService.Get(assetID.ToString());
1898 if (a != null)
1899 {
1900 System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
1901 string data = enc.GetString(a.Data);
1902 NotecardCache.Cache(assetID, data);
1903 }
1904 else
1905 {
1906 OSSLShoutError("Notecard '" + name + "' could not be found.");
1907 return -1;
1908 }
1909 };
1910
1911 return NotecardCache.GetLines(assetID); 1946 return NotecardCache.GetLines(assetID);
1912 } 1947 }
1913 1948
@@ -1947,15 +1982,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1947 { 1982 {
1948 return ""; 1983 return "";
1949 } 1984 }
1950
1951 } 1985 }
1952 1986
1987 /// <summary>
1988 /// Get the nickname of this grid, as set in the [GridInfo] config section.
1989 /// </summary>
1990 /// <remarks>
1953 /// Threat level is Moderate because intentional abuse, for instance 1991 /// Threat level is Moderate because intentional abuse, for instance
1954 /// scripts that are written to be malicious only on one grid, 1992 /// scripts that are written to be malicious only on one grid,
1955 /// for instance in a HG scenario, are a distinct possibility. 1993 /// for instance in a HG scenario, are a distinct possibility.
1956 /// 1994 /// </remarks>
1957 /// Use value from the config file and return it. 1995 /// <returns></returns>
1958 ///
1959 public string osGetGridNick() 1996 public string osGetGridNick()
1960 { 1997 {
1961 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); 1998 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick");
@@ -2063,12 +2100,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2063 return World.RegionInfo.RegionSettings.LoadedCreationID; 2100 return World.RegionInfo.RegionSettings.LoadedCreationID;
2064 } 2101 }
2065 2102
2066 // Threat level is 'Low' because certain users could possibly be tricked into 2103 /// <summary>
2067 // dropping an unverified script into one of their own objects, which could 2104 /// Get the primitive parameters of a linked prim.
2068 // then gather the physical construction details of the object and transmit it 2105 /// </summary>
2069 // to an unscrupulous third party, thus permitting unauthorized duplication of 2106 /// <remarks>
2070 // the object's form. 2107 /// Threat level is 'Low' because certain users could possibly be tricked into
2071 // 2108 /// dropping an unverified script into one of their own objects, which could
2109 /// then gather the physical construction details of the object and transmit it
2110 /// to an unscrupulous third party, thus permitting unauthorized duplication of
2111 /// the object's form.
2112 /// </remarks>
2113 /// <param name="linknumber"></param>
2114 /// <param name="rules"></param>
2115 /// <returns></returns>
2072 public LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules) 2116 public LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules)
2073 { 2117 {
2074 CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams"); 2118 CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams");
@@ -2083,25 +2127,122 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2083 return retVal; 2127 return retVal;
2084 } 2128 }
2085 2129
2086 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom) 2130 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard)
2087 { 2131 {
2088 CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); 2132 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
2089 //QueueUserWorkItem
2090 2133
2091 INPCModule module = World.RequestModuleInterface<INPCModule>(); 2134 INPCModule module = World.RequestModuleInterface<INPCModule>();
2092 if (module != null) 2135 if (module != null)
2093 { 2136 {
2137 AvatarAppearance appearance = null;
2138
2139 UUID id;
2140 if (UUID.TryParse(notecard, out id))
2141 {
2142 ScenePresence clonePresence = World.GetScenePresence(id);
2143 if (clonePresence != null)
2144 appearance = clonePresence.Appearance;
2145 }
2146
2147 if (appearance == null)
2148 {
2149 string appearanceSerialized = LoadNotecard(notecard);
2150
2151 if (appearanceSerialized != null)
2152 {
2153 OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized);
2154 appearance = new AvatarAppearance();
2155 appearance.Unpack(appearanceOsd);
2156 }
2157 }
2158
2159 if (appearance == null)
2160 return new LSL_Key(UUID.Zero.ToString());
2161
2094 UUID x = module.CreateNPC(firstname, 2162 UUID x = module.CreateNPC(firstname,
2095 lastname, 2163 lastname,
2096 new Vector3((float) position.x, (float) position.y, (float) position.z), 2164 new Vector3((float) position.x, (float) position.y, (float) position.z),
2097 World, 2165 World,
2098 new UUID(cloneFrom)); 2166 appearance);
2099 2167
2100 return new LSL_Key(x.ToString()); 2168 return new LSL_Key(x.ToString());
2101 } 2169 }
2170
2102 return new LSL_Key(UUID.Zero.ToString()); 2171 return new LSL_Key(UUID.Zero.ToString());
2103 } 2172 }
2104 2173
2174 /// <summary>
2175 /// Save the current appearance of the NPC permanently to the named notecard.
2176 /// </summary>
2177 /// <param name="avatar"></param>
2178 /// <param name="notecard">The name of the notecard to which to save the appearance.</param>
2179 /// <returns>The asset ID of the notecard saved.</returns>
2180 public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard)
2181 {
2182 CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance");
2183
2184 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
2185
2186 if (npcModule != null)
2187 {
2188 UUID npcId;
2189 if (!UUID.TryParse(npc.m_string, out npcId))
2190 return new LSL_Key(UUID.Zero.ToString());
2191
2192 if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene))
2193 return new LSL_Key(UUID.Zero.ToString());
2194
2195 return SaveAppearanceToNotecard(npcId, notecard);
2196 }
2197
2198 return new LSL_Key(UUID.Zero.ToString());
2199 }
2200
2201 public void osNpcLoadAppearance(LSL_Key npc, string notecard)
2202 {
2203 CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance");
2204
2205 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
2206
2207 if (npcModule != null)
2208 {
2209 UUID npcId;
2210 if (!UUID.TryParse(npc.m_string, out npcId))
2211 return;
2212
2213 string appearanceSerialized = LoadNotecard(notecard);
2214 OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized);
2215// OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized);
2216// Console.WriteLine("appearanceSerialized {0}", appearanceSerialized);
2217// Console.WriteLine("a.Type {0}, a.ToString() {1}", a.Type, a);
2218 AvatarAppearance appearance = new AvatarAppearance();
2219 appearance.Unpack(appearanceOsd);
2220
2221 npcModule.SetNPCAppearance(npcId, appearance, m_host.ParentGroup.Scene);
2222 }
2223 }
2224
2225 public LSL_Vector osNpcGetPos(LSL_Key npc)
2226 {
2227 CheckThreatLevel(ThreatLevel.High, "osNpcGetPos");
2228
2229 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
2230 if (npcModule != null)
2231 {
2232 UUID npcId;
2233 if (!UUID.TryParse(npc.m_string, out npcId))
2234 return new LSL_Vector(0, 0, 0);
2235
2236 if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene))
2237 return new LSL_Vector(0, 0, 0);
2238
2239 Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition;
2240 return new LSL_Vector(pos.X, pos.Y, pos.Z);
2241 }
2242
2243 return new LSL_Vector(0, 0, 0);
2244 }
2245
2105 public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) 2246 public void osNpcMoveTo(LSL_Key npc, LSL_Vector position)
2106 { 2247 {
2107 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); 2248 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
@@ -2109,11 +2250,87 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2109 INPCModule module = World.RequestModuleInterface<INPCModule>(); 2250 INPCModule module = World.RequestModuleInterface<INPCModule>();
2110 if (module != null) 2251 if (module != null)
2111 { 2252 {
2253 UUID npcId;
2254 if (!UUID.TryParse(npc.m_string, out npcId))
2255 return;
2256
2112 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); 2257 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
2113 module.MoveToTarget(new UUID(npc.m_string), World, pos); 2258 module.MoveToTarget(npcId, World, pos, false, true);
2114 } 2259 }
2115 } 2260 }
2116 2261
2262 public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options)
2263 {
2264 CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget");
2265
2266 INPCModule module = World.RequestModuleInterface<INPCModule>();
2267 if (module != null)
2268 {
2269 UUID npcId;
2270 if (!UUID.TryParse(npc.m_string, out npcId))
2271 return;
2272
2273 Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z);
2274 module.MoveToTarget(
2275 new UUID(npc.m_string),
2276 World,
2277 pos,
2278 (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0,
2279 (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0);
2280 }
2281 }
2282
2283 public LSL_Rotation osNpcGetRot(LSL_Key npc)
2284 {
2285 CheckThreatLevel(ThreatLevel.High, "osNpcGetRot");
2286
2287 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
2288 if (npcModule != null)
2289 {
2290 UUID npcId;
2291 if (!UUID.TryParse(npc.m_string, out npcId))
2292 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
2293
2294 if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene))
2295 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
2296
2297 ScenePresence sp = World.GetScenePresence(npcId);
2298 Quaternion rot = sp.Rotation;
2299
2300 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
2301 }
2302
2303 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
2304 }
2305
2306 public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation)
2307 {
2308 CheckThreatLevel(ThreatLevel.High, "osNpcSetRot");
2309
2310 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
2311 if (npcModule != null)
2312 {
2313 UUID npcId;
2314 if (!UUID.TryParse(npc.m_string, out npcId))
2315 return;
2316
2317 if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene))
2318 return;
2319
2320 ScenePresence sp = World.GetScenePresence(npcId);
2321 sp.Rotation = LSL_Api.Rot2Quaternion(rotation);
2322 }
2323 }
2324
2325 public void osNpcStopMoveToTarget(LSL_Key npc)
2326 {
2327 CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo");
2328
2329 INPCModule module = World.RequestModuleInterface<INPCModule>();
2330 if (module != null)
2331 module.StopMoveToTarget(new UUID(npc.m_string), World);
2332 }
2333
2117 public void osNpcSay(LSL_Key npc, string message) 2334 public void osNpcSay(LSL_Key npc, string message)
2118 { 2335 {
2119 CheckThreatLevel(ThreatLevel.High, "osNpcSay"); 2336 CheckThreatLevel(ThreatLevel.High, "osNpcSay");
@@ -2135,6 +2352,64 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2135 module.DeleteNPC(new UUID(npc.m_string), World); 2352 module.DeleteNPC(new UUID(npc.m_string), World);
2136 } 2353 }
2137 } 2354 }
2355
2356 /// <summary>
2357 /// Save the current appearance of the script owner permanently to the named notecard.
2358 /// </summary>
2359 /// <param name="notecard">The name of the notecard to which to save the appearance.</param>
2360 /// <returns>The asset ID of the notecard saved.</returns>
2361 public LSL_Key osOwnerSaveAppearance(string notecard)
2362 {
2363 CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance");
2364
2365 return SaveAppearanceToNotecard(m_host.OwnerID, notecard);
2366 }
2367
2368 public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard)
2369 {
2370 CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance");
2371
2372 return SaveAppearanceToNotecard(avatarId, notecard);
2373 }
2374
2375 protected LSL_Key SaveAppearanceToNotecard(ScenePresence sp, string notecard)
2376 {
2377 IAvatarFactory appearanceModule = World.RequestModuleInterface<IAvatarFactory>();
2378
2379 if (appearanceModule != null)
2380 {
2381 appearanceModule.SaveBakedTextures(sp.UUID);
2382 OSDMap appearancePacked = sp.Appearance.Pack();
2383
2384 TaskInventoryItem item
2385 = SaveNotecard(notecard, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true);
2386
2387 return new LSL_Key(item.AssetID.ToString());
2388 }
2389 else
2390 {
2391 return new LSL_Key(UUID.Zero.ToString());
2392 }
2393 }
2394
2395 protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecard)
2396 {
2397 ScenePresence sp = World.GetScenePresence(avatarId);
2398
2399 if (sp == null || sp.IsChildAgent)
2400 return new LSL_Key(UUID.Zero.ToString());
2401
2402 return SaveAppearanceToNotecard(sp, notecard);
2403 }
2404
2405 protected LSL_Key SaveAppearanceToNotecard(LSL_Key rawAvatarId, string notecard)
2406 {
2407 UUID avatarId;
2408 if (!UUID.TryParse(rawAvatarId, out avatarId))
2409 return new LSL_Key(UUID.Zero.ToString());
2410
2411 return SaveAppearanceToNotecard(avatarId, notecard);
2412 }
2138 2413
2139 /// <summary> 2414 /// <summary>
2140 /// Get current region's map texture UUID 2415 /// Get current region's map texture UUID
@@ -2344,10 +2619,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2344 obj.Shape.ProjectionFocus = (float)focus; 2619 obj.Shape.ProjectionFocus = (float)focus;
2345 obj.Shape.ProjectionAmbiance = (float)amb; 2620 obj.Shape.ProjectionAmbiance = (float)amb;
2346 2621
2347
2348 obj.ParentGroup.HasGroupChanged = true; 2622 obj.ParentGroup.HasGroupChanged = true;
2349 obj.ScheduleFullUpdate(); 2623 obj.ScheduleFullUpdate();
2350
2351 } 2624 }
2352 2625
2353 /// <summary> 2626 /// <summary>
@@ -2372,6 +2645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2372 } 2645 }
2373 } 2646 }
2374 }); 2647 });
2648
2375 return result; 2649 return result;
2376 } 2650 }
2377 2651
@@ -2391,4 +2665,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2391 return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); 2665 return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
2392 } 2666 }
2393 } 2667 }
2394} 2668} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 19352f0..87cfe1a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -168,12 +168,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
168 168
169 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); 169 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
170 170
171 171 key osNpcCreate(string user, string name, vector position, string notecard);
172 key osNpcCreate(string user, string name, vector position, key cloneFrom); 172 LSL_Key osNpcSaveAppearance(key npc, string notecard);
173 void osNpcLoadAppearance(key npc, string notecard);
174 vector osNpcGetPos(key npc);
173 void osNpcMoveTo(key npc, vector position); 175 void osNpcMoveTo(key npc, vector position);
176 void osNpcMoveToTarget(key npc, vector target, int options);
177 rotation osNpcGetRot(key npc);
178 void osNpcSetRot(LSL_Key npc, rotation rot);
179 void osNpcStopMoveToTarget(LSL_Key npc);
174 void osNpcSay(key npc, string message); 180 void osNpcSay(key npc, string message);
175 void osNpcRemove(key npc); 181 void osNpcRemove(key npc);
176 182
183 LSL_Key osOwnerSaveAppearance(string notecard);
184 LSL_Key osAgentSaveAppearance(key agentId, string notecard);
185
177 key osGetMapTexture(); 186 key osGetMapTexture();
178 key osGetRegionMapTexture(string regionName); 187 key osGetRegionMapTexture(string regionName);
179 LSL_List osGetRegionStats(); 188 LSL_List osGetRegionStats();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 3f90788..e82c281 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -591,6 +591,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
591 public const int STATS_ACTIVE_SCRIPTS = 19; 591 public const int STATS_ACTIVE_SCRIPTS = 19;
592 public const int STATS_SCRIPT_LPS = 20; 592 public const int STATS_SCRIPT_LPS = 20;
593 593
594 // Constants for osNpc* functions
595 public const int OS_NPC_FLY = 0;
596 public const int OS_NPC_NO_FLY = 1;
597 public const int OS_NPC_LAND_AT_TARGET = 2;
598
594 public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; 599 public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED";
595 public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; 600 public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED";
596 601
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 7c59098..bbc8cc6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -483,11 +483,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
483 return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); 483 return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom);
484 } 484 }
485 485
486 public key osNpcSaveAppearance(key npc, string notecard)
487 {
488 return m_OSSL_Functions.osNpcSaveAppearance(npc, notecard);
489 }
490
491 public void osNpcLoadAppearance(key npc, string notecard)
492 {
493 m_OSSL_Functions.osNpcLoadAppearance(npc, notecard);
494 }
495
496 public vector osNpcGetPos(LSL_Key npc)
497 {
498 return m_OSSL_Functions.osNpcGetPos(npc);
499 }
500
486 public void osNpcMoveTo(key npc, vector position) 501 public void osNpcMoveTo(key npc, vector position)
487 { 502 {
488 m_OSSL_Functions.osNpcMoveTo(npc, position); 503 m_OSSL_Functions.osNpcMoveTo(npc, position);
489 } 504 }
490 505
506 public void osNpcMoveToTarget(key npc, vector target, int options)
507 {
508 m_OSSL_Functions.osNpcMoveToTarget(npc, target, options);
509 }
510
511 public rotation osNpcGetRot(key npc)
512 {
513 return m_OSSL_Functions.osNpcGetRot(npc);
514 }
515
516 public void osNpcSetRot(key npc, rotation rot)
517 {
518 m_OSSL_Functions.osNpcSetRot(npc, rot);
519 }
520
521 public void osNpcStopMoveToTarget(LSL_Key npc)
522 {
523 m_OSSL_Functions.osNpcStopMoveToTarget(npc);
524 }
525
491 public void osNpcSay(key npc, string message) 526 public void osNpcSay(key npc, string message)
492 { 527 {
493 m_OSSL_Functions.osNpcSay(npc, message); 528 m_OSSL_Functions.osNpcSay(npc, message);
@@ -498,6 +533,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
498 m_OSSL_Functions.osNpcRemove(npc); 533 m_OSSL_Functions.osNpcRemove(npc);
499 } 534 }
500 535
536 public LSL_Key osOwnerSaveAppearance(string notecard)
537 {
538 return m_OSSL_Functions.osOwnerSaveAppearance(notecard);
539 }
540
541 public LSL_Key osAgentSaveAppearance(LSL_Key agentId, string notecard)
542 {
543 return m_OSSL_Functions.osAgentSaveAppearance(agentId, notecard);
544 }
545
501 public OSSLPrim Prim; 546 public OSSLPrim Prim;
502 547
503 [Serializable] 548 [Serializable]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 80b60a4..623c82d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -27,11 +27,13 @@
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using NUnit.Framework; 29using NUnit.Framework;
30using OpenSim.Framework;
30using OpenSim.Tests.Common; 31using OpenSim.Tests.Common;
31using OpenSim.Region.ScriptEngine.Shared; 32using OpenSim.Region.ScriptEngine.Shared;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
33using Nini.Config; 34using Nini.Config;
34using OpenSim.Region.ScriptEngine.Shared.Api; 35using OpenSim.Region.ScriptEngine.Shared.Api;
36using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
35using OpenMetaverse; 37using OpenMetaverse;
36using System; 38using System;
37using OpenSim.Tests.Common.Mock; 39using OpenSim.Tests.Common.Mock;
@@ -47,6 +49,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
47 49
48 private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; 50 private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
49 private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; 51 private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d;
52 private const double FLOAT_ACCURACY = 0.00005d;
50 private LSL_Api m_lslApi; 53 private LSL_Api m_lslApi;
51 54
52 [SetUp] 55 [SetUp]
@@ -57,8 +60,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
57 IConfig config = initConfigSource.AddConfig("XEngine"); 60 IConfig config = initConfigSource.AddConfig("XEngine");
58 config.Set("Enabled", "true"); 61 config.Set("Enabled", "true");
59 62
60 Scene scene = SceneSetupHelpers.SetupScene(); 63 Scene scene = SceneHelpers.SetupScene();
61 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 64 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
62 65
63 XEngine.XEngine engine = new XEngine.XEngine(); 66 XEngine.XEngine engine = new XEngine.XEngine();
64 engine.Initialise(initConfigSource); 67 engine.Initialise(initConfigSource);
@@ -166,6 +169,178 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
166 } 169 }
167 170
168 [Test] 171 [Test]
172 // llSetPrimitiveParams and llGetPrimitiveParams test.
173 public void TestllSetPrimitiveParams()
174 {
175 // Create Prim1.
176 Scene scene = SceneHelpers.SetupScene();
177 string obj1Name = "Prim1";
178 UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
179 SceneObjectPart part1 =
180 new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default,
181 Vector3.Zero, Quaternion.Identity,
182 Vector3.Zero) { Name = obj1Name, UUID = objUuid };
183 Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);
184
185 // Test a sphere.
186 CheckllSetPrimitiveParams(
187 "test 1", // Prim test identification string
188 new LSL_Types.Vector3(6.0d, 9.9d, 9.9d), // Prim size
189 ScriptBaseClass.PRIM_TYPE_SPHERE, // Prim type
190 ScriptBaseClass.PRIM_HOLE_DEFAULT, // Prim hole type
191 new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut
192 0.80d, // Prim hollow
193 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist
194 new LSL_Types.Vector3(0.32d, 0.76d, 0.0d)); // Prim dimple
195
196 // Test a prism.
197 CheckllSetPrimitiveParams(
198 "test 2", // Prim test identification string
199 new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size
200 ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type
201 ScriptBaseClass.PRIM_HOLE_CIRCLE, // Prim hole type
202 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
203 0.90d, // Prim hollow
204 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist
205 new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper
206 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear
207
208 // Test a box.
209 CheckllSetPrimitiveParams(
210 "test 3", // Prim test identification string
211 new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size
212 ScriptBaseClass.PRIM_TYPE_BOX, // Prim type
213 ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type
214 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
215 0.90d, // Prim hollow
216 new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist
217 new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper
218 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear
219
220 // Test a tube.
221 CheckllSetPrimitiveParams(
222 "test 4", // Prim test identification string
223 new LSL_Types.Vector3(4.2d, 4.2d, 4.2d), // Prim size
224 ScriptBaseClass.PRIM_TYPE_TUBE, // Prim type
225 ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type
226 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
227 0.00d, // Prim hollow
228 new LSL_Types.Vector3(1.0d, -1.0d, 0.0d), // Prim twist
229 new LSL_Types.Vector3(1.0d, 0.5d, 0.0d), // Prim hole size
230 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
231 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim profile cut
232 new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper
233 1.0d, // Prim revolutions
234 1.0d, // Prim radius
235 0.0d); // Prim skew
236 }
237
238 // Set prim params for a box, cylinder or prism and check results.
239 public void CheckllSetPrimitiveParams(string primTest,
240 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
241 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear)
242 {
243 // Set the prim params.
244 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
245 ScriptBaseClass.PRIM_TYPE, primType, primHoleType,
246 primCut, primHollow, primTwist, primTaper, primShear));
247
248 // Get params for prim to validate settings.
249 LSL_Types.list primParams =
250 m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE));
251
252 // Validate settings.
253 CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size");
254 Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1),
255 "TestllSetPrimitiveParams " + primTest + " prim type check fail");
256 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
257 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
258 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
259 Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
260 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
261 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
262 CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper");
263 CheckllSetPrimitiveParamsVector(primShear, m_lslApi.llList2Vector(primParams, 7), primTest + " prim shear");
264 }
265
266 // Set prim params for a sphere and check results.
267 public void CheckllSetPrimitiveParams(string primTest,
268 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
269 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple)
270 {
271 // Set the prim params.
272 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
273 ScriptBaseClass.PRIM_TYPE, primType, primHoleType,
274 primCut, primHollow, primTwist, primDimple));
275
276 // Get params for prim to validate settings.
277 LSL_Types.list primParams =
278 m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE));
279
280 // Validate settings.
281 CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size");
282 Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1),
283 "TestllSetPrimitiveParams " + primTest + " prim type check fail");
284 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
285 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
286 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
287 Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
288 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
289 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
290 CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple");
291 }
292
293 // Set prim params for a torus, tube or ring and check results.
294 public void CheckllSetPrimitiveParams(string primTest,
295 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
296 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize,
297 LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper,
298 double primRev, double primRadius, double primSkew)
299 {
300 // Set the prim params.
301 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
302 ScriptBaseClass.PRIM_TYPE, primType, primHoleType,
303 primCut, primHollow, primTwist, primHoleSize, primShear, primProfCut,
304 primTaper, primRev, primRadius, primSkew));
305
306 // Get params for prim to validate settings.
307 LSL_Types.list primParams =
308 m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE));
309
310 // Valdate settings.
311 CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size");
312 Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1),
313 "TestllSetPrimitiveParams " + primTest + " prim type check fail");
314 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
315 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
316 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
317 Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
318 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
319 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
320 CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size");
321 CheckllSetPrimitiveParamsVector(primShear, m_lslApi.llList2Vector(primParams, 7), primTest + " prim shear");
322 CheckllSetPrimitiveParamsVector(primProfCut, m_lslApi.llList2Vector(primParams, 8), primTest + " prim profile cut");
323 CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 9), primTest + " prim taper");
324 Assert.AreEqual(primRev, m_lslApi.llList2Float(primParams, 10), FLOAT_ACCURACY,
325 "TestllSetPrimitiveParams " + primTest + " prim revolution fail");
326 Assert.AreEqual(primRadius, m_lslApi.llList2Float(primParams, 11), FLOAT_ACCURACY,
327 "TestllSetPrimitiveParams " + primTest + " prim radius fail");
328 Assert.AreEqual(primSkew, m_lslApi.llList2Float(primParams, 12), FLOAT_ACCURACY,
329 "TestllSetPrimitiveParams " + primTest + " prim skew fail");
330 }
331
332 public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg)
333 {
334 // Check each vector component against expected result.
335 Assert.AreEqual(vecCheck.x, vecReturned.x, VECTOR_COMPONENT_ACCURACY,
336 "TestllSetPrimitiveParams " + msg + " vector check fail on x component");
337 Assert.AreEqual(vecCheck.y, vecReturned.y, VECTOR_COMPONENT_ACCURACY,
338 "TestllSetPrimitiveParams " + msg + " vector check fail on y component");
339 Assert.AreEqual(vecCheck.z, vecReturned.z, VECTOR_COMPONENT_ACCURACY,
340 "TestllSetPrimitiveParams " + msg + " vector check fail on z component");
341 }
342
343 [Test]
169 // llVecNorm test. 344 // llVecNorm test.
170 public void TestllVecNorm() 345 public void TestllVecNorm()
171 { 346 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
new file mode 100644
index 0000000..7573dff
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
@@ -0,0 +1,229 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using log4net;
33using Nini.Config;
34using NUnit.Framework;
35using OpenMetaverse;
36using OpenMetaverse.Assets;
37using OpenMetaverse.StructuredData;
38using OpenSim.Framework;
39using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
40using OpenSim.Region.OptionalModules.World.NPC;
41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.ScriptEngine.Shared;
43using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47
48namespace OpenSim.Region.ScriptEngine.Shared.Tests
49{
50 /// <summary>
51 /// Tests for OSSL_Api
52 /// </summary>
53 [TestFixture]
54 public class OSSL_ApiAppearanceTest
55 {
56 protected Scene m_scene;
57 protected XEngine.XEngine m_engine;
58
59 [SetUp]
60 public void SetUp()
61 {
62 IConfigSource initConfigSource = new IniConfigSource();
63 IConfig config = initConfigSource.AddConfig("XEngine");
64 config.Set("Enabled", "true");
65 config.Set("AllowOSFunctions", "true");
66 config.Set("OSFunctionThreatLevel", "Severe");
67 config = initConfigSource.AddConfig("NPC");
68 config.Set("Enabled", "true");
69
70 m_scene = SceneHelpers.SetupScene();
71 SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule());
72
73 m_engine = new XEngine.XEngine();
74 m_engine.Initialise(initConfigSource);
75 m_engine.AddRegion(m_scene);
76 }
77
78 /// <summary>
79 /// Test creation of an NPC where the appearance data comes from a notecard
80 /// </summary>
81 [Test]
82 public void TestOsNpcCreateFromNotecard()
83 {
84 TestHelpers.InMethod();
85// log4net.Config.XmlConfigurator.Configure();
86
87 // Store an avatar with a different height from default in a notecard.
88 UUID userId = TestHelpers.ParseTail(0x1);
89 float newHeight = 1.9f;
90
91 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
92 sp.Appearance.AvatarHeight = newHeight;
93 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
94 SceneObjectPart part = so.RootPart;
95 m_scene.AddSceneObject(so);
96
97 OSSL_Api osslApi = new OSSL_Api();
98 osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
99
100 string notecardName = "appearanceNc";
101 osslApi.osOwnerSaveAppearance(notecardName);
102
103 // Try creating a bot using the appearance in the notecard.
104 string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), notecardName);
105 Assert.That(npcRaw, Is.Not.Null);
106
107 UUID npcId = new UUID(npcRaw);
108 ScenePresence npc = m_scene.GetScenePresence(npcId);
109 Assert.That(npc, Is.Not.Null);
110 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight));
111 }
112
113 /// <summary>
114 /// Test creation of an NPC where the appearance data comes from an avatar already in the region.
115 /// </summary>
116 [Test]
117 public void TestOsNpcCreateFromAvatar()
118 {
119 TestHelpers.InMethod();
120// log4net.Config.XmlConfigurator.Configure();
121
122 // Store an avatar with a different height from default in a notecard.
123 UUID userId = TestHelpers.ParseTail(0x1);
124 float newHeight = 1.9f;
125
126 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
127 sp.Appearance.AvatarHeight = newHeight;
128 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
129 SceneObjectPart part = so.RootPart;
130 m_scene.AddSceneObject(so);
131
132 OSSL_Api osslApi = new OSSL_Api();
133 osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
134
135 string notecardName = "appearanceNc";
136 osslApi.osOwnerSaveAppearance(notecardName);
137
138 // Try creating a bot using the existing avatar's appearance
139 string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), sp.UUID.ToString());
140 Assert.That(npcRaw, Is.Not.Null);
141
142 UUID npcId = new UUID(npcRaw);
143 ScenePresence npc = m_scene.GetScenePresence(npcId);
144 Assert.That(npc, Is.Not.Null);
145 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight));
146 }
147
148 [Test]
149 public void TestOsOwnerSaveAppearance()
150 {
151 TestHelpers.InMethod();
152// log4net.Config.XmlConfigurator.Configure();
153
154 UUID userId = TestHelpers.ParseTail(0x1);
155 float newHeight = 1.9f;
156
157 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
158 sp.Appearance.AvatarHeight = newHeight;
159 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
160 SceneObjectPart part = so.RootPart;
161 m_scene.AddSceneObject(so);
162
163 OSSL_Api osslApi = new OSSL_Api();
164 osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
165
166 string notecardName = "appearanceNc";
167
168 osslApi.osOwnerSaveAppearance(notecardName);
169
170 IList<TaskInventoryItem> items = part.Inventory.GetInventoryItems(notecardName);
171 Assert.That(items.Count, Is.EqualTo(1));
172
173 TaskInventoryItem ncItem = items[0];
174 Assert.That(ncItem.Name, Is.EqualTo(notecardName));
175
176 AssetBase ncAsset = m_scene.AssetService.Get(ncItem.AssetID.ToString());
177 Assert.That(ncAsset, Is.Not.Null);
178
179 AssetNotecard anc = new AssetNotecard(UUID.Zero, ncAsset.Data);
180 anc.Decode();
181 OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(anc.BodyText);
182 AvatarAppearance savedAppearance = new AvatarAppearance();
183 savedAppearance.Unpack(appearanceOsd);
184
185 Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight));
186 }
187
188 [Test]
189 public void TestOsAgentSaveAppearance()
190 {
191 TestHelpers.InMethod();
192// log4net.Config.XmlConfigurator.Configure();
193
194 UUID ownerId = TestHelpers.ParseTail(0x1);
195 UUID nonOwnerId = TestHelpers.ParseTail(0x2);
196 float newHeight = 1.9f;
197
198 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, nonOwnerId);
199 sp.Appearance.AvatarHeight = newHeight;
200 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId);
201 SceneObjectPart part = so.RootPart;
202 m_scene.AddSceneObject(so);
203
204 OSSL_Api osslApi = new OSSL_Api();
205 osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
206
207 string notecardName = "appearanceNc";
208
209 osslApi.osAgentSaveAppearance(new LSL_Types.LSLString(nonOwnerId.ToString()), notecardName);
210
211 IList<TaskInventoryItem> items = part.Inventory.GetInventoryItems(notecardName);
212 Assert.That(items.Count, Is.EqualTo(1));
213
214 TaskInventoryItem ncItem = items[0];
215 Assert.That(ncItem.Name, Is.EqualTo(notecardName));
216
217 AssetBase ncAsset = m_scene.AssetService.Get(ncItem.AssetID.ToString());
218 Assert.That(ncAsset, Is.Not.Null);
219
220 AssetNotecard anc = new AssetNotecard(UUID.Zero, ncAsset.Data);
221 anc.Decode();
222 OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(anc.BodyText);
223 AvatarAppearance savedAppearance = new AvatarAppearance();
224 savedAppearance.Unpack(appearanceOsd);
225
226 Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight));
227 }
228 }
229} \ No newline at end of file
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index c7a259d..d40aa4b 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -174,10 +174,12 @@ namespace OpenSim.Services.AssetService
174 174
175 public virtual string Store(AssetBase asset) 175 public virtual string Store(AssetBase asset)
176 { 176 {
177// m_log.DebugFormat( 177 if (!m_Database.ExistsAsset(asset.FullID))
178// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length); 178 {
179 179// m_log.DebugFormat(
180 m_Database.StoreAsset(asset); 180// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
181 m_Database.StoreAsset(asset);
182 }
181 183
182 return asset.ID; 184 return asset.ID;
183 } 185 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
index b8703c6..2267325 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
97 } 97 }
98 } 98 }
99 99
100 m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); 100// m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
101 m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat); 101 m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat);
102 } 102 }
103 } 103 }
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index f663dd6..0a4372a 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -510,8 +510,9 @@ namespace OpenSim.Services.GridService
510 OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); 510 OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
511 MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", 511 MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n",
512 r.RegionName, r.RegionID, 512 r.RegionName, r.RegionID,
513 String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], 513 String.Format("{0},{1}", r.posX / Constants.RegionSize, r.posY / Constants.RegionSize),
514 r.Data["owner_uuid"].ToString(), flags.ToString())); 514 r.Data["serverURI"],
515 r.Data["owner_uuid"], flags));
515 } 516 }
516 return; 517 return;
517 } 518 }
diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs
index bb31fc9..0c9cfd3 100644
--- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs
+++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs
@@ -95,7 +95,6 @@ namespace OpenSim.Services.HypergridService
95 m_InGatekeeper = serverConfig.GetBoolean("InGatekeeper", false); 95 m_InGatekeeper = serverConfig.GetBoolean("InGatekeeper", false);
96 m_log.DebugFormat("[HG IM SERVICE]: Starting... InRobust? {0}", m_InGatekeeper); 96 m_log.DebugFormat("[HG IM SERVICE]: Starting... InRobust? {0}", m_InGatekeeper);
97 97
98
99 if (gridService == string.Empty || presenceService == string.Empty) 98 if (gridService == string.Empty || presenceService == string.Empty)
100 throw new Exception(String.Format("Incomplete specifications, InstantMessage Service cannot function.")); 99 throw new Exception(String.Format("Incomplete specifications, InstantMessage Service cannot function."));
101 100
@@ -120,8 +119,8 @@ namespace OpenSim.Services.HypergridService
120 119
121 public bool IncomingInstantMessage(GridInstantMessage im) 120 public bool IncomingInstantMessage(GridInstantMessage im)
122 { 121 {
123 m_log.DebugFormat("[HG IM SERVICE]: Received message from {0} to {1}", im.fromAgentID, im.toAgentID); 122// m_log.DebugFormat("[HG IM SERVICE]: Received message from {0} to {1}", im.fromAgentID, im.toAgentID);
124 UUID toAgentID = new UUID(im.toAgentID); 123// UUID toAgentID = new UUID(im.toAgentID);
125 124
126 bool success = false; 125 bool success = false;
127 if (m_IMSimConnector != null) 126 if (m_IMSimConnector != null)
@@ -142,7 +141,7 @@ namespace OpenSim.Services.HypergridService
142 141
143 public bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner) 142 public bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner)
144 { 143 {
145 m_log.DebugFormat("[HG IM SERVICE]: Sending message from {0} to {1}@{2}", im.fromAgentID, im.toAgentID, url); 144// m_log.DebugFormat("[HG IM SERVICE]: Sending message from {0} to {1}@{2}", im.fromAgentID, im.toAgentID, url);
146 if (url != string.Empty) 145 if (url != string.Empty)
147 return TrySendInstantMessage(im, url, true, foreigner); 146 return TrySendInstantMessage(im, url, true, foreigner);
148 else 147 else
@@ -333,7 +332,7 @@ namespace OpenSim.Services.HypergridService
333 if (m_RestURL != string.Empty && (im.offline != 0) 332 if (m_RestURL != string.Empty && (im.offline != 0)
334 && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) 333 && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
335 { 334 {
336 m_log.DebugFormat("[HG IM SERVICE]: Message saved"); 335// m_log.DebugFormat("[HG IM SERVICE]: Message saved");
337 336
338 return SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( 337 return SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
339 "POST", m_RestURL + "/SaveMessage/", im); 338 "POST", m_RestURL + "/SaveMessage/", im);
diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs
index 1ac1cec..80494f1 100644
--- a/OpenSim/Services/Interfaces/IAssetService.cs
+++ b/OpenSim/Services/Interfaces/IAssetService.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Services.Interfaces
56 byte[] GetData(string id); 56 byte[] GetData(string id);
57 57
58 /// <summary> 58 /// <summary>
59 /// Synchronously fetches an asset from the local cache only 59 /// Synchronously fetches an asset from the local cache only.
60 /// </summary> 60 /// </summary>
61 /// <param name="id">Asset ID</param> 61 /// <param name="id">Asset ID</param>
62 /// <returns>The fetched asset, or null if it did not exist in the local cache</returns> 62 /// <returns>The fetched asset, or null if it did not exist in the local cache</returns>
@@ -75,7 +75,9 @@ namespace OpenSim.Services.Interfaces
75 /// <summary> 75 /// <summary>
76 /// Creates a new asset 76 /// Creates a new asset
77 /// </summary> 77 /// </summary>
78 /// Returns a random ID if none is passed into it 78 /// <remarks>
79 /// Returns a random ID if none is passed via the asset argument.
80 /// </remarks>
79 /// <param name="asset"></param> 81 /// <param name="asset"></param>
80 /// <returns></returns> 82 /// <returns></returns>
81 string Store(AssetBase asset); 83 string Store(AssetBase asset);
@@ -83,7 +85,9 @@ namespace OpenSim.Services.Interfaces
83 /// <summary> 85 /// <summary>
84 /// Update an asset's content 86 /// Update an asset's content
85 /// </summary> 87 /// </summary>
88 /// <remarks>
86 /// Attachments and bare scripts need this!! 89 /// Attachments and bare scripts need this!!
90 /// </remarks>
87 /// <param name="id"> </param> 91 /// <param name="id"> </param>
88 /// <param name="data"></param> 92 /// <param name="data"></param>
89 /// <returns></returns> 93 /// <returns></returns>
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index f68c078..1a874c8 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -183,6 +183,8 @@ namespace OpenSim.Services.LLLoginService
183 183
184 private BuddyList m_buddyList = null; 184 private BuddyList m_buddyList = null;
185 185
186 private string currency;
187
186 static LLLoginResponse() 188 static LLLoginResponse()
187 { 189 {
188 // This is being set, but it's not used 190 // This is being set, but it's not used
@@ -218,7 +220,7 @@ namespace OpenSim.Services.LLLoginService
218 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, 220 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
219 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, 221 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
220 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, 222 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
221 GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL) 223 GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL, string currency)
222 : this() 224 : this()
223 { 225 {
224 FillOutInventoryData(invSkel, libService); 226 FillOutInventoryData(invSkel, libService);
@@ -236,6 +238,7 @@ namespace OpenSim.Services.LLLoginService
236 StartLocation = where; 238 StartLocation = where;
237 MapTileURL = mapTileURL; 239 MapTileURL = mapTileURL;
238 SearchURL = searchURL; 240 SearchURL = searchURL;
241 Currency = currency;
239 242
240 FillOutHomeData(pinfo, home); 243 FillOutHomeData(pinfo, home);
241 LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); 244 LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z);
@@ -382,6 +385,8 @@ namespace OpenSim.Services.LLLoginService
382 initialOutfit.Add(InitialOutfitHash); 385 initialOutfit.Add(InitialOutfitHash);
383 mapTileURL = String.Empty; 386 mapTileURL = String.Empty;
384 searchURL = String.Empty; 387 searchURL = String.Empty;
388
389 currency = String.Empty;
385 } 390 }
386 391
387 392
@@ -456,6 +461,12 @@ namespace OpenSim.Services.LLLoginService
456 responseData["buddy-list"] = m_buddyList.ToArray(); 461 responseData["buddy-list"] = m_buddyList.ToArray();
457 } 462 }
458 463
464 if (currency != String.Empty)
465 {
466 // responseData["real_currency"] = currency;
467 responseData["currency"] = currency;
468 }
469
459 responseData["login"] = "true"; 470 responseData["login"] = "true";
460 471
461 return responseData; 472 return responseData;
@@ -940,6 +951,12 @@ namespace OpenSim.Services.LLLoginService
940 set { m_buddyList = value; } 951 set { m_buddyList = value; }
941 } 952 }
942 953
954 public string Currency
955 {
956 get { return currency; }
957 set { currency = value; }
958 }
959
943 #endregion 960 #endregion
944 961
945 public class UserInfo 962 public class UserInfo
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 00405a1..4ccc7ff 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -75,6 +75,7 @@ namespace OpenSim.Services.LLLoginService
75 protected bool m_AllowRemoteSetLoginLevel; 75 protected bool m_AllowRemoteSetLoginLevel;
76 protected string m_MapTileURL; 76 protected string m_MapTileURL;
77 protected string m_SearchURL; 77 protected string m_SearchURL;
78 protected string m_Currency;
78 79
79 protected string m_AllowedClients; 80 protected string m_AllowedClients;
80 protected string m_DeniedClients; 81 protected string m_DeniedClients;
@@ -108,6 +109,7 @@ namespace OpenSim.Services.LLLoginService
108 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); 109 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
109 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); 110 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
110 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); 111 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
112 m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty);
111 113
112 m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); 114 m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
113 m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); 115 m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty);
@@ -408,7 +410,7 @@ namespace OpenSim.Services.LLLoginService
408 // Finally, fill out the response and return it 410 // Finally, fill out the response and return it
409 // 411 //
410 LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, 412 LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
411 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_SearchURL); 413 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_SearchURL, m_Currency);
412 414
413 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); 415 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
414 return response; 416 return response;
diff --git a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index 70621d5..086a725 100644
--- a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Tests.Common
54 /// <summary> 54 /// <summary>
55 /// Helpers for setting up scenes. 55 /// Helpers for setting up scenes.
56 /// </summary> 56 /// </summary>
57 public class SceneSetupHelpers 57 public class SceneHelpers
58 { 58 {
59 /// <summary> 59 /// <summary>
60 /// Set up a test scene 60 /// Set up a test scene
@@ -331,6 +331,7 @@ namespace OpenSim.Tests.Common
331 agentData.InventoryFolder = UUID.Zero; 331 agentData.InventoryFolder = UUID.Zero;
332 agentData.startpos = Vector3.Zero; 332 agentData.startpos = Vector3.Zero;
333 agentData.CapsPath = "http://wibble.com"; 333 agentData.CapsPath = "http://wibble.com";
334 agentData.ServiceURLs = new Dictionary<string, object>();
334 335
335 return agentData; 336 return agentData;
336 } 337 }
@@ -341,9 +342,9 @@ namespace OpenSim.Tests.Common
341 /// <param name="scene"></param> 342 /// <param name="scene"></param>
342 /// <param name="agentId"></param> 343 /// <param name="agentId"></param>
343 /// <returns></returns> 344 /// <returns></returns>
344 public static TestClient AddClient(Scene scene, UUID agentId) 345 public static ScenePresence AddScenePresence(Scene scene, UUID agentId)
345 { 346 {
346 return AddClient(scene, GenerateAgentData(agentId)); 347 return AddScenePresence(scene, GenerateAgentData(agentId));
347 } 348 }
348 349
349 /// <summary> 350 /// <summary>
@@ -364,7 +365,7 @@ namespace OpenSim.Tests.Common
364 /// <param name="scene"></param> 365 /// <param name="scene"></param>
365 /// <param name="agentData"></param> 366 /// <param name="agentData"></param>
366 /// <returns></returns> 367 /// <returns></returns>
367 public static TestClient AddClient(Scene scene, AgentCircuitData agentData) 368 public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData)
368 { 369 {
369 string reason; 370 string reason;
370 371
@@ -379,14 +380,14 @@ namespace OpenSim.Tests.Common
379 380
380 // Stage 2: add the new client as a child agent to the scene 381 // Stage 2: add the new client as a child agent to the scene
381 TestClient client = new TestClient(agentData, scene); 382 TestClient client = new TestClient(agentData, scene);
382 scene.AddNewClient(client); 383 scene.AddNewClient(client, PresenceType.User);
383 384
384 // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. 385 // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent.
385 ScenePresence scp = scene.GetScenePresence(agentData.AgentID); 386 ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
386 scp.CompleteMovement(client); 387 scp.CompleteMovement(client, true);
387 //scp.MakeRootAgent(new Vector3(90, 90, 90), true); 388 //scp.MakeRootAgent(new Vector3(90, 90, 90), true);
388 389
389 return client; 390 return scp;
390 } 391 }
391 392
392 /// <summary> 393 /// <summary>
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
index 5215c34..a8f0d59 100644
--- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Tests.Common
74 /// <param name="id"></param> 74 /// <param name="id"></param>
75 public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id) 75 public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id)
76 { 76 {
77 SceneObjectGroup taskSceneObject = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); 77 SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero);
78 AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); 78 AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
79 scene.AssetService.Store(taskSceneObjectAsset); 79 scene.AssetService.Store(taskSceneObjectAsset);
80 TaskInventoryItem taskSceneObjectItem 80 TaskInventoryItem taskSceneObjectItem
diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
index d924ecd..b73df2c 100644
--- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
@@ -118,13 +118,12 @@ namespace OpenSim.Tests.Common
118 118
119 public static UserAccount CreateUserWithInventory(Scene scene) 119 public static UserAccount CreateUserWithInventory(Scene scene)
120 { 120 {
121 return CreateUserWithInventory(scene, 99); 121 return CreateUserWithInventory(scene, TestHelpers.ParseTail(99));
122 } 122 }
123 123
124 public static UserAccount CreateUserWithInventory(Scene scene, int uuidTail) 124 public static UserAccount CreateUserWithInventory(Scene scene, UUID userId)
125 { 125 {
126 return CreateUserWithInventory( 126 return CreateUserWithInventory(scene, "Bill", "Bailey", userId, "troll");
127 scene, "Bill", "Bailey", new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail)), "troll");
128 } 127 }
129 128
130 public static UserAccount CreateUserWithInventory( 129 public static UserAccount CreateUserWithInventory(
@@ -139,7 +138,6 @@ namespace OpenSim.Tests.Common
139 { 138 {
140 // FIXME: This should really be set up by UserAccount itself 139 // FIXME: This should really be set up by UserAccount itself
141 ua.ServiceURLs = new Dictionary<string, object>(); 140 ua.ServiceURLs = new Dictionary<string, object>();
142
143 scene.UserAccountService.StoreUserAccount(ua); 141 scene.UserAccountService.StoreUserAccount(ua);
144 scene.InventoryService.CreateUserInventory(ua.PrincipalID); 142 scene.InventoryService.CreateUserInventory(ua.PrincipalID);
145 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); 143 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
index 1703597..4e60ca9 100644
--- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
@@ -52,7 +52,22 @@ namespace OpenSim.Tests.Common
52 /// <returns></returns> 52 /// <returns></returns>
53 public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId) 53 public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId)
54 { 54 {
55 return CreateInventoryItem(scene, itemName, UUID.Random(), userId); 55 return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, InventoryType.Notecard);
56 }
57
58 /// <summary>
59 /// Creates an item of the given type with an accompanying asset.
60 /// </summary>
61 /// <param name="scene"></param>
62 /// <param name="itemName"></param>
63 /// <param name="itemId"></param>
64 /// <param name="userId"></param>
65 /// <param name="type">Type of item to create</param>
66 /// <returns></returns>
67 public static InventoryItemBase CreateInventoryItem(
68 Scene scene, string itemName, UUID userId, InventoryType type)
69 {
70 return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, type);
56 } 71 }
57 72
58 /// <summary> 73 /// <summary>
@@ -61,18 +76,32 @@ namespace OpenSim.Tests.Common
61 /// <param name="scene"></param> 76 /// <param name="scene"></param>
62 /// <param name="itemName"></param> 77 /// <param name="itemName"></param>
63 /// <param name="itemId"></param> 78 /// <param name="itemId"></param>
79 /// <param name="assetId"></param>
64 /// <param name="userId"></param> 80 /// <param name="userId"></param>
81 /// <param name="type">Type of item to create</param>
65 /// <returns></returns> 82 /// <returns></returns>
66 public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId) 83 public static InventoryItemBase CreateInventoryItem(
84 Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType type)
67 { 85 {
68 AssetBase asset = AssetHelpers.CreateAsset(scene, userId); 86 AssetBase asset = null;
87
88 if (type == InventoryType.Notecard)
89 asset = AssetHelpers.CreateAsset(scene, userId);
90 else if (type == InventoryType.Object)
91 asset
92 = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId));
93 else
94 throw new Exception(string.Format("Inventory type {0} not supported", type));
95
96 scene.AssetService.Store(asset);
97
69 InventoryItemBase item = new InventoryItemBase(); 98 InventoryItemBase item = new InventoryItemBase();
70 item.Name = itemName; 99 item.Name = itemName;
71 item.AssetID = asset.FullID; 100 item.AssetID = asset.FullID;
72 item.ID = itemId; 101 item.ID = itemId;
73 item.Owner = userId; 102 item.Owner = userId;
74 item.AssetType = asset.Type; 103 item.AssetType = asset.Type;
75 item.InvType = (int)InventoryType.Notecard; 104 item.InvType = (int)type;
76 105
77 InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); 106 InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard);
78 107
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 88043f3..b7cefeb 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Tests.Common.Mock
95 public event DeRezObject OnDeRezObject; 95 public event DeRezObject OnDeRezObject;
96 public event Action<IClientAPI> OnRegionHandShakeReply; 96 public event Action<IClientAPI> OnRegionHandShakeReply;
97 public event GenericCall1 OnRequestWearables; 97 public event GenericCall1 OnRequestWearables;
98 public event GenericCall1 OnCompleteMovementToRegion; 98 public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
99 public event UpdateAgent OnPreAgentUpdate; 99 public event UpdateAgent OnPreAgentUpdate;
100 public event UpdateAgent OnAgentUpdate; 100 public event UpdateAgent OnAgentUpdate;
101 public event AgentRequestSit OnAgentRequestSit; 101 public event AgentRequestSit OnAgentRequestSit;
@@ -234,7 +234,7 @@ namespace OpenSim.Tests.Common.Mock
234 public event ScriptReset OnScriptReset; 234 public event ScriptReset OnScriptReset;
235 public event GetScriptRunning OnGetScriptRunning; 235 public event GetScriptRunning OnGetScriptRunning;
236 public event SetScriptRunning OnSetScriptRunning; 236 public event SetScriptRunning OnSetScriptRunning;
237 public event Action<Vector3> OnAutoPilotGo; 237 public event Action<Vector3, bool> OnAutoPilotGo;
238 238
239 public event TerrainUnacked OnUnackedTerrain; 239 public event TerrainUnacked OnUnackedTerrain;
240 240
@@ -455,7 +455,7 @@ namespace OpenSim.Tests.Common.Mock
455 455
456 public void CompleteMovement() 456 public void CompleteMovement()
457 { 457 {
458 OnCompleteMovementToRegion(this); 458 OnCompleteMovementToRegion(this, true);
459 } 459 }
460 460
461 public virtual void ActivateGesture(UUID assetId, UUID gestureId) 461 public virtual void ActivateGesture(UUID assetId, UUID gestureId)
@@ -579,7 +579,7 @@ namespace OpenSim.Tests.Common.Mock
579 579
580 // Stage 2: add the new client as a child agent to the scene 580 // Stage 2: add the new client as a child agent to the scene
581 TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene); 581 TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene);
582 TeleportTargetScene.AddNewClient(TeleportSceneClient); 582 TeleportTargetScene.AddNewClient(TeleportSceneClient, PresenceType.User);
583 } 583 }
584 584
585 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 585 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
@@ -759,9 +759,10 @@ namespace OpenSim.Tests.Common.Mock
759 759
760 if (OnCompleteMovementToRegion != null) 760 if (OnCompleteMovementToRegion != null)
761 { 761 {
762 OnCompleteMovementToRegion(this); 762 OnCompleteMovementToRegion(this, true);
763 } 763 }
764 } 764 }
765
765 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) 766 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
766 { 767 {
767 } 768 }
@@ -886,7 +887,7 @@ namespace OpenSim.Tests.Common.Mock
886 887
887 public void Close() 888 public void Close()
888 { 889 {
889 m_scene.RemoveClient(AgentId); 890 m_scene.RemoveClient(AgentId, true);
890 } 891 }
891 892
892 public void Start() 893 public void Start()
diff --git a/OpenSim/Tests/Common/TestHelper.cs b/OpenSim/Tests/Common/TestHelpers.cs
index 86bd107..ced06de 100644
--- a/OpenSim/Tests/Common/TestHelper.cs
+++ b/OpenSim/Tests/Common/TestHelpers.cs
@@ -32,7 +32,7 @@ using OpenMetaverse;
32 32
33namespace OpenSim.Tests.Common 33namespace OpenSim.Tests.Common
34{ 34{
35 public class TestHelper 35 public class TestHelpers
36 { 36 {
37 public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) 37 public static bool AssertThisDelegateCausesArgumentException(TestDelegate d)
38 { 38 {