diff options
author | Sean Dague | 2007-07-16 15:40:11 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-16 15:40:11 +0000 |
commit | 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch) | |
tree | e3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |
parent | *Trunk compiles now (diff) | |
download | opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2 opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz |
changed to native line ending encoding
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 1236 |
1 files changed, 618 insertions, 618 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 347625a..e37d105 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -1,618 +1,618 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
32 | using OpenSim.Framework.Interfaces; | 32 | using OpenSim.Framework.Interfaces; |
33 | using OpenSim.Framework.Types; | 33 | using OpenSim.Framework.Types; |
34 | 34 | ||
35 | namespace OpenSim.Region.Environment.Scenes | 35 | namespace OpenSim.Region.Environment.Scenes |
36 | { | 36 | { |
37 | public partial class Scene | 37 | public partial class Scene |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// Modifies terrain using the specified information | 40 | /// Modifies terrain using the specified information |
41 | /// </summary> | 41 | /// </summary> |
42 | /// <param name="height">The height at which the user started modifying the terrain</param> | 42 | /// <param name="height">The height at which the user started modifying the terrain</param> |
43 | /// <param name="seconds">The number of seconds the modify button was pressed</param> | 43 | /// <param name="seconds">The number of seconds the modify button was pressed</param> |
44 | /// <param name="brushsize">The size of the brush used</param> | 44 | /// <param name="brushsize">The size of the brush used</param> |
45 | /// <param name="action">The action to be performed</param> | 45 | /// <param name="action">The action to be performed</param> |
46 | /// <param name="north">Distance from the north border where the cursor is located</param> | 46 | /// <param name="north">Distance from the north border where the cursor is located</param> |
47 | /// <param name="west">Distance from the west border where the cursor is located</param> | 47 | /// <param name="west">Distance from the west border where the cursor is located</param> |
48 | public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west) | 48 | public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west) |
49 | { | 49 | { |
50 | // Shiny. | 50 | // Shiny. |
51 | double size = (double)(1 << brushsize); | 51 | double size = (double)(1 << brushsize); |
52 | 52 | ||
53 | switch (action) | 53 | switch (action) |
54 | { | 54 | { |
55 | case 0: | 55 | case 0: |
56 | // flatten terrain | 56 | // flatten terrain |
57 | Terrain.flatten(north, west, size, (double)seconds / 100.0); | 57 | Terrain.flatten(north, west, size, (double)seconds / 100.0); |
58 | RegenerateTerrain(true, (int)north, (int)west); | 58 | RegenerateTerrain(true, (int)north, (int)west); |
59 | break; | 59 | break; |
60 | case 1: | 60 | case 1: |
61 | // raise terrain | 61 | // raise terrain |
62 | Terrain.raise(north, west, size, (double)seconds / 100.0); | 62 | Terrain.raise(north, west, size, (double)seconds / 100.0); |
63 | RegenerateTerrain(true, (int)north, (int)west); | 63 | RegenerateTerrain(true, (int)north, (int)west); |
64 | break; | 64 | break; |
65 | case 2: | 65 | case 2: |
66 | //lower terrain | 66 | //lower terrain |
67 | Terrain.lower(north, west, size, (double)seconds / 100.0); | 67 | Terrain.lower(north, west, size, (double)seconds / 100.0); |
68 | RegenerateTerrain(true, (int)north, (int)west); | 68 | RegenerateTerrain(true, (int)north, (int)west); |
69 | break; | 69 | break; |
70 | case 3: | 70 | case 3: |
71 | // smooth terrain | 71 | // smooth terrain |
72 | Terrain.smooth(north, west, size, (double)seconds / 100.0); | 72 | Terrain.smooth(north, west, size, (double)seconds / 100.0); |
73 | RegenerateTerrain(true, (int)north, (int)west); | 73 | RegenerateTerrain(true, (int)north, (int)west); |
74 | break; | 74 | break; |
75 | case 4: | 75 | case 4: |
76 | // noise | 76 | // noise |
77 | Terrain.noise(north, west, size, (double)seconds / 100.0); | 77 | Terrain.noise(north, west, size, (double)seconds / 100.0); |
78 | RegenerateTerrain(true, (int)north, (int)west); | 78 | RegenerateTerrain(true, (int)north, (int)west); |
79 | break; | 79 | break; |
80 | case 5: | 80 | case 5: |
81 | // revert | 81 | // revert |
82 | Terrain.revert(north, west, size, (double)seconds / 100.0); | 82 | Terrain.revert(north, west, size, (double)seconds / 100.0); |
83 | RegenerateTerrain(true, (int)north, (int)west); | 83 | RegenerateTerrain(true, (int)north, (int)west); |
84 | break; | 84 | break; |
85 | 85 | ||
86 | // CLIENT EXTENSIONS GO HERE | 86 | // CLIENT EXTENSIONS GO HERE |
87 | case 128: | 87 | case 128: |
88 | // erode-thermal | 88 | // erode-thermal |
89 | break; | 89 | break; |
90 | case 129: | 90 | case 129: |
91 | // erode-aerobic | 91 | // erode-aerobic |
92 | break; | 92 | break; |
93 | case 130: | 93 | case 130: |
94 | // erode-hydraulic | 94 | // erode-hydraulic |
95 | break; | 95 | break; |
96 | } | 96 | } |
97 | return; | 97 | return; |
98 | } | 98 | } |
99 | 99 | ||
100 | /// <summary> | 100 | /// <summary> |
101 | /// | 101 | /// |
102 | /// </summary> | 102 | /// </summary> |
103 | /// <remarks>Inefficient. TODO: Fixme</remarks> | 103 | /// <remarks>Inefficient. TODO: Fixme</remarks> |
104 | /// <param name="fromAgentID"></param> | 104 | /// <param name="fromAgentID"></param> |
105 | /// <param name="toAgentID"></param> | 105 | /// <param name="toAgentID"></param> |
106 | /// <param name="timestamp"></param> | 106 | /// <param name="timestamp"></param> |
107 | /// <param name="fromAgentName"></param> | 107 | /// <param name="fromAgentName"></param> |
108 | /// <param name="message"></param> | 108 | /// <param name="message"></param> |
109 | public void InstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message) | 109 | public void InstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message) |
110 | { | 110 | { |
111 | if (this.Avatars.ContainsKey(toAgentID)) | 111 | if (this.Avatars.ContainsKey(toAgentID)) |
112 | { | 112 | { |
113 | if (this.Avatars.ContainsKey(fromAgentID)) | 113 | if (this.Avatars.ContainsKey(fromAgentID)) |
114 | { | 114 | { |
115 | // Local sim message | 115 | // Local sim message |
116 | ScenePresence fromAvatar = this.Avatars[fromAgentID]; | 116 | ScenePresence fromAvatar = this.Avatars[fromAgentID]; |
117 | ScenePresence toAvatar = this.Avatars[toAgentID]; | 117 | ScenePresence toAvatar = this.Avatars[toAgentID]; |
118 | string fromName = fromAvatar.firstname + " " + fromAvatar.lastname; | 118 | string fromName = fromAvatar.firstname + " " + fromAvatar.lastname; |
119 | toAvatar.ControllingClient.SendInstantMessage(message, toAgentID, fromName); | 119 | toAvatar.ControllingClient.SendInstantMessage(message, toAgentID, fromName); |
120 | } | 120 | } |
121 | else | 121 | else |
122 | { | 122 | { |
123 | // Message came from a user outside the sim, ignore? | 123 | // Message came from a user outside the sim, ignore? |
124 | } | 124 | } |
125 | } | 125 | } |
126 | else | 126 | else |
127 | { | 127 | { |
128 | // Grid message | 128 | // Grid message |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | /// <summary> | 132 | /// <summary> |
133 | /// | 133 | /// |
134 | /// </summary> | 134 | /// </summary> |
135 | /// <param name="message"></param> | 135 | /// <param name="message"></param> |
136 | /// <param name="type"></param> | 136 | /// <param name="type"></param> |
137 | /// <param name="fromPos"></param> | 137 | /// <param name="fromPos"></param> |
138 | /// <param name="fromName"></param> | 138 | /// <param name="fromName"></param> |
139 | /// <param name="fromAgentID"></param> | 139 | /// <param name="fromAgentID"></param> |
140 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 140 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
141 | { | 141 | { |
142 | ScenePresence avatar = null; | 142 | ScenePresence avatar = null; |
143 | if (this.Avatars.ContainsKey(fromAgentID)) | 143 | if (this.Avatars.ContainsKey(fromAgentID)) |
144 | { | 144 | { |
145 | avatar = this.Avatars[fromAgentID]; | 145 | avatar = this.Avatars[fromAgentID]; |
146 | fromPos = avatar.Pos; | 146 | fromPos = avatar.Pos; |
147 | fromName = avatar.firstname + " " + avatar.lastname; | 147 | fromName = avatar.firstname + " " + avatar.lastname; |
148 | avatar = null; | 148 | avatar = null; |
149 | } | 149 | } |
150 | 150 | ||
151 | this.ForEachScenePresence(delegate(ScenePresence presence) | 151 | this.ForEachScenePresence(delegate(ScenePresence presence) |
152 | { | 152 | { |
153 | int dis = -1000; | 153 | int dis = -1000; |
154 | if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId)) | 154 | if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId)) |
155 | { | 155 | { |
156 | avatar = this.Avatars[presence.ControllingClient.AgentId]; | 156 | avatar = this.Avatars[presence.ControllingClient.AgentId]; |
157 | dis = (int)avatar.Pos.GetDistanceTo(fromPos); | 157 | dis = (int)avatar.Pos.GetDistanceTo(fromPos); |
158 | } | 158 | } |
159 | 159 | ||
160 | switch (type) | 160 | switch (type) |
161 | { | 161 | { |
162 | case 0: // Whisper | 162 | case 0: // Whisper |
163 | if ((dis < 10) && (dis > -10)) | 163 | if ((dis < 10) && (dis > -10)) |
164 | { | 164 | { |
165 | //should change so the message is sent through the avatar rather than direct to the ClientView | 165 | //should change so the message is sent through the avatar rather than direct to the ClientView |
166 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | 166 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, |
167 | fromAgentID); | 167 | fromAgentID); |
168 | } | 168 | } |
169 | break; | 169 | break; |
170 | case 1: // Say | 170 | case 1: // Say |
171 | if ((dis < 30) && (dis > -30)) | 171 | if ((dis < 30) && (dis > -30)) |
172 | { | 172 | { |
173 | //Console.WriteLine("sending chat"); | 173 | //Console.WriteLine("sending chat"); |
174 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | 174 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, |
175 | fromAgentID); | 175 | fromAgentID); |
176 | } | 176 | } |
177 | break; | 177 | break; |
178 | case 2: // Shout | 178 | case 2: // Shout |
179 | if ((dis < 100) && (dis > -100)) | 179 | if ((dis < 100) && (dis > -100)) |
180 | { | 180 | { |
181 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | 181 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, |
182 | fromAgentID); | 182 | fromAgentID); |
183 | } | 183 | } |
184 | break; | 184 | break; |
185 | 185 | ||
186 | case 0xff: // Broadcast | 186 | case 0xff: // Broadcast |
187 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, | 187 | presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, |
188 | fromAgentID); | 188 | fromAgentID); |
189 | break; | 189 | break; |
190 | } | 190 | } |
191 | }); | 191 | }); |
192 | } | 192 | } |
193 | 193 | ||
194 | /// <summary> | 194 | /// <summary> |
195 | /// | 195 | /// |
196 | /// </summary> | 196 | /// </summary> |
197 | /// <param name="primAsset"></param> | 197 | /// <param name="primAsset"></param> |
198 | /// <param name="pos"></param> | 198 | /// <param name="pos"></param> |
199 | public void RezObject(AssetBase primAsset, LLVector3 pos) | 199 | public void RezObject(AssetBase primAsset, LLVector3 pos) |
200 | { | 200 | { |
201 | 201 | ||
202 | } | 202 | } |
203 | 203 | ||
204 | /// <summary> | 204 | /// <summary> |
205 | /// | 205 | /// |
206 | /// </summary> | 206 | /// </summary> |
207 | /// <param name="packet"></param> | 207 | /// <param name="packet"></param> |
208 | /// <param name="simClient"></param> | 208 | /// <param name="simClient"></param> |
209 | public void DeRezObject(Packet packet, IClientAPI simClient) | 209 | public void DeRezObject(Packet packet, IClientAPI simClient) |
210 | { | 210 | { |
211 | 211 | ||
212 | } | 212 | } |
213 | 213 | ||
214 | /// <summary> | 214 | /// <summary> |
215 | /// | 215 | /// |
216 | /// </summary> | 216 | /// </summary> |
217 | /// <param name="remoteClient"></param> | 217 | /// <param name="remoteClient"></param> |
218 | public void SendAvatarsToClient(IClientAPI remoteClient) | 218 | public void SendAvatarsToClient(IClientAPI remoteClient) |
219 | { | 219 | { |
220 | 220 | ||
221 | } | 221 | } |
222 | 222 | ||
223 | /// <summary> | 223 | /// <summary> |
224 | /// | 224 | /// |
225 | /// </summary> | 225 | /// </summary> |
226 | /// <param name="originalPrim"></param> | 226 | /// <param name="originalPrim"></param> |
227 | /// <param name="offset"></param> | 227 | /// <param name="offset"></param> |
228 | /// <param name="flags"></param> | 228 | /// <param name="flags"></param> |
229 | public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags) | 229 | public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags) |
230 | { | 230 | { |
231 | SceneObject originPrim = null; | 231 | SceneObject originPrim = null; |
232 | foreach (EntityBase ent in Entities.Values) | 232 | foreach (EntityBase ent in Entities.Values) |
233 | { | 233 | { |
234 | if (ent is SceneObject) | 234 | if (ent is SceneObject) |
235 | { | 235 | { |
236 | if (((SceneObject)ent).rootLocalID == originalPrim) | 236 | if (((SceneObject)ent).rootLocalID == originalPrim) |
237 | { | 237 | { |
238 | originPrim = (SceneObject)ent; | 238 | originPrim = (SceneObject)ent; |
239 | break; | 239 | break; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | } | 242 | } |
243 | 243 | ||
244 | if (originPrim != null) | 244 | if (originPrim != null) |
245 | { | 245 | { |
246 | SceneObject copy = originPrim.Copy(); | 246 | SceneObject copy = originPrim.Copy(); |
247 | copy.Pos = copy.Pos + offset; | 247 | copy.Pos = copy.Pos + offset; |
248 | this.Entities.Add(copy.rootUUID, copy); | 248 | this.Entities.Add(copy.rootUUID, copy); |
249 | 249 | ||
250 | List<ScenePresence> avatars = this.RequestAvatarList(); | 250 | List<ScenePresence> avatars = this.RequestAvatarList(); |
251 | for (int i = 0; i < avatars.Count; i++) | 251 | for (int i = 0; i < avatars.Count; i++) |
252 | { | 252 | { |
253 | copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); | 253 | copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); |
254 | } | 254 | } |
255 | 255 | ||
256 | } | 256 | } |
257 | else | 257 | else |
258 | { | 258 | { |
259 | OpenSim.Framework.Console.MainLog.Instance.Warn("Attempted to duplicate nonexistant prim"); | 259 | OpenSim.Framework.Console.MainLog.Instance.Warn("Attempted to duplicate nonexistant prim"); |
260 | } | 260 | } |
261 | 261 | ||
262 | } | 262 | } |
263 | 263 | ||
264 | /// <summary> | 264 | /// <summary> |
265 | /// | 265 | /// |
266 | /// </summary> | 266 | /// </summary> |
267 | /// <param name="parentPrim"></param> | 267 | /// <param name="parentPrim"></param> |
268 | /// <param name="childPrims"></param> | 268 | /// <param name="childPrims"></param> |
269 | public void LinkObjects(uint parentPrim, List<uint> childPrims) | 269 | public void LinkObjects(uint parentPrim, List<uint> childPrims) |
270 | { | 270 | { |
271 | SceneObject parenPrim = null; | 271 | SceneObject parenPrim = null; |
272 | foreach (EntityBase ent in Entities.Values) | 272 | foreach (EntityBase ent in Entities.Values) |
273 | { | 273 | { |
274 | if (ent is SceneObject) | 274 | if (ent is SceneObject) |
275 | { | 275 | { |
276 | if (((SceneObject)ent).rootLocalID == parentPrim) | 276 | if (((SceneObject)ent).rootLocalID == parentPrim) |
277 | { | 277 | { |
278 | parenPrim = (SceneObject)ent; | 278 | parenPrim = (SceneObject)ent; |
279 | break; | 279 | break; |
280 | } | 280 | } |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | List<SceneObject> children = new List<SceneObject>(); | 284 | List<SceneObject> children = new List<SceneObject>(); |
285 | if (parenPrim != null) | 285 | if (parenPrim != null) |
286 | { | 286 | { |
287 | for (int i = 0; i < childPrims.Count; i++) | 287 | for (int i = 0; i < childPrims.Count; i++) |
288 | { | 288 | { |
289 | foreach (EntityBase ent in Entities.Values) | 289 | foreach (EntityBase ent in Entities.Values) |
290 | { | 290 | { |
291 | if (ent is SceneObject) | 291 | if (ent is SceneObject) |
292 | { | 292 | { |
293 | if (((SceneObject)ent).rootLocalID == childPrims[i]) | 293 | if (((SceneObject)ent).rootLocalID == childPrims[i]) |
294 | { | 294 | { |
295 | children.Add((SceneObject)ent); | 295 | children.Add((SceneObject)ent); |
296 | } | 296 | } |
297 | } | 297 | } |
298 | } | 298 | } |
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | foreach (SceneObject sceneObj in children) | 302 | foreach (SceneObject sceneObj in children) |
303 | { | 303 | { |
304 | parenPrim.AddNewChildPrims(sceneObj); | 304 | parenPrim.AddNewChildPrims(sceneObj); |
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | /// <summary> | 308 | /// <summary> |
309 | /// | 309 | /// |
310 | /// </summary> | 310 | /// </summary> |
311 | /// <param name="primLocalID"></param> | 311 | /// <param name="primLocalID"></param> |
312 | /// <param name="shapeBlock"></param> | 312 | /// <param name="shapeBlock"></param> |
313 | public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) | 313 | public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) |
314 | { | 314 | { |
315 | Primitive prim = null; | 315 | Primitive prim = null; |
316 | foreach (EntityBase ent in Entities.Values) | 316 | foreach (EntityBase ent in Entities.Values) |
317 | { | 317 | { |
318 | if (ent is SceneObject) | 318 | if (ent is SceneObject) |
319 | { | 319 | { |
320 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); | 320 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); |
321 | if (prim != null) | 321 | if (prim != null) |
322 | { | 322 | { |
323 | prim.UpdateShape(shapeBlock); | 323 | prim.UpdateShape(shapeBlock); |
324 | break; | 324 | break; |
325 | } | 325 | } |
326 | } | 326 | } |
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
330 | /// <summary> | 330 | /// <summary> |
331 | /// | 331 | /// |
332 | /// </summary> | 332 | /// </summary> |
333 | /// <param name="primLocalID"></param> | 333 | /// <param name="primLocalID"></param> |
334 | /// <param name="remoteClient"></param> | 334 | /// <param name="remoteClient"></param> |
335 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) | 335 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) |
336 | { | 336 | { |
337 | foreach (EntityBase ent in Entities.Values) | 337 | foreach (EntityBase ent in Entities.Values) |
338 | { | 338 | { |
339 | if (ent is SceneObject) | 339 | if (ent is SceneObject) |
340 | { | 340 | { |
341 | if (((SceneObject)ent).rootLocalID == primLocalID) | 341 | if (((SceneObject)ent).rootLocalID == primLocalID) |
342 | { | 342 | { |
343 | ((SceneObject)ent).GetProperites(remoteClient); | 343 | ((SceneObject)ent).GetProperites(remoteClient); |
344 | ((SceneObject)ent).isSelected = true; | 344 | ((SceneObject)ent).isSelected = true; |
345 | this.ParcelManager.setPrimsTainted(); | 345 | this.ParcelManager.setPrimsTainted(); |
346 | break; | 346 | break; |
347 | } | 347 | } |
348 | } | 348 | } |
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
352 | /// <summary> | 352 | /// <summary> |
353 | /// | 353 | /// |
354 | /// </summary> | 354 | /// </summary> |
355 | /// <param name="primLocalID"></param> | 355 | /// <param name="primLocalID"></param> |
356 | /// <param name="remoteClient"></param> | 356 | /// <param name="remoteClient"></param> |
357 | public void DeselectPrim(uint primLocalID, IClientAPI remoteClient) | 357 | public void DeselectPrim(uint primLocalID, IClientAPI remoteClient) |
358 | { | 358 | { |
359 | foreach (EntityBase ent in Entities.Values) | 359 | foreach (EntityBase ent in Entities.Values) |
360 | { | 360 | { |
361 | if (ent is SceneObject) | 361 | if (ent is SceneObject) |
362 | { | 362 | { |
363 | if (((SceneObject)ent).rootLocalID == primLocalID) | 363 | if (((SceneObject)ent).rootLocalID == primLocalID) |
364 | { | 364 | { |
365 | ((SceneObject)ent).isSelected = false; | 365 | ((SceneObject)ent).isSelected = false; |
366 | this.ParcelManager.setPrimsTainted(); | 366 | this.ParcelManager.setPrimsTainted(); |
367 | break; | 367 | break; |
368 | } | 368 | } |
369 | } | 369 | } |
370 | } | 370 | } |
371 | } | 371 | } |
372 | 372 | ||
373 | /// <summary> | 373 | /// <summary> |
374 | /// | 374 | /// |
375 | /// </summary> | 375 | /// </summary> |
376 | /// <param name="primLocalID"></param> | 376 | /// <param name="primLocalID"></param> |
377 | /// <param name="description"></param> | 377 | /// <param name="description"></param> |
378 | public void PrimDescription(uint primLocalID, string description) | 378 | public void PrimDescription(uint primLocalID, string description) |
379 | { | 379 | { |
380 | Primitive prim = null; | 380 | Primitive prim = null; |
381 | foreach (EntityBase ent in Entities.Values) | 381 | foreach (EntityBase ent in Entities.Values) |
382 | { | 382 | { |
383 | if (ent is SceneObject) | 383 | if (ent is SceneObject) |
384 | { | 384 | { |
385 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); | 385 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); |
386 | if (prim != null) | 386 | if (prim != null) |
387 | { | 387 | { |
388 | prim.Description = description; | 388 | prim.Description = description; |
389 | break; | 389 | break; |
390 | } | 390 | } |
391 | } | 391 | } |
392 | } | 392 | } |
393 | } | 393 | } |
394 | 394 | ||
395 | /// <summary> | 395 | /// <summary> |
396 | /// | 396 | /// |
397 | /// </summary> | 397 | /// </summary> |
398 | /// <param name="primLocalID"></param> | 398 | /// <param name="primLocalID"></param> |
399 | /// <param name="description"></param> | 399 | /// <param name="description"></param> |
400 | public void PrimName(uint primLocalID, string name) | 400 | public void PrimName(uint primLocalID, string name) |
401 | { | 401 | { |
402 | Primitive prim = null; | 402 | Primitive prim = null; |
403 | foreach (EntityBase ent in Entities.Values) | 403 | foreach (EntityBase ent in Entities.Values) |
404 | { | 404 | { |
405 | if (ent is SceneObject) | 405 | if (ent is SceneObject) |
406 | { | 406 | { |
407 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); | 407 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); |
408 | if (prim != null) | 408 | if (prim != null) |
409 | { | 409 | { |
410 | prim.Name = name; | 410 | prim.Name = name; |
411 | break; | 411 | break; |
412 | } | 412 | } |
413 | } | 413 | } |
414 | } | 414 | } |
415 | } | 415 | } |
416 | 416 | ||
417 | public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) | 417 | public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) |
418 | { | 418 | { |
419 | Primitive prim = null; | 419 | Primitive prim = null; |
420 | foreach (EntityBase ent in Entities.Values) | 420 | foreach (EntityBase ent in Entities.Values) |
421 | { | 421 | { |
422 | if (ent is SceneObject) | 422 | if (ent is SceneObject) |
423 | { | 423 | { |
424 | prim = ((SceneObject)ent).HasChildPrim(objectID); | 424 | prim = ((SceneObject)ent).HasChildPrim(objectID); |
425 | if (prim != null) | 425 | if (prim != null) |
426 | { | 426 | { |
427 | ((SceneObject)ent).GrapMovement(offset, pos, remoteClient); | 427 | ((SceneObject)ent).GrapMovement(offset, pos, remoteClient); |
428 | break; | 428 | break; |
429 | } | 429 | } |
430 | } | 430 | } |
431 | } | 431 | } |
432 | /* | 432 | /* |
433 | if (this.Entities.ContainsKey(objectID)) | 433 | if (this.Entities.ContainsKey(objectID)) |
434 | { | 434 | { |
435 | if (this.Entities[objectID] is SceneObject) | 435 | if (this.Entities[objectID] is SceneObject) |
436 | { | 436 | { |
437 | ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); | 437 | ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); |
438 | } | 438 | } |
439 | }*/ | 439 | }*/ |
440 | } | 440 | } |
441 | 441 | ||
442 | /// <summary> | 442 | /// <summary> |
443 | /// | 443 | /// |
444 | /// </summary> | 444 | /// </summary> |
445 | /// <param name="localID"></param> | 445 | /// <param name="localID"></param> |
446 | /// <param name="packet"></param> | 446 | /// <param name="packet"></param> |
447 | /// <param name="remoteClient"></param> | 447 | /// <param name="remoteClient"></param> |
448 | public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) | 448 | public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) |
449 | { | 449 | { |
450 | 450 | ||
451 | } | 451 | } |
452 | 452 | ||
453 | /// <summary> | 453 | /// <summary> |
454 | /// | 454 | /// |
455 | /// </summary> | 455 | /// </summary> |
456 | /// <param name="localID"></param> | 456 | /// <param name="localID"></param> |
457 | /// <param name="texture"></param> | 457 | /// <param name="texture"></param> |
458 | /// <param name="remoteClient"></param> | 458 | /// <param name="remoteClient"></param> |
459 | public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) | 459 | public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) |
460 | { | 460 | { |
461 | Primitive prim = null; | 461 | Primitive prim = null; |
462 | foreach (EntityBase ent in Entities.Values) | 462 | foreach (EntityBase ent in Entities.Values) |
463 | { | 463 | { |
464 | if (ent is SceneObject) | 464 | if (ent is SceneObject) |
465 | { | 465 | { |
466 | prim = ((SceneObject)ent).HasChildPrim(localID); | 466 | prim = ((SceneObject)ent).HasChildPrim(localID); |
467 | if (prim != null) | 467 | if (prim != null) |
468 | { | 468 | { |
469 | prim.UpdateTextureEntry(texture); | 469 | prim.UpdateTextureEntry(texture); |
470 | } | 470 | } |
471 | } | 471 | } |
472 | } | 472 | } |
473 | } | 473 | } |
474 | 474 | ||
475 | /// <summary> | 475 | /// <summary> |
476 | /// | 476 | /// |
477 | /// </summary> | 477 | /// </summary> |
478 | /// <param name="localID"></param> | 478 | /// <param name="localID"></param> |
479 | /// <param name="pos"></param> | 479 | /// <param name="pos"></param> |
480 | /// <param name="remoteClient"></param> | 480 | /// <param name="remoteClient"></param> |
481 | public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) | 481 | public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) |
482 | { | 482 | { |
483 | Primitive prim = null; | 483 | Primitive prim = null; |
484 | foreach (EntityBase ent in Entities.Values) | 484 | foreach (EntityBase ent in Entities.Values) |
485 | { | 485 | { |
486 | if (ent is SceneObject) | 486 | if (ent is SceneObject) |
487 | { | 487 | { |
488 | prim = ((SceneObject)ent).HasChildPrim(localID); | 488 | prim = ((SceneObject)ent).HasChildPrim(localID); |
489 | if (prim != null) | 489 | if (prim != null) |
490 | { | 490 | { |
491 | prim.UpdateGroupPosition(pos); | 491 | prim.UpdateGroupPosition(pos); |
492 | break; | 492 | break; |
493 | } | 493 | } |
494 | } | 494 | } |
495 | } | 495 | } |
496 | } | 496 | } |
497 | 497 | ||
498 | public void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient) | 498 | public void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient) |
499 | { | 499 | { |
500 | Primitive prim = null; | 500 | Primitive prim = null; |
501 | foreach (EntityBase ent in Entities.Values) | 501 | foreach (EntityBase ent in Entities.Values) |
502 | { | 502 | { |
503 | if (ent is SceneObject) | 503 | if (ent is SceneObject) |
504 | { | 504 | { |
505 | prim = ((SceneObject)ent).HasChildPrim(localID); | 505 | prim = ((SceneObject)ent).HasChildPrim(localID); |
506 | if (prim != null) | 506 | if (prim != null) |
507 | { | 507 | { |
508 | prim.UpdateSinglePosition(pos); | 508 | prim.UpdateSinglePosition(pos); |
509 | break; | 509 | break; |
510 | } | 510 | } |
511 | } | 511 | } |
512 | } | 512 | } |
513 | } | 513 | } |
514 | 514 | ||
515 | /// <summary> | 515 | /// <summary> |
516 | /// | 516 | /// |
517 | /// </summary> | 517 | /// </summary> |
518 | /// <param name="localID"></param> | 518 | /// <param name="localID"></param> |
519 | /// <param name="pos"></param> | 519 | /// <param name="pos"></param> |
520 | /// <param name="rot"></param> | 520 | /// <param name="rot"></param> |
521 | /// <param name="remoteClient"></param> | 521 | /// <param name="remoteClient"></param> |
522 | public void UpdatePrimRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient) | 522 | public void UpdatePrimRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient) |
523 | { | 523 | { |
524 | Primitive prim = null; | 524 | Primitive prim = null; |
525 | foreach (EntityBase ent in Entities.Values) | 525 | foreach (EntityBase ent in Entities.Values) |
526 | { | 526 | { |
527 | if (ent is SceneObject) | 527 | if (ent is SceneObject) |
528 | { | 528 | { |
529 | prim = ((SceneObject)ent).HasChildPrim(localID); | 529 | prim = ((SceneObject)ent).HasChildPrim(localID); |
530 | if (prim != null) | 530 | if (prim != null) |
531 | { | 531 | { |
532 | prim.UpdateGroupMouseRotation(pos, rot); | 532 | prim.UpdateGroupMouseRotation(pos, rot); |
533 | break; | 533 | break; |
534 | } | 534 | } |
535 | } | 535 | } |
536 | } | 536 | } |
537 | } | 537 | } |
538 | 538 | ||
539 | /// <summary> | 539 | /// <summary> |
540 | /// | 540 | /// |
541 | /// </summary> | 541 | /// </summary> |
542 | /// <param name="localID"></param> | 542 | /// <param name="localID"></param> |
543 | /// <param name="rot"></param> | 543 | /// <param name="rot"></param> |
544 | /// <param name="remoteClient"></param> | 544 | /// <param name="remoteClient"></param> |
545 | public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) | 545 | public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) |
546 | { | 546 | { |
547 | Primitive prim = null; | 547 | Primitive prim = null; |
548 | foreach (EntityBase ent in Entities.Values) | 548 | foreach (EntityBase ent in Entities.Values) |
549 | { | 549 | { |
550 | if (ent is SceneObject) | 550 | if (ent is SceneObject) |
551 | { | 551 | { |
552 | prim = ((SceneObject)ent).HasChildPrim(localID); | 552 | prim = ((SceneObject)ent).HasChildPrim(localID); |
553 | if (prim != null) | 553 | if (prim != null) |
554 | { | 554 | { |
555 | prim.UpdateGroupRotation(rot); | 555 | prim.UpdateGroupRotation(rot); |
556 | break; | 556 | break; |
557 | } | 557 | } |
558 | } | 558 | } |
559 | } | 559 | } |
560 | } | 560 | } |
561 | 561 | ||
562 | /// <summary> | 562 | /// <summary> |
563 | /// | 563 | /// |
564 | /// </summary> | 564 | /// </summary> |
565 | /// <param name="localID"></param> | 565 | /// <param name="localID"></param> |
566 | /// <param name="rot"></param> | 566 | /// <param name="rot"></param> |
567 | /// <param name="remoteClient"></param> | 567 | /// <param name="remoteClient"></param> |
568 | public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) | 568 | public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) |
569 | { | 569 | { |
570 | //Console.WriteLine("trying to update single prim rotation"); | 570 | //Console.WriteLine("trying to update single prim rotation"); |
571 | Primitive prim = null; | 571 | Primitive prim = null; |
572 | foreach (EntityBase ent in Entities.Values) | 572 | foreach (EntityBase ent in Entities.Values) |
573 | { | 573 | { |
574 | if (ent is SceneObject) | 574 | if (ent is SceneObject) |
575 | { | 575 | { |
576 | prim = ((SceneObject)ent).HasChildPrim(localID); | 576 | prim = ((SceneObject)ent).HasChildPrim(localID); |
577 | if (prim != null) | 577 | if (prim != null) |
578 | { | 578 | { |
579 | prim.UpdateSingleRotation(rot); | 579 | prim.UpdateSingleRotation(rot); |
580 | break; | 580 | break; |
581 | } | 581 | } |
582 | } | 582 | } |
583 | } | 583 | } |
584 | } | 584 | } |
585 | 585 | ||
586 | /// <summary> | 586 | /// <summary> |
587 | /// | 587 | /// |
588 | /// </summary> | 588 | /// </summary> |
589 | /// <param name="localID"></param> | 589 | /// <param name="localID"></param> |
590 | /// <param name="scale"></param> | 590 | /// <param name="scale"></param> |
591 | /// <param name="remoteClient"></param> | 591 | /// <param name="remoteClient"></param> |
592 | public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) | 592 | public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) |
593 | { | 593 | { |
594 | Primitive prim = null; | 594 | Primitive prim = null; |
595 | foreach (EntityBase ent in Entities.Values) | 595 | foreach (EntityBase ent in Entities.Values) |
596 | { | 596 | { |
597 | if (ent is SceneObject) | 597 | if (ent is SceneObject) |
598 | { | 598 | { |
599 | prim = ((SceneObject)ent).HasChildPrim(localID); | 599 | prim = ((SceneObject)ent).HasChildPrim(localID); |
600 | if (prim != null) | 600 | if (prim != null) |
601 | { | 601 | { |
602 | prim.ResizeGoup(scale); | 602 | prim.ResizeGoup(scale); |
603 | break; | 603 | break; |
604 | } | 604 | } |
605 | } | 605 | } |
606 | } | 606 | } |
607 | } | 607 | } |
608 | 608 | ||
609 | /// <summary> | 609 | /// <summary> |
610 | /// Sends prims to a client | 610 | /// Sends prims to a client |
611 | /// </summary> | 611 | /// </summary> |
612 | /// <param name="RemoteClient">Client to send to</param> | 612 | /// <param name="RemoteClient">Client to send to</param> |
613 | public void GetInitialPrims(IClientAPI RemoteClient) | 613 | public void GetInitialPrims(IClientAPI RemoteClient) |
614 | { | 614 | { |
615 | 615 | ||
616 | } | 616 | } |
617 | } | 617 | } |
618 | } | 618 | } |