aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs105
1 files changed, 52 insertions, 53 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
index ee77ae1..68b4ba5 100644
--- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
@@ -35,83 +35,66 @@ 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(SceneObjectPart part)
76 { 47 {
77 m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); 48 bool result = false;
78 49
79 m_Scene.RegionInfo.RegionSettings.TelehubObject = part.UUID; 50 if (m_Scene.RegionInfo.RegionSettings.HasTelehub)
80 m_Scene.RegionInfo.RegionSettings.TelehubName = part.Name; 51 return result;
81 m_Scene.RegionInfo.RegionSettings.TelehubPos = part.AbsolutePosition;
82 m_Scene.RegionInfo.RegionSettings.TelehubRot = part.GetWorldRotation();
83 52
84 // Clear this for now 53 try
85 m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(InitialSpawnPoint); 54 {
86 m_Scene.RegionInfo.RegionSettings.HasTelehub = true; 55 m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
87 m_Scene.RegionInfo.RegionSettings.Save(); 56
88 return true; 57 m_Scene.RegionInfo.RegionSettings.TelehubObject = part.UUID;
58 m_Scene.RegionInfo.RegionSettings.TelehubName = part.Name;
59 m_Scene.RegionInfo.RegionSettings.TelehubPos = part.AbsolutePosition;
60 m_Scene.RegionInfo.RegionSettings.TelehubRot = part.GetWorldRotation();
61 m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(new Vector3(0.0f,0.0f,0.0f));
62 m_Scene.RegionInfo.RegionSettings.HasTelehub = true;
63 m_Scene.RegionInfo.RegionSettings.Save();
64
65 result = true;
66 }
67 catch (Exception ex)
68 {
69 result = false;
70 }
71
72 return result;
89 } 73 }
90 74
91 // Disconnect the Telehub: Clear it out for now, look at just disableing 75 // Disconnect the Telehub:
92 public bool DisConnect(SceneObjectPart part) 76 public bool DisConnect(SceneObjectPart part)
93 { 77 {
94 bool result = false; 78 bool result = false;
95 79
96 try{ 80 if (!m_Scene.RegionInfo.RegionSettings.HasTelehub)
81 return result;
82
83 try
84 {
97 m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; 85 m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero;
98 m_Scene.RegionInfo.RegionSettings.TelehubName = String.Empty; 86 m_Scene.RegionInfo.RegionSettings.TelehubName = String.Empty;
99 m_Scene.RegionInfo.RegionSettings.TelehubPos = Vector3.Zero; 87 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(); 88 m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
103 m_Scene.RegionInfo.RegionSettings.HasTelehub = false; 89 m_Scene.RegionInfo.RegionSettings.HasTelehub = false;
104 m_Scene.RegionInfo.RegionSettings.Save(); 90 m_Scene.RegionInfo.RegionSettings.Save();
91
105 result = true; 92 result = true;
106 } 93 }
107 catch (Exception ex) 94 catch (Exception ex)
108 { 95 {
109 result = false; 96 result = false;
110 } 97 }
111 finally
112 {
113
114 }
115 98
116 return result; 99 return result;
117 } 100 }
@@ -119,19 +102,35 @@ namespace OpenSim.Region.CoreModules.World.Estate
119 // Add a SpawnPoint to the Telehub 102 // Add a SpawnPoint to the Telehub
120 public bool AddSpawnPoint(Vector3 point) 103 public bool AddSpawnPoint(Vector3 point)
121 { 104 {
105 bool result = false;
122 106
123 float dist = (float) Util.GetDistanceTo(m_Scene.RegionInfo.RegionSettings.TelehubPos, point); 107 if (!m_Scene.RegionInfo.RegionSettings.HasTelehub)
124 Vector3 nvec = Util.GetNormalizedVector(point - m_Scene.RegionInfo.RegionSettings.TelehubPos); 108 return result;
125 Vector3 spoint = nvec * dist;
126 109
127 m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(spoint); 110 try
128 m_Scene.RegionInfo.RegionSettings.Save(); 111 {
129 return true; 112 float dist = (float) Util.GetDistanceTo(m_Scene.RegionInfo.RegionSettings.TelehubPos, point);
113 Vector3 nvec = Util.GetNormalizedVector(point - m_Scene.RegionInfo.RegionSettings.TelehubPos);
114 Vector3 spoint = nvec * dist;
115
116 m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(spoint);
117 m_Scene.RegionInfo.RegionSettings.Save();
118 result = true;
119 }
120 catch (Exception ex)
121 {
122 result = false;
123 }
124
125 return result;
130 } 126 }
131 127
132 // Remove a SpawnPoint from the Telehub 128 // Remove a SpawnPoint from the Telehub
133 public bool RemoveSpawnPoint(int spawnpoint) 129 public bool RemoveSpawnPoint(int spawnpoint)
134 { 130 {
131 if (!m_Scene.RegionInfo.RegionSettings.HasTelehub)
132 return false;
133
135 m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); 134 m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint);
136 m_Scene.RegionInfo.RegionSettings.Save(); 135 m_Scene.RegionInfo.RegionSettings.Save();
137 136