aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs')
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs137
1 files changed, 0 insertions, 137 deletions
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
deleted file mode 100644
index f424e7f..0000000
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
+++ /dev/null
@@ -1,137 +0,0 @@
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 OpenSim.Framework;
31using OpenSim.Region.CoreModules.Avatar.Attachments;
32using OpenSim.Region.CoreModules.Avatar.Gods;
33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes;
35
36namespace OpenSim.Region.RegionCombinerModule
37{
38 public class RegionCombinerIndividualEventForwarder
39 {
40 private Scene m_rootScene;
41 private Scene m_virtScene;
42
43 public RegionCombinerIndividualEventForwarder(Scene rootScene, Scene virtScene)
44 {
45 m_rootScene = rootScene;
46 m_virtScene = virtScene;
47 }
48
49 public void ClientConnect(IClientAPI client)
50 {
51 m_virtScene.UnSubscribeToClientPrimEvents(client);
52 m_virtScene.UnSubscribeToClientPrimRezEvents(client);
53 m_virtScene.UnSubscribeToClientInventoryEvents(client);
54 ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client);
55 //m_virtScene.UnSubscribeToClientTeleportEvents(client);
56 m_virtScene.UnSubscribeToClientScriptEvents(client);
57
58 IGodsModule virtGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
59 if (virtGodsModule != null)
60 ((GodsModule)virtGodsModule).UnsubscribeFromClientEvents(client);
61
62 m_virtScene.UnSubscribeToClientNetworkEvents(client);
63
64 m_rootScene.SubscribeToClientPrimEvents(client);
65 client.OnAddPrim += LocalAddNewPrim;
66 client.OnRezObject += LocalRezObject;
67
68 m_rootScene.SubscribeToClientInventoryEvents(client);
69 ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client);
70 //m_rootScene.SubscribeToClientTeleportEvents(client);
71 m_rootScene.SubscribeToClientScriptEvents(client);
72
73 IGodsModule rootGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
74 if (rootGodsModule != null)
75 ((GodsModule)rootGodsModule).UnsubscribeFromClientEvents(client);
76
77 m_rootScene.SubscribeToClientNetworkEvents(client);
78 }
79
80 public void ClientClosed(UUID clientid, Scene scene)
81 {
82 }
83
84 /// <summary>
85 /// Fixes position based on the region the Rez event came in on
86 /// </summary>
87 /// <param name="remoteclient"></param>
88 /// <param name="itemid"></param>
89 /// <param name="rayend"></param>
90 /// <param name="raystart"></param>
91 /// <param name="raytargetid"></param>
92 /// <param name="bypassraycast"></param>
93 /// <param name="rayendisintersection"></param>
94 /// <param name="rezselected"></param>
95 /// <param name="removeitem"></param>
96 /// <param name="fromtaskid"></param>
97 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart,
98 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem,
99 UUID fromtaskid)
100 {
101 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
102 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
103 rayend.X += differenceX * (int)Constants.RegionSize;
104 rayend.Y += differenceY * (int)Constants.RegionSize;
105 raystart.X += differenceX * (int)Constants.RegionSize;
106 raystart.Y += differenceY * (int)Constants.RegionSize;
107
108 m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
109 rayendisintersection, rezselected, removeitem, fromtaskid);
110 }
111 /// <summary>
112 /// Fixes position based on the region the AddPrimShape event came in on
113 /// </summary>
114 /// <param name="ownerid"></param>
115 /// <param name="groupid"></param>
116 /// <param name="rayend"></param>
117 /// <param name="rot"></param>
118 /// <param name="shape"></param>
119 /// <param name="bypassraycast"></param>
120 /// <param name="raystart"></param>
121 /// <param name="raytargetid"></param>
122 /// <param name="rayendisintersection"></param>
123 private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot,
124 PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid,
125 byte rayendisintersection)
126 {
127 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
128 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
129 rayend.X += differenceX * (int)Constants.RegionSize;
130 rayend.Y += differenceY * (int)Constants.RegionSize;
131 raystart.X += differenceX * (int)Constants.RegionSize;
132 raystart.Y += differenceY * (int)Constants.RegionSize;
133 m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
134 rayendisintersection);
135 }
136 }
137} \ No newline at end of file