aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2012-05-14 23:32:49 +0100
committerMelanie2012-05-14 23:32:49 +0100
commit6126b6da72bc0d3265df1ec45901f10737173d9a (patch)
tree2e645853cccef8591738a59a8b76bb14a0d2fb0b /OpenSim/Region
parentMerge branch 'avination' into careminster (diff)
parentSave the Telehub and its Spawn Points in the OAR (diff)
downloadopensim-SC-6126b6da72bc0d3265df1ec45901f10737173d9a.zip
opensim-SC-6126b6da72bc0d3265df1ec45901f10737173d9a.tar.gz
opensim-SC-6126b6da72bc0d3265df1ec45901f10737173d9a.tar.bz2
opensim-SC-6126b6da72bc0d3265df1ec45901f10737173d9a.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/Scene.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs63
-rw-r--r--OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs24
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs25
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs82
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs103
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs28
9 files changed, 257 insertions, 84 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index d98ea39..875c073 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -371,11 +371,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
371 if (missingTexturesOnly) 371 if (missingTexturesOnly)
372 { 372 {
373 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) 373 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
374 {
374 continue; 375 continue;
376 }
375 else 377 else
378 {
379 // On inter-simulator teleports, this occurs if baked textures are not being stored by the
380 // grid asset service (which means that they are not available to the new region and so have
381 // to be re-requested from the client).
382 //
383 // The only available core OpenSimulator behaviour right now
384 // is not to store these textures, temporarily or otherwise.
376 m_log.DebugFormat( 385 m_log.DebugFormat(
377 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", 386 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
378 face.TextureID, idx, sp.Name); 387 face.TextureID, idx, sp.Name);
388 }
379 } 389 }
380 else 390 else
381 { 391 {
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index d4fbdce..514a65b 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -53,7 +53,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
53 public const int DefaultMaxTransferDistance = 4095; 53 public const int DefaultMaxTransferDistance = 4095;
54 public const bool EnableWaitForCallbackFromTeleportDestDefault = true; 54 public const bool EnableWaitForCallbackFromTeleportDestDefault = true;
55 55
56
57 /// <summary> 56 /// <summary>
58 /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. 57 /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
59 /// </summary> 58 /// </summary>
@@ -211,6 +210,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
211 sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName, 210 sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName,
212 e.Message, e.StackTrace); 211 e.Message, e.StackTrace);
213 212
213 // Make sure that we clear the in-transit flag so that future teleport attempts don't always fail.
214 ResetFromTransit(sp.UUID);
215
214 sp.ControllingClient.SendTeleportFailed("Internal error"); 216 sp.ControllingClient.SendTeleportFailed("Internal error");
215 } 217 }
216 } 218 }
@@ -386,7 +388,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
386 return; 388 return;
387 } 389 }
388 390
389 if (IsInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this. 391 if (!SetInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this.
390 { 392 {
391 m_log.DebugFormat( 393 m_log.DebugFormat(
392 "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.", 394 "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
@@ -434,8 +436,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
434 if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason)) 436 if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
435 { 437 {
436 sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); 438 sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason);
439 ResetFromTransit(sp.UUID);
440
437 return; 441 return;
438 } 442 }
443
439 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); 444 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
440 445
441 sp.ControllingClient.SendTeleportStart(teleportFlags); 446 sp.ControllingClient.SendTeleportStart(teleportFlags);
@@ -475,13 +480,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
475 bool logout = false; 480 bool logout = false;
476 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) 481 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
477 { 482 {
478 sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", 483 sp.ControllingClient.SendTeleportFailed(
479 reason)); 484 String.Format("Teleport refused: {0}", reason));
485 ResetFromTransit(sp.UUID);
486
480 return; 487 return;
481 } 488 }
482 489
483 // OK, it got this agent. Let's close some child agents 490 // OK, it got this agent. Let's close some child agents
484 sp.CloseChildAgents(newRegionX, newRegionY); 491 sp.CloseChildAgents(newRegionX, newRegionY);
492
485 IClientIPEndpoint ipepClient; 493 IClientIPEndpoint ipepClient;
486 if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) 494 if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
487 { 495 {
@@ -518,8 +526,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
518 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); 526 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
519 } 527 }
520 528
521 SetInTransit(sp.UUID);
522
523 // Let's send a full update of the agent. This is a synchronous call. 529 // Let's send a full update of the agent. This is a synchronous call.
524 AgentData agent = new AgentData(); 530 AgentData agent = new AgentData();
525 sp.CopyTo(agent); 531 sp.CopyTo(agent);
@@ -532,8 +538,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
532 { 538 {
533 // Region doesn't take it 539 // Region doesn't take it
534 m_log.WarnFormat( 540 m_log.WarnFormat(
535 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.", 541 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Returning avatar to source region.",
536 sp.Name, finalDestination.RegionName); 542 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName);
537 543
538 Fail(sp, finalDestination, logout); 544 Fail(sp, finalDestination, logout);
539 return; 545 return;
@@ -565,8 +571,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
565 if (EnableWaitForCallbackFromTeleportDest && !WaitForCallback(sp.UUID)) 571 if (EnableWaitForCallbackFromTeleportDest && !WaitForCallback(sp.UUID))
566 { 572 {
567 m_log.WarnFormat( 573 m_log.WarnFormat(
568 "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.", 574 "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.",
569 sp.Name, finalDestination.RegionName); 575 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName);
570 576
571 Fail(sp, finalDestination, logout); 577 Fail(sp, finalDestination, logout);
572 return; 578 return;
@@ -662,8 +668,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
662 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) 668 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
663 { 669 {
664 agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; 670 agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/";
665 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Set callback URL to {0}", agent.CallbackURI);
666 671
672 m_log.DebugFormat(
673 "[ENTITY TRANSFER MODULE]: Set release callback URL to {0} in {1}",
674 agent.CallbackURI, region.RegionName);
667 } 675 }
668 676
669 protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) 677 protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
@@ -1921,25 +1929,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1921 return count > 0; 1929 return count > 0;
1922 } 1930 }
1923 1931
1924 protected void SetInTransit(UUID id) 1932 /// <summary>
1933 /// Set that an agent is in the process of being teleported.
1934 /// </summary>
1935 /// <param name='id'>The ID of the agent being teleported</param>
1936 /// <returns>true if the agent was not already in transit, false if it was</returns>
1937 protected bool SetInTransit(UUID id)
1925 { 1938 {
1926 lock (m_agentsInTransit) 1939 lock (m_agentsInTransit)
1927 { 1940 {
1928 if (!m_agentsInTransit.Contains(id)) 1941 if (!m_agentsInTransit.Contains(id))
1942 {
1929 m_agentsInTransit.Add(id); 1943 m_agentsInTransit.Add(id);
1944 return true;
1945 }
1930 } 1946 }
1947
1948 return false;
1931 } 1949 }
1932 1950
1951 /// <summary>
1952 /// Show whether the given agent is being teleported.
1953 /// </summary>
1954 /// <returns>true if the agent is in the process of being teleported, false otherwise.</returns>
1955 /// <param name='id'>The agent ID</para></param>
1933 protected bool IsInTransit(UUID id) 1956 protected bool IsInTransit(UUID id)
1934 { 1957 {
1935 lock (m_agentsInTransit) 1958 lock (m_agentsInTransit)
1936 { 1959 return m_agentsInTransit.Contains(id);
1937 if (m_agentsInTransit.Contains(id))
1938 return true;
1939 }
1940 return false;
1941 } 1960 }
1942 1961
1962 /// <summary>
1963 /// Set that an agent is no longer being teleported.
1964 /// </summary>
1965 /// <returns></returns>
1966 /// <param name='id'>
1967 /// true if the agent was flagged as being teleported when this method was called, false otherwise
1968 /// </param>
1943 protected bool ResetFromTransit(UUID id) 1969 protected bool ResetFromTransit(UUID id)
1944 { 1970 {
1945 lock (m_agentsInTransit) 1971 lock (m_agentsInTransit)
@@ -1950,6 +1976,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1950 return true; 1976 return true;
1951 } 1977 }
1952 } 1978 }
1979
1953 return false; 1980 return false;
1954 } 1981 }
1955 1982
@@ -1980,4 +2007,4 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1980 #endregion 2007 #endregion
1981 2008
1982 } 2009 }
1983} 2010} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
index 9255791..e91e8b9 100644
--- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
@@ -64,6 +64,8 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
64 private TimeSpan m_QueueTimeout = new TimeSpan(2, 0, 0); // 2 hours without llGetNextEmail drops the queue 64 private TimeSpan m_QueueTimeout = new TimeSpan(2, 0, 0); // 2 hours without llGetNextEmail drops the queue
65 private string m_InterObjectHostname = "lsl.opensim.local"; 65 private string m_InterObjectHostname = "lsl.opensim.local";
66 66
67 private int m_MaxEmailSize = 4096; // largest email allowed by default, as per lsl docs.
68
67 // Scenes by Region Handle 69 // Scenes by Region Handle
68 private Dictionary<ulong, Scene> m_Scenes = 70 private Dictionary<ulong, Scene> m_Scenes =
69 new Dictionary<ulong, Scene>(); 71 new Dictionary<ulong, Scene>();
@@ -127,6 +129,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
127 SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); 129 SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT);
128 SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); 130 SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN);
129 SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); 131 SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD);
132 m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize);
130 } 133 }
131 catch (Exception e) 134 catch (Exception e)
132 { 135 {
@@ -176,18 +179,6 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
176 get { return true; } 179 get { return true; }
177 } 180 }
178 181
179 /// <summary>
180 /// Delay function using thread in seconds
181 /// </summary>
182 /// <param name="seconds"></param>
183 private void DelayInSeconds(int delay)
184 {
185 delay = (int)((float)delay * 1000);
186 if (delay == 0)
187 return;
188 System.Threading.Thread.Sleep(delay);
189 }
190
191 private bool IsLocal(UUID objectID) 182 private bool IsLocal(UUID objectID)
192 { 183 {
193 string unused; 184 string unused;
@@ -267,10 +258,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
267 m_log.Error("[EMAIL] REGEX Problem in EMail Address: "+address); 258 m_log.Error("[EMAIL] REGEX Problem in EMail Address: "+address);
268 return; 259 return;
269 } 260 }
270 //FIXME:Check if subject + body = 4096 Byte 261 if ((subject.Length + body.Length) > m_MaxEmailSize)
271 if ((subject.Length + body.Length) > 1024)
272 { 262 {
273 m_log.Error("[EMAIL] subject + body > 1024 Byte"); 263 m_log.Error("[EMAIL] subject + body larger than limit of " + m_MaxEmailSize + " bytes");
274 return; 264 return;
275 } 265 }
276 266
@@ -345,10 +335,6 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
345 // TODO FIX 335 // TODO FIX
346 } 336 }
347 } 337 }
348
349 //DONE: Message as Second Life style
350 //20 second delay - AntiSpam System - for now only 10 seconds
351 DelayInSeconds(10);
352 } 338 }
353 339
354 /// <summary> 340 /// <summary>
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 38db239..0c4069f 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -245,6 +245,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
245 // Reload serialized prims 245 // Reload serialized prims
246 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); 246 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
247 247
248 UUID oldTelehubUUID = m_scene.RegionInfo.RegionSettings.TelehubObject;
249
248 IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>(); 250 IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>();
249 int sceneObjectsLoadedCount = 0; 251 int sceneObjectsLoadedCount = 0;
250 252
@@ -266,11 +268,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver
266 268
267 SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); 269 SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject);
268 270
271 bool isTelehub = (sceneObject.UUID == oldTelehubUUID);
272
269 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned 273 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned
270 // on the same region server and multiple examples a single object archive to be imported 274 // on the same region server and multiple examples a single object archive to be imported
271 // to the same scene (when this is possible). 275 // to the same scene (when this is possible).
272 sceneObject.ResetIDs(); 276 sceneObject.ResetIDs();
273 277
278 if (isTelehub)
279 {
280 // Change the Telehub Object to the new UUID
281 m_scene.RegionInfo.RegionSettings.TelehubObject = sceneObject.UUID;
282 m_scene.RegionInfo.RegionSettings.Save();
283 oldTelehubUUID = UUID.Zero;
284 }
285
274 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid 286 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid
275 // or creator data is present. Otherwise, use the estate owner instead. 287 // or creator data is present. Otherwise, use the estate owner instead.
276 foreach (SceneObjectPart part in sceneObject.Parts) 288 foreach (SceneObjectPart part in sceneObject.Parts)
@@ -347,7 +359,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
347 int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount; 359 int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount;
348 360
349 if (ignoredObjects > 0) 361 if (ignoredObjects > 0)
350 m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects); 362 m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects);
363
364 if (oldTelehubUUID != UUID.Zero)
365 {
366 m_log.WarnFormat("Telehub object not found: {0}", oldTelehubUUID);
367 m_scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero;
368 m_scene.RegionInfo.RegionSettings.ClearSpawnPoints();
369 }
351 } 370 }
352 371
353 /// <summary> 372 /// <summary>
@@ -523,6 +542,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
523 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; 542 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4;
524 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; 543 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun;
525 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; 544 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight;
545 currentRegionSettings.TelehubObject = loadedRegionSettings.TelehubObject;
546 currentRegionSettings.ClearSpawnPoints();
547 foreach (SpawnPoint sp in loadedRegionSettings.SpawnPoints())
548 currentRegionSettings.AddSpawnPoint(sp);
526 549
527 currentRegionSettings.Save(); 550 currentRegionSettings.Save();
528 551
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index eabe46e..5679ad5 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -328,7 +328,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
328 /// <returns></returns> 328 /// <returns></returns>
329 public string CreateControlFile(Dictionary<string, object> options) 329 public string CreateControlFile(Dictionary<string, object> options)
330 { 330 {
331 int majorVersion = MAX_MAJOR_VERSION, minorVersion = 7; 331 int majorVersion = MAX_MAJOR_VERSION, minorVersion = 8;
332// 332//
333// if (options.ContainsKey("version")) 333// if (options.ContainsKey("version"))
334// { 334// {
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 053c6f5..394ca27 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -534,6 +534,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
534 rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); 534 rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080");
535 rs.UseEstateSun = true; 535 rs.UseEstateSun = true;
536 rs.WaterHeight = 23; 536 rs.WaterHeight = 23;
537 rs.TelehubObject = UUID.Parse("00000000-0000-0000-0000-111111111111");
538 rs.AddSpawnPoint(SpawnPoint.Parse("1,-2,0.33"));
537 539
538 tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs)); 540 tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs));
539 541
@@ -580,6 +582,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
580 Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080"))); 582 Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080")));
581 Assert.That(loadedRs.UseEstateSun, Is.True); 583 Assert.That(loadedRs.UseEstateSun, Is.True);
582 Assert.That(loadedRs.WaterHeight, Is.EqualTo(23)); 584 Assert.That(loadedRs.WaterHeight, Is.EqualTo(23));
585 Assert.AreEqual(UUID.Zero, loadedRs.TelehubObject); // because no object was found with the original UUID
586 Assert.AreEqual(0, loadedRs.SpawnPoints().Count);
583 } 587 }
584 588
585 /// <summary> 589 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 89cde05..3e11db3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -591,6 +591,15 @@ namespace OpenSim.Region.Framework.Scenes
591 get { return m_sceneGraph.Entities; } 591 get { return m_sceneGraph.Entities; }
592 } 592 }
593 593
594 // can be closest/random/sequence
595 private string m_SpawnPointRouting = "closest";
596 // used in sequence see: SpawnPoint()
597 private int m_SpawnPoint;
598 public string SpawnPointRouting
599 {
600 get { return m_SpawnPointRouting; }
601 }
602
594 #endregion Properties 603 #endregion Properties
595 604
596 #region Constructors 605 #region Constructors
@@ -608,7 +617,7 @@ namespace OpenSim.Region.Framework.Scenes
608 617
609 Random random = new Random(); 618 Random random = new Random();
610 619
611 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); 620 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4);
612 m_moduleLoader = moduleLoader; 621 m_moduleLoader = moduleLoader;
613 m_authenticateHandler = authen; 622 m_authenticateHandler = authen;
614 m_sceneGridService = sceneGridService; 623 m_sceneGridService = sceneGridService;
@@ -728,6 +737,8 @@ namespace OpenSim.Region.Framework.Scenes
728 m_maxPhys = RegionInfo.PhysPrimMax; 737 m_maxPhys = RegionInfo.PhysPrimMax;
729 } 738 }
730 739
740 m_SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
741
731 // Here, if clamping is requested in either global or 742 // Here, if clamping is requested in either global or
732 // local config, it will be used 743 // local config, it will be used
733 // 744 //
@@ -2684,10 +2695,10 @@ namespace OpenSim.Region.Framework.Scenes
2684 { 2695 {
2685 SceneObjectGroup grp = sceneObject; 2696 SceneObjectGroup grp = sceneObject;
2686 2697
2687 m_log.DebugFormat( 2698// m_log.DebugFormat(
2688 "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); 2699// "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID);
2689 m_log.DebugFormat( 2700// m_log.DebugFormat(
2690 "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); 2701// "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
2691 2702
2692 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2703 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2693 2704
@@ -3554,7 +3565,7 @@ namespace OpenSim.Region.Framework.Scenes
3554 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) 3565 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup)
3555 { 3566 {
3556 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || 3567 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 ||
3557 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); 3568 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0);
3558 bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); 3569 bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0);
3559 bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); 3570 bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0);
3560 3571
@@ -3570,8 +3581,17 @@ namespace OpenSim.Region.Framework.Scenes
3570 // Don't disable this log message - it's too helpful 3581 // Don't disable this log message - it's too helpful
3571 m_log.DebugFormat( 3582 m_log.DebugFormat(
3572 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", 3583 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})",
3573 RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname, 3584 RegionInfo.RegionName,
3574 agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, ((TPFlags)teleportFlags).ToString(), agent.startpos); 3585 (agent.child ? "child" : "root"),
3586 agent.firstname,
3587 agent.lastname,
3588 agent.AgentID,
3589 agent.circuitcode,
3590 agent.IPAddress,
3591 agent.Viewer,
3592 ((TPFlags)teleportFlags).ToString(),
3593 agent.startpos
3594 );
3575 3595
3576 if (LoginsDisabled) 3596 if (LoginsDisabled)
3577 { 3597 {
@@ -3586,7 +3606,11 @@ namespace OpenSim.Region.Framework.Scenes
3586 // We have a zombie from a crashed session. 3606 // We have a zombie from a crashed session.
3587 // Or the same user is trying to be root twice here, won't work. 3607 // Or the same user is trying to be root twice here, won't work.
3588 // Kill it. 3608 // Kill it.
3589 m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); 3609 m_log.DebugFormat(
3610 "[SCENE]: Zombie scene presence detected for {0} in {1}",
3611 agent.AgentID,
3612 RegionInfo.RegionName
3613 );
3590 sp.ControllingClient.Close(); 3614 sp.ControllingClient.Close();
3591 sp = null; 3615 sp = null;
3592 } 3616 }
@@ -3613,8 +3637,7 @@ namespace OpenSim.Region.Framework.Scenes
3613 { 3637 {
3614 if (!VerifyUserPresence(agent, out reason)) 3638 if (!VerifyUserPresence(agent, out reason))
3615 return false; 3639 return false;
3616 } 3640 } catch (Exception e)
3617 catch (Exception e)
3618 { 3641 {
3619 m_log.ErrorFormat( 3642 m_log.ErrorFormat(
3620 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); 3643 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace);
@@ -3649,8 +3672,7 @@ namespace OpenSim.Region.Framework.Scenes
3649 CapsModule.SetAgentCapsSeeds(agent); 3672 CapsModule.SetAgentCapsSeeds(agent);
3650 CapsModule.CreateCaps(agent.AgentID); 3673 CapsModule.CreateCaps(agent.AgentID);
3651 } 3674 }
3652 } 3675 } else
3653 else
3654 { 3676 {
3655 // Let the SP know how we got here. This has a lot of interesting 3677 // Let the SP know how we got here. This has a lot of interesting
3656 // uses down the line. 3678 // uses down the line.
@@ -3673,7 +3695,7 @@ namespace OpenSim.Region.Framework.Scenes
3673 agent.teleportFlags = teleportFlags; 3695 agent.teleportFlags = teleportFlags;
3674 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3696 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
3675 3697
3676 if (vialogin) 3698 if (vialogin)
3677 { 3699 {
3678// CleanDroppedAttachments(); 3700// CleanDroppedAttachments();
3679 3701
@@ -3714,8 +3736,7 @@ namespace OpenSim.Region.Framework.Scenes
3714 agent.startpos.Z = 720; 3736 agent.startpos.Z = 720;
3715 } 3737 }
3716 } 3738 }
3717 } 3739 } else
3718 else
3719 { 3740 {
3720 if (agent.startpos.X > EastBorders[0].BorderLine.Z) 3741 if (agent.startpos.X > EastBorders[0].BorderLine.Z)
3721 { 3742 {
@@ -3741,10 +3762,19 @@ namespace OpenSim.Region.Framework.Scenes
3741 SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); 3762 SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject);
3742 // Can have multiple SpawnPoints 3763 // Can have multiple SpawnPoints
3743 List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); 3764 List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints();
3744 if ( spawnpoints.Count > 1) 3765 if (spawnpoints.Count > 1)
3745 { 3766 {
3746 // We have multiple SpawnPoints, Route the agent to a random one 3767 // We have multiple SpawnPoints, Route the agent to a random or sequential one
3747 agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); 3768 if (SpawnPointRouting == "random")
3769 agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation(
3770 telehub.AbsolutePosition,
3771 telehub.GroupRotation
3772 );
3773 else
3774 agent.startpos = spawnpoints[SpawnPoint()].GetLocation(
3775 telehub.AbsolutePosition,
3776 telehub.GroupRotation
3777 );
3748 } 3778 }
3749 else 3779 else
3750 { 3780 {
@@ -5640,5 +5670,19 @@ Environment.Exit(1);
5640 } 5670 }
5641 } 5671 }
5642 } 5672 }
5673
5674 // manage and select spawn points in sequence
5675 public int SpawnPoint()
5676 {
5677 int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count;
5678
5679 if (spawnpoints == 0)
5680 return 0;
5681
5682 m_SpawnPoint++;
5683 if (m_SpawnPoint > spawnpoints)
5684 m_SpawnPoint = 1;
5685 return m_SpawnPoint - 1;
5686 }
5643 } 5687 }
5644} 5688}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1a8caae..34362bf 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -4134,28 +4134,93 @@ namespace OpenSim.Region.Framework.Scenes
4134 if (spawnPoints.Length == 0) 4134 if (spawnPoints.Length == 0)
4135 return; 4135 return;
4136 4136
4137 float distance = 9999; 4137 int index;
4138 int closest = -1; 4138 bool selected = false;
4139 4139
4140 for (int i = 0 ; i < spawnPoints.Length ; i++) 4140 switch (m_scene.SpawnPointRouting)
4141 { 4141 {
4142 Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); 4142 case "closest":
4143 Vector3 offset = spawnPosition - pos;
4144 float d = Vector3.Mag(offset);
4145 if (d >= distance)
4146 continue;
4147 ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
4148 if (land == null)
4149 continue;
4150 if (land.IsEitherBannedOrRestricted(UUID))
4151 continue;
4152 distance = d;
4153 closest = i;
4154 }
4155 if (closest == -1)
4156 return;
4157 4143
4158 pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); 4144 float distance = 9999;
4145 int closest = -1;
4146
4147 for (int i = 0; i < spawnPoints.Length; i++)
4148 {
4149 Vector3 spawnPosition = spawnPoints[i].GetLocation(
4150 telehub.AbsolutePosition,
4151 telehub.GroupRotation
4152 );
4153 Vector3 offset = spawnPosition - pos;
4154 float d = Vector3.Mag(offset);
4155 if (d >= distance)
4156 continue;
4157 ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
4158 if (land == null)
4159 continue;
4160 if (land.IsEitherBannedOrRestricted(UUID))
4161 continue;
4162 distance = d;
4163 closest = i;
4164 }
4165 if (closest == -1)
4166 return;
4167
4168 pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
4169 return;
4170
4171 case "random":
4172
4173 do
4174 {
4175 index = Util.RandomClass.Next(spawnPoints.Length - 1);
4176
4177 Vector3 spawnPosition = spawnPoints[index].GetLocation(
4178 telehub.AbsolutePosition,
4179 telehub.GroupRotation
4180 );
4181 // SpawnPoint sp = spawnPoints[index];
4182
4183 ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
4184 if (land == null || land.IsEitherBannedOrRestricted(UUID))
4185 selected = false;
4186 else
4187 selected = true;
4188
4189 } while ( selected == false);
4190
4191 pos = spawnPoints[index].GetLocation(
4192 telehub.AbsolutePosition,
4193 telehub.GroupRotation
4194 );
4195 return;
4196
4197 case "sequence":
4198
4199 do
4200 {
4201 index = m_scene.SpawnPoint();
4202
4203 Vector3 spawnPosition = spawnPoints[index].GetLocation(
4204 telehub.AbsolutePosition,
4205 telehub.GroupRotation
4206 );
4207 // SpawnPoint sp = spawnPoints[index];
4208
4209 ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
4210 if (land == null || land.IsEitherBannedOrRestricted(UUID))
4211 selected = false;
4212 else
4213 selected = true;
4214
4215 } while (selected == false);
4216
4217 pos = spawnPoints[index].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
4218 ;
4219 return;
4220
4221 default:
4222 return;
4223 }
4159 } 4224 }
4160 } 4225 }
4161 } 4226 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 5bd781c..8c4ee41 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -111,6 +111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
111 protected IUrlModule m_UrlModule = null; 111 protected IUrlModule m_UrlModule = null;
112 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = 112 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache =
113 new Dictionary<UUID, UserInfoCacheEntry>(); 113 new Dictionary<UUID, UserInfoCacheEntry>();
114 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
114 115
115 protected Timer m_ShoutSayTimer; 116 protected Timer m_ShoutSayTimer;
116 protected int m_SayShoutCount = 0; 117 protected int m_SayShoutCount = 0;
@@ -127,6 +128,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
127 m_item = item; 128 m_item = item;
128 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); 129 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
129 130
131 LoadLimits(); // read script limits from config.
132
133 m_TransferModule =
134 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
135 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
136
137 AsyncCommands = new AsyncCommandManager(ScriptEngine);
138 }
139
140 /* load configuration items that affect script, object and run-time behavior. */
141 private void LoadLimits()
142 {
130 m_ScriptDelayFactor = 143 m_ScriptDelayFactor =
131 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); 144 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
132 m_ScriptDistanceFactor = 145 m_ScriptDistanceFactor =
@@ -139,12 +152,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
139 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); 152 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
140 if (m_notecardLineReadCharsMax > 65535) 153 if (m_notecardLineReadCharsMax > 65535)
141 m_notecardLineReadCharsMax = 65535; 154 m_notecardLineReadCharsMax = 65535;
142 155 // load limits for particular subsystems.
143 m_TransferModule = 156 IConfig SMTPConfig;
144 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); 157 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) {
145 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); 158 // there's an smtp config, so load in the snooze time.
146 159 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
147 AsyncCommands = new AsyncCommandManager(ScriptEngine); 160 }
148 } 161 }
149 162
150 public override Object InitializeLifetimeService() 163 public override Object InitializeLifetimeService()
@@ -3127,6 +3140,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3127 3140
3128 public virtual void llSleep(double sec) 3141 public virtual void llSleep(double sec)
3129 { 3142 {
3143// m_log.Info("llSleep snoozing " + sec + "s.");
3130 m_host.AddScriptLPS(1); 3144 m_host.AddScriptLPS(1);
3131 Thread.Sleep((int)(sec * 1000)); 3145 Thread.Sleep((int)(sec * 1000));
3132 } 3146 }
@@ -3413,7 +3427,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3413 } 3427 }
3414 3428
3415 emailModule.SendEmail(m_host.UUID, address, subject, message); 3429 emailModule.SendEmail(m_host.UUID, address, subject, message);
3416 ScriptSleep(15000); 3430 ScriptSleep(EMAIL_PAUSE_TIME * 1000);
3417 } 3431 }
3418 3432
3419 public void llGetNextEmail(string address, string subject) 3433 public void llGetNextEmail(string address, string subject)