diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 1 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 70 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/RegionStore.migrations | 26 | ||||
-rw-r--r-- | OpenSim/Framework/RegionSettings.cs | 151 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 50 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | 111 |
7 files changed, 350 insertions, 73 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 40619de..afd42d7 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -861,6 +861,8 @@ namespace OpenSim.Data.MySQL | |||
861 | } | 861 | } |
862 | } | 862 | } |
863 | 863 | ||
864 | LoadSpawnPoints(rs); | ||
865 | |||
864 | return rs; | 866 | return rs; |
865 | } | 867 | } |
866 | 868 | ||
@@ -1032,6 +1034,7 @@ namespace OpenSim.Data.MySQL | |||
1032 | } | 1034 | } |
1033 | } | 1035 | } |
1034 | } | 1036 | } |
1037 | SaveSpawnPoints(rs); | ||
1035 | } | 1038 | } |
1036 | 1039 | ||
1037 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) | 1040 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
@@ -1852,5 +1855,72 @@ namespace OpenSim.Data.MySQL | |||
1852 | } | 1855 | } |
1853 | } | 1856 | } |
1854 | } | 1857 | } |
1858 | |||
1859 | private void LoadSpawnPoints(RegionSettings rs) | ||
1860 | { | ||
1861 | rs.ClearSpawnPoints(); | ||
1862 | |||
1863 | lock (m_dbLock) | ||
1864 | { | ||
1865 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1866 | { | ||
1867 | dbcon.Open(); | ||
1868 | |||
1869 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1870 | { | ||
1871 | cmd.CommandText = "select PointX, PointY, PointZ from spawn_points where RegionID = ?RegionID"; | ||
1872 | cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); | ||
1873 | |||
1874 | using (IDataReader r = cmd.ExecuteReader()) | ||
1875 | { | ||
1876 | while (r.Read()) | ||
1877 | { | ||
1878 | Vector3 point = new Vector3(); | ||
1879 | |||
1880 | point.X = (float)r["PointX"]; | ||
1881 | point.Y = (float)r["PointY"]; | ||
1882 | point.Z = (float)r["PointZ"]; | ||
1883 | |||
1884 | rs.AddSpawnPoint(point); | ||
1885 | } | ||
1886 | } | ||
1887 | } | ||
1888 | } | ||
1889 | } | ||
1890 | } | ||
1891 | |||
1892 | private void SaveSpawnPoints(RegionSettings rs) | ||
1893 | { | ||
1894 | lock (m_dbLock) | ||
1895 | { | ||
1896 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1897 | { | ||
1898 | dbcon.Open(); | ||
1899 | |||
1900 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1901 | { | ||
1902 | cmd.CommandText = "delete from spawn_points where RegionID = ?RegionID"; | ||
1903 | cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); | ||
1904 | |||
1905 | cmd.ExecuteNonQuery(); | ||
1906 | |||
1907 | cmd.Parameters.Clear(); | ||
1908 | |||
1909 | cmd.CommandText = "insert into spawn_points (RegionID, PointX, PointY, PointZ) values ( ?EstateID, ?PointX, ?PointY,?PointZ)"; | ||
1910 | |||
1911 | foreach (Vector3 p in rs.SpawnPoints()) | ||
1912 | { | ||
1913 | cmd.Parameters.AddWithValue("?EstateID", rs.RegionUUID.ToString()); | ||
1914 | cmd.Parameters.AddWithValue("?PointX", p.X); | ||
1915 | cmd.Parameters.AddWithValue("?PointY", p.Y); | ||
1916 | cmd.Parameters.AddWithValue("?PointZ", p.Z); | ||
1917 | |||
1918 | cmd.ExecuteNonQuery(); | ||
1919 | cmd.Parameters.Clear(); | ||
1920 | } | ||
1921 | } | ||
1922 | } | ||
1923 | } | ||
1924 | } | ||
1855 | } | 1925 | } |
1856 | } | 1926 | } |
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index c2b130c..3872a75 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations | |||
@@ -841,4 +841,28 @@ alter table regionban ENGINE = MyISAM; | |||
841 | alter table regionsettings ENGINE = MyISAM; | 841 | alter table regionsettings ENGINE = MyISAM; |
842 | alter table terrain ENGINE = MyISAM; | 842 | alter table terrain ENGINE = MyISAM; |
843 | 843 | ||
844 | COMMIT; \ No newline at end of file | 844 | COMMIT; |
845 | |||
846 | :VERSION 39 #--------------- Telehub support | ||
847 | |||
848 | BEGIN; | ||
849 | CREATE TABLE IF NOT EXISTS `spawn_points` ( | ||
850 | `RegionID` varchar(36) COLLATE utf8_unicode_ci NOT NULL, | ||
851 | `PointX` float NOT NULL, | ||
852 | `PointY` float NOT NULL, | ||
853 | `PointZ` float NOT NULL, | ||
854 | KEY `RegionID` (`RegionID`) | ||
855 | ) ENGINE=Innodb; | ||
856 | |||
857 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL; | ||
858 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubName` varchar(255) NOT NULL; | ||
859 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubEnabled` tinyint(4) NOT NULL; | ||
860 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosX` float NOT NULL; | ||
861 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosY` float NOT NULL; | ||
862 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosZ` float NOT NULL; | ||
863 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotX` float NOT NULL; | ||
864 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotY` float NOT NULL; | ||
865 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotZ` float NOT NULL; | ||
866 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotW` float NOT NULL; | ||
867 | COMMIT; | ||
868 | |||
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index f0786fc..2c9f7d2 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.IO; | 30 | using System.IO; |
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
31 | 32 | ||
@@ -410,5 +411,155 @@ namespace OpenSim.Framework | |||
410 | get { return m_Casino; } | 411 | get { return m_Casino; } |
411 | set { m_Casino = value; } | 412 | set { m_Casino = value; } |
412 | } | 413 | } |
414 | |||
415 | // Telehub support | ||
416 | private bool m_TelehubEnabled = false; | ||
417 | public bool HasTelehub | ||
418 | { | ||
419 | get { return m_TelehubEnabled; } | ||
420 | set { m_TelehubEnabled = value; } | ||
421 | } | ||
422 | |||
423 | // Connected Telehub object | ||
424 | private UUID m_TelehubObject; | ||
425 | public UUID TelehubObject | ||
426 | { | ||
427 | get | ||
428 | { | ||
429 | if (HasTelehub) | ||
430 | { | ||
431 | return m_TelehubObject; | ||
432 | } | ||
433 | else | ||
434 | { | ||
435 | return UUID.Zero; | ||
436 | } | ||
437 | } | ||
438 | set | ||
439 | { | ||
440 | m_TelehubObject = value; | ||
441 | } | ||
442 | } | ||
443 | |||
444 | // Connected Telehub name | ||
445 | private string m_TelehubName; | ||
446 | public string TelehubName | ||
447 | { | ||
448 | get | ||
449 | { | ||
450 | if (HasTelehub) | ||
451 | { | ||
452 | return m_TelehubName; | ||
453 | } | ||
454 | else | ||
455 | { | ||
456 | return String.Empty; | ||
457 | } | ||
458 | } | ||
459 | set | ||
460 | { | ||
461 | m_TelehubName = value; | ||
462 | } | ||
463 | } | ||
464 | |||
465 | // Connected Telehub position | ||
466 | private float m_TelehubPosX; | ||
467 | private float m_TelehubPosY; | ||
468 | private float m_TelehubPosZ; | ||
469 | public Vector3 TelehubPos | ||
470 | { | ||
471 | get | ||
472 | { | ||
473 | if (HasTelehub) | ||
474 | { | ||
475 | Vector3 Pos = new Vector3(m_TelehubPosX, m_TelehubPosY, m_TelehubPosZ); | ||
476 | return Pos; | ||
477 | } | ||
478 | else | ||
479 | { | ||
480 | return Vector3.Zero; | ||
481 | } | ||
482 | } | ||
483 | set | ||
484 | { | ||
485 | |||
486 | m_TelehubPosX = value.X; | ||
487 | m_TelehubPosY = value.Y; | ||
488 | m_TelehubPosZ = value.Z; | ||
489 | } | ||
490 | } | ||
491 | |||
492 | // Connected Telehub rotation | ||
493 | private float m_TelehubRotX; | ||
494 | private float m_TelehubRotY; | ||
495 | private float m_TelehubRotZ; | ||
496 | private float m_TelehubRotW; | ||
497 | public Quaternion TelehubRot | ||
498 | { | ||
499 | get | ||
500 | { | ||
501 | if (HasTelehub) | ||
502 | { | ||
503 | Quaternion quat = new Quaternion(); | ||
504 | |||
505 | quat.X = m_TelehubRotX; | ||
506 | quat.Y = m_TelehubRotY; | ||
507 | quat.Z = m_TelehubRotZ; | ||
508 | quat.W = m_TelehubRotW; | ||
509 | |||
510 | return quat; | ||
511 | } | ||
512 | else | ||
513 | { | ||
514 | // What else to do?? | ||
515 | Quaternion quat = new Quaternion(); | ||
516 | |||
517 | quat.X = m_TelehubRotX; | ||
518 | quat.X = m_TelehubRotY; | ||
519 | quat.X = m_TelehubRotZ; | ||
520 | quat.X = m_TelehubRotW; | ||
521 | |||
522 | return quat; | ||
523 | } | ||
524 | } | ||
525 | set | ||
526 | { | ||
527 | m_TelehubRotX = value.X; | ||
528 | m_TelehubRotY = value.Y; | ||
529 | m_TelehubRotZ = value.Z; | ||
530 | m_TelehubRotW = value.W; | ||
531 | } | ||
532 | } | ||
533 | |||
534 | // Our Connected Telehub's SpawnPoints | ||
535 | public List<Vector3> l_SpawnPoints = new List<Vector3>(); | ||
536 | |||
537 | // Add a SpawnPoint | ||
538 | // ** These are not region coordinates ** | ||
539 | // They are relative to the Telehub coordinates | ||
540 | // | ||
541 | public void AddSpawnPoint(Vector3 point) | ||
542 | { | ||
543 | l_SpawnPoints.Add(point); | ||
544 | } | ||
545 | |||
546 | // Remove a SpawnPoint | ||
547 | public void RemoveSpawnPoint(int point_index) | ||
548 | { | ||
549 | l_SpawnPoints.RemoveAt(point_index); | ||
550 | } | ||
551 | |||
552 | // Return the List of SpawnPoints | ||
553 | public List<Vector3> SpawnPoints() | ||
554 | { | ||
555 | return l_SpawnPoints; | ||
556 | |||
557 | } | ||
558 | |||
559 | // Clear the SpawnPoints List of all entries | ||
560 | public void ClearSpawnPoints() | ||
561 | { | ||
562 | l_SpawnPoints.Clear(); | ||
563 | } | ||
413 | } | 564 | } |
414 | } | 565 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d9dc6b7..bbaa08e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -9303,10 +9303,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9303 | { | 9303 | { |
9304 | UUID invoice = messagePacket.MethodData.Invoice; | 9304 | UUID invoice = messagePacket.MethodData.Invoice; |
9305 | UUID SenderID = messagePacket.AgentData.AgentID; | 9305 | UUID SenderID = messagePacket.AgentData.AgentID; |
9306 | UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); | 9306 | UInt32 param1 = 0u; |
9307 | 9307 | ||
9308 | string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter); | 9308 | string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter); |
9309 | 9309 | ||
9310 | if (command != "info ui") | ||
9311 | { | ||
9312 | try | ||
9313 | { | ||
9314 | param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); | ||
9315 | } | ||
9316 | catch (Exception ex) | ||
9317 | { | ||
9318 | |||
9319 | } | ||
9320 | } | ||
9321 | |||
9310 | EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub; | 9322 | EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub; |
9311 | if (handlerEstateManageTelehub != null) | 9323 | if (handlerEstateManageTelehub != null) |
9312 | { | 9324 | { |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 35ad939..4f3b271 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
55 | protected EstateManagementCommands m_commands; | 55 | protected EstateManagementCommands m_commands; |
56 | 56 | ||
57 | private EstateTerrainXferHandler TerrainUploader; | 57 | private EstateTerrainXferHandler TerrainUploader; |
58 | private TelehubManager m_Telehub; | 58 | public TelehubManager m_Telehub; |
59 | 59 | ||
60 | public event ChangeDelegate OnRegionInfoChange; | 60 | public event ChangeDelegate OnRegionInfoChange; |
61 | public event ChangeDelegate OnEstateInfoChange; | 61 | public event ChangeDelegate OnEstateInfoChange; |
@@ -615,22 +615,20 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
615 | } | 615 | } |
616 | } | 616 | } |
617 | 617 | ||
618 | private void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) | 618 | public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) |
619 | { | 619 | { |
620 | uint ObjectLocalID; | 620 | uint ObjectLocalID; |
621 | SceneObjectPart part; | 621 | SceneObjectPart part; |
622 | // UUID EstateID = Scene.RegionInfo.EstateSettings.EstateID; | ||
623 | TelehubManager.Telehub telehub; | ||
624 | 622 | ||
625 | switch (cmd) | 623 | switch (cmd) |
626 | { | 624 | { |
627 | case "info ui": | 625 | case "info ui": |
628 | // Send info: | 626 | // Send info: |
629 | if (m_Telehub.HasTelehub) | 627 | if (Scene.RegionInfo.RegionSettings.HasTelehub) |
630 | { | 628 | { |
631 | telehub = m_Telehub.TelehubVals(); | 629 | RegionSettings settings = this.Scene.RegionInfo.RegionSettings; |
632 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 630 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, |
633 | telehub.ObjectRotation, telehub.SpawnPoint); | 631 | settings.TelehubRot, settings.SpawnPoints()); |
634 | } | 632 | } |
635 | else | 633 | else |
636 | { | 634 | { |
@@ -641,32 +639,44 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
641 | case "connect": | 639 | case "connect": |
642 | // Add the Telehub | 640 | // Add the Telehub |
643 | part = Scene.GetSceneObjectPart((uint)param1); | 641 | part = Scene.GetSceneObjectPart((uint)param1); |
644 | telehub = m_Telehub.Connect(part); | 642 | if (m_Telehub.Connect(part)) |
645 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 643 | { |
646 | telehub.ObjectRotation, telehub.SpawnPoint); | 644 | RegionSettings settings = this.Scene.RegionInfo.RegionSettings; |
645 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
646 | settings.TelehubRot, settings.SpawnPoints()); | ||
647 | } | ||
647 | break; | 648 | break; |
648 | 649 | ||
649 | case "delete": | 650 | case "delete": |
650 | // Disconnect Telehub | 651 | // Disconnect Telehub |
651 | part = Scene.GetSceneObjectPart((uint)param1); | 652 | part = Scene.GetSceneObjectPart((uint)param1); |
652 | telehub = m_Telehub.DisConnect(part); | 653 | if (m_Telehub.DisConnect(part)) |
653 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 654 | { |
654 | telehub.ObjectRotation, telehub.SpawnPoint); | 655 | RegionSettings settings = this.Scene.RegionInfo.RegionSettings; |
656 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
657 | settings.TelehubRot, settings.SpawnPoints()); | ||
658 | } | ||
655 | break; | 659 | break; |
656 | 660 | ||
657 | case "spawnpoint add": | 661 | case "spawnpoint add": |
658 | // Add SpawnPoint to the Telehub | 662 | // Add SpawnPoint to the Telehub |
659 | part = Scene.GetSceneObjectPart((uint)param1); | 663 | part = Scene.GetSceneObjectPart((uint)param1); |
660 | telehub = m_Telehub.AddSpawnPoint(part.AbsolutePosition); | 664 | if( m_Telehub.AddSpawnPoint(part.AbsolutePosition)) |
661 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 665 | { |
662 | telehub.ObjectRotation, telehub.SpawnPoint); | 666 | RegionSettings settings = this.Scene.RegionInfo.RegionSettings; |
667 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
668 | settings.TelehubRot, settings.SpawnPoints()); | ||
669 | } | ||
663 | break; | 670 | break; |
664 | 671 | ||
665 | case "spawnpoint remove": | 672 | case "spawnpoint remove": |
666 | // Remove SpawnPoint from Telehub | 673 | // Remove SpawnPoint from Telehub |
667 | telehub = m_Telehub.RemoveSpawnPoint((int)param1); | 674 | if (m_Telehub.RemoveSpawnPoint((int)param1)) |
668 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 675 | { |
669 | telehub.ObjectRotation, telehub.SpawnPoint); | 676 | RegionSettings settings = this.Scene.RegionInfo.RegionSettings; |
677 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
678 | settings.TelehubRot, settings.SpawnPoints()); | ||
679 | } | ||
670 | break; | 680 | break; |
671 | 681 | ||
672 | default: | 682 | default: |
diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs index c99c9ba..ee77ae1 100644 --- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | |||
@@ -35,14 +35,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
35 | { | 35 | { |
36 | public class TelehubManager | 36 | public class TelehubManager |
37 | { | 37 | { |
38 | public struct Telehub | ||
39 | { | ||
40 | public UUID ObjectID; | ||
41 | public string ObjectName; | ||
42 | public Vector3 ObjectPosition; | ||
43 | public Quaternion ObjectRotation; | ||
44 | public List<Vector3> SpawnPoint; | ||
45 | }; | ||
46 | 38 | ||
47 | private UUID ObjectID; | 39 | private UUID ObjectID; |
48 | private string ObjectName; | 40 | private string ObjectName; |
@@ -53,7 +45,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
53 | bool m_HasTelehub = false; | 45 | bool m_HasTelehub = false; |
54 | Scene m_Scene; | 46 | Scene m_Scene; |
55 | // This will get an option... | 47 | // This will get an option... |
56 | Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,-3.0f); | 48 | Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,0.0f); |
57 | 49 | ||
58 | public bool HasTelehub | 50 | public bool HasTelehub |
59 | { | 51 | { |
@@ -66,65 +58,84 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
66 | } | 58 | } |
67 | 59 | ||
68 | // Fill our Telehub struct with values | 60 | // Fill our Telehub struct with values |
69 | public Telehub TelehubVals() | 61 | // public Telehub TelehubVals() |
70 | { | 62 | // { |
71 | Telehub telehub = new Telehub(); | 63 | // // Telehub telehub = new Telehub(); |
72 | 64 | // EstateSettings telehub = m_EstateSettings; | |
73 | telehub.ObjectID = ObjectID; | 65 | // |
74 | telehub.ObjectName = ObjectName; | 66 | // telehub.TelehubObject = ObjectID; |
75 | telehub.ObjectPosition = ObjectPosition; | 67 | // telehub.TelehubName = ObjectName; |
76 | telehub.ObjectRotation = ObjectRotation; | 68 | // telehub.TelehubPos = ObjectPosition; |
77 | telehub.SpawnPoint = SpawnPoint; | 69 | // telehub.TelehubRot = ObjectRotation; |
78 | return telehub; | 70 | // telehub. = SpawnPoint; |
79 | } | 71 | // return telehub; |
72 | // } | ||
80 | 73 | ||
81 | // Connect the Telehub | 74 | // Connect the Telehub |
82 | public Telehub Connect(SceneObjectPart part) | 75 | public bool Connect(SceneObjectPart part) |
83 | { | 76 | { |
84 | ObjectID = part.UUID; | 77 | m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); |
85 | ObjectName = part.Name; | ||
86 | ObjectPosition = part.AbsolutePosition; | ||
87 | ObjectRotation = part.GetWorldRotation(); | ||
88 | // Clear this for now | ||
89 | SpawnPoint.Clear(); | ||
90 | SpawnPoint.Add(InitialSpawnPoint); | ||
91 | m_HasTelehub = true; | ||
92 | 78 | ||
93 | return TelehubVals(); | 79 | m_Scene.RegionInfo.RegionSettings.TelehubObject = part.UUID; |
80 | m_Scene.RegionInfo.RegionSettings.TelehubName = part.Name; | ||
81 | m_Scene.RegionInfo.RegionSettings.TelehubPos = part.AbsolutePosition; | ||
82 | m_Scene.RegionInfo.RegionSettings.TelehubRot = part.GetWorldRotation(); | ||
83 | |||
84 | // Clear this for now | ||
85 | m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(InitialSpawnPoint); | ||
86 | m_Scene.RegionInfo.RegionSettings.HasTelehub = true; | ||
87 | m_Scene.RegionInfo.RegionSettings.Save(); | ||
88 | return true; | ||
94 | } | 89 | } |
95 | 90 | ||
96 | // Disconnect the Telehub | 91 | // Disconnect the Telehub: Clear it out for now, look at just disableing |
97 | public Telehub DisConnect(SceneObjectPart part) | 92 | public bool DisConnect(SceneObjectPart part) |
98 | { | 93 | { |
99 | ObjectID = UUID.Zero; | 94 | bool result = false; |
100 | ObjectName = String.Empty; | 95 | |
101 | ObjectPosition = Vector3.Zero; | 96 | try{ |
102 | ObjectRotation = Quaternion.Identity; | 97 | m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; |
103 | SpawnPoint.Clear(); | 98 | m_Scene.RegionInfo.RegionSettings.TelehubName = String.Empty; |
104 | m_HasTelehub = false; | 99 | m_Scene.RegionInfo.RegionSettings.TelehubPos = Vector3.Zero; |
105 | 100 | // This is probably wrong! But, HasTelehub will block access | |
106 | return TelehubVals(); | 101 | m_Scene.RegionInfo.RegionSettings.TelehubRot = Quaternion.Identity; |
102 | m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); | ||
103 | m_Scene.RegionInfo.RegionSettings.HasTelehub = false; | ||
104 | m_Scene.RegionInfo.RegionSettings.Save(); | ||
105 | result = true; | ||
106 | } | ||
107 | catch (Exception ex) | ||
108 | { | ||
109 | result = false; | ||
110 | } | ||
111 | finally | ||
112 | { | ||
113 | |||
114 | } | ||
115 | |||
116 | return result; | ||
107 | } | 117 | } |
108 | 118 | ||
109 | // Add a SpawnPoint to the Telehub | 119 | // Add a SpawnPoint to the Telehub |
110 | public Telehub AddSpawnPoint(Vector3 point) | 120 | public bool AddSpawnPoint(Vector3 point) |
111 | { | 121 | { |
112 | float dist = (float) Util.GetDistanceTo(ObjectPosition, point); | ||
113 | |||
114 | Vector3 nvec = Util.GetNormalizedVector(point - ObjectPosition); | ||
115 | 122 | ||
123 | float dist = (float) Util.GetDistanceTo(m_Scene.RegionInfo.RegionSettings.TelehubPos, point); | ||
124 | Vector3 nvec = Util.GetNormalizedVector(point - m_Scene.RegionInfo.RegionSettings.TelehubPos); | ||
116 | Vector3 spoint = nvec * dist; | 125 | Vector3 spoint = nvec * dist; |
117 | 126 | ||
118 | SpawnPoint.Add(spoint); | 127 | m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(spoint); |
119 | return TelehubVals(); | 128 | m_Scene.RegionInfo.RegionSettings.Save(); |
129 | return true; | ||
120 | } | 130 | } |
121 | 131 | ||
122 | // Remove a SpawnPoint from the Telehub | 132 | // Remove a SpawnPoint from the Telehub |
123 | public Telehub RemoveSpawnPoint(int spawnpoint) | 133 | public bool RemoveSpawnPoint(int spawnpoint) |
124 | { | 134 | { |
125 | SpawnPoint.RemoveAt(spawnpoint); | 135 | m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); |
136 | m_Scene.RegionInfo.RegionSettings.Save(); | ||
126 | 137 | ||
127 | return TelehubVals(); | 138 | return true; |
128 | } | 139 | } |
129 | } | 140 | } |
130 | } \ No newline at end of file | 141 | } |