diff options
author | BlueWall | 2012-01-21 23:26:27 -0500 |
---|---|---|
committer | BlueWall | 2012-01-21 23:26:27 -0500 |
commit | 32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85 (patch) | |
tree | 8c19dbfa8975080d7bbbeaa1e2de4072520c899f /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.zip opensim-SC_OLD-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.tar.gz opensim-SC_OLD-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.tar.bz2 opensim-SC_OLD-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.tar.xz |
Telehub Support:
Telehub settings now persist to the database and are saved across sim restarts. So-far this only works on MySQL. this is a work in progress, teleport routing is not yet implemented.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 50 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | 111 |
2 files changed, 92 insertions, 69 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 0d4df6c..6a02ffe 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -53,7 +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 | private TelehubManager m_Telehub; | 56 | public TelehubManager m_Telehub; |
57 | 57 | ||
58 | public event ChangeDelegate OnRegionInfoChange; | 58 | public event ChangeDelegate OnRegionInfoChange; |
59 | public event ChangeDelegate OnEstateInfoChange; | 59 | public event ChangeDelegate OnEstateInfoChange; |
@@ -600,22 +600,20 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
600 | } | 600 | } |
601 | } | 601 | } |
602 | 602 | ||
603 | private void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) | 603 | public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) |
604 | { | 604 | { |
605 | uint ObjectLocalID; | 605 | uint ObjectLocalID; |
606 | SceneObjectPart part; | 606 | SceneObjectPart part; |
607 | // UUID EstateID = Scene.RegionInfo.EstateSettings.EstateID; | ||
608 | TelehubManager.Telehub telehub; | ||
609 | 607 | ||
610 | switch (cmd) | 608 | switch (cmd) |
611 | { | 609 | { |
612 | case "info ui": | 610 | case "info ui": |
613 | // Send info: | 611 | // Send info: |
614 | if (m_Telehub.HasTelehub) | 612 | if (Scene.RegionInfo.EstateSettings.HasTelehub) |
615 | { | 613 | { |
616 | telehub = m_Telehub.TelehubVals(); | 614 | EstateSettings settings = this.Scene.RegionInfo.EstateSettings; |
617 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 615 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, |
618 | telehub.ObjectRotation, telehub.SpawnPoint); | 616 | settings.TelehubRot, settings.SpawnPoints()); |
619 | } | 617 | } |
620 | else | 618 | else |
621 | { | 619 | { |
@@ -626,32 +624,44 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
626 | case "connect": | 624 | case "connect": |
627 | // Add the Telehub | 625 | // Add the Telehub |
628 | part = Scene.GetSceneObjectPart((uint)param1); | 626 | part = Scene.GetSceneObjectPart((uint)param1); |
629 | telehub = m_Telehub.Connect(part); | 627 | if (m_Telehub.Connect(part)) |
630 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 628 | { |
631 | telehub.ObjectRotation, telehub.SpawnPoint); | 629 | EstateSettings settings = this.Scene.RegionInfo.EstateSettings; |
630 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
631 | settings.TelehubRot, settings.SpawnPoints()); | ||
632 | } | ||
632 | break; | 633 | break; |
633 | 634 | ||
634 | case "delete": | 635 | case "delete": |
635 | // Disconnect Telehub | 636 | // Disconnect Telehub |
636 | part = Scene.GetSceneObjectPart((uint)param1); | 637 | part = Scene.GetSceneObjectPart((uint)param1); |
637 | telehub = m_Telehub.DisConnect(part); | 638 | if (m_Telehub.DisConnect(part)) |
638 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 639 | { |
639 | telehub.ObjectRotation, telehub.SpawnPoint); | 640 | EstateSettings settings = this.Scene.RegionInfo.EstateSettings; |
641 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
642 | settings.TelehubRot, settings.SpawnPoints()); | ||
643 | } | ||
640 | break; | 644 | break; |
641 | 645 | ||
642 | case "spawnpoint add": | 646 | case "spawnpoint add": |
643 | // Add SpawnPoint to the Telehub | 647 | // Add SpawnPoint to the Telehub |
644 | part = Scene.GetSceneObjectPart((uint)param1); | 648 | part = Scene.GetSceneObjectPart((uint)param1); |
645 | telehub = m_Telehub.AddSpawnPoint(part.AbsolutePosition); | 649 | if( m_Telehub.AddSpawnPoint(part.AbsolutePosition)) |
646 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 650 | { |
647 | telehub.ObjectRotation, telehub.SpawnPoint); | 651 | EstateSettings settings = this.Scene.RegionInfo.EstateSettings; |
652 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
653 | settings.TelehubRot, settings.SpawnPoints()); | ||
654 | } | ||
648 | break; | 655 | break; |
649 | 656 | ||
650 | case "spawnpoint remove": | 657 | case "spawnpoint remove": |
651 | // Remove SpawnPoint from Telehub | 658 | // Remove SpawnPoint from Telehub |
652 | telehub = m_Telehub.RemoveSpawnPoint((int)param1); | 659 | if (m_Telehub.RemoveSpawnPoint((int)param1)) |
653 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 660 | { |
654 | telehub.ObjectRotation, telehub.SpawnPoint); | 661 | EstateSettings settings = this.Scene.RegionInfo.EstateSettings; |
662 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
663 | settings.TelehubRot, settings.SpawnPoints()); | ||
664 | } | ||
655 | break; | 665 | break; |
656 | 666 | ||
657 | default: | 667 | default: |
diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs index c99c9ba..309ef13 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; |
@@ -52,8 +44,9 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
52 | UUID EstateID; | 44 | UUID EstateID; |
53 | bool m_HasTelehub = false; | 45 | bool m_HasTelehub = false; |
54 | Scene m_Scene; | 46 | Scene m_Scene; |
47 | EstateSettings m_EstateSettings; | ||
55 | // This will get an option... | 48 | // This will get an option... |
56 | Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,-3.0f); | 49 | Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,0.0f); |
57 | 50 | ||
58 | public bool HasTelehub | 51 | public bool HasTelehub |
59 | { | 52 | { |
@@ -63,68 +56,88 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
63 | public TelehubManager(Scene scene) | 56 | public TelehubManager(Scene scene) |
64 | { | 57 | { |
65 | m_Scene = scene; | 58 | m_Scene = scene; |
59 | m_EstateSettings = m_Scene.RegionInfo.EstateSettings; | ||
66 | } | 60 | } |
67 | 61 | ||
68 | // Fill our Telehub struct with values | 62 | // Fill our Telehub struct with values |
69 | public Telehub TelehubVals() | 63 | // public Telehub TelehubVals() |
70 | { | 64 | // { |
71 | Telehub telehub = new Telehub(); | 65 | // // Telehub telehub = new Telehub(); |
72 | 66 | // EstateSettings telehub = m_EstateSettings; | |
73 | telehub.ObjectID = ObjectID; | 67 | // |
74 | telehub.ObjectName = ObjectName; | 68 | // telehub.TelehubObject = ObjectID; |
75 | telehub.ObjectPosition = ObjectPosition; | 69 | // telehub.TelehubName = ObjectName; |
76 | telehub.ObjectRotation = ObjectRotation; | 70 | // telehub.TelehubPos = ObjectPosition; |
77 | telehub.SpawnPoint = SpawnPoint; | 71 | // telehub.TelehubRot = ObjectRotation; |
78 | return telehub; | 72 | // telehub. = SpawnPoint; |
79 | } | 73 | // return telehub; |
74 | // } | ||
80 | 75 | ||
81 | // Connect the Telehub | 76 | // Connect the Telehub |
82 | public Telehub Connect(SceneObjectPart part) | 77 | public bool Connect(SceneObjectPart part) |
83 | { | 78 | { |
84 | ObjectID = part.UUID; | 79 | m_EstateSettings.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 | 80 | ||
93 | return TelehubVals(); | 81 | m_EstateSettings.TelehubObject = part.UUID; |
82 | m_EstateSettings.TelehubName = part.Name; | ||
83 | m_EstateSettings.TelehubPos = part.AbsolutePosition; | ||
84 | m_EstateSettings.TelehubRot = part.GetWorldRotation(); | ||
85 | |||
86 | // Clear this for now | ||
87 | m_EstateSettings.AddSpawnPoint(InitialSpawnPoint); | ||
88 | m_EstateSettings.HasTelehub = true; | ||
89 | m_EstateSettings.Save(); | ||
90 | return true; | ||
94 | } | 91 | } |
95 | 92 | ||
96 | // Disconnect the Telehub | 93 | // Disconnect the Telehub: Clear it out for now, look at just disableing |
97 | public Telehub DisConnect(SceneObjectPart part) | 94 | public bool DisConnect(SceneObjectPart part) |
98 | { | 95 | { |
99 | ObjectID = UUID.Zero; | 96 | bool result = false; |
100 | ObjectName = String.Empty; | 97 | |
101 | ObjectPosition = Vector3.Zero; | 98 | try{ |
102 | ObjectRotation = Quaternion.Identity; | 99 | m_EstateSettings.TelehubObject = UUID.Zero; |
103 | SpawnPoint.Clear(); | 100 | m_EstateSettings.TelehubName = String.Empty; |
104 | m_HasTelehub = false; | 101 | m_EstateSettings.TelehubPos = Vector3.Zero; |
105 | 102 | // This is probably wrong! But, HasTelehub will block access | |
106 | return TelehubVals(); | 103 | m_EstateSettings.TelehubRot = Quaternion.Identity; |
104 | m_EstateSettings.ClearSpawnPoints(); | ||
105 | m_EstateSettings.HasTelehub = false; | ||
106 | m_EstateSettings.Save(); | ||
107 | result = true; | ||
108 | } | ||
109 | catch (Exception ex) | ||
110 | { | ||
111 | result = false; | ||
112 | } | ||
113 | finally | ||
114 | { | ||
115 | |||
116 | } | ||
117 | |||
118 | return result; | ||
107 | } | 119 | } |
108 | 120 | ||
109 | // Add a SpawnPoint to the Telehub | 121 | // Add a SpawnPoint to the Telehub |
110 | public Telehub AddSpawnPoint(Vector3 point) | 122 | public bool AddSpawnPoint(Vector3 point) |
111 | { | 123 | { |
112 | float dist = (float) Util.GetDistanceTo(ObjectPosition, point); | ||
113 | |||
114 | Vector3 nvec = Util.GetNormalizedVector(point - ObjectPosition); | ||
115 | 124 | ||
125 | float dist = (float) Util.GetDistanceTo(m_EstateSettings.TelehubPos, point); | ||
126 | Vector3 nvec = Util.GetNormalizedVector(point - m_EstateSettings.TelehubPos); | ||
116 | Vector3 spoint = nvec * dist; | 127 | Vector3 spoint = nvec * dist; |
117 | 128 | ||
118 | SpawnPoint.Add(spoint); | 129 | m_EstateSettings.AddSpawnPoint(spoint); |
119 | return TelehubVals(); | 130 | m_EstateSettings.Save(); |
131 | return true; | ||
120 | } | 132 | } |
121 | 133 | ||
122 | // Remove a SpawnPoint from the Telehub | 134 | // Remove a SpawnPoint from the Telehub |
123 | public Telehub RemoveSpawnPoint(int spawnpoint) | 135 | public bool RemoveSpawnPoint(int spawnpoint) |
124 | { | 136 | { |
125 | SpawnPoint.RemoveAt(spawnpoint); | 137 | m_EstateSettings.RemoveSpawnPoint(spawnpoint); |
138 | m_EstateSettings.Save(); | ||
126 | 139 | ||
127 | return TelehubVals(); | 140 | return true; |
128 | } | 141 | } |
129 | } | 142 | } |
130 | } \ No newline at end of file | 143 | } \ No newline at end of file |