aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/MSSQL/MSSQLSimulationData.cs6
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs6
-rw-r--r--OpenSim/Data/Null/NullSimulationData.cs1
-rw-r--r--OpenSim/Data/PGSQL/PGSQLSimulationData.cs6
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs6
-rw-r--r--OpenSim/Framework/TerrainData.cs7
-rw-r--r--OpenSim/Framework/WebUtil.cs6
-rw-r--r--OpenSim/Region/Application/OpenSim.cs18
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs77
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs51
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs48
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs181
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs36
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs26
-rw-r--r--OpenSim/Region/Framework/Interfaces/ITerrainChannel.cs3
-rw-r--r--OpenSim/Region/Framework/Interfaces/ITerrainModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/TerrainChannel.cs72
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs17
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs15
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs26
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs223
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs4
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs29
-rw-r--r--OpenSim/Services/UserAccountService/GridUserService.cs33
-rw-r--r--bin/OpenSimDefaults.ini4
33 files changed, 611 insertions, 355 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
index 9f5991b..1a5ecd6 100644
--- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
@@ -531,10 +531,14 @@ ELSE
531 /// <returns></returns> 531 /// <returns></returns>
532 public double[,] LoadTerrain(UUID regionID) 532 public double[,] LoadTerrain(UUID regionID)
533 { 533 {
534 double[,] ret = null;
534 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); 535 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
535 return terrData.GetDoubles(); 536 if (terrData != null)
537 ret = terrData.GetDoubles();
538 return ret;
536 } 539 }
537 540
541 // Returns 'null' if region not found
538 public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) 542 public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
539 { 543 {
540 TerrainData terrData = null; 544 TerrainData terrData = null;
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 42f2ebb..2921c1c 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -616,10 +616,14 @@ namespace OpenSim.Data.MySQL
616 // Legacy region loading 616 // Legacy region loading
617 public double[,] LoadTerrain(UUID regionID) 617 public double[,] LoadTerrain(UUID regionID)
618 { 618 {
619 double[,] ret = null;
619 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); 620 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
620 return terrData.GetDoubles(); 621 if (terrData != null)
622 ret = terrData.GetDoubles();
623 return ret;
621 } 624 }
622 625
626 // Returns 'null' if region not found
623 public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) 627 public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
624 { 628 {
625 TerrainData terrData = null; 629 TerrainData terrData = null;
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs
index acde1a1..deeaced 100644
--- a/OpenSim/Data/Null/NullSimulationData.cs
+++ b/OpenSim/Data/Null/NullSimulationData.cs
@@ -148,6 +148,7 @@ namespace OpenSim.Data.Null
148 } 148 }
149 149
150 // Legacy. Just don't do this. 150 // Legacy. Just don't do this.
151 // Returns 'null' if region not found
151 public double[,] LoadTerrain(UUID regionID) 152 public double[,] LoadTerrain(UUID regionID)
152 { 153 {
153 if (m_terrains.ContainsKey(regionID)) 154 if (m_terrains.ContainsKey(regionID))
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
index 1505f87..77d87d4 100644
--- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
@@ -524,10 +524,14 @@ namespace OpenSim.Data.PGSQL
524 /// <returns></returns> 524 /// <returns></returns>
525 public double[,] LoadTerrain(UUID regionID) 525 public double[,] LoadTerrain(UUID regionID)
526 { 526 {
527 double[,] ret = null;
527 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); 528 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
528 return terrData.GetDoubles(); 529 if (terrData != null)
530 ret = terrData.GetDoubles();
531 return ret;
529 } 532 }
530 533
534 // Returns 'null' if region not found
531 public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) 535 public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
532 { 536 {
533 TerrainData terrData = null; 537 TerrainData terrData = null;
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 5a34f09..9466e99 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -870,10 +870,14 @@ namespace OpenSim.Data.SQLite
870 /// <returns>Heightfield data</returns> 870 /// <returns>Heightfield data</returns>
871 public double[,] LoadTerrain(UUID regionID) 871 public double[,] LoadTerrain(UUID regionID)
872 { 872 {
873 double[,] ret = null;
873 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); 874 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
874 return terrData.GetDoubles(); 875 if (terrData != null)
876 ret = terrData.GetDoubles();
877 return ret;
875 } 878 }
876 879
880 // Returns 'null' if region not found
877 public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) 881 public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
878 { 882 {
879 TerrainData terrData = null; 883 TerrainData terrData = null;
diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs
index 1c52a69..9325df2 100644
--- a/OpenSim/Framework/TerrainData.cs
+++ b/OpenSim/Framework/TerrainData.cs
@@ -160,7 +160,11 @@ namespace OpenSim.Framework
160 160
161 public override bool IsTaintedAt(int xx, int yy) 161 public override bool IsTaintedAt(int xx, int yy)
162 { 162 {
163 return m_taint[xx / Constants.TerrainPatchSize, yy / Constants.TerrainPatchSize]; 163 int tx = xx / Constants.TerrainPatchSize;
164 int ty = yy / Constants.TerrainPatchSize;
165 bool ret = m_taint[tx, ty];
166 m_taint[tx, ty] = false;
167 return ret;
164 } 168 }
165 169
166 // TerrainData.GetDatabaseBlob 170 // TerrainData.GetDatabaseBlob
@@ -274,6 +278,7 @@ namespace OpenSim.Framework
274 m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize]; 278 m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize];
275 // m_log.DebugFormat("{0} new by dimensions. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ); 279 // m_log.DebugFormat("{0} new by dimensions. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ);
276 ClearTaint(); 280 ClearTaint();
281 ClearLand(0f);
277 } 282 }
278 283
279 public HeightmapTerrainData(short[] cmap, float pCompressionFactor, int pX, int pY, int pZ) : this(pX, pY, pZ) 284 public HeightmapTerrainData(short[] cmap, float pCompressionFactor, int pX, int pY, int pZ) : this(pX, pY, pZ)
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index bcf6af8..54a6c0c 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -1030,7 +1030,7 @@ namespace OpenSim.Framework
1030 finally 1030 finally
1031 { 1031 {
1032 if (requestStream != null) 1032 if (requestStream != null)
1033 requestStream.Close(); 1033 requestStream.Dispose();
1034 1034
1035 // capture how much time was spent writing 1035 // capture how much time was spent writing
1036 tickdata = Util.EnvironmentTickCountSubtract(tickstart); 1036 tickdata = Util.EnvironmentTickCountSubtract(tickstart);
@@ -1183,7 +1183,7 @@ namespace OpenSim.Framework
1183 finally 1183 finally
1184 { 1184 {
1185 if (requestStream != null) 1185 if (requestStream != null)
1186 requestStream.Close(); 1186 requestStream.Dispose();
1187 1187
1188 // capture how much time was spent writing 1188 // capture how much time was spent writing
1189 tickdata = Util.EnvironmentTickCountSubtract(tickstart); 1189 tickdata = Util.EnvironmentTickCountSubtract(tickstart);
@@ -1268,4 +1268,4 @@ namespace OpenSim.Framework
1268 return deserial; 1268 return deserial;
1269 } 1269 }
1270 } 1270 }
1271} \ No newline at end of file 1271}
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 1e36853..77b9440 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -267,18 +267,20 @@ namespace OpenSim
267 267
268 m_console.Commands.AddCommand("Archiving", false, "load oar", 268 m_console.Commands.AddCommand("Archiving", false, "load oar",
269 "load oar [--merge] [--skip-assets]" 269 "load oar [--merge] [--skip-assets]"
270 + " [--forceterrain] [--forceparcels]" 270 + " [--force-terrain] [--force-parcels]"
271 + " [--rotation degrees] [--rotationCenter \"<x,y,z>\"]" 271 + " [--no-objects]"
272 + " [--rotation degrees] [--rotation-center \"<x,y,z>\"]"
272 + " [--displacement \"<x,y,z>\"]" 273 + " [--displacement \"<x,y,z>\"]"
273 + " [<OAR path>]", 274 + " [<OAR path>]",
274 "Load a region's data from an OAR archive.", 275 "Load a region's data from an OAR archive.",
275 "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine 276 "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine
276 + "--skip-assets will load the OAR but ignore the assets it contains." + Environment.NewLine 277 + "--skip-assets will load the OAR but ignore the assets it contains." + Environment.NewLine
277 + "--displacement will add this value to the position of every object loaded" + Environment.NewLine 278 + "--displacement will add this value to the position of every object loaded" + Environment.NewLine
278 + "--forceterrain forces the loading of terrain from the oar (undoes suppression done by --merge)" + Environment.NewLine 279 + "--force-terrain forces the loading of terrain from the oar (undoes suppression done by --merge)" + Environment.NewLine
279 + "--forceparcels forces the loading of parcels from the oar (undoes suppression done by --merge)" + Environment.NewLine 280 + "--force-parcels forces the loading of parcels from the oar (undoes suppression done by --merge)" + Environment.NewLine
280 + "--rotation specified rotation to be applied to the oar. Specified in degrees." + Environment.NewLine 281 + "--rotation specified rotation to be applied to the oar. Specified in degrees." + Environment.NewLine
281 + "--rotationcenter Location (relative to original OAR) to apply rotation. Default is <128,128,0>" + Environment.NewLine 282 + "--rotation-center Location (relative to original OAR) to apply rotation. Default is <128,128,0>" + Environment.NewLine
283 + "--no-objects suppresses the addition of any objects (good for loading only the terrain)" + Environment.NewLine
282 + "The path can be either a filesystem location or a URI." 284 + "The path can be either a filesystem location or a URI."
283 + " If this is not given then the command looks for an OAR named region.oar in the current directory.", 285 + " If this is not given then the command looks for an OAR named region.oar in the current directory.",
284 LoadOar); 286 LoadOar);
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 7e50cc6..2da0a74 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -1290,9 +1290,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1290 webRequest.ContentType = "application/json-rpc"; 1290 webRequest.ContentType = "application/json-rpc";
1291 webRequest.Method = "POST"; 1291 webRequest.Method = "POST";
1292 1292
1293 Stream dataStream = webRequest.GetRequestStream(); 1293 using (Stream dataStream = webRequest.GetRequestStream())
1294 dataStream.Write(content, 0, content.Length); 1294 dataStream.Write(content, 0, content.Length);
1295 dataStream.Close();
1296 1295
1297 WebResponse webResponse = null; 1296 WebResponse webResponse = null;
1298 try 1297 try
@@ -1306,26 +1305,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1306 return false; 1305 return false;
1307 } 1306 }
1308 1307
1309 Stream rstream = webResponse.GetResponseStream(); 1308 using (webResponse)
1310 1309 using (Stream rstream = webResponse.GetResponseStream())
1311 OSDMap mret = new OSDMap();
1312 try
1313 {
1314 mret = (OSDMap)OSDParser.DeserializeJson(rstream);
1315 }
1316 catch (Exception e)
1317 { 1310 {
1318 m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); 1311 OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream);
1319 return false;
1320 }
1321 1312
1313 if (mret.ContainsKey("error"))
1314 return false;
1322 1315
1323 if (mret.ContainsKey("error")) 1316 // get params...
1324 return false; 1317 OSD.DeserializeMembers(ref parameters, (OSDMap)mret["result"]);
1325 1318 return true;
1326 // get params... 1319 }
1327 OSD.DeserializeMembers(ref parameters, (OSDMap) mret["result"]);
1328 return true;
1329 } 1320 }
1330 1321
1331 /// <summary> 1322 /// <summary>
@@ -1366,9 +1357,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1366 webRequest.ContentType = "application/json-rpc"; 1357 webRequest.ContentType = "application/json-rpc";
1367 webRequest.Method = "POST"; 1358 webRequest.Method = "POST";
1368 1359
1369 Stream dataStream = webRequest.GetRequestStream(); 1360 using (Stream dataStream = webRequest.GetRequestStream())
1370 dataStream.Write(content, 0, content.Length); 1361 dataStream.Write(content, 0, content.Length);
1371 dataStream.Close();
1372 1362
1373 WebResponse webResponse = null; 1363 WebResponse webResponse = null;
1374 try 1364 try
@@ -1382,29 +1372,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1382 return false; 1372 return false;
1383 } 1373 }
1384 1374
1385 Stream rstream = webResponse.GetResponseStream(); 1375 using (webResponse)
1386 1376 using (Stream rstream = webResponse.GetResponseStream())
1387 OSDMap response = new OSDMap();
1388 try
1389 {
1390 response = (OSDMap)OSDParser.DeserializeJson(rstream);
1391 }
1392 catch (Exception e)
1393 { 1377 {
1394 m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); 1378 OSDMap response = new OSDMap();
1395 return false; 1379 try
1396 } 1380 {
1381 response = (OSDMap)OSDParser.DeserializeJson(rstream);
1382 }
1383 catch (Exception e)
1384 {
1385 m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message);
1386 return false;
1387 }
1397 1388
1398 if(response.ContainsKey("error")) 1389 if (response.ContainsKey("error"))
1399 { 1390 {
1400 data = response["error"]; 1391 data = response["error"];
1401 return false; 1392 return false;
1402 } 1393 }
1403 1394
1404 data = response; 1395 data = response;
1405 1396
1406 return true; 1397 return true;
1398 }
1407 } 1399 }
1400
1408 #endregion Web Util 1401 #endregion Web Util
1409 } 1402 }
1410} \ No newline at end of file 1403}
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index c3a8afd..a7237ea 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -488,9 +488,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
488 byte[] data = Util.UTF8.GetBytes(OutboundBody); 488 byte[] data = Util.UTF8.GetBytes(OutboundBody);
489 489
490 Request.ContentLength = data.Length; 490 Request.ContentLength = data.Length;
491 Stream bstream = Request.GetRequestStream(); 491 using (Stream bstream = Request.GetRequestStream())
492 bstream.Write(data, 0, data.Length); 492 bstream.Write(data, 0, data.Length);
493 bstream.Close();
494 } 493 }
495 494
496 try 495 try
@@ -584,4 +583,4 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
584 Request.Abort(); 583 Request.Abort();
585 } 584 }
586 } 585 }
587} \ No newline at end of file 586}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index f4807ad..0c4b79b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
121 protected Vector3 m_displacement = Vector3.Zero; 121 protected Vector3 m_displacement = Vector3.Zero;
122 122
123 /// <value> 123 /// <value>
124 /// Rotation to apply to the objects as they are loaded. 124 /// Rotation (in radians) to apply to the objects as they are loaded.
125 /// </value> 125 /// </value>
126 protected float m_rotation = 0f; 126 protected float m_rotation = 0f;
127 127
@@ -130,6 +130,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
130 /// </value> 130 /// </value>
131 protected Vector3 m_rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0f); 131 protected Vector3 m_rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0f);
132 132
133 protected bool m_noObjects = false;
134
133 /// <summary> 135 /// <summary>
134 /// Used to cache lookups for valid uuids. 136 /// Used to cache lookups for valid uuids.
135 /// </summary> 137 /// </summary>
@@ -177,14 +179,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
177 179
178 m_errorMessage = String.Empty; 180 m_errorMessage = String.Empty;
179 m_merge = options.ContainsKey("merge"); 181 m_merge = options.ContainsKey("merge");
180 m_forceTerrain = options.ContainsKey("forceTerrain"); 182 m_forceTerrain = options.ContainsKey("force-terrain");
181 m_forceParcels = options.ContainsKey("forceParcels"); 183 m_forceParcels = options.ContainsKey("force-parcels");
184 m_noObjects = options.ContainsKey("no-objects");
182 m_skipAssets = options.ContainsKey("skipAssets"); 185 m_skipAssets = options.ContainsKey("skipAssets");
183 m_requestId = requestId; 186 m_requestId = requestId;
184 m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; 187 m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero;
185 m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; 188 m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f;
186 m_rotationCenter = options.ContainsKey("rotationCenter") ? (Vector3)options["rotationCenter"] 189 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"]
187 : new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0f); 190 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f);
188 191
189 // Zero can never be a valid user id 192 // Zero can never be a valid user id
190 m_validUserUuids[UUID.Zero] = false; 193 m_validUserUuids[UUID.Zero] = false;
@@ -261,7 +264,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
261 264
262 // Process the file 265 // Process the file
263 266
264 if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) 267 if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH) && !m_noObjects)
265 { 268 {
266 sceneContext.SerialisedSceneObjects.Add(Encoding.UTF8.GetString(data)); 269 sceneContext.SerialisedSceneObjects.Add(Encoding.UTF8.GetString(data));
267 } 270 }
@@ -454,8 +457,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
454 // Reload serialized prims 457 // Reload serialized prims
455 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); 458 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
456 459
457 float angle = (float)(m_rotation / 180.0 * Math.PI); 460 OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, m_rotation);
458 OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle);
459 461
460 UUID oldTelehubUUID = scene.RegionInfo.RegionSettings.TelehubObject; 462 UUID oldTelehubUUID = scene.RegionInfo.RegionSettings.TelehubObject;
461 463
@@ -483,16 +485,25 @@ namespace OpenSim.Region.CoreModules.World.Archiver
483 // Happily this does not do much to the object since it hasn't been added to the scene yet 485 // Happily this does not do much to the object since it hasn't been added to the scene yet
484 if (sceneObject.AttachmentPoint == 0) 486 if (sceneObject.AttachmentPoint == 0)
485 { 487 {
486 if (angle != 0f) 488 if (m_displacement != Vector3.Zero || m_rotation != 0f)
487 {
488 sceneObject.RootPart.RotationOffset = rot * sceneObject.GroupRotation;
489 Vector3 offset = sceneObject.AbsolutePosition - m_rotationCenter;
490 offset *= rot;
491 sceneObject.AbsolutePosition = m_rotationCenter + offset;
492 }
493 if (m_displacement != Vector3.Zero)
494 { 489 {
495 sceneObject.AbsolutePosition += m_displacement; 490 Vector3 pos = sceneObject.AbsolutePosition;
491 if (m_rotation != 0f)
492 {
493 // Rotate the object
494 sceneObject.RootPart.RotationOffset = rot * sceneObject.GroupRotation;
495 // Get object position relative to rotation axis
496 Vector3 offset = pos - m_rotationCenter;
497 // Rotate the object position
498 offset *= rot;
499 // Restore the object position back to relative to the region
500 pos = m_rotationCenter + offset;
501 }
502 if (m_displacement != Vector3.Zero)
503 {
504 pos += m_displacement;
505 }
506 sceneObject.AbsolutePosition = pos;
496 } 507 }
497 } 508 }
498 509
@@ -868,10 +879,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
868 ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); 879 ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
869 880
870 MemoryStream ms = new MemoryStream(data); 881 MemoryStream ms = new MemoryStream(data);
871 if (m_displacement != Vector3.Zero) 882 if (m_displacement != Vector3.Zero || m_rotation != 0f)
872 { 883 {
873 Vector2 terrainDisplacement = new Vector2(m_displacement.X, m_displacement.Y); 884 Vector2 rotationCenter = new Vector2(m_rotationCenter.X, m_rotationCenter.Y);
874 terrainModule.LoadFromStream(terrainPath, terrainDisplacement, ms); 885 terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, rotationCenter, ms);
875 } 886 }
876 else 887 else
877 { 888 {
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 2a6f1eb..2b2da6f 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -106,6 +106,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
106 bool skipAssets = false; 106 bool skipAssets = false;
107 bool forceTerrain = false; 107 bool forceTerrain = false;
108 bool forceParcels = false; 108 bool forceParcels = false;
109 bool noObjects = false;
109 Vector3 displacement = new Vector3(0f, 0f, 0f); 110 Vector3 displacement = new Vector3(0f, 0f, 0f);
110 float rotation = 0f; 111 float rotation = 0f;
111 Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); 112 Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0);
@@ -113,26 +114,48 @@ namespace OpenSim.Region.CoreModules.World.Archiver
113 OptionSet options = new OptionSet(); 114 OptionSet options = new OptionSet();
114 options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); 115 options.Add("m|merge", delegate (string v) { mergeOar = (v != null); });
115 options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); }); 116 options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); });
116 options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); 117 options.Add("force-terrain", delegate (string v) { forceTerrain = (v != null); });
117 options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); 118 options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); // downward compatibility
119 options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); });
120 options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility
121 options.Add("no-objects", delegate (string v) { noObjects = (v != null); });
118 options.Add("displacement=", delegate (string v) { 122 options.Add("displacement=", delegate (string v) {
119 try 123 try
120 { 124 {
121 displacement = v == null ? Vector3.Zero : Vector3.Parse(v); 125 displacement = v == null ? Vector3.Zero : Vector3.Parse(v);
122 } 126 }
123 catch (Exception e) 127 catch
124 { 128 {
125 m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing displacement"); 129 m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing displacement");
126 displacement = new Vector3(0f, 0f, 0f); 130 m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --displacement \"<128,128,0>\"");
131 return;
127 } 132 }
128 }); 133 });
129 options.Add("rotation=", delegate (string v) { 134 options.Add("rotation=", delegate (string v) {
130 rotation = float.Parse(v); 135 try
131 rotation = Util.Clamp<float>(rotation, -359f, 359f); 136 {
137 rotation = v == null ? 0f : float.Parse(v);
138 }
139 catch
140 {
141 m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing rotation");
142 m_log.ErrorFormat("[ARCHIVER MODULE] Must be an angle in degrees between -360 and +360: --rotation 45");
143 return;
144 }
145 // Convert to radians for internals
146 rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI;
132 }); 147 });
133 options.Add("rotationcenter=", delegate (string v) { 148 options.Add("rotation-center=", delegate (string v) {
134 // RA 20130119: libomv's Vector2.Parse doesn't work. Need to use vector3 for the moment 149 try
135 rotationCenter = Vector3.Parse(v); 150 {
151 rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v);
152 }
153 catch
154 {
155 m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing rotation displacement");
156 m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --rotation-center \"<128,128,0>\"");
157 return;
158 }
136 }); 159 });
137 160
138 // Send a message to the region ready module 161 // Send a message to the region ready module
@@ -155,11 +178,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
155 Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); 178 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
156 if (mergeOar) archiveOptions.Add("merge", null); 179 if (mergeOar) archiveOptions.Add("merge", null);
157 if (skipAssets) archiveOptions.Add("skipAssets", null); 180 if (skipAssets) archiveOptions.Add("skipAssets", null);
158 if (forceTerrain) archiveOptions.Add("forceTerrain", null); 181 if (forceTerrain) archiveOptions.Add("force-terrain", null);
159 if (forceParcels) archiveOptions.Add("forceParcels", null); 182 if (forceParcels) archiveOptions.Add("force-parcels", null);
183 if (noObjects) archiveOptions.Add("no-objects", null);
160 archiveOptions.Add("displacement", displacement); 184 archiveOptions.Add("displacement", displacement);
161 archiveOptions.Add("rotation", rotation); 185 archiveOptions.Add("rotation", rotation);
162 archiveOptions.Add("rotationCenter", rotationCenter); 186 archiveOptions.Add("rotation-center", rotationCenter);
163 187
164 if (mainParams.Count > 2) 188 if (mainParams.Count > 2)
165 { 189 {
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 53f41f9..e08a42d 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
579 ArchiveConstants.CONTROL_FILE_PATH, 579 ArchiveConstants.CONTROL_FILE_PATH,
580 new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); 580 new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));
581 581
582 LandObject lo = new LandObject(groupID, true, null); 582 LandObject lo = new LandObject(groupID, true, m_scene);
583 lo.SetLandBitmap(lo.BasicFullRegionLandBitmap()); 583 lo.SetLandBitmap(lo.BasicFullRegionLandBitmap());
584 LandData ld = lo.LandData; 584 LandData ld = lo.LandData;
585 ld.GlobalID = landID; 585 ld.GlobalID = landID;
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index f8f4986..939512f 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -134,7 +134,10 @@ namespace OpenSim.Region.CoreModules.World.Land
134 public LandObject(UUID owner_id, bool is_group_owned, Scene scene) 134 public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
135 { 135 {
136 m_scene = scene; 136 m_scene = scene;
137 m_landBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; 137 if (m_scene == null)
138 m_landBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit];
139 else
140 m_landBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
138 141
139 LandData.OwnerID = owner_id; 142 LandData.OwnerID = owner_id;
140 if (is_group_owned) 143 if (is_group_owned)
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index 6f344c8..561552a 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -68,9 +68,6 @@ namespace OpenSim.Region.CoreModules
68 // updating those region settings in GenSunPos() 68 // updating those region settings in GenSunPos()
69 private bool receivedEstateToolsSunUpdate = false; 69 private bool receivedEstateToolsSunUpdate = false;
70 70
71 // Configurable values
72 private string m_RegionMode = "SL";
73
74 // Sun's position information is updated and sent to clients every m_UpdateInterval frames 71 // Sun's position information is updated and sent to clients every m_UpdateInterval frames
75 private int m_UpdateInterval = 0; 72 private int m_UpdateInterval = 0;
76 73
@@ -90,7 +87,6 @@ namespace OpenSim.Region.CoreModules
90 // private double m_longitude = 0; 87 // private double m_longitude = 0;
91 // private double m_latitude = 0; 88 // private double m_latitude = 0;
92 // Configurable defaults Defaults close to SL 89 // Configurable defaults Defaults close to SL
93 private string d_mode = "SL";
94 private int d_frame_mod = 100; // Every 10 seconds (actually less) 90 private int d_frame_mod = 100; // Every 10 seconds (actually less)
95 private double d_day_length = 4; // A VW day is 4 RW hours long 91 private double d_day_length = 4; // A VW day is 4 RW hours long
96 private int d_year_length = 60; // There are 60 VW days in a VW year 92 private int d_year_length = 60; // There are 60 VW days in a VW year
@@ -134,12 +130,15 @@ namespace OpenSim.Region.CoreModules
134 130
135 private const int TICKS_PER_SECOND = 10000000; 131 private const int TICKS_PER_SECOND = 10000000;
136 132
133 private ulong m_CurrentTimeOffset = 0;
134
137 // Current time in elapsed seconds since Jan 1st 1970 135 // Current time in elapsed seconds since Jan 1st 1970
138 private ulong CurrentTime 136 private ulong CurrentTime
139 { 137 {
140 get 138 get
141 { 139 {
142 return (ulong)(((DateTime.Now.Ticks) - TicksToEpoch + TicksUTCOffset) / TICKS_PER_SECOND); 140 ulong ctime = (ulong)(((DateTime.Now.Ticks) - TicksToEpoch + TicksUTCOffset) / TICKS_PER_SECOND);
141 return ctime + m_CurrentTimeOffset;
143 } 142 }
144 } 143 }
145 144
@@ -262,10 +261,8 @@ namespace OpenSim.Region.CoreModules
262 261
263 private float GetCurrentTimeAsLindenSunHour() 262 private float GetCurrentTimeAsLindenSunHour()
264 { 263 {
265 if (m_SunFixed) 264 float curtime = m_SunFixed ? m_SunFixedHour : GetCurrentSunHour();
266 return m_SunFixedHour + 6; 265 return (curtime + 6.0f) % 24.0f;
267
268 return GetCurrentSunHour() + 6.0f;
269 } 266 }
270 267
271 #region INonSharedRegion Methods 268 #region INonSharedRegion Methods
@@ -291,8 +288,6 @@ namespace OpenSim.Region.CoreModules
291 try 288 try
292 { 289 {
293 // Mode: determines how the sun is handled 290 // Mode: determines how the sun is handled
294 m_RegionMode = config.Configs["Sun"].GetString("mode", d_mode);
295 // Mode: determines how the sun is handled
296 // m_latitude = config.Configs["Sun"].GetDouble("latitude", d_latitude); 291 // m_latitude = config.Configs["Sun"].GetDouble("latitude", d_latitude);
297 // Mode: determines how the sun is handled 292 // Mode: determines how the sun is handled
298 // m_longitude = config.Configs["Sun"].GetDouble("longitude", d_longitude); 293 // m_longitude = config.Configs["Sun"].GetDouble("longitude", d_longitude);
@@ -314,7 +309,6 @@ namespace OpenSim.Region.CoreModules
314 catch (Exception e) 309 catch (Exception e)
315 { 310 {
316 m_log.Debug("[SUN]: Configuration access failed, using defaults. Reason: " + e.Message); 311 m_log.Debug("[SUN]: Configuration access failed, using defaults. Reason: " + e.Message);
317 m_RegionMode = d_mode;
318 m_YearLengthDays = d_year_length; 312 m_YearLengthDays = d_year_length;
319 m_DayLengthHours = d_day_length; 313 m_DayLengthHours = d_day_length;
320 m_HorizonShift = d_day_night; 314 m_HorizonShift = d_day_night;
@@ -325,40 +319,28 @@ namespace OpenSim.Region.CoreModules
325 // m_longitude = d_longitude; 319 // m_longitude = d_longitude;
326 } 320 }
327 321
328 switch (m_RegionMode) 322 SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60);
329 { 323 SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays);
330 case "T1":
331 default:
332 case "SL":
333 // Time taken to complete a cycle (day and season)
334
335 SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60);
336 SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays);
337 324
338 // Ration of real-to-virtual time 325 // Ration of real-to-virtual time
339 326
340 // VWTimeRatio = 24/m_day_length; 327 // VWTimeRatio = 24/m_day_length;
341 328
342 // Speed of rotation needed to complete a cycle in the 329 // Speed of rotation needed to complete a cycle in the
343 // designated period (day and season) 330 // designated period (day and season)
344 331
345 SunSpeed = m_SunCycle/SecondsPerSunCycle; 332 SunSpeed = m_SunCycle/SecondsPerSunCycle;
346 SeasonSpeed = m_SeasonalCycle/SecondsPerYear; 333 SeasonSpeed = m_SeasonalCycle/SecondsPerYear;
347 334
348 // Horizon translation 335 // Horizon translation
349 336
350 HorizonShift = m_HorizonShift; // Z axis translation 337 HorizonShift = m_HorizonShift; // Z axis translation
351 // HoursToRadians = (SunCycle/24)*VWTimeRatio; 338 // HoursToRadians = (SunCycle/24)*VWTimeRatio;
352
353 m_log.Debug("[SUN]: Mode is " + m_RegionMode);
354 m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days");
355 m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift);
356 m_log.Debug("[SUN]: Percentage of time for daylight " + m_DayTimeSunHourScale);
357 m_log.Debug("[SUN]: Positional data updated every " + m_UpdateInterval + " frames");
358
359 break;
360 }
361 339
340 m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days");
341 m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift);
342 m_log.Debug("[SUN]: Percentage of time for daylight " + m_DayTimeSunHourScale);
343 m_log.Debug("[SUN]: Positional data updated every " + m_UpdateInterval + " frames");
362 } 344 }
363 345
364 public Type ReplaceableInterface 346 public Type ReplaceableInterface
@@ -385,7 +367,8 @@ namespace OpenSim.Region.CoreModules
385 string sunCommand = string.Format("sun {0}", kvp.Key); 367 string sunCommand = string.Format("sun {0}", kvp.Key);
386 m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand); 368 m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand);
387 } 369 }
388 370 m_scene.AddCommand("Regions", this, "sun help", "sun help", "list parameters that can be changed", "", HandleSunConsoleCommand);
371 m_scene.AddCommand("Regions", this, "sun list", "sun list", "list parameters that can be changed", "", HandleSunConsoleCommand);
389 ready = true; 372 ready = true;
390 } 373 }
391 374
@@ -419,23 +402,22 @@ namespace OpenSim.Region.CoreModules
419 402
420 public void SunToClient(IClientAPI client) 403 public void SunToClient(IClientAPI client)
421 { 404 {
422 if (m_RegionMode != "T1") 405 if (ready)
423 { 406 {
424 if (ready) 407 if (m_SunFixed)
425 { 408 {
426 if (m_SunFixed) 409 // m_log.DebugFormat("[SUN]: Fixed SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ",
427 { 410 // m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString());
428 // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); 411 client.SendSunPos(Position, Velocity, PosTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition);
429 client.SendSunPos(Position, Velocity, PosTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); 412 }
430 } 413 else
431 else 414 {
432 { 415 // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ",
433 // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); 416 // m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString());
434 client.SendSunPos(Position, Velocity, CurrentTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); 417 client.SendSunPos(Position, Velocity, CurrentTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition);
435 }
436 } 418 }
437 } 419 }
438 } 420 }
439 421
440 public void SunUpdate() 422 public void SunUpdate()
441 { 423 {
@@ -532,6 +514,9 @@ namespace OpenSim.Region.CoreModules
532 case "update_interval": 514 case "update_interval":
533 return m_UpdateInterval; 515 return m_UpdateInterval;
534 516
517 case "current_time":
518 return GetCurrentTimeAsLindenSunHour();
519
535 default: 520 default:
536 throw new Exception("Unknown sun parameter."); 521 throw new Exception("Unknown sun parameter.");
537 } 522 }
@@ -539,7 +524,51 @@ namespace OpenSim.Region.CoreModules
539 524
540 public void SetSunParameter(string param, double value) 525 public void SetSunParameter(string param, double value)
541 { 526 {
542 HandleSunConsoleCommand("sun", new string[] {param, value.ToString() }); 527 switch (param)
528 {
529 case "year_length":
530 m_YearLengthDays = (int)value;
531 SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays);
532 SeasonSpeed = m_SeasonalCycle/SecondsPerYear;
533 break;
534
535 case "day_length":
536 m_DayLengthHours = value;
537 SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60);
538 SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays);
539 SunSpeed = m_SunCycle/SecondsPerSunCycle;
540 SeasonSpeed = m_SeasonalCycle/SecondsPerYear;
541 break;
542
543 case "day_night_offset":
544 m_HorizonShift = value;
545 HorizonShift = m_HorizonShift;
546 break;
547
548 case "day_time_sun_hour_scale":
549 m_DayTimeSunHourScale = value;
550 break;
551
552 case "update_interval":
553 m_UpdateInterval = (int)value;
554 break;
555
556 case "current_time":
557 value = (value + 18.0) % 24.0;
558 // set the current offset so that the effective sun time is the parameter
559 m_CurrentTimeOffset = 0; // clear this first so we use raw time
560 m_CurrentTimeOffset = (ulong)(SecondsPerSunCycle * value/ 24.0) - (CurrentTime % SecondsPerSunCycle);
561 break;
562
563 default:
564 throw new Exception("Unknown sun parameter.");
565
566 // Generate shared values
567 GenSunPos();
568
569 // When sun settings are updated, we should update all clients with new settings.
570 SunUpdateToAllClients();
571 }
543 } 572 }
544 573
545 public float GetCurrentSunHour() 574 public float GetCurrentSunHour()
@@ -572,7 +601,7 @@ namespace OpenSim.Region.CoreModules
572 601
573 foreach (string output in ParseCmdParams(cmdparams)) 602 foreach (string output in ParseCmdParams(cmdparams))
574 { 603 {
575 m_log.Info("[SUN] " + output); 604 MainConsole.Instance.Output(output);
576 } 605 }
577 } 606 }
578 607
@@ -581,10 +610,11 @@ namespace OpenSim.Region.CoreModules
581 Dictionary<string, string> Params = new Dictionary<string, string>(); 610 Dictionary<string, string> Params = new Dictionary<string, string>();
582 611
583 Params.Add("year_length", "number of days to a year"); 612 Params.Add("year_length", "number of days to a year");
584 Params.Add("day_length", "number of seconds to a day"); 613 Params.Add("day_length", "number of hours to a day");
585 Params.Add("day_night_offset", "induces a horizon shift"); 614 Params.Add("day_night_offset", "induces a horizon shift");
586 Params.Add("update_interval", "how often to update the sun's position in frames"); 615 Params.Add("update_interval", "how often to update the sun's position in frames");
587 Params.Add("day_time_sun_hour_scale", "scales day light vs nite hours to change day/night ratio"); 616 Params.Add("day_time_sun_hour_scale", "scales day light vs nite hours to change day/night ratio");
617 Params.Add("current_time", "time in seconds of the simulator");
588 618
589 return Params; 619 return Params;
590 } 620 }
@@ -618,46 +648,15 @@ namespace OpenSim.Region.CoreModules
618 } 648 }
619 else if (args.Length == 3) 649 else if (args.Length == 3)
620 { 650 {
621 float value = 0.0f; 651 double value = 0.0;
622 if (!float.TryParse(args[2], out value)) 652 if (! double.TryParse(args[2], out value))
623 { 653 {
624 Output.Add(String.Format("The parameter value {0} is not a valid number.", args[2])); 654 Output.Add(String.Format("The parameter value {0} is not a valid number.", args[2]));
655 return Output;
625 } 656 }
626 657
627 switch (args[1].ToLower()) 658 SetSunParameter(args[1].ToLower(), value);
628 {
629 case "year_length":
630 m_YearLengthDays = (int)value;
631 break;
632
633 case "day_length":
634 m_DayLengthHours = value;
635 break;
636
637 case "day_night_offset":
638 m_HorizonShift = value;
639 break;
640
641 case "day_time_sun_hour_scale":
642 m_DayTimeSunHourScale = value;
643 break;
644
645 case "update_interval":
646 m_UpdateInterval = (int)value;
647 break;
648
649 default:
650 Output.Add(String.Format("Unknown parameter {0}.", args[1]));
651 return Output;
652 }
653
654 Output.Add(String.Format("Parameter {0} set to {1}.", args[1], value.ToString())); 659 Output.Add(String.Format("Parameter {0} set to {1}.", args[1], value.ToString()));
655
656 // Generate shared values
657 GenSunPos();
658
659 // When sun settings are updated, we should update all clients with new settings.
660 SunUpdateToAllClients();
661 } 660 }
662 661
663 return Output; 662 return Output;
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 7bc5e88..08891d9 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -316,8 +316,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
316 316
317 public void LoadFromStream(string filename, Stream stream) 317 public void LoadFromStream(string filename, Stream stream)
318 { 318 {
319 Vector2 defaultDisplacement = new Vector2(0f, 0f); 319 LoadFromStream(filename, Vector3.Zero, 0f, Vector2.Zero, stream);
320 LoadFromStream(filename, defaultDisplacement, stream);
321 } 320 }
322 321
323 /// <summary> 322 /// <summary>
@@ -325,7 +324,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
325 /// </summary> 324 /// </summary>
326 /// <param name="filename">Filename to terrain file. Type is determined by extension.</param> 325 /// <param name="filename">Filename to terrain file. Type is determined by extension.</param>
327 /// <param name="stream"></param> 326 /// <param name="stream"></param>
328 public void LoadFromStream(string filename, Vector2 displacement, Stream stream) 327 public void LoadFromStream(string filename, Vector3 displacement,
328 float radianRotation, Vector2 rotationDisplacement, Stream stream)
329 { 329 {
330 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) 330 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
331 { 331 {
@@ -336,7 +336,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
336 try 336 try
337 { 337 {
338 ITerrainChannel channel = loader.Value.LoadStream(stream); 338 ITerrainChannel channel = loader.Value.LoadStream(stream);
339 MergeTerrainIntoExisting(channel, displacement); 339 m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement);
340 UpdateRevertMap(); 340 UpdateRevertMap();
341 } 341 }
342 catch (NotImplementedException) 342 catch (NotImplementedException)
@@ -356,33 +356,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
356 throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename)); 356 throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename));
357 } 357 }
358 358
359 private void MergeTerrainIntoExisting(ITerrainChannel channel, Vector2 displacement)
360 {
361 if (displacement == Vector2.Zero)
362 {
363 // If there is no displacement, just use this channel as the new heightmap
364 m_scene.Heightmap = channel;
365 m_channel = channel;
366 }
367 else
368 {
369 // If there is a displacement, we copy the loaded heightmap into the overall region
370 for (int xx = 0; xx < channel.Width; xx++)
371 {
372 for (int yy = 0; yy < channel.Height; yy++)
373 {
374 int dispX = xx + (int)displacement.X;
375 int dispY = yy + (int)displacement.Y;
376 if (dispX >= 0 && dispX < m_channel.Width
377 && dispY >= 0 && dispY < m_channel.Height)
378 {
379 m_channel[dispX, dispY] = channel[xx, yy];
380 }
381 }
382 }
383 }
384 }
385
386 private static Stream URIFetch(Uri uri) 359 private static Stream URIFetch(Uri uri)
387 { 360 {
388 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); 361 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
index be719ea..96c16a9 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
@@ -40,10 +40,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
40 [Test] 40 [Test]
41 public void BrushTest() 41 public void BrushTest()
42 { 42 {
43 int midRegion = (int)Constants.RegionSize / 2;
44
45 // Create a mask that covers only the left half of the region
43 bool[,] allowMask = new bool[(int)Constants.RegionSize, 256]; 46 bool[,] allowMask = new bool[(int)Constants.RegionSize, 256];
44 int x; 47 int x;
45 int y; 48 int y;
46 for (x = 0; x < (int)((int)Constants.RegionSize * 0.5f); x++) 49 for (x = 0; x < midRegion; x++)
47 { 50 {
48 for (y = 0; y < (int)Constants.RegionSize; y++) 51 for (y = 0; y < (int)Constants.RegionSize; y++)
49 { 52 {
@@ -57,13 +60,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
57 TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); 60 TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize);
58 ITerrainPaintableEffect effect = new RaiseSphere(); 61 ITerrainPaintableEffect effect = new RaiseSphere();
59 62
60 effect.PaintEffect(map, allowMask, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, -1.0, 2, 0.1); 63 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0);
61 Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (127,128)."); 64 Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128).");
62 Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (124,128)."); 65 Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128).");
63 Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (123,128)."); 66 Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128).");
64 Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (128,128)."); 67 Assert.That(map[128, midRegion] == 0.0, "Raise brush should not change value at this point (128,128).");
65 Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (0,128)."); 68 Assert.That(map[0, midRegion] == 0.0, "Raise brush should not change value at this point (0,128).");
66
67 // 69 //
68 // Test LowerSphere 70 // Test LowerSphere
69 // 71 //
@@ -77,13 +79,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
77 } 79 }
78 effect = new LowerSphere(); 80 effect = new LowerSphere();
79 81
80 effect.PaintEffect(map, allowMask, ((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), -1.0, 2, 6.0); 82 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0);
81 Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); 83 Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128).");
82 Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); 84 Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128).");
83 Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] < 1.0, "Lower brush should lowering value at this point (124,128)."); 85 Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128).");
84 Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (123,128)."); 86 Assert.That(map[120, midRegion] == 1.0, "Lower brush should not change value at this point (120,128).");
85 Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (128,128)."); 87 Assert.That(map[128, midRegion] == 1.0, "Lower brush should not change value at this point (128,128).");
86 Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (0,128)."); 88 Assert.That(map[0, midRegion] == 1.0, "Lower brush should not change value at this point (0,128).");
87 } 89 }
88 90
89 [Test] 91 [Test]
@@ -100,10 +102,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
100 x[0, 0] -= 1.0; 102 x[0, 0] -= 1.0;
101 Assert.That(x[0, 0] == 4.0, "Terrain addition/subtraction error."); 103 Assert.That(x[0, 0] == 4.0, "Terrain addition/subtraction error.");
102 104
103 x[0, 0] = Math.PI;
104 double[,] doublesExport = x.GetDoubles();
105 Assert.That(doublesExport[0, 0] == Math.PI, "Export to double[,] array not working correctly.");
106
107 x[0, 0] = 1.0; 105 x[0, 0] = 1.0;
108 float[] floatsExport = x.GetFloatsSerialised(); 106 float[] floatsExport = x.GetFloatsSerialised();
109 Assert.That(floatsExport[0] == 1.0f, "Export to float[] not working correctly."); 107 Assert.That(floatsExport[0] == 1.0f, "Export to float[] not working correctly.");
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index f57be83..a3b0f39 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -899,7 +899,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
899 finally 899 finally
900 { 900 {
901 if (os != null) 901 if (os != null)
902 os.Close(); 902 os.Dispose();
903 } 903 }
904 904
905 string response_mapItems_reply = null; 905 string response_mapItems_reply = null;
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 9817cf7..d5dcddd 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -72,6 +72,32 @@ namespace OpenSim.Region.Framework.Interfaces
72 AvatarAppearance appearance); 72 AvatarAppearance appearance);
73 73
74 /// <summary> 74 /// <summary>
75 /// Create an NPC with a user-supplied agentID
76 /// </summary>
77 /// <param name="firstname"></param>
78 /// <param name="lastname"></param>
79 /// <param name="position"></param>
80 /// <param name="agentID"></param>
81 /// The desired agent ID
82 /// <param name="owner"></param>
83 /// <param name="senseAsAgent">
84 /// Make the NPC show up as an agent on LSL sensors. The default is
85 /// that they show up as the NPC type instead, but this is currently
86 /// an OpenSim-only extension.
87 /// </param>
88 /// <param name="scene"></param>
89 /// <param name="appearance">
90 /// The avatar appearance to use for the new NPC.
91 /// </param>
92 /// <returns>
93 /// The UUID of the ScenePresence created. UUID.Zero if there was a
94 /// failure.
95 /// </returns>
96 UUID CreateNPC(string firstname, string lastname,
97 Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene,
98 AvatarAppearance appearance);
99
100 /// <summary>
75 /// Check if the agent is an NPC. 101 /// Check if the agent is an NPC.
76 /// </summary> 102 /// </summary>
77 /// <param name="agentID"></param> 103 /// <param name="agentID"></param>
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainChannel.cs b/OpenSim/Region/Framework/Interfaces/ITerrainChannel.cs
index 469bd31..f660b8d 100644
--- a/OpenSim/Region/Framework/Interfaces/ITerrainChannel.cs
+++ b/OpenSim/Region/Framework/Interfaces/ITerrainChannel.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using OpenSim.Framework; 28using OpenSim.Framework;
29using OpenMetaverse;
29 30
30namespace OpenSim.Region.Framework.Interfaces 31namespace OpenSim.Region.Framework.Interfaces
31{ 32{
@@ -56,5 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces
56 ITerrainChannel MakeCopy(); 57 ITerrainChannel MakeCopy();
57 string SaveToXmlString(); 58 string SaveToXmlString();
58 void LoadFromXmlString(string data); 59 void LoadFromXmlString(string data);
60 // Merge some terrain into this channel
61 void Merge(ITerrainChannel newTerrain, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement);
59 } 62 }
60} 63}
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
index 189a30a..a6f5d98 100644
--- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Interfaces
51 /// </param> 51 /// </param>
52 /// <param name="stream"></param> 52 /// <param name="stream"></param>
53 void LoadFromStream(string filename, Stream stream); 53 void LoadFromStream(string filename, Stream stream);
54 void LoadFromStream(string filename, Vector2 displacement, Stream stream); 54 void LoadFromStream(string filename, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement, Stream stream);
55 void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); 55 void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap);
56 /// <summary> 56 /// <summary>
57 /// Save a terrain to a stream. 57 /// Save a terrain to a stream.
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
index b4b1823..24709dc 100644
--- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
+++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
@@ -36,6 +36,8 @@ using OpenSim.Data;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38 38
39using OpenMetaverse;
40
39using log4net; 41using log4net;
40 42
41namespace OpenSim.Region.Framework.Scenes 43namespace OpenSim.Region.Framework.Scenes
@@ -212,6 +214,76 @@ namespace OpenSim.Region.Framework.Scenes
212 sr.Close(); 214 sr.Close();
213 } 215 }
214 216
217 // ITerrainChannel.Merge
218 public void Merge(ITerrainChannel newTerrain, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement)
219 {
220 for (int xx = 0; xx < newTerrain.Width; xx++)
221 {
222 for (int yy = 0; yy < newTerrain.Height; yy++)
223 {
224 int dispX = (int)displacement.X;
225 int dispY = (int)displacement.Y;
226 float newHeight = (float)newTerrain[xx, yy] + displacement.Z;
227 if (radianRotation == 0)
228 {
229 // If no rotation, place the new height in the specified location
230 dispX += xx;
231 dispY += yy;
232 if (dispX >= 0 && dispX < m_terrainData.SizeX && dispY >= 0 && dispY < m_terrainData.SizeY)
233 {
234 m_terrainData[dispX, dispY] = newHeight;
235 }
236 }
237 else
238 {
239 // If rotating, we have to smooth the result because the conversion
240 // to ints will mean heightmap entries will not get changed
241 // First compute the rotation location for the new height.
242 dispX += (int)(rotationDisplacement.X
243 + ((float)xx - rotationDisplacement.X) * Math.Cos(radianRotation)
244 - ((float)yy - rotationDisplacement.Y) * Math.Sin(radianRotation) );
245
246 dispY += (int)(rotationDisplacement.Y
247 + ((float)xx - rotationDisplacement.X) * Math.Sin(radianRotation)
248 + ((float)yy - rotationDisplacement.Y) * Math.Cos(radianRotation) );
249
250 if (dispX >= 0 && dispX < m_terrainData.SizeX && dispY >= 0 && dispY < m_terrainData.SizeY)
251 {
252 float oldHeight = m_terrainData[dispX, dispY];
253 // Smooth the heights around this location if the old height is far from this one
254 for (int sxx = dispX - 2; sxx < dispX + 2; sxx++)
255 {
256 for (int syy = dispY - 2; syy < dispY + 2; syy++)
257 {
258 if (sxx >= 0 && sxx < m_terrainData.SizeX && syy >= 0 && syy < m_terrainData.SizeY)
259 {
260 if (sxx == dispX && syy == dispY)
261 {
262 // Set height for the exact rotated point
263 m_terrainData[dispX, dispY] = newHeight;
264 }
265 else
266 {
267 if (Math.Abs(m_terrainData[sxx, syy] - newHeight) > 1f)
268 {
269 // If the adjacent height is far off, force it to this height
270 m_terrainData[sxx, syy] = newHeight;
271 }
272 }
273 }
274 }
275 }
276 }
277
278 if (dispX >= 0 && dispX < m_terrainData.SizeX && dispY >= 0 && dispY < m_terrainData.SizeY)
279 {
280 m_terrainData[dispX, dispY] = (float)newTerrain[xx, yy];
281 }
282 }
283 }
284 }
285 }
286
215 #endregion 287 #endregion
216 288
217 public TerrainChannel Copy() 289 public TerrainChannel Copy()
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 75a51b5..fe6cb84 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -161,7 +161,7 @@ namespace OpenSim.Region.Framework.Scenes
161 { 161 {
162 // Get the prim's default texture. This will be used for faces which don't have their own texture 162 // Get the prim's default texture. This will be used for faces which don't have their own texture
163 if (textureEntry.DefaultTexture != null) 163 if (textureEntry.DefaultTexture != null)
164 assetUuids[textureEntry.DefaultTexture.TextureID] = (sbyte)AssetType.Texture; 164 GatherTextureEntryAssets(textureEntry.DefaultTexture, assetUuids);
165 165
166 if (textureEntry.FaceTextures != null) 166 if (textureEntry.FaceTextures != null)
167 { 167 {
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes
169 foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures) 169 foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures)
170 { 170 {
171 if (texture != null) 171 if (texture != null)
172 assetUuids[texture.TextureID] = (sbyte)AssetType.Texture; 172 GatherTextureEntryAssets(texture, assetUuids);
173 } 173 }
174 } 174 }
175 } 175 }
@@ -233,6 +233,19 @@ namespace OpenSim.Region.Framework.Scenes
233 } 233 }
234 } 234 }
235 235
236 /// <summary>
237 /// Gather all the asset uuids found in one face of a Texture Entry.
238 /// </summary>
239 private void GatherTextureEntryAssets(Primitive.TextureEntryFace texture, IDictionary<UUID, sbyte> assetUuids)
240 {
241 assetUuids[texture.TextureID] = (sbyte)AssetType.Texture;
242
243 if (texture.MaterialID != UUID.Zero)
244 {
245 GatherAssetUuids(texture.MaterialID, (sbyte)OpenSimAssetType.Material, assetUuids);
246 }
247 }
248
236// /// <summary> 249// /// <summary>
237// /// The callback made when we request the asset for an object from the asset service. 250// /// The callback made when we request the asset for an object from the asset service.
238// /// </summary> 251// /// </summary>
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 296ab87..d059b97 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -304,7 +304,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
304 finally 304 finally
305 { 305 {
306 if (os != null) 306 if (os != null)
307 os.Close(); 307 os.Dispose();
308 } 308 }
309 } 309 }
310 } 310 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index a895ee1..fb644b7 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
61 private readonly string m_firstname; 61 private readonly string m_firstname;
62 private readonly string m_lastname; 62 private readonly string m_lastname;
63 private readonly Vector3 m_startPos; 63 private readonly Vector3 m_startPos;
64 private readonly UUID m_uuid = UUID.Random(); 64 private readonly UUID m_uuid;
65 private readonly Scene m_scene; 65 private readonly Scene m_scene;
66 private readonly UUID m_ownerID; 66 private readonly UUID m_ownerID;
67 67
@@ -71,6 +71,19 @@ namespace OpenSim.Region.OptionalModules.World.NPC
71 m_firstname = firstname; 71 m_firstname = firstname;
72 m_lastname = lastname; 72 m_lastname = lastname;
73 m_startPos = position; 73 m_startPos = position;
74 m_uuid = UUID.Random();
75 m_scene = scene;
76 m_ownerID = ownerID;
77 SenseAsAgent = senseAsAgent;
78 }
79
80 public NPCAvatar(
81 string firstname, string lastname, UUID agentID, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene)
82 {
83 m_firstname = firstname;
84 m_lastname = lastname;
85 m_startPos = position;
86 m_uuid = agentID;
74 m_scene = scene; 87 m_scene = scene;
75 m_ownerID = ownerID; 88 m_ownerID = ownerID;
76 SenseAsAgent = senseAsAgent; 89 SenseAsAgent = senseAsAgent;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index fffe1ab..8a2da6e 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -140,8 +140,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC
140 Vector3 position, UUID owner, bool senseAsAgent, Scene scene, 140 Vector3 position, UUID owner, bool senseAsAgent, Scene scene,
141 AvatarAppearance appearance) 141 AvatarAppearance appearance)
142 { 142 {
143 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, 143 return CreateNPC(firstname, lastname, position, UUID.Zero, owner, senseAsAgent, scene, appearance);
144 owner, senseAsAgent, scene); 144 }
145
146 public UUID CreateNPC(string firstname, string lastname,
147 Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene,
148 AvatarAppearance appearance)
149 {
150 NPCAvatar npcAvatar = null;
151
152 try
153 {
154 if (agentID == UUID.Zero)
155 npcAvatar = new NPCAvatar(firstname, lastname, position,
156 owner, senseAsAgent, scene);
157 else
158 npcAvatar = new NPCAvatar(firstname, lastname, agentID, position,
159 owner, senseAsAgent, scene);
160 }
161 catch (Exception e)
162 {
163 m_log.Info("[NPC MODULE]: exception creating NPC avatar: " + e.ToString());
164 return UUID.Zero;
165 }
166
145 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, 167 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0,
146 int.MaxValue); 168 int.MaxValue);
147 169
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 834228e..d993e6a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -538,7 +538,7 @@ public static class BSParam
538 (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), 538 (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ),
539 539
540 new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", 540 new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
541 (float)BSTerrainPhys.TerrainImplementation.Mesh ), 541 (float)BSTerrainPhys.TerrainImplementation.Heightmap ),
542 new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , 542 new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" ,
543 2 ), 543 2 ),
544 new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , 544 new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" ,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index fe014fc..2d2e55f 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -235,6 +235,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
235 // Set default values for physics parameters plus any overrides from the ini file 235 // Set default values for physics parameters plus any overrides from the ini file
236 GetInitialParameterValues(config); 236 GetInitialParameterValues(config);
237 237
238 // Force some parameters to values depending on other configurations
239 // Only use heightmap terrain implementation if terrain larger than legacy size
240 if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize)
241 {
242 m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader);
243 BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap;
244 }
245
238 // Get the connection to the physics engine (could be native or one of many DLLs) 246 // Get the connection to the physics engine (could be native or one of many DLLs)
239 PE = SelectUnderlyingBulletEngine(BulletEngineName); 247 PE = SelectUnderlyingBulletEngine(BulletEngineName);
240 248
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7b56abf..91885b7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -101,7 +101,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
101 /// </summary> 101 /// </summary>
102 protected TaskInventoryItem m_item; 102 protected TaskInventoryItem m_item;
103 103
104 protected bool throwErrorOnNotImplemented = true; 104 protected bool throwErrorOnNotImplemented = false;
105 protected AsyncCommandManager AsyncCommands = null; 105 protected AsyncCommandManager AsyncCommands = null;
106 protected float m_ScriptDelayFactor = 1.0f; 106 protected float m_ScriptDelayFactor = 1.0f;
107 protected float m_ScriptDistanceFactor = 1.0f; 107 protected float m_ScriptDistanceFactor = 1.0f;
@@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
261 if ((item = GetScriptByName(name)) != UUID.Zero) 261 if ((item = GetScriptByName(name)) != UUID.Zero)
262 m_ScriptEngine.ResetScript(item); 262 m_ScriptEngine.ResetScript(item);
263 else 263 else
264 ShoutError("llResetOtherScript: script "+name+" not found"); 264 Error("llResetOtherScript", "Can't find script '" + name + "'");
265 } 265 }
266 266
267 public LSL_Integer llGetScriptState(string name) 267 public LSL_Integer llGetScriptState(string name)
@@ -275,7 +275,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
275 return m_ScriptEngine.GetScriptState(item) ?1:0; 275 return m_ScriptEngine.GetScriptState(item) ?1:0;
276 } 276 }
277 277
278 ShoutError("llGetScriptState: script "+name+" not found"); 278 Error("llGetScriptState", "Can't find script '" + name + "'");
279 279
280 // If we didn't find it, then it's safe to 280 // If we didn't find it, then it's safe to
281 // assume it is not running. 281 // assume it is not running.
@@ -298,7 +298,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
298 } 298 }
299 else 299 else
300 { 300 {
301 ShoutError("llSetScriptState: script "+name+" not found"); 301 Error("llSetScriptState", "Can't find script '" + name + "'");
302 } 302 }
303 } 303 }
304 304
@@ -890,7 +890,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
890 { 890 {
891 if (channelID == 0) 891 if (channelID == 0)
892 { 892 {
893 LSLError("Cannot use llRegionSay() on channel 0"); 893 Error("llRegionSay", "Cannot use on channel 0");
894 return; 894 return;
895 } 895 }
896 896
@@ -2553,9 +2553,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2553 public void llSound(string sound, double volume, int queue, int loop) 2553 public void llSound(string sound, double volume, int queue, int loop)
2554 { 2554 {
2555 m_host.AddScriptLPS(1); 2555 m_host.AddScriptLPS(1);
2556 // This function has been deprecated 2556 Deprecated("llSound", "Use llPlaySound instead");
2557 // see http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSound
2558 Deprecated("llSound");
2559 } 2557 }
2560 2558
2561 // Xantor 20080528 PlaySound updated so it accepts an objectinventory name -or- a key to a sound 2559 // Xantor 20080528 PlaySound updated so it accepts an objectinventory name -or- a key to a sound
@@ -2886,7 +2884,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2886 2884
2887 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) 2885 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
2888 { 2886 {
2889 LSLError("No permissions to give money"); 2887 Error("llGiveMoney", "No permissions to give money");
2890 return; 2888 return;
2891 } 2889 }
2892 2890
@@ -2894,7 +2892,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2894 2892
2895 if (!UUID.TryParse(destination, out toID)) 2893 if (!UUID.TryParse(destination, out toID))
2896 { 2894 {
2897 LSLError("Bad key in llGiveMoney"); 2895 Error("llGiveMoney", "Bad key in llGiveMoney");
2898 return; 2896 return;
2899 } 2897 }
2900 2898
@@ -2914,28 +2912,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2914 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 2912 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
2915 { 2913 {
2916 m_host.AddScriptLPS(1); 2914 m_host.AddScriptLPS(1);
2917 Deprecated("llMakeExplosion"); 2915 Deprecated("llMakeExplosion", "Use llParticleSystem instead");
2918 ScriptSleep(100); 2916 ScriptSleep(100);
2919 } 2917 }
2920 2918
2921 public void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset) 2919 public void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset)
2922 { 2920 {
2923 m_host.AddScriptLPS(1); 2921 m_host.AddScriptLPS(1);
2924 Deprecated("llMakeFountain"); 2922 Deprecated("llMakeFountain", "Use llParticleSystem instead");
2925 ScriptSleep(100); 2923 ScriptSleep(100);
2926 } 2924 }
2927 2925
2928 public void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 2926 public void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
2929 { 2927 {
2930 m_host.AddScriptLPS(1); 2928 m_host.AddScriptLPS(1);
2931 Deprecated("llMakeSmoke"); 2929 Deprecated("llMakeSmoke", "Use llParticleSystem instead");
2932 ScriptSleep(100); 2930 ScriptSleep(100);
2933 } 2931 }
2934 2932
2935 public void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 2933 public void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
2936 { 2934 {
2937 m_host.AddScriptLPS(1); 2935 m_host.AddScriptLPS(1);
2938 Deprecated("llMakeFire"); 2936 Deprecated("llMakeFire", "Use llParticleSystem instead");
2939 ScriptSleep(100); 2937 ScriptSleep(100);
2940 } 2938 }
2941 2939
@@ -2957,13 +2955,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2957 2955
2958 if (item == null) 2956 if (item == null)
2959 { 2957 {
2960 llSay(0, "Could not find object " + inventory); 2958 Error("llRezAtRoot", "Can't find object '" + inventory + "'");
2961 return; 2959 return;
2962 } 2960 }
2963 2961
2964 if (item.InvType != (int)InventoryType.Object) 2962 if (item.InvType != (int)InventoryType.Object)
2965 { 2963 {
2966 llSay(0, "Unable to create requested object. Object is missing from database."); 2964 Error("llRezAtRoot", "Can't create requested object; object is missing from database");
2967 return; 2965 return;
2968 } 2966 }
2969 2967
@@ -3053,7 +3051,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3053 public void llStopLookAt() 3051 public void llStopLookAt()
3054 { 3052 {
3055 m_host.AddScriptLPS(1); 3053 m_host.AddScriptLPS(1);
3056// NotImplemented("llStopLookAt");
3057 m_host.StopLookAt(); 3054 m_host.StopLookAt();
3058 } 3055 }
3059 3056
@@ -3237,13 +3234,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3237 public void llTakeCamera(string avatar) 3234 public void llTakeCamera(string avatar)
3238 { 3235 {
3239 m_host.AddScriptLPS(1); 3236 m_host.AddScriptLPS(1);
3240 Deprecated("llTakeCamera"); 3237 Deprecated("llTakeCamera", "Use llSetCameraParams instead");
3241 } 3238 }
3242 3239
3243 public void llReleaseCamera(string avatar) 3240 public void llReleaseCamera(string avatar)
3244 { 3241 {
3245 m_host.AddScriptLPS(1); 3242 m_host.AddScriptLPS(1);
3246 Deprecated("llReleaseCamera"); 3243 Deprecated("llReleaseCamera", "Use llClearCameraParams instead");
3247 } 3244 }
3248 3245
3249 public LSL_String llGetOwner() 3246 public LSL_String llGetOwner()
@@ -3320,7 +3317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3320 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>(); 3317 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>();
3321 if (emailModule == null) 3318 if (emailModule == null)
3322 { 3319 {
3323 ShoutError("llEmail: email module not configured"); 3320 Error("llEmail", "Email module not configured");
3324 return; 3321 return;
3325 } 3322 }
3326 3323
@@ -3334,7 +3331,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3334 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>(); 3331 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>();
3335 if (emailModule == null) 3332 if (emailModule == null)
3336 { 3333 {
3337 ShoutError("llGetNextEmail: email module not configured"); 3334 Error("llGetNextEmail", "Email module not configured");
3338 return; 3335 return;
3339 } 3336 }
3340 Email email; 3337 Email email;
@@ -3419,17 +3416,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3419 catch (NotImplementedException) 3416 catch (NotImplementedException)
3420 { 3417 {
3421 // Currently not implemented in DotNetEngine only XEngine 3418 // Currently not implemented in DotNetEngine only XEngine
3422 NotImplemented("llMinEventDelay in DotNetEngine"); 3419 NotImplemented("llMinEventDelay", "In DotNetEngine");
3423 } 3420 }
3424 } 3421 }
3425 3422
3426 /// <summary>
3427 /// llSoundPreload is deprecated. In SL this appears to do absolutely nothing
3428 /// and is documented to have no delay.
3429 /// </summary>
3430 public void llSoundPreload(string sound) 3423 public void llSoundPreload(string sound)
3431 { 3424 {
3432 m_host.AddScriptLPS(1); 3425 m_host.AddScriptLPS(1);
3426 Deprecated("llSoundPreload", "Use llPreloadSound instead");
3433 } 3427 }
3434 3428
3435 public void llRotLookAt(LSL_Rotation target, double strength, double damping) 3429 public void llRotLookAt(LSL_Rotation target, double strength, double damping)
@@ -3734,7 +3728,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3734 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 3728 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
3735 && !m_automaticLinkPermission) 3729 && !m_automaticLinkPermission)
3736 { 3730 {
3737 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); 3731 Error("llCreateLink", "PERMISSION_CHANGE_LINKS permission not set");
3738 return; 3732 return;
3739 } 3733 }
3740 3734
@@ -3789,7 +3783,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3789 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 3783 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
3790 && !m_automaticLinkPermission) 3784 && !m_automaticLinkPermission)
3791 { 3785 {
3792 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); 3786 Error("llBreakLink", "PERMISSION_CHANGE_LINKS permission not set");
3793 return; 3787 return;
3794 } 3788 }
3795 3789
@@ -4009,7 +4003,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4009 4003
4010 if (!UUID.TryParse(destination, out destId)) 4004 if (!UUID.TryParse(destination, out destId))
4011 { 4005 {
4012 llSay(0, "Could not parse key " + destination); 4006 Error("llGiveInventory", "Can't parse destination key '" + destination + "'");
4013 return; 4007 return;
4014 } 4008 }
4015 4009
@@ -4017,8 +4011,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4017 4011
4018 if (item == null) 4012 if (item == null)
4019 { 4013 {
4020 llSay(0, String.Format("Could not find object '{0}'", inventory)); 4014 Error("llGiveInventory", "Can't find inventory object '" + inventory + "'");
4021 throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
4022 } 4015 }
4023 4016
4024 UUID objId = item.ItemID; 4017 UUID objId = item.ItemID;
@@ -4042,7 +4035,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4042 4035
4043 if (account == null) 4036 if (account == null)
4044 { 4037 {
4045 llSay(0, "Can't find destination "+destId.ToString()); 4038 Error("llGiveInventory", "Can't find destination '" + destId.ToString() + "'");
4046 return; 4039 return;
4047 } 4040 }
4048 } 4041 }
@@ -4394,17 +4387,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4394 UUID av = new UUID(); 4387 UUID av = new UUID();
4395 if (!UUID.TryParse(agent,out av)) 4388 if (!UUID.TryParse(agent,out av))
4396 { 4389 {
4397 LSLError("First parameter to llTextBox needs to be a key"); 4390 Error("llTextBox", "First parameter must be a key");
4398 return; 4391 return;
4399 } 4392 }
4400 4393
4401 if (message == string.Empty) 4394 if (message == string.Empty)
4402 { 4395 {
4403 ShoutError("Trying to use llTextBox with empty message."); 4396 Error("llTextBox", "Empty message");
4404 } 4397 }
4405 else if (message.Length > 512) 4398 else if (message.Length > 512)
4406 { 4399 {
4407 ShoutError("Trying to use llTextBox with message over 512 characters."); 4400 Error("llTextBox", "Message more than 512 characters");
4408 } 4401 }
4409 else 4402 else
4410 { 4403 {
@@ -6814,17 +6807,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6814 UUID av = new UUID(); 6807 UUID av = new UUID();
6815 if (!UUID.TryParse(avatar,out av)) 6808 if (!UUID.TryParse(avatar,out av))
6816 { 6809 {
6817 LSLError("First parameter to llDialog needs to be a key"); 6810 Error("llDialog", "First parameter must be a key");
6818 return; 6811 return;
6819 } 6812 }
6820 if (buttons.Length < 1) 6813 if (buttons.Length < 1)
6821 { 6814 {
6822 LSLError("No less than 1 button can be shown"); 6815 Error("llDialog", "At least 1 button must be shown");
6823 return; 6816 return;
6824 } 6817 }
6825 if (buttons.Length > 12) 6818 if (buttons.Length > 12)
6826 { 6819 {
6827 LSLError("No more than 12 buttons can be shown"); 6820 Error("llDialog", "No more than 12 buttons can be shown");
6828 return; 6821 return;
6829 } 6822 }
6830 string[] buts = new string[buttons.Length]; 6823 string[] buts = new string[buttons.Length];
@@ -6832,12 +6825,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6832 { 6825 {
6833 if (buttons.Data[i].ToString() == String.Empty) 6826 if (buttons.Data[i].ToString() == String.Empty)
6834 { 6827 {
6835 LSLError("button label cannot be blank"); 6828 Error("llDialog", "Button label cannot be blank");
6836 return; 6829 return;
6837 } 6830 }
6838 if (buttons.Data[i].ToString().Length > 24) 6831 if (buttons.Data[i].ToString().Length > 24)
6839 { 6832 {
6840 LSLError("button label cannot be longer than 24 characters"); 6833 Error("llDialog", "Button label cannot be longer than 24 characters");
6841 return; 6834 return;
6842 } 6835 }
6843 buts[i] = buttons.Data[i].ToString(); 6836 buts[i] = buttons.Data[i].ToString();
@@ -6858,15 +6851,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6858 m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0); 6851 m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
6859 } 6852 }
6860 6853
6861 /// <summary>
6862 /// This is a depecated function so this just replicates the result of
6863 /// invoking it in SL
6864 /// </summary>
6865 public void llRemoteLoadScript(string target, string name, int running, int start_param) 6854 public void llRemoteLoadScript(string target, string name, int running, int start_param)
6866 { 6855 {
6867 m_host.AddScriptLPS(1); 6856 m_host.AddScriptLPS(1);
6868 // Report an error as it does in SL 6857 Deprecated("llRemoteLoadScript", "Use llRemoteLoadScriptPin instead");
6869 ShoutError("Deprecated. Please use llRemoteLoadScriptPin instead.");
6870 ScriptSleep(3000); 6858 ScriptSleep(3000);
6871 } 6859 }
6872 6860
@@ -6884,7 +6872,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6884 6872
6885 if (!UUID.TryParse(target, out destId)) 6873 if (!UUID.TryParse(target, out destId))
6886 { 6874 {
6887 llSay(0, "Could not parse key " + target); 6875 Error("llRemoteLoadScriptPin", "Can't parse key '" + target + "'");
6888 return; 6876 return;
6889 } 6877 }
6890 6878
@@ -6900,7 +6888,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6900 // make sure the object is a script 6888 // make sure the object is a script
6901 if (item == null || item.Type != 10) 6889 if (item == null || item.Type != 10)
6902 { 6890 {
6903 llSay(0, "Could not find script " + name); 6891 Error("llRemoteLoadScriptPin", "Can't find script '" + name + "'");
6904 return; 6892 return;
6905 } 6893 }
6906 6894
@@ -7948,9 +7936,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7948 } 7936 }
7949 catch (InvalidCastException e) 7937 catch (InvalidCastException e)
7950 { 7938 {
7951 ShoutError(string.Format( 7939 Error(originFunc, string.Format("Error running rule #{0}: arg #{1} - ", rulesParsed, idx - idxStart) + e.Message);
7952 "{0} error running rule #{1}: arg #{2} ",
7953 originFunc, rulesParsed, idx - idxStart) + e.Message);
7954 } 7940 }
7955 finally 7941 finally
7956 { 7942 {
@@ -7983,9 +7969,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7983 string encodedData = Convert.ToBase64String(encData_byte); 7969 string encodedData = Convert.ToBase64String(encData_byte);
7984 return encodedData; 7970 return encodedData;
7985 } 7971 }
7986 catch (Exception e) 7972 catch
7987 { 7973 {
7988 throw new Exception("Error in base64Encode" + e.Message); 7974 Error("llBase64ToString", "Error encoding string");
7975 return String.Empty;
7989 } 7976 }
7990 } 7977 }
7991 7978
@@ -7996,16 +7983,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7996 { 7983 {
7997 return Util.Base64ToString(str); 7984 return Util.Base64ToString(str);
7998 } 7985 }
7999 catch (Exception e) 7986 catch
8000 { 7987 {
8001 throw new Exception("Error in base64Decode" + e.Message); 7988 Error("llBase64ToString", "Error decoding string");
7989 return String.Empty;
8002 } 7990 }
8003 } 7991 }
8004 7992
8005 public LSL_String llXorBase64Strings(string str1, string str2) 7993 public LSL_String llXorBase64Strings(string str1, string str2)
8006 { 7994 {
8007 m_host.AddScriptLPS(1); 7995 m_host.AddScriptLPS(1);
8008 Deprecated("llXorBase64Strings"); 7996 Deprecated("llXorBase64Strings", "Use llXorBase64 instead");
8009 ScriptSleep(300); 7997 ScriptSleep(300);
8010 return String.Empty; 7998 return String.Empty;
8011 } 7999 }
@@ -8013,7 +8001,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8013 public void llRemoteDataSetRegion() 8001 public void llRemoteDataSetRegion()
8014 { 8002 {
8015 m_host.AddScriptLPS(1); 8003 m_host.AddScriptLPS(1);
8016 Deprecated("llRemoteDataSetRegion"); 8004 Deprecated("llRemoteDataSetRegion", "Use llOpenRemoteDataChannel instead");
8017 } 8005 }
8018 8006
8019 public LSL_Float llLog10(double val) 8007 public LSL_Float llLog10(double val)
@@ -9728,7 +9716,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9728 9716
9729 if (item == null) 9717 if (item == null)
9730 { 9718 {
9731 llSay(0, "No item name '" + item + "'"); 9719 Error("llGetInventoryCreator", "Can't find item '" + item + "'");
9732 9720
9733 return String.Empty; 9721 return String.Empty;
9734 } 9722 }
@@ -10047,7 +10035,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10047 presence = World.GetScenePresence(agentID); 10035 presence = World.GetScenePresence(agentID);
10048 } 10036 }
10049 } 10037 }
10050 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_AGENT must be a key"); 10038 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_AGENT must be a key");
10051 ++i; 10039 ++i;
10052 } 10040 }
10053 break; 10041 break;
@@ -10078,7 +10066,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10078 url = (LSL_String)commandList.Data[i + 1]; 10066 url = (LSL_String)commandList.Data[i + 1];
10079 update = true; 10067 update = true;
10080 } 10068 }
10081 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_URL must be a string."); 10069 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_URL must be a string");
10082 ++i; 10070 ++i;
10083 } 10071 }
10084 break; 10072 break;
@@ -10091,7 +10079,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10091 texture = (LSL_String)commandList.Data[i + 1]; 10079 texture = (LSL_String)commandList.Data[i + 1];
10092 update = true; 10080 update = true;
10093 } 10081 }
10094 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TEXTURE must be a string or key."); 10082 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TEXTURE must be a string or a key");
10095 ++i; 10083 ++i;
10096 } 10084 }
10097 break; 10085 break;
@@ -10103,7 +10091,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10103 { 10091 {
10104 time = (float)(LSL_Float)commandList.Data[i + 1]; 10092 time = (float)(LSL_Float)commandList.Data[i + 1];
10105 } 10093 }
10106 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TIME must be a float."); 10094 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TIME must be a float");
10107 ++i; 10095 ++i;
10108 } 10096 }
10109 break; 10097 break;
@@ -10117,7 +10105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10117 update = true; 10105 update = true;
10118 } 10106 }
10119 10107
10120 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_AUTO_ALIGN must be an integer."); 10108 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_AUTO_ALIGN must be an integer");
10121 ++i; 10109 ++i;
10122 } 10110 }
10123 break; 10111 break;
@@ -10130,7 +10118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10130 mediaType = (LSL_String)commandList.Data[i + 1]; 10118 mediaType = (LSL_String)commandList.Data[i + 1];
10131 update = true; 10119 update = true;
10132 } 10120 }
10133 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TYPE must be a string."); 10121 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TYPE must be a string");
10134 ++i; 10122 ++i;
10135 } 10123 }
10136 break; 10124 break;
@@ -10143,7 +10131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10143 description = (LSL_String)commandList.Data[i + 1]; 10131 description = (LSL_String)commandList.Data[i + 1];
10144 update = true; 10132 update = true;
10145 } 10133 }
10146 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_DESC must be a string."); 10134 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_DESC must be a string");
10147 ++i; 10135 ++i;
10148 } 10136 }
10149 break; 10137 break;
@@ -10159,15 +10147,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10159 height = (LSL_Integer)commandList.Data[i + 2]; 10147 height = (LSL_Integer)commandList.Data[i + 2];
10160 update = true; 10148 update = true;
10161 } 10149 }
10162 else ShoutError("The second argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer."); 10150 else Error("llParcelMediaCommandList", "The second argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer");
10163 } 10151 }
10164 else ShoutError("The first argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer."); 10152 else Error("llParcelMediaCommandList", "The first argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer");
10165 i += 2; 10153 i += 2;
10166 } 10154 }
10167 break; 10155 break;
10168 10156
10169 default: 10157 default:
10170 NotImplemented("llParcelMediaCommandList parameter not supported yet: " + Enum.Parse(typeof(ParcelMediaCommandEnum), commandList.Data[i].ToString()).ToString()); 10158 NotImplemented("llParcelMediaCommandList", "Parameter not supported yet: " + Enum.Parse(typeof(ParcelMediaCommandEnum), commandList.Data[i].ToString()).ToString());
10171 break; 10159 break;
10172 }//end switch 10160 }//end switch
10173 }//end for 10161 }//end for
@@ -10275,7 +10263,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10275 break; 10263 break;
10276 default: 10264 default:
10277 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; 10265 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;
10278 NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); 10266 NotImplemented("llParcelMediaQuery", "Parameter not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString());
10279 break; 10267 break;
10280 } 10268 }
10281 10269
@@ -10312,7 +10300,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10312 10300
10313 if (quick_pay_buttons.Data.Length < 4) 10301 if (quick_pay_buttons.Data.Length < 4)
10314 { 10302 {
10315 LSLError("List must have at least 4 elements"); 10303 Error("llSetPayPrice", "List must have at least 4 elements");
10316 return; 10304 return;
10317 } 10305 }
10318 m_host.ParentGroup.RootPart.PayPrice[0]=price; 10306 m_host.ParentGroup.RootPart.PayPrice[0]=price;
@@ -10333,7 +10321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10333 10321
10334 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) 10322 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
10335 { 10323 {
10336 ShoutError("No permissions to track the camera"); 10324 Error("llGetCameraPos", "No permissions to track the camera");
10337 return Vector3.Zero; 10325 return Vector3.Zero;
10338 } 10326 }
10339 10327
@@ -10356,7 +10344,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10356 10344
10357 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) 10345 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
10358 { 10346 {
10359 ShoutError("No permissions to track the camera"); 10347 Error("llGetCameraRot", "No permissions to track the camera");
10360 return Quaternion.Identity; 10348 return Quaternion.Identity;
10361 } 10349 }
10362 10350
@@ -10369,24 +10357,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10369 return Quaternion.Identity; 10357 return Quaternion.Identity;
10370 } 10358 }
10371 10359
10372 /// <summary>
10373 /// The SL implementation does nothing, it is deprecated
10374 /// This duplicates SL
10375 /// </summary>
10376 public void llSetPrimURL(string url) 10360 public void llSetPrimURL(string url)
10377 { 10361 {
10378 m_host.AddScriptLPS(1); 10362 m_host.AddScriptLPS(1);
10363 Deprecated("llSetPrimURL", "Use llSetPrimMediaParams instead");
10379 ScriptSleep(2000); 10364 ScriptSleep(2000);
10380 } 10365 }
10381 10366
10382 /// <summary>
10383 /// The SL implementation shouts an error, it is deprecated
10384 /// This duplicates SL
10385 /// </summary>
10386 public void llRefreshPrimURL() 10367 public void llRefreshPrimURL()
10387 { 10368 {
10388 m_host.AddScriptLPS(1); 10369 m_host.AddScriptLPS(1);
10389 ShoutError("llRefreshPrimURL - not yet supported"); 10370 Deprecated("llRefreshPrimURL");
10390 ScriptSleep(20000); 10371 ScriptSleep(20000);
10391 } 10372 }
10392 10373
@@ -10696,7 +10677,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10696 if (!ok || flag < 0 || 10677 if (!ok || flag < 0 ||
10697 flag > (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE) 10678 flag > (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE)
10698 { 10679 {
10699 throw new ScriptException("Parameter " + i.ToString() + " is an invalid flag"); 10680 Error("llHTTPRequest", "Parameter " + i.ToString() + " is an invalid flag");
10700 } 10681 }
10701 10682
10702 param.Add(parameters.Data[i].ToString()); //Add parameter flag 10683 param.Add(parameters.Data[i].ToString()); //Add parameter flag
@@ -10720,12 +10701,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10720 { 10701 {
10721 //There must be at least one name/value pair for custom header 10702 //There must be at least one name/value pair for custom header
10722 if (count == 1) 10703 if (count == 1)
10723 throw new ScriptException("Missing name/value for custom header at parameter " + i.ToString()); 10704 Error("llHTTPRequest", "Missing name/value for custom header at parameter " + i.ToString());
10724 break; 10705 break;
10725 } 10706 }
10726 10707
10727 if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase)) 10708 if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase))
10728 throw new ScriptException("Name is invalid as a custom header at parameter " + i.ToString()); 10709 Error("llHTTPRequest", "Name is invalid as a custom header at parameter " + i.ToString());
10729 10710
10730 param.Add(parameters.Data[i].ToString()); 10711 param.Add(parameters.Data[i].ToString());
10731 param.Add(parameters.Data[i+1].ToString()); 10712 param.Add(parameters.Data[i+1].ToString());
@@ -11242,25 +11223,71 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11242 return item.ItemID; 11223 return item.ItemID;
11243 } 11224 }
11244 11225
11245 internal void ShoutError(string msg) 11226 /// <summary>
11227 /// Reports the script error in the viewer's Script Warning/Error dialog and shouts it on the debug channel.
11228 /// </summary>
11229 /// <param name="command">The name of the command that generated the error.</param>
11230 /// <param name="message">The error message to report to the user.</param>
11231 internal void Error(string command, string message)
11246 { 11232 {
11247 llShout(ScriptBaseClass.DEBUG_CHANNEL, msg); 11233 string text = command + ": " + message;
11234 if (text.Length > 1023)
11235 {
11236 text = text.Substring(0, 1023);
11237 }
11238
11239 World.SimChat(Utils.StringToBytes(text), ChatTypeEnum.DebugChannel, ScriptBaseClass.DEBUG_CHANNEL,
11240 m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false);
11241
11242 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
11243 if (wComm != null)
11244 {
11245 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, text);
11246 }
11248 } 11247 }
11249 11248
11250 internal void NotImplemented(string command) 11249 /// <summary>
11250 /// Reports that the command is not implemented as a script error.
11251 /// </summary>
11252 /// <param name="command">The name of the command that is not implemented.</param>
11253 /// <param name="message">Additional information to report to the user. (Optional)</param>
11254 internal void NotImplemented(string command, string message = "")
11251 { 11255 {
11252 if (throwErrorOnNotImplemented) 11256 if (throwErrorOnNotImplemented)
11253 throw new NotImplementedException("Command not implemented: " + command); 11257 {
11254 } 11258 if (message != "")
11259 {
11260 message = " - " + message;
11261 }
11255 11262
11256 internal void Deprecated(string command) 11263 throw new NotImplementedException("Command not implemented: " + command + message);
11257 { 11264 }
11258 throw new ScriptException("Command deprecated: " + command); 11265 else
11266 {
11267 string text = "Command not implemented";
11268 if (message != "")
11269 {
11270 text = text + " - " + message;
11271 }
11272
11273 Error(command, text);
11274 }
11259 } 11275 }
11260 11276
11261 internal void LSLError(string msg) 11277 /// <summary>
11278 /// Reports that the command is deprecated as a script error.
11279 /// </summary>
11280 /// <param name="command">The name of the command that is deprecated.</param>
11281 /// <param name="message">Additional information to report to the user. (Optional)</param>
11282 internal void Deprecated(string command, string message = "")
11262 { 11283 {
11263 throw new ScriptException("LSL Runtime Error: " + msg); 11284 string text = "Command deprecated";
11285 if (message != "")
11286 {
11287 text = text + " - " + message;
11288 }
11289
11290 Error(command, text);
11264 } 11291 }
11265 11292
11266 public delegate void AssetRequestCallback(UUID assetID, AssetBase asset); 11293 public delegate void AssetRequestCallback(UUID assetID, AssetBase asset);
@@ -11292,7 +11319,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11292 if (assetID == UUID.Zero) 11319 if (assetID == UUID.Zero)
11293 { 11320 {
11294 // => complain loudly, as specified by the LSL docs 11321 // => complain loudly, as specified by the LSL docs
11295 ShoutError("Notecard '" + name + "' could not be found."); 11322 Error("llGetNumberOfNotecardLines", "Can't find notecard '" + name + "'");
11296 11323
11297 return UUID.Zero.ToString(); 11324 return UUID.Zero.ToString();
11298 } 11325 }
@@ -11314,7 +11341,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11314 { 11341 {
11315 if (a == null || a.Type != 7) 11342 if (a == null || a.Type != 7)
11316 { 11343 {
11317 ShoutError("Notecard '" + name + "' could not be found."); 11344 Error("llGetNumberOfNotecardLines", "Can't find notecard '" + name + "'");
11318 return; 11345 return;
11319 } 11346 }
11320 11347
@@ -11345,7 +11372,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11345 if (assetID == UUID.Zero) 11372 if (assetID == UUID.Zero)
11346 { 11373 {
11347 // => complain loudly, as specified by the LSL docs 11374 // => complain loudly, as specified by the LSL docs
11348 ShoutError("Notecard '" + name + "' could not be found."); 11375 Error("llGetNotecardLine", "Can't find notecard '" + name + "'");
11349 11376
11350 return UUID.Zero.ToString(); 11377 return UUID.Zero.ToString();
11351 } 11378 }
@@ -11368,7 +11395,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11368 { 11395 {
11369 if (a == null || a.Type != 7) 11396 if (a == null || a.Type != 7)
11370 { 11397 {
11371 ShoutError("Notecard '" + name + "' could not be found."); 11398 Error("llGetNotecardLine", "Can't find notecard '" + name + "'");
11372 return; 11399 return;
11373 } 11400 }
11374 11401
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
index beead97..0f8033d 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
@@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors
162 finally 162 finally
163 { 163 {
164 if (os != null) 164 if (os != null)
165 os.Close(); 165 os.Dispose();
166 } 166 }
167 167
168 // Let's wait for the response 168 // Let's wait for the response
@@ -202,4 +202,4 @@ namespace OpenSim.Services.Connectors
202 return true; 202 return true;
203 } 203 }
204 } 204 }
205} \ No newline at end of file 205}
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 150c2c0..46a5c18 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -384,11 +384,30 @@ namespace OpenSim.Services.LLLoginService
384 // 384 //
385 GridRegion home = null; 385 GridRegion home = null;
386 GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString()); 386 GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString());
387 if (guinfo != null && (guinfo.HomeRegionID != UUID.Zero) && m_GridService != null) 387
388 // We are only going to complain about no home if the user actually tries to login there, to avoid
389 // spamming the console.
390 if (guinfo != null)
388 { 391 {
389 home = m_GridService.GetRegionByUUID(scopeID, guinfo.HomeRegionID); 392 if (guinfo.HomeRegionID == UUID.Zero && startLocation == "home")
393 {
394 m_log.WarnFormat(
395 "[LLOGIN SERVICE]: User {0} tried to login to a 'home' start location but they have none set",
396 account.Name);
397 }
398 else if (m_GridService != null)
399 {
400 home = m_GridService.GetRegionByUUID(scopeID, guinfo.HomeRegionID);
401
402 if (home == null && startLocation == "home")
403 {
404 m_log.WarnFormat(
405 "[LLOGIN SERVICE]: User {0} tried to login to a 'home' start location with ID {1} but this was not found.",
406 account.Name, guinfo.HomeRegionID);
407 }
408 }
390 } 409 }
391 if (guinfo == null) 410 else
392 { 411 {
393 // something went wrong, make something up, so that we don't have to test this anywhere else 412 // something went wrong, make something up, so that we don't have to test this anywhere else
394 m_log.DebugFormat("{0} Failed to fetch GridUserInfo. Creating empty GridUserInfo as home", LogHeader); 413 m_log.DebugFormat("{0} Failed to fetch GridUserInfo. Creating empty GridUserInfo as home", LogHeader);
@@ -509,10 +528,6 @@ namespace OpenSim.Services.LLLoginService
509 528
510 if (home == null) 529 if (home == null)
511 { 530 {
512 m_log.WarnFormat(
513 "[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set",
514 account.FirstName, account.LastName);
515
516 tryDefaults = true; 531 tryDefaults = true;
517 } 532 }
518 else 533 else
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs
index bef1691..bfc27b5 100644
--- a/OpenSim/Services/UserAccountService/GridUserService.cs
+++ b/OpenSim/Services/UserAccountService/GridUserService.cs
@@ -50,6 +50,14 @@ namespace OpenSim.Services.UserAccountService
50 50
51 MainConsole.Instance.Commands.AddCommand( 51 MainConsole.Instance.Commands.AddCommand(
52 "Users", false, 52 "Users", false,
53 "show grid user",
54 "show grid user <ID>",
55 "Show grid user entry or entries that match or start with the given ID. This will normally be a UUID.",
56 "This is for debug purposes to see what data is found for a particular user id.",
57 HandleShowGridUser);
58
59 MainConsole.Instance.Commands.AddCommand(
60 "Users", false,
53 "show grid users online", 61 "show grid users online",
54 "show grid users online", 62 "show grid users online",
55 "Show number of grid users registered as online.", 63 "Show number of grid users registered as online.",
@@ -58,6 +66,31 @@ namespace OpenSim.Services.UserAccountService
58 HandleShowGridUsersOnline); 66 HandleShowGridUsersOnline);
59 } 67 }
60 68
69 protected void HandleShowGridUser(string module, string[] cmdparams)
70 {
71 if (cmdparams.Length != 4)
72 {
73 MainConsole.Instance.Output("Usage: show grid user <UUID>");
74 return;
75 }
76
77 GridUserData[] data = m_Database.GetAll(cmdparams[3]);
78
79 foreach (GridUserData gu in data)
80 {
81 ConsoleDisplayList cdl = new ConsoleDisplayList();
82
83 cdl.AddRow("User ID", gu.UserID);
84
85 foreach (KeyValuePair<string,string> kvp in gu.Data)
86 cdl.AddRow(kvp.Key, kvp.Value);
87
88 MainConsole.Instance.Output(cdl.ToString());
89 }
90
91 MainConsole.Instance.OutputFormat("Entries: {0}", data.Length);
92 }
93
61 protected void HandleShowGridUsersOnline(string module, string[] cmdparams) 94 protected void HandleShowGridUsersOnline(string module, string[] cmdparams)
62 { 95 {
63// if (cmdparams.Length != 4) 96// if (cmdparams.Length != 4)
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index df94239..026f285 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -1001,10 +1001,10 @@
1001 1001
1002 ; Terrain implementation can use either Bullet's heightField or BulletSim can build 1002 ; Terrain implementation can use either Bullet's heightField or BulletSim can build
1003 ; a mesh. 0=heightField, 1=mesh 1003 ; a mesh. 0=heightField, 1=mesh
1004 TerrainImplementation = 1 1004 TerrainImplementation = 0
1005 ; For mesh terrain, the detail of the created mesh. '1' gives 256x256 (heightfield 1005 ; For mesh terrain, the detail of the created mesh. '1' gives 256x256 (heightfield
1006 ; resolution). '2' gives 512x512. Etc. Cannot be larger than '4'. Higher 1006 ; resolution). '2' gives 512x512. Etc. Cannot be larger than '4'. Higher
1007 ; magnification uses lots of memory. 1007 ; magnifications use lots of memory.
1008 TerrainMeshMagnification = 2 1008 TerrainMeshMagnification = 2
1009 1009
1010 ; Avatar physics height adjustments. 1010 ; Avatar physics height adjustments.