opensim-development – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | eva | 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 OpenSim.Framework; |
||
31 | using OpenSim.Region.CoreModules.Avatar.Attachments; |
||
32 | using OpenSim.Region.CoreModules.Avatar.Gods; |
||
33 | using OpenSim.Region.Framework.Interfaces; |
||
34 | using OpenSim.Region.Framework.Scenes; |
||
35 | |||
36 | namespace 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 | if(m_virtScene.AttachmentsModule != null) |
||
55 | ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client); |
||
56 | //m_virtScene.UnSubscribeToClientTeleportEvents(client); |
||
57 | m_virtScene.UnSubscribeToClientScriptEvents(client); |
||
58 | |||
59 | IGodsModule virtGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>(); |
||
60 | if (virtGodsModule != null) |
||
61 | ((GodsModule)virtGodsModule).UnsubscribeFromClientEvents(client); |
||
62 | |||
63 | m_virtScene.UnSubscribeToClientNetworkEvents(client); |
||
64 | |||
65 | m_rootScene.SubscribeToClientPrimEvents(client); |
||
66 | client.OnAddPrim += LocalAddNewPrim; |
||
67 | client.OnRezObject += LocalRezObject; |
||
68 | |||
69 | m_rootScene.SubscribeToClientInventoryEvents(client); |
||
70 | if (m_rootScene.AttachmentsModule != null) |
||
71 | ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client); |
||
72 | //m_rootScene.SubscribeToClientTeleportEvents(client); |
||
73 | m_rootScene.SubscribeToClientScriptEvents(client); |
||
74 | |||
75 | IGodsModule rootGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>(); |
||
76 | if (rootGodsModule != null) |
||
77 | ((GodsModule)rootGodsModule).UnsubscribeFromClientEvents(client); |
||
78 | |||
79 | m_rootScene.SubscribeToClientNetworkEvents(client); |
||
80 | } |
||
81 | |||
82 | public void ClientClosed(UUID clientid, Scene scene) |
||
83 | { |
||
84 | } |
||
85 | |||
86 | /// <summary> |
||
87 | /// Fixes position based on the region the Rez event came in on |
||
88 | /// </summary> |
||
89 | /// <param name="remoteclient"></param> |
||
90 | /// <param name="itemid"></param> |
||
91 | /// <param name="rayend"></param> |
||
92 | /// <param name="raystart"></param> |
||
93 | /// <param name="raytargetid"></param> |
||
94 | /// <param name="bypassraycast"></param> |
||
95 | /// <param name="rayendisintersection"></param> |
||
96 | /// <param name="rezselected"></param> |
||
97 | /// <param name="removeitem"></param> |
||
98 | /// <param name="fromtaskid"></param> |
||
99 | private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, |
||
100 | UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, |
||
101 | UUID fromtaskid) |
||
102 | { |
||
103 | int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; |
||
104 | int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; |
||
105 | rayend.X += differenceX * (int)Constants.RegionSize; |
||
106 | rayend.Y += differenceY * (int)Constants.RegionSize; |
||
107 | raystart.X += differenceX * (int)Constants.RegionSize; |
||
108 | raystart.Y += differenceY * (int)Constants.RegionSize; |
||
109 | |||
110 | m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast, |
||
111 | rayendisintersection, rezselected, removeitem, fromtaskid); |
||
112 | } |
||
113 | /// <summary> |
||
114 | /// Fixes position based on the region the AddPrimShape event came in on |
||
115 | /// </summary> |
||
116 | /// <param name="ownerid"></param> |
||
117 | /// <param name="groupid"></param> |
||
118 | /// <param name="rayend"></param> |
||
119 | /// <param name="rot"></param> |
||
120 | /// <param name="shape"></param> |
||
121 | /// <param name="bypassraycast"></param> |
||
122 | /// <param name="raystart"></param> |
||
123 | /// <param name="raytargetid"></param> |
||
124 | /// <param name="rayendisintersection"></param> |
||
125 | private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, |
||
126 | PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, |
||
127 | byte rayendisintersection) |
||
128 | { |
||
129 | int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; |
||
130 | int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; |
||
131 | rayend.X += differenceX * (int)Constants.RegionSize; |
||
132 | rayend.Y += differenceY * (int)Constants.RegionSize; |
||
133 | raystart.X += differenceX * (int)Constants.RegionSize; |
||
134 | raystart.Y += differenceY * (int)Constants.RegionSize; |
||
135 | m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid, |
||
136 | rayendisintersection); |
||
137 | } |
||
138 | } |
||
139 | } |