diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 78 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | 101 |
2 files changed, 85 insertions, 94 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 4f3b271..ea8d396 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -624,59 +624,37 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
624 | { | 624 | { |
625 | case "info ui": | 625 | case "info ui": |
626 | // Send info: | 626 | // Send info: |
627 | if (Scene.RegionInfo.RegionSettings.HasTelehub) | 627 | SendTelehubInfo(client); |
628 | { | ||
629 | RegionSettings settings = this.Scene.RegionInfo.RegionSettings; | ||
630 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
631 | settings.TelehubRot, settings.SpawnPoints()); | ||
632 | } | ||
633 | else | ||
634 | { | ||
635 | return; | ||
636 | } | ||
637 | break; | 628 | break; |
638 | 629 | ||
639 | case "connect": | 630 | case "connect": |
640 | // Add the Telehub | 631 | // Add the Telehub |
641 | part = Scene.GetSceneObjectPart((uint)param1); | 632 | part = Scene.GetSceneObjectPart((uint)param1); |
642 | if (m_Telehub.Connect(part)) | 633 | if (part == null) |
643 | { | 634 | return; |
644 | RegionSettings settings = this.Scene.RegionInfo.RegionSettings; | 635 | SceneObjectGroup grp = part.ParentGroup; |
645 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | 636 | |
646 | settings.TelehubRot, settings.SpawnPoints()); | 637 | if (m_Telehub.Connect(grp)) |
647 | } | 638 | SendTelehubInfo(client); |
648 | break; | 639 | break; |
649 | 640 | ||
650 | case "delete": | 641 | case "delete": |
651 | // Disconnect Telehub | 642 | // Disconnect Telehub |
652 | part = Scene.GetSceneObjectPart((uint)param1); | 643 | if (m_Telehub.Disconnect()) |
653 | if (m_Telehub.DisConnect(part)) | 644 | SendTelehubInfo(client); |
654 | { | ||
655 | RegionSettings settings = this.Scene.RegionInfo.RegionSettings; | ||
656 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
657 | settings.TelehubRot, settings.SpawnPoints()); | ||
658 | } | ||
659 | break; | 645 | break; |
660 | 646 | ||
661 | case "spawnpoint add": | 647 | case "spawnpoint add": |
662 | // Add SpawnPoint to the Telehub | 648 | // Add SpawnPoint to the Telehub |
663 | part = Scene.GetSceneObjectPart((uint)param1); | 649 | part = Scene.GetSceneObjectPart((uint)param1); |
664 | if( m_Telehub.AddSpawnPoint(part.AbsolutePosition)) | 650 | if( m_Telehub.AddSpawnPoint(part.AbsolutePosition)) |
665 | { | 651 | SendTelehubInfo(client); |
666 | RegionSettings settings = this.Scene.RegionInfo.RegionSettings; | ||
667 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
668 | settings.TelehubRot, settings.SpawnPoints()); | ||
669 | } | ||
670 | break; | 652 | break; |
671 | 653 | ||
672 | case "spawnpoint remove": | 654 | case "spawnpoint remove": |
673 | // Remove SpawnPoint from Telehub | 655 | // Remove SpawnPoint from Telehub |
674 | if (m_Telehub.RemoveSpawnPoint((int)param1)) | 656 | if (m_Telehub.RemoveSpawnPoint((int)param1)) |
675 | { | 657 | SendTelehubInfo(client); |
676 | RegionSettings settings = this.Scene.RegionInfo.RegionSettings; | ||
677 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
678 | settings.TelehubRot, settings.SpawnPoints()); | ||
679 | } | ||
680 | break; | 658 | break; |
681 | 659 | ||
682 | default: | 660 | default: |
@@ -1365,5 +1343,39 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1365 | if (onmessage != null) | 1343 | if (onmessage != null) |
1366 | onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message); | 1344 | onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message); |
1367 | } | 1345 | } |
1346 | |||
1347 | |||
1348 | private void SendTelehubInfo(IClientAPI client) | ||
1349 | { | ||
1350 | RegionSettings settings = | ||
1351 | this.Scene.RegionInfo.RegionSettings; | ||
1352 | |||
1353 | SceneObjectGroup telehub = null; | ||
1354 | if (settings.TelehubObject != UUID.Zero && | ||
1355 | (telehub = Scene.GetSceneObjectGroup(settings.TelehubObject)) != null) | ||
1356 | { | ||
1357 | List<Vector3> spawnPoints = new List<Vector3>(); | ||
1358 | |||
1359 | foreach (SpawnPoint sp in settings.SpawnPoints()) | ||
1360 | { | ||
1361 | spawnPoints.Add(sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation)); | ||
1362 | } | ||
1363 | |||
1364 | client.SendTelehubInfo(settings.TelehubObject, | ||
1365 | telehub.Name, | ||
1366 | telehub.AbsolutePosition, | ||
1367 | telehub.GroupRotation, | ||
1368 | spawnPoints); | ||
1369 | } | ||
1370 | else | ||
1371 | { | ||
1372 | client.SendTelehubInfo(UUID.Zero, | ||
1373 | String.Empty, | ||
1374 | Vector3.Zero, | ||
1375 | Quaternion.Identity, | ||
1376 | new List<Vector3>()); | ||
1377 | } | ||
1378 | } | ||
1368 | } | 1379 | } |
1369 | } | 1380 | } |
1381 | |||
diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs index ee77ae1..3eb7efa 100644 --- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | |||
@@ -35,103 +35,82 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
35 | { | 35 | { |
36 | public class TelehubManager | 36 | public class TelehubManager |
37 | { | 37 | { |
38 | |||
39 | private UUID ObjectID; | ||
40 | private string ObjectName; | ||
41 | private Vector3 ObjectPosition; | ||
42 | Quaternion ObjectRotation; | ||
43 | List<Vector3> SpawnPoint = new List<Vector3>(); | ||
44 | UUID EstateID; | ||
45 | bool m_HasTelehub = false; | ||
46 | Scene m_Scene; | 38 | Scene m_Scene; |
47 | // This will get an option... | ||
48 | Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,0.0f); | ||
49 | |||
50 | public bool HasTelehub | ||
51 | { | ||
52 | get { return m_HasTelehub; } | ||
53 | } | ||
54 | 39 | ||
55 | public TelehubManager(Scene scene) | 40 | public TelehubManager(Scene scene) |
56 | { | 41 | { |
57 | m_Scene = scene; | 42 | m_Scene = scene; |
58 | } | 43 | } |
59 | 44 | ||
60 | // Fill our Telehub struct with values | ||
61 | // public Telehub TelehubVals() | ||
62 | // { | ||
63 | // // Telehub telehub = new Telehub(); | ||
64 | // EstateSettings telehub = m_EstateSettings; | ||
65 | // | ||
66 | // telehub.TelehubObject = ObjectID; | ||
67 | // telehub.TelehubName = ObjectName; | ||
68 | // telehub.TelehubPos = ObjectPosition; | ||
69 | // telehub.TelehubRot = ObjectRotation; | ||
70 | // telehub. = SpawnPoint; | ||
71 | // return telehub; | ||
72 | // } | ||
73 | |||
74 | // Connect the Telehub | 45 | // Connect the Telehub |
75 | public bool Connect(SceneObjectPart part) | 46 | public bool Connect(SceneObjectGroup grp) |
76 | { | 47 | { |
77 | m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); | 48 | try |
78 | 49 | { | |
79 | m_Scene.RegionInfo.RegionSettings.TelehubObject = part.UUID; | 50 | m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); |
80 | m_Scene.RegionInfo.RegionSettings.TelehubName = part.Name; | 51 | |
81 | m_Scene.RegionInfo.RegionSettings.TelehubPos = part.AbsolutePosition; | 52 | m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID; |
82 | m_Scene.RegionInfo.RegionSettings.TelehubRot = part.GetWorldRotation(); | 53 | m_Scene.RegionInfo.RegionSettings.Save(); |
54 | } | ||
55 | catch (Exception ex) | ||
56 | { | ||
57 | return false; | ||
58 | } | ||
83 | 59 | ||
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; | 60 | return true; |
89 | } | 61 | } |
90 | 62 | ||
91 | // Disconnect the Telehub: Clear it out for now, look at just disableing | 63 | // Disconnect the Telehub: |
92 | public bool DisConnect(SceneObjectPart part) | 64 | public bool Disconnect() |
93 | { | 65 | { |
94 | bool result = false; | 66 | if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) |
67 | return false; | ||
95 | 68 | ||
96 | try{ | 69 | try |
70 | { | ||
97 | m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; | 71 | m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; |
98 | m_Scene.RegionInfo.RegionSettings.TelehubName = String.Empty; | ||
99 | m_Scene.RegionInfo.RegionSettings.TelehubPos = Vector3.Zero; | ||
100 | // This is probably wrong! But, HasTelehub will block access | ||
101 | m_Scene.RegionInfo.RegionSettings.TelehubRot = Quaternion.Identity; | ||
102 | m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); | 72 | m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); |
103 | m_Scene.RegionInfo.RegionSettings.HasTelehub = false; | ||
104 | m_Scene.RegionInfo.RegionSettings.Save(); | 73 | m_Scene.RegionInfo.RegionSettings.Save(); |
105 | result = true; | ||
106 | } | 74 | } |
107 | catch (Exception ex) | 75 | catch (Exception ex) |
108 | { | 76 | { |
109 | result = false; | 77 | return false; |
110 | } | ||
111 | finally | ||
112 | { | ||
113 | |||
114 | } | 78 | } |
115 | 79 | ||
116 | return result; | 80 | return true; |
117 | } | 81 | } |
118 | 82 | ||
119 | // Add a SpawnPoint to the Telehub | 83 | // Add a SpawnPoint to the Telehub |
120 | public bool AddSpawnPoint(Vector3 point) | 84 | public bool AddSpawnPoint(Vector3 point) |
121 | { | 85 | { |
86 | if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) | ||
87 | return false; | ||
122 | 88 | ||
123 | float dist = (float) Util.GetDistanceTo(m_Scene.RegionInfo.RegionSettings.TelehubPos, point); | 89 | SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject); |
124 | Vector3 nvec = Util.GetNormalizedVector(point - m_Scene.RegionInfo.RegionSettings.TelehubPos); | 90 | if (grp == null) |
125 | Vector3 spoint = nvec * dist; | 91 | return false; |
92 | |||
93 | try | ||
94 | { | ||
95 | SpawnPoint sp = new SpawnPoint(); | ||
96 | sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point); | ||
97 | m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp); | ||
98 | m_Scene.RegionInfo.RegionSettings.Save(); | ||
99 | } | ||
100 | catch (Exception ex) | ||
101 | { | ||
102 | return false; | ||
103 | } | ||
126 | 104 | ||
127 | m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(spoint); | ||
128 | m_Scene.RegionInfo.RegionSettings.Save(); | ||
129 | return true; | 105 | return true; |
130 | } | 106 | } |
131 | 107 | ||
132 | // Remove a SpawnPoint from the Telehub | 108 | // Remove a SpawnPoint from the Telehub |
133 | public bool RemoveSpawnPoint(int spawnpoint) | 109 | public bool RemoveSpawnPoint(int spawnpoint) |
134 | { | 110 | { |
111 | if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) | ||
112 | return false; | ||
113 | |||
135 | m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); | 114 | m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); |
136 | m_Scene.RegionInfo.RegionSettings.Save(); | 115 | m_Scene.RegionInfo.RegionSettings.Save(); |
137 | 116 | ||