aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-01-24 01:48:38 +0100
committerMelanie2012-01-24 01:48:38 +0100
commitcc02f78d4e8f0cae4168e6d634f86d0ea9d0b537 (patch)
treeb03ee9ee31441eb72a111c69d8602e39d80f4241
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-cc02f78d4e8f0cae4168e6d634f86d0ea9d0b537.zip
opensim-SC_OLD-cc02f78d4e8f0cae4168e6d634f86d0ea9d0b537.tar.gz
opensim-SC_OLD-cc02f78d4e8f0cae4168e6d634f86d0ea9d0b537.tar.bz2
opensim-SC_OLD-cc02f78d4e8f0cae4168e6d634f86d0ea9d0b537.tar.xz
Simplify and streamline telehub editing code. Verify rotations and fix
spwan point positioning on rotated telehubs.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/RegionSettings.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs19
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs69
3 files changed, 31 insertions, 59 deletions
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs
index 8322cd6..786638e 100644
--- a/OpenSim/Framework/RegionSettings.cs
+++ b/OpenSim/Framework/RegionSettings.cs
@@ -47,6 +47,7 @@ namespace OpenSim.Framework
47 47
48 // Next we need to rotate this vector into the spawn point's 48 // Next we need to rotate this vector into the spawn point's
49 // coordinate system 49 // coordinate system
50 rot.W = -rot.W;
50 offset = offset * rot; 51 offset = offset * rot;
51 52
52 Vector3 dir = Vector3.Normalize(offset); 53 Vector3 dir = Vector3.Normalize(offset);
@@ -66,7 +67,6 @@ namespace OpenSim.Framework
66 Vector3 dir = new Vector3(1, 0, 0) * p * y; 67 Vector3 dir = new Vector3(1, 0, 0) * p * y;
67 Vector3 offset = dir * (float)Distance; 68 Vector3 offset = dir * (float)Distance;
68 69
69 rot.W = -rot.W;
70 offset *= rot; 70 offset *= rot;
71 71
72 return pos + offset; 72 return pos + offset;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index a8e943a..161cf82 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -623,8 +623,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
623 switch (cmd) 623 switch (cmd)
624 { 624 {
625 case "info ui": 625 case "info ui":
626 // Send info:
627 SendTelehubInfo(client);
628 break; 626 break;
629 627
630 case "connect": 628 case "connect":
@@ -634,32 +632,31 @@ namespace OpenSim.Region.CoreModules.World.Estate
634 return; 632 return;
635 SceneObjectGroup grp = part.ParentGroup; 633 SceneObjectGroup grp = part.ParentGroup;
636 634
637 if (m_Telehub.Connect(grp)) 635 m_Telehub.Connect(grp);
638 SendTelehubInfo(client);
639 break; 636 break;
640 637
641 case "delete": 638 case "delete":
642 // Disconnect Telehub 639 // Disconnect Telehub
643 if (m_Telehub.Disconnect()) 640 m_Telehub.Disconnect();
644 SendTelehubInfo(client);
645 break; 641 break;
646 642
647 case "spawnpoint add": 643 case "spawnpoint add":
648 // Add SpawnPoint to the Telehub 644 // Add SpawnPoint to the Telehub
649 part = Scene.GetSceneObjectPart((uint)param1); 645 part = Scene.GetSceneObjectPart((uint)param1);
650 if( m_Telehub.AddSpawnPoint(part.AbsolutePosition)) 646 if (part == null)
651 SendTelehubInfo(client); 647 return;
648 m_Telehub.AddSpawnPoint(part.AbsolutePosition);
652 break; 649 break;
653 650
654 case "spawnpoint remove": 651 case "spawnpoint remove":
655 // Remove SpawnPoint from Telehub 652 // Remove SpawnPoint from Telehub
656 if (m_Telehub.RemoveSpawnPoint((int)param1)) 653 m_Telehub.RemoveSpawnPoint((int)param1);
657 SendTelehubInfo(client);
658 break; 654 break;
659 655
660 default: 656 default:
661 break; 657 break;
662 } 658 }
659 SendTelehubInfo(client);
663 } 660 }
664 661
665 private void SendSimulatorBlueBoxMessage( 662 private void SendSimulatorBlueBoxMessage(
@@ -1358,7 +1355,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
1358 1355
1359 foreach (SpawnPoint sp in settings.SpawnPoints()) 1356 foreach (SpawnPoint sp in settings.SpawnPoints())
1360 { 1357 {
1361 spawnPoints.Add(sp.GetLocation(Vector3.Zero, telehub.GroupRotation)); 1358 spawnPoints.Add(sp.GetLocation(Vector3.Zero, Quaternion.Identity));
1362 } 1359 }
1363 1360
1364 client.SendTelehubInfo(settings.TelehubObject, 1361 client.SendTelehubInfo(settings.TelehubObject,
diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
index 3eb7efa..8bc831f 100644
--- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
@@ -26,15 +26,19 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
29using OpenMetaverse; 30using OpenMetaverse;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using OpenSim.Framework; 32using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using log4net;
33 35
34namespace OpenSim.Region.CoreModules.World.Estate 36namespace OpenSim.Region.CoreModules.World.Estate
35{ 37{
36 public class TelehubManager 38 public class TelehubManager
37 { 39 {
40 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41
38 Scene m_Scene; 42 Scene m_Scene;
39 43
40 public TelehubManager(Scene scene) 44 public TelehubManager(Scene scene)
@@ -43,78 +47,49 @@ namespace OpenSim.Region.CoreModules.World.Estate
43 } 47 }
44 48
45 // Connect the Telehub 49 // Connect the Telehub
46 public bool Connect(SceneObjectGroup grp) 50 public void Connect(SceneObjectGroup grp)
47 { 51 {
48 try 52 m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
49 {
50 m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
51
52 m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID;
53 m_Scene.RegionInfo.RegionSettings.Save();
54 }
55 catch (Exception ex)
56 {
57 return false;
58 }
59 53
60 return true; 54 m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID;
55 m_Scene.RegionInfo.RegionSettings.Save();
61 } 56 }
62 57
63 // Disconnect the Telehub: 58 // Disconnect the Telehub:
64 public bool Disconnect() 59 public void Disconnect()
65 { 60 {
66 if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) 61 if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
67 return false; 62 return;
68 63
69 try 64 m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero;
70 { 65 m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
71 m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; 66 m_Scene.RegionInfo.RegionSettings.Save();
72 m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
73 m_Scene.RegionInfo.RegionSettings.Save();
74 }
75 catch (Exception ex)
76 {
77 return false;
78 }
79
80 return true;
81 } 67 }
82 68
83 // Add a SpawnPoint to the Telehub 69 // Add a SpawnPoint to the Telehub
84 public bool AddSpawnPoint(Vector3 point) 70 public void AddSpawnPoint(Vector3 point)
85 { 71 {
86 if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) 72 if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
87 return false; 73 return;
88 74
89 SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject); 75 SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject);
90 if (grp == null) 76 if (grp == null)
91 return false; 77 return;
92 78
93 try 79 SpawnPoint sp = new SpawnPoint();
94 { 80 sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point);
95 SpawnPoint sp = new SpawnPoint(); 81 m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp);
96 sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point); 82 m_Scene.RegionInfo.RegionSettings.Save();
97 m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp);
98 m_Scene.RegionInfo.RegionSettings.Save();
99 }
100 catch (Exception ex)
101 {
102 return false;
103 }
104
105 return true;
106 } 83 }
107 84
108 // Remove a SpawnPoint from the Telehub 85 // Remove a SpawnPoint from the Telehub
109 public bool RemoveSpawnPoint(int spawnpoint) 86 public void RemoveSpawnPoint(int spawnpoint)
110 { 87 {
111 if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) 88 if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
112 return false; 89 return;
113 90
114 m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); 91 m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint);
115 m_Scene.RegionInfo.RegionSettings.Save(); 92 m_Scene.RegionInfo.RegionSettings.Save();
116
117 return true;
118 } 93 }
119 } 94 }
120} 95}