aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
diff options
context:
space:
mode:
authorBlueWall2012-01-20 23:50:37 -0500
committerBlueWall2012-01-20 23:50:37 -0500
commitb6f3de5028ab9a288f60b020a0dffda079dc550d (patch)
tree57505b2486d98bfd379a9ce0ada9c32f0ddedf6c /OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
parentAdd "image queues clear <first-name> <last-name>" console command (diff)
downloadopensim-SC_OLD-b6f3de5028ab9a288f60b020a0dffda079dc550d.zip
opensim-SC_OLD-b6f3de5028ab9a288f60b020a0dffda079dc550d.tar.gz
opensim-SC_OLD-b6f3de5028ab9a288f60b020a0dffda079dc550d.tar.bz2
opensim-SC_OLD-b6f3de5028ab9a288f60b020a0dffda079dc550d.tar.xz
Telehub Support:
Support for viewer side of telehub management. Can manupulate Telehubs and SpawnPoints from the viewer estate managemnt tools. This is a work in progress and does not yet persist or affect teleport routing.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs130
1 files changed, 130 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
new file mode 100644
index 0000000..c99c9ba
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
@@ -0,0 +1,130 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30using System.Collections.Generic;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes;
33
34namespace OpenSim.Region.CoreModules.World.Estate
35{
36 public class TelehubManager
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
47 private UUID ObjectID;
48 private string ObjectName;
49 private Vector3 ObjectPosition;
50 Quaternion ObjectRotation;
51 List<Vector3> SpawnPoint = new List<Vector3>();
52 UUID EstateID;
53 bool m_HasTelehub = false;
54 Scene m_Scene;
55 // This will get an option...
56 Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,-3.0f);
57
58 public bool HasTelehub
59 {
60 get { return m_HasTelehub; }
61 }
62
63 public TelehubManager(Scene scene)
64 {
65 m_Scene = scene;
66 }
67
68 // Fill our Telehub struct with values
69 public Telehub TelehubVals()
70 {
71 Telehub telehub = new Telehub();
72
73 telehub.ObjectID = ObjectID;
74 telehub.ObjectName = ObjectName;
75 telehub.ObjectPosition = ObjectPosition;
76 telehub.ObjectRotation = ObjectRotation;
77 telehub.SpawnPoint = SpawnPoint;
78 return telehub;
79 }
80
81 // Connect the Telehub
82 public Telehub Connect(SceneObjectPart part)
83 {
84 ObjectID = part.UUID;
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
93 return TelehubVals();
94 }
95
96 // Disconnect the Telehub
97 public Telehub DisConnect(SceneObjectPart part)
98 {
99 ObjectID = UUID.Zero;
100 ObjectName = String.Empty;
101 ObjectPosition = Vector3.Zero;
102 ObjectRotation = Quaternion.Identity;
103 SpawnPoint.Clear();
104 m_HasTelehub = false;
105
106 return TelehubVals();
107 }
108
109 // Add a SpawnPoint to the Telehub
110 public Telehub AddSpawnPoint(Vector3 point)
111 {
112 float dist = (float) Util.GetDistanceTo(ObjectPosition, point);
113
114 Vector3 nvec = Util.GetNormalizedVector(point - ObjectPosition);
115
116 Vector3 spoint = nvec * dist;
117
118 SpawnPoint.Add(spoint);
119 return TelehubVals();
120 }
121
122 // Remove a SpawnPoint from the Telehub
123 public Telehub RemoveSpawnPoint(int spawnpoint)
124 {
125 SpawnPoint.RemoveAt(spawnpoint);
126
127 return TelehubVals();
128 }
129 }
130} \ No newline at end of file