aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/MySQL/MySQLEstateData.cs1
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs79
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations17
-rw-r--r--OpenSim/Framework/IClientAPI.cs5
-rw-r--r--OpenSim/Framework/RegionSettings.cs86
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs51
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs84
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs95
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs53
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs6
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs5
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs5
-rw-r--r--TESTING.txt3
13 files changed, 481 insertions, 9 deletions
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index 3d647ca..3dd46cb 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -210,7 +210,6 @@ namespace OpenSim.Data.MySQL
210 } 210 }
211 211
212 LoadBanList(es); 212 LoadBanList(es);
213
214 es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); 213 es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
215 es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); 214 es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
216 es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); 215 es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 6d14b82..31d17f1 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -846,6 +846,8 @@ namespace OpenSim.Data.MySQL
846 } 846 }
847 } 847 }
848 848
849 LoadSpawnPoints(rs);
850
849 return rs; 851 return rs;
850 } 852 }
851 853
@@ -994,7 +996,9 @@ namespace OpenSim.Data.MySQL
994 "use_estate_sun, fixed_sun, sun_position, " + 996 "use_estate_sun, fixed_sun, sun_position, " +
995 "covenant, Sandbox, sunvectorx, sunvectory, " + 997 "covenant, Sandbox, sunvectorx, sunvectory, " +
996 "sunvectorz, loaded_creation_datetime, " + 998 "sunvectorz, loaded_creation_datetime, " +
997 "loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " + 999 "loaded_creation_id, map_tile_ID, " +
1000 "TelehubObject) " +
1001 "values (?RegionUUID, ?BlockTerraform, " +
998 "?BlockFly, ?AllowDamage, ?RestrictPushing, " + 1002 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
999 "?AllowLandResell, ?AllowLandJoinDivide, " + 1003 "?AllowLandResell, ?AllowLandJoinDivide, " +
1000 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + 1004 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
@@ -1009,7 +1013,7 @@ namespace OpenSim.Data.MySQL
1009 "?SunPosition, ?Covenant, ?Sandbox, " + 1013 "?SunPosition, ?Covenant, ?Sandbox, " +
1010 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + 1014 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1011 "?LoadedCreationDateTime, ?LoadedCreationID, " + 1015 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1012 "?TerrainImageID)"; 1016 "?TerrainImageID, ?TelehubObject) ";
1013 1017
1014 FillRegionSettingsCommand(cmd, rs); 1018 FillRegionSettingsCommand(cmd, rs);
1015 1019
@@ -1017,6 +1021,7 @@ namespace OpenSim.Data.MySQL
1017 } 1021 }
1018 } 1022 }
1019 } 1023 }
1024 SaveSpawnPoints(rs);
1020 } 1025 }
1021 1026
1022 public List<LandData> LoadLandObjects(UUID regionUUID) 1027 public List<LandData> LoadLandObjects(UUID regionUUID)
@@ -1296,6 +1301,7 @@ namespace OpenSim.Data.MySQL
1296 newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; 1301 newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
1297 1302
1298 newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); 1303 newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]);
1304 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]);
1299 1305
1300 return newSettings; 1306 return newSettings;
1301 } 1307 }
@@ -1626,7 +1632,7 @@ namespace OpenSim.Data.MySQL
1626 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); 1632 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
1627 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); 1633 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
1628 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); 1634 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
1629 1635 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
1630 } 1636 }
1631 1637
1632 /// <summary> 1638 /// <summary>
@@ -1828,5 +1834,72 @@ namespace OpenSim.Data.MySQL
1828 } 1834 }
1829 } 1835 }
1830 } 1836 }
1837
1838 private void LoadSpawnPoints(RegionSettings rs)
1839 {
1840 rs.ClearSpawnPoints();
1841
1842 lock (m_dbLock)
1843 {
1844 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1845 {
1846 dbcon.Open();
1847
1848 using (MySqlCommand cmd = dbcon.CreateCommand())
1849 {
1850 cmd.CommandText = "select Yaw, Pitch, Distance from spawn_points where RegionID = ?RegionID";
1851 cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
1852
1853 using (IDataReader r = cmd.ExecuteReader())
1854 {
1855 while (r.Read())
1856 {
1857 SpawnPoint sp = new SpawnPoint();
1858
1859 sp.Yaw = (float)r["Yaw"];
1860 sp.Pitch = (float)r["Pitch"];
1861 sp.Distance = (float)r["Distance"];
1862
1863 rs.AddSpawnPoint(sp);
1864 }
1865 }
1866 }
1867 }
1868 }
1869 }
1870
1871 private void SaveSpawnPoints(RegionSettings rs)
1872 {
1873 lock (m_dbLock)
1874 {
1875 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1876 {
1877 dbcon.Open();
1878
1879 using (MySqlCommand cmd = dbcon.CreateCommand())
1880 {
1881 cmd.CommandText = "delete from spawn_points where RegionID = ?RegionID";
1882 cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
1883
1884 cmd.ExecuteNonQuery();
1885
1886 cmd.Parameters.Clear();
1887
1888 cmd.CommandText = "insert into spawn_points (RegionID, Yaw, Pitch, Distance) values ( ?RegionID, ?Yaw, ?Pitch, ?Distance)";
1889
1890 foreach (SpawnPoint p in rs.SpawnPoints())
1891 {
1892 cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
1893 cmd.Parameters.AddWithValue("?Yaw", p.Yaw);
1894 cmd.Parameters.AddWithValue("?Pitch", p.Pitch);
1895 cmd.Parameters.AddWithValue("?Distance", p.Distance);
1896
1897 cmd.ExecuteNonQuery();
1898 cmd.Parameters.Clear();
1899 }
1900 }
1901 }
1902 }
1903 }
1831 } 1904 }
1832} 1905}
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index 987625b..720e200 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -841,4 +841,19 @@ alter table regionban ENGINE = MyISAM;
841alter table regionsettings ENGINE = MyISAM; 841alter table regionsettings ENGINE = MyISAM;
842alter table terrain ENGINE = MyISAM; 842alter table terrain ENGINE = MyISAM;
843 843
844COMMIT; \ No newline at end of file 844COMMIT;
845
846:VERSION 39 #--------------- Telehub support
847
848BEGIN;
849CREATE TABLE IF NOT EXISTS `spawn_points` (
850 `RegionID` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
851 `Yaw` float NOT NULL,
852 `Pitch` float NOT NULL,
853 `Distance` float NOT NULL,
854 KEY `RegionID` (`RegionID`)
855) ENGINE=Innodb;
856
857ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL;
858COMMIT;
859
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 29a69c3..1326fe9 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -358,6 +358,8 @@ namespace OpenSim.Framework
358 358
359 public delegate void EstateChangeInfo(IClientAPI client, UUID invoice, UUID senderID, UInt32 param1, UInt32 param2); 359 public delegate void EstateChangeInfo(IClientAPI client, UUID invoice, UUID senderID, UInt32 param1, UInt32 param2);
360 360
361 public delegate void EstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, UInt32 param1);
362
361 public delegate void RequestTerrain(IClientAPI remoteClient, string clientFileName); 363 public delegate void RequestTerrain(IClientAPI remoteClient, string clientFileName);
362 364
363 public delegate void BakeTerrain(IClientAPI remoteClient); 365 public delegate void BakeTerrain(IClientAPI remoteClient);
@@ -769,6 +771,7 @@ namespace OpenSim.Framework
769 event ModifyTerrain OnModifyTerrain; 771 event ModifyTerrain OnModifyTerrain;
770 event BakeTerrain OnBakeTerrain; 772 event BakeTerrain OnBakeTerrain;
771 event EstateChangeInfo OnEstateChangeInfo; 773 event EstateChangeInfo OnEstateChangeInfo;
774 event EstateManageTelehub OnEstateManageTelehub;
772 // [Obsolete("LLClientView Specific.")] 775 // [Obsolete("LLClientView Specific.")]
773 event SetAppearance OnSetAppearance; 776 event SetAppearance OnSetAppearance;
774 // [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")] 777 // [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")]
@@ -1141,6 +1144,8 @@ namespace OpenSim.Framework
1141 1144
1142 void SendTaskInventory(UUID taskID, short serial, byte[] fileName); 1145 void SendTaskInventory(UUID taskID, short serial, byte[] fileName);
1143 1146
1147 void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint);
1148
1144 /// <summary> 1149 /// <summary>
1145 /// Used by the server to inform the client of new inventory items and folders. 1150 /// Used by the server to inform the client of new inventory items and folders.
1146 /// </summary> 1151 /// </summary>
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs
index 673cf20..e115432 100644
--- a/OpenSim/Framework/RegionSettings.cs
+++ b/OpenSim/Framework/RegionSettings.cs
@@ -26,11 +26,53 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.IO; 30using System.IO;
30using OpenMetaverse; 31using OpenMetaverse;
31 32
32namespace OpenSim.Framework 33namespace OpenSim.Framework
33{ 34{
35 public struct SpawnPoint
36 {
37 public float Yaw;
38 public float Pitch;
39 public float Distance;
40
41 public void SetLocation(Vector3 pos, Quaternion rot, Vector3 point)
42 {
43 // The point is an absolute position, so we need the relative
44 // location to the spawn point
45 Vector3 offset = point - pos;
46 Distance = Vector3.Mag(offset);
47
48 // Next we need to rotate this vector into the spawn point's
49 // coordinate system
50 rot.W = -rot.W;
51 offset = offset * rot;
52
53 Vector3 dir = Vector3.Normalize(offset);
54
55 // Get the bearing (yaw)
56 Yaw = (float)Math.Atan2(dir.Y, dir.X);
57
58 // Get the elevation (pitch)
59 Pitch = (float)-Math.Atan2(dir.Z, Math.Sqrt(dir.X * dir.X + dir.Y * dir.Y));
60 }
61
62 public Vector3 GetLocation(Vector3 pos, Quaternion rot)
63 {
64 Quaternion y = Quaternion.CreateFromEulers(0, 0, Yaw);
65 Quaternion p = Quaternion.CreateFromEulers(0, Pitch, 0);
66
67 Vector3 dir = new Vector3(1, 0, 0) * p * y;
68 Vector3 offset = dir * (float)Distance;
69
70 offset *= rot;
71
72 return pos + offset;
73 }
74 }
75
34 public class RegionSettings 76 public class RegionSettings
35 { 77 {
36 public delegate void SaveDelegate(RegionSettings rs); 78 public delegate void SaveDelegate(RegionSettings rs);
@@ -397,5 +439,49 @@ namespace OpenSim.Framework
397 set { m_LoadedCreationID = value; } 439 set { m_LoadedCreationID = value; }
398 } 440 }
399 441
442 // Connected Telehub object
443 private UUID m_TelehubObject;
444 public UUID TelehubObject
445 {
446 get
447 {
448 return m_TelehubObject;
449 }
450 set
451 {
452 m_TelehubObject = value;
453 }
454 }
455
456 // Our Connected Telehub's SpawnPoints
457 public List<SpawnPoint> l_SpawnPoints = new List<SpawnPoint>();
458
459 // Add a SpawnPoint
460 // ** These are not region coordinates **
461 // They are relative to the Telehub coordinates
462 //
463 public void AddSpawnPoint(SpawnPoint point)
464 {
465 l_SpawnPoints.Add(point);
466 }
467
468 // Remove a SpawnPoint
469 public void RemoveSpawnPoint(int point_index)
470 {
471 l_SpawnPoints.RemoveAt(point_index);
472 }
473
474 // Return the List of SpawnPoints
475 public List<SpawnPoint> SpawnPoints()
476 {
477 return l_SpawnPoints;
478
479 }
480
481 // Clear the SpawnPoints List of all entries
482 public void ClearSpawnPoints()
483 {
484 l_SpawnPoints.Clear();
485 }
400 } 486 }
401} 487}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 4ba441e..29ad966 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -219,6 +219,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
219 public event BakeTerrain OnBakeTerrain; 219 public event BakeTerrain OnBakeTerrain;
220 public event RequestTerrain OnUploadTerrain; 220 public event RequestTerrain OnUploadTerrain;
221 public event EstateChangeInfo OnEstateChangeInfo; 221 public event EstateChangeInfo OnEstateChangeInfo;
222 public event EstateManageTelehub OnEstateManageTelehub;
222 public event EstateRestartSimRequest OnEstateRestartSimRequest; 223 public event EstateRestartSimRequest OnEstateRestartSimRequest;
223 public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; 224 public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
224 public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; 225 public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
@@ -4482,6 +4483,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4482 OutPacket(packet, ThrottleOutPacketType.Task); 4483 OutPacket(packet, ThrottleOutPacketType.Task);
4483 } 4484 }
4484 4485
4486 public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
4487 {
4488 TelehubInfoPacket packet = (TelehubInfoPacket)PacketPool.Instance.GetPacket(PacketType.TelehubInfo);
4489 packet.TelehubBlock.ObjectID = ObjectID;
4490 packet.TelehubBlock.ObjectName = Utils.StringToBytes(ObjectName);
4491 packet.TelehubBlock.TelehubPos = ObjectPos;
4492 packet.TelehubBlock.TelehubRot = ObjectRot;
4493
4494 packet.SpawnPointBlock = new TelehubInfoPacket.SpawnPointBlockBlock[SpawnPoint.Count];
4495 for (int n = 0; n < SpawnPoint.Count; n++)
4496 {
4497 packet.SpawnPointBlock[n] = new TelehubInfoPacket.SpawnPointBlockBlock{SpawnPointPos = SpawnPoint[n]};
4498 }
4499
4500 OutPacket(packet, ThrottleOutPacketType.Task);
4501 }
4502
4485 #endregion 4503 #endregion
4486 4504
4487 #region Land Data Sending Methods 4505 #region Land Data Sending Methods
@@ -8920,7 +8938,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8920 private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack) 8938 private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack)
8921 { 8939 {
8922 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; 8940 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
8923 //m_log.Debug(messagePacket.ToString()); 8941 // m_log.InfoFormat("[LLCLIENTVIEW]: Packet: {0}", Utils.BytesToString(messagePacket.MethodData.Method));
8924 GodLandStatRequest handlerLandStatRequest; 8942 GodLandStatRequest handlerLandStatRequest;
8925 8943
8926 #region Packet Session and User Check 8944 #region Packet Session and User Check
@@ -9219,6 +9237,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9219 } 9237 }
9220 return true; 9238 return true;
9221 9239
9240 case "telehub":
9241 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
9242 {
9243 UUID invoice = messagePacket.MethodData.Invoice;
9244 UUID SenderID = messagePacket.AgentData.AgentID;
9245 UInt32 param1 = 0u;
9246
9247 string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter);
9248
9249 if (command != "info ui")
9250 {
9251 try
9252 {
9253 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
9254 }
9255 catch (Exception ex)
9256 {
9257
9258 }
9259 }
9260
9261 EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub;
9262 if (handlerEstateManageTelehub != null)
9263 {
9264 handlerEstateManageTelehub(this, invoice, SenderID, command, param1);
9265 }
9266 }
9267 return true;
9268
9222 default: 9269 default:
9223 m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket); 9270 m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket);
9224 return true; 9271 return true;
@@ -9230,8 +9277,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9230 //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts 9277 //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts
9231 //lsrp.RequestData.RequestFlags; 9278 //lsrp.RequestData.RequestFlags;
9232 //lsrp.RequestData.Filter; 9279 //lsrp.RequestData.Filter;
9233
9234// return true;
9235 } 9280 }
9236 9281
9237 private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) 9282 private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack)
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 58d9455..2e1487f 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
53 protected EstateManagementCommands m_commands; 53 protected EstateManagementCommands m_commands;
54 54
55 private EstateTerrainXferHandler TerrainUploader; 55 private EstateTerrainXferHandler TerrainUploader;
56 public TelehubManager m_Telehub;
56 57
57 public event ChangeDelegate OnRegionInfoChange; 58 public event ChangeDelegate OnRegionInfoChange;
58 public event ChangeDelegate OnEstateInfoChange; 59 public event ChangeDelegate OnEstateInfoChange;
@@ -599,6 +600,50 @@ namespace OpenSim.Region.CoreModules.World.Estate
599 } 600 }
600 } 601 }
601 602
603 public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)
604 {
605 uint ObjectLocalID;
606 SceneObjectPart part;
607
608 switch (cmd)
609 {
610 case "info ui":
611 break;
612
613 case "connect":
614 // Add the Telehub
615 part = Scene.GetSceneObjectPart((uint)param1);
616 if (part == null)
617 return;
618 SceneObjectGroup grp = part.ParentGroup;
619
620 m_Telehub.Connect(grp);
621 break;
622
623 case "delete":
624 // Disconnect Telehub
625 m_Telehub.Disconnect();
626 break;
627
628 case "spawnpoint add":
629 // Add SpawnPoint to the Telehub
630 part = Scene.GetSceneObjectPart((uint)param1);
631 if (part == null)
632 return;
633 m_Telehub.AddSpawnPoint(part.AbsolutePosition);
634 break;
635
636 case "spawnpoint remove":
637 // Remove SpawnPoint from Telehub
638 m_Telehub.RemoveSpawnPoint((int)param1);
639 break;
640
641 default:
642 break;
643 }
644 SendTelehubInfo(client);
645 }
646
602 private void SendSimulatorBlueBoxMessage( 647 private void SendSimulatorBlueBoxMessage(
603 IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) 648 IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message)
604 { 649 {
@@ -1055,7 +1100,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
1055 Scene.RegisterModuleInterface<IEstateModule>(this); 1100 Scene.RegisterModuleInterface<IEstateModule>(this);
1056 Scene.EventManager.OnNewClient += EventManager_OnNewClient; 1101 Scene.EventManager.OnNewClient += EventManager_OnNewClient;
1057 Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; 1102 Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
1058 1103
1104 m_Telehub = new TelehubManager(scene);
1105
1059 m_commands = new EstateManagementCommands(this); 1106 m_commands = new EstateManagementCommands(this);
1060 m_commands.Initialise(); 1107 m_commands.Initialise();
1061 } 1108 }
@@ -1109,6 +1156,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
1109 client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; 1156 client.OnEstateRestartSimRequest += handleEstateRestartSimRequest;
1110 client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; 1157 client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest;
1111 client.OnEstateChangeInfo += handleEstateChangeInfo; 1158 client.OnEstateChangeInfo += handleEstateChangeInfo;
1159 client.OnEstateManageTelehub += handleOnEstateManageTelehub;
1112 client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; 1160 client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest;
1113 client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; 1161 client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
1114 client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; 1162 client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;
@@ -1243,5 +1291,39 @@ namespace OpenSim.Region.CoreModules.World.Estate
1243 if (onmessage != null) 1291 if (onmessage != null)
1244 onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message); 1292 onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message);
1245 } 1293 }
1294
1295
1296 private void SendTelehubInfo(IClientAPI client)
1297 {
1298 RegionSettings settings =
1299 this.Scene.RegionInfo.RegionSettings;
1300
1301 SceneObjectGroup telehub = null;
1302 if (settings.TelehubObject != UUID.Zero &&
1303 (telehub = Scene.GetSceneObjectGroup(settings.TelehubObject)) != null)
1304 {
1305 List<Vector3> spawnPoints = new List<Vector3>();
1306
1307 foreach (SpawnPoint sp in settings.SpawnPoints())
1308 {
1309 spawnPoints.Add(sp.GetLocation(Vector3.Zero, Quaternion.Identity));
1310 }
1311
1312 client.SendTelehubInfo(settings.TelehubObject,
1313 telehub.Name,
1314 telehub.AbsolutePosition,
1315 telehub.GroupRotation,
1316 spawnPoints);
1317 }
1318 else
1319 {
1320 client.SendTelehubInfo(UUID.Zero,
1321 String.Empty,
1322 Vector3.Zero,
1323 Quaternion.Identity,
1324 new List<Vector3>());
1325 }
1326 }
1246 } 1327 }
1247} 1328}
1329
diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
new file mode 100644
index 0000000..8bc831f
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
@@ -0,0 +1,95 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using OpenMetaverse;
31using System.Collections.Generic;
32using OpenSim.Framework;
33using OpenSim.Region.Framework.Scenes;
34using log4net;
35
36namespace OpenSim.Region.CoreModules.World.Estate
37{
38 public class TelehubManager
39 {
40 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41
42 Scene m_Scene;
43
44 public TelehubManager(Scene scene)
45 {
46 m_Scene = scene;
47 }
48
49 // Connect the Telehub
50 public void Connect(SceneObjectGroup grp)
51 {
52 m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
53
54 m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID;
55 m_Scene.RegionInfo.RegionSettings.Save();
56 }
57
58 // Disconnect the Telehub:
59 public void Disconnect()
60 {
61 if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
62 return;
63
64 m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero;
65 m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
66 m_Scene.RegionInfo.RegionSettings.Save();
67 }
68
69 // Add a SpawnPoint to the Telehub
70 public void AddSpawnPoint(Vector3 point)
71 {
72 if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
73 return;
74
75 SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject);
76 if (grp == null)
77 return;
78
79 SpawnPoint sp = new SpawnPoint();
80 sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point);
81 m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp);
82 m_Scene.RegionInfo.RegionSettings.Save();
83 }
84
85 // Remove a SpawnPoint from the Telehub
86 public void RemoveSpawnPoint(int spawnpoint)
87 {
88 if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
89 return;
90
91 m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint);
92 m_Scene.RegionInfo.RegionSettings.Save();
93 }
94 }
95}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index c66f30e..5c56150 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3835,8 +3835,61 @@ namespace OpenSim.Region.Framework.Scenes
3835 } 3835 }
3836 } 3836 }
3837 3837
3838 private void CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos)
3839 {
3840 if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) ==
3841 (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) ||
3842 (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 ||
3843 (m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
3844 (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)
3845 {
3846 if (GodLevel < 200 &&
3847 ((!m_scene.Permissions.IsGod(m_uuid) &&
3848 !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) ||
3849 (m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
3850 (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
3851 {
3852 SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray();
3853 if (spawnPoints.Length == 0)
3854 return;
3855
3856 float distance = 9999;
3857 int closest = -1;
3858
3859 for (int i = 0 ; i < spawnPoints.Length ; i++)
3860 {
3861 Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
3862 Vector3 offset = spawnPosition - pos;
3863 float d = Vector3.Mag(offset);
3864 if (d >= distance)
3865 continue;
3866 ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
3867 if (land == null)
3868 continue;
3869 if (land.IsEitherBannedOrRestricted(UUID))
3870 continue;
3871 distance = d;
3872 closest = i;
3873 }
3874 if (closest == -1)
3875 return;
3876
3877 pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
3878 }
3879 }
3880 }
3881
3838 private void CheckAndAdjustLandingPoint(ref Vector3 pos) 3882 private void CheckAndAdjustLandingPoint(ref Vector3 pos)
3839 { 3883 {
3884 SceneObjectGroup telehub = null;
3885 if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null)
3886 {
3887 if (!m_scene.RegionInfo.EstateSettings.AllowDirectTeleport)
3888 {
3889 CheckAndAdjustTelehub(telehub, ref pos);
3890 return;
3891 }
3892 }
3840 3893
3841 ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); 3894 ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
3842 if (land != null) 3895 if (land != null)
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 32de85f..bbf3729 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -658,6 +658,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
658 public event ModifyTerrain OnModifyTerrain; 658 public event ModifyTerrain OnModifyTerrain;
659 public event BakeTerrain OnBakeTerrain; 659 public event BakeTerrain OnBakeTerrain;
660 public event EstateChangeInfo OnEstateChangeInfo; 660 public event EstateChangeInfo OnEstateChangeInfo;
661 public event EstateManageTelehub OnEstateManageTelehub;
661 public event SetAppearance OnSetAppearance; 662 public event SetAppearance OnSetAppearance;
662 public event AvatarNowWearing OnAvatarNowWearing; 663 public event AvatarNowWearing OnAvatarNowWearing;
663 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; 664 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
@@ -1530,6 +1531,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1530 1531
1531 } 1532 }
1532 1533
1534 public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
1535 {
1536
1537 }
1538
1533 public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) 1539 public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
1534 { 1540 {
1535 1541
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 5f4f937..6a6c4c3 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -32,6 +32,7 @@ using OpenMetaverse;
32using OpenMetaverse.Packets; 32using OpenMetaverse.Packets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Region.CoreModules.World.Estate;
35 36
36namespace OpenSim.Region.OptionalModules.World.NPC 37namespace OpenSim.Region.OptionalModules.World.NPC
37{ 38{
@@ -334,6 +335,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
334 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; 335 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
335 public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest; 336 public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
336 public event EstateChangeInfo OnEstateChangeInfo; 337 public event EstateChangeInfo OnEstateChangeInfo;
338 public event EstateManageTelehub OnEstateManageTelehub;
337 public event ScriptReset OnScriptReset; 339 public event ScriptReset OnScriptReset;
338 public event GetScriptRunning OnGetScriptRunning; 340 public event GetScriptRunning OnGetScriptRunning;
339 public event SetScriptRunning OnSetScriptRunning; 341 public event SetScriptRunning OnSetScriptRunning;
@@ -923,6 +925,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
923 public void SendEstateCovenantInformation(UUID covenant) 925 public void SendEstateCovenantInformation(UUID covenant)
924 { 926 {
925 } 927 }
928 public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
929 {
930 }
926 public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) 931 public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
927 { 932 {
928 } 933 }
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index fad757a..ab89fe0 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -194,6 +194,7 @@ namespace OpenSim.Tests.Common.Mock
194 public event RegionInfoRequest OnRegionInfoRequest; 194 public event RegionInfoRequest OnRegionInfoRequest;
195 public event EstateCovenantRequest OnEstateCovenantRequest; 195 public event EstateCovenantRequest OnEstateCovenantRequest;
196 public event EstateChangeInfo OnEstateChangeInfo; 196 public event EstateChangeInfo OnEstateChangeInfo;
197 public event EstateManageTelehub OnEstateManageTelehub;
197 198
198 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; 199 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
199 200
@@ -951,6 +952,10 @@ namespace OpenSim.Tests.Common.Mock
951 { 952 {
952 } 953 }
953 954
955 public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
956 {
957 }
958
954 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) 959 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
955 { 960 {
956 } 961 }
diff --git a/TESTING.txt b/TESTING.txt
index 54fc976..08a0698 100644
--- a/TESTING.txt
+++ b/TESTING.txt
@@ -69,3 +69,6 @@ Example
69 69
70nunit-console2 OpenSim.Framework.Tests.dll (on linux) 70nunit-console2 OpenSim.Framework.Tests.dll (on linux)
71nunit-console OpenSim.Framework.Tests.dll (on windows) 71nunit-console OpenSim.Framework.Tests.dll (on windows)
72
73See the file OpenSim/Data/Tests/Resources/TestDataConnections.ini
74for information to setup testing for data