aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-01-24 01:48:38 +0100
committerMelanie2012-01-24 02:36:35 +0000
commita4977bbe190fb6c1eb5c45247b9222c719118fd4 (patch)
treec6e028bc3b06c607ff5372a1808b5922a74801b0 /OpenSim
parentReverse the spawn point distance vector (diff)
downloadopensim-SC_OLD-a4977bbe190fb6c1eb5c45247b9222c719118fd4.zip
opensim-SC_OLD-a4977bbe190fb6c1eb5c45247b9222c719118fd4.tar.gz
opensim-SC_OLD-a4977bbe190fb6c1eb5c45247b9222c719118fd4.tar.bz2
opensim-SC_OLD-a4977bbe190fb6c1eb5c45247b9222c719118fd4.tar.xz
Simplify and streamline telehub editing code. Verify rotations and fix
spwan point positioning on rotated telehubs.
Diffstat (limited to 'OpenSim')
-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 9ffde03..e115432 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 20f3903..2e1487f 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -608,8 +608,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
608 switch (cmd) 608 switch (cmd)
609 { 609 {
610 case "info ui": 610 case "info ui":
611 // Send info:
612 SendTelehubInfo(client);
613 break; 611 break;
614 612
615 case "connect": 613 case "connect":
@@ -619,32 +617,31 @@ namespace OpenSim.Region.CoreModules.World.Estate
619 return; 617 return;
620 SceneObjectGroup grp = part.ParentGroup; 618 SceneObjectGroup grp = part.ParentGroup;
621 619
622 if (m_Telehub.Connect(grp)) 620 m_Telehub.Connect(grp);
623 SendTelehubInfo(client);
624 break; 621 break;
625 622
626 case "delete": 623 case "delete":
627 // Disconnect Telehub 624 // Disconnect Telehub
628 if (m_Telehub.Disconnect()) 625 m_Telehub.Disconnect();
629 SendTelehubInfo(client);
630 break; 626 break;
631 627
632 case "spawnpoint add": 628 case "spawnpoint add":
633 // Add SpawnPoint to the Telehub 629 // Add SpawnPoint to the Telehub
634 part = Scene.GetSceneObjectPart((uint)param1); 630 part = Scene.GetSceneObjectPart((uint)param1);
635 if( m_Telehub.AddSpawnPoint(part.AbsolutePosition)) 631 if (part == null)
636 SendTelehubInfo(client); 632 return;
633 m_Telehub.AddSpawnPoint(part.AbsolutePosition);
637 break; 634 break;
638 635
639 case "spawnpoint remove": 636 case "spawnpoint remove":
640 // Remove SpawnPoint from Telehub 637 // Remove SpawnPoint from Telehub
641 if (m_Telehub.RemoveSpawnPoint((int)param1)) 638 m_Telehub.RemoveSpawnPoint((int)param1);
642 SendTelehubInfo(client);
643 break; 639 break;
644 640
645 default: 641 default:
646 break; 642 break;
647 } 643 }
644 SendTelehubInfo(client);
648 } 645 }
649 646
650 private void SendSimulatorBlueBoxMessage( 647 private void SendSimulatorBlueBoxMessage(
@@ -1309,7 +1306,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
1309 1306
1310 foreach (SpawnPoint sp in settings.SpawnPoints()) 1307 foreach (SpawnPoint sp in settings.SpawnPoints())
1311 { 1308 {
1312 spawnPoints.Add(sp.GetLocation(Vector3.Zero, telehub.GroupRotation)); 1309 spawnPoints.Add(sp.GetLocation(Vector3.Zero, Quaternion.Identity));
1313 } 1310 }
1314 1311
1315 client.SendTelehubInfo(settings.TelehubObject, 1312 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}