diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 65 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | 130 |
2 files changed, 194 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 58d9455..0d4df6c 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -53,6 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
53 | protected EstateManagementCommands m_commands; | 53 | protected EstateManagementCommands m_commands; |
54 | 54 | ||
55 | private EstateTerrainXferHandler TerrainUploader; | 55 | private EstateTerrainXferHandler TerrainUploader; |
56 | private TelehubManager m_Telehub; | ||
56 | 57 | ||
57 | public event ChangeDelegate OnRegionInfoChange; | 58 | public event ChangeDelegate OnRegionInfoChange; |
58 | public event ChangeDelegate OnEstateInfoChange; | 59 | public event ChangeDelegate OnEstateInfoChange; |
@@ -599,6 +600,65 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
599 | } | 600 | } |
600 | } | 601 | } |
601 | 602 | ||
603 | private void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) | ||
604 | { | ||
605 | uint ObjectLocalID; | ||
606 | SceneObjectPart part; | ||
607 | // UUID EstateID = Scene.RegionInfo.EstateSettings.EstateID; | ||
608 | TelehubManager.Telehub telehub; | ||
609 | |||
610 | switch (cmd) | ||
611 | { | ||
612 | case "info ui": | ||
613 | // Send info: | ||
614 | if (m_Telehub.HasTelehub) | ||
615 | { | ||
616 | telehub = m_Telehub.TelehubVals(); | ||
617 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | ||
618 | telehub.ObjectRotation, telehub.SpawnPoint); | ||
619 | } | ||
620 | else | ||
621 | { | ||
622 | return; | ||
623 | } | ||
624 | break; | ||
625 | |||
626 | case "connect": | ||
627 | // Add the Telehub | ||
628 | part = Scene.GetSceneObjectPart((uint)param1); | ||
629 | telehub = m_Telehub.Connect(part); | ||
630 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | ||
631 | telehub.ObjectRotation, telehub.SpawnPoint); | ||
632 | break; | ||
633 | |||
634 | case "delete": | ||
635 | // Disconnect Telehub | ||
636 | part = Scene.GetSceneObjectPart((uint)param1); | ||
637 | telehub = m_Telehub.DisConnect(part); | ||
638 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | ||
639 | telehub.ObjectRotation, telehub.SpawnPoint); | ||
640 | break; | ||
641 | |||
642 | case "spawnpoint add": | ||
643 | // Add SpawnPoint to the Telehub | ||
644 | part = Scene.GetSceneObjectPart((uint)param1); | ||
645 | telehub = m_Telehub.AddSpawnPoint(part.AbsolutePosition); | ||
646 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | ||
647 | telehub.ObjectRotation, telehub.SpawnPoint); | ||
648 | break; | ||
649 | |||
650 | case "spawnpoint remove": | ||
651 | // Remove SpawnPoint from Telehub | ||
652 | telehub = m_Telehub.RemoveSpawnPoint((int)param1); | ||
653 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | ||
654 | telehub.ObjectRotation, telehub.SpawnPoint); | ||
655 | break; | ||
656 | |||
657 | default: | ||
658 | break; | ||
659 | } | ||
660 | } | ||
661 | |||
602 | private void SendSimulatorBlueBoxMessage( | 662 | private void SendSimulatorBlueBoxMessage( |
603 | IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) | 663 | IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) |
604 | { | 664 | { |
@@ -1055,7 +1115,9 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1055 | Scene.RegisterModuleInterface<IEstateModule>(this); | 1115 | Scene.RegisterModuleInterface<IEstateModule>(this); |
1056 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; | 1116 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; |
1057 | Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; | 1117 | Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; |
1058 | 1118 | ||
1119 | m_Telehub = new TelehubManager(scene); | ||
1120 | |||
1059 | m_commands = new EstateManagementCommands(this); | 1121 | m_commands = new EstateManagementCommands(this); |
1060 | m_commands.Initialise(); | 1122 | m_commands.Initialise(); |
1061 | } | 1123 | } |
@@ -1109,6 +1171,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1109 | client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; | 1171 | client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; |
1110 | client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; | 1172 | client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; |
1111 | client.OnEstateChangeInfo += handleEstateChangeInfo; | 1173 | client.OnEstateChangeInfo += handleEstateChangeInfo; |
1174 | client.OnEstateManageTelehub += handleOnEstateManageTelehub; | ||
1112 | client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; | 1175 | client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; |
1113 | client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; | 1176 | client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; |
1114 | client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; | 1177 | client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; |
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 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using System.Collections.Generic; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | |||
34 | namespace 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 | ||