aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
diff options
context:
space:
mode:
authorBlueWall2012-01-21 23:26:27 -0500
committerBlueWall2012-01-21 23:26:27 -0500
commit32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85 (patch)
tree8c19dbfa8975080d7bbbeaa1e2de4072520c899f /OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-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/World/Estate/TelehubManager.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs111
1 files changed, 62 insertions, 49 deletions
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