aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorlbsa712007-09-19 00:30:55 +0000
committerlbsa712007-09-19 00:30:55 +0000
commit8f0b03597b0bc8ea6873af9a55495407fae1ec56 (patch)
treef9f4de38379aebf2223ad4cb10a3d9ebcfa52a4f /OpenSim/Region/Environment/Scenes
parent* Moved SendLogoutPacket back to IClientAPI. (diff)
downloadopensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.zip
opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.gz
opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.bz2
opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.xz
* Modernized ScriptManager to new interface-based module calls.
* 'remove redundant this qualifier' ftw
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs21
-rw-r--r--OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs134
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs115
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs284
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs21
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs54
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs402
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs345
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs393
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs28
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs38
17 files changed, 991 insertions, 906 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 2caab9e..bc27ec8 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -1,30 +1,25 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using Axiom.Math; 2using Axiom.Math;
3using libsecondlife; 3using libsecondlife;
4using OpenSim.Region.Environment.Scenes.Scripting;
5 4
6namespace OpenSim.Region.Environment.Scenes 5namespace OpenSim.Region.Environment.Scenes
7{ 6{
8 public abstract class EntityBase 7 public abstract class EntityBase
9 { 8 {
10 protected List<EntityBase> m_children; 9 protected List<EntityBase> m_children;
11 10
12 protected Scene m_scene; 11 protected Scene m_scene;
13 12
14 public LLUUID m_uuid; 13 public LLUUID m_uuid;
14
15 public virtual LLUUID UUID 15 public virtual LLUUID UUID
16 { 16 {
17 get 17 get { return m_uuid; }
18 { 18 set { m_uuid = value; }
19 return m_uuid;
20 }
21 set
22 {
23 m_uuid = value;
24 }
25 } 19 }
26 20
27 protected string m_name; 21 protected string m_name;
22
28 /// <summary> 23 /// <summary>
29 /// 24 ///
30 /// </summary> 25 /// </summary>
@@ -35,6 +30,7 @@ namespace OpenSim.Region.Environment.Scenes
35 } 30 }
36 31
37 protected LLVector3 m_pos; 32 protected LLVector3 m_pos;
33
38 /// <summary> 34 /// <summary>
39 /// 35 ///
40 /// </summary> 36 /// </summary>
@@ -45,6 +41,7 @@ namespace OpenSim.Region.Environment.Scenes
45 } 41 }
46 42
47 public LLVector3 m_velocity; 43 public LLVector3 m_velocity;
44
48 /// <summary> 45 /// <summary>
49 /// 46 ///
50 /// </summary> 47 /// </summary>
@@ -55,6 +52,7 @@ namespace OpenSim.Region.Environment.Scenes
55 } 52 }
56 53
57 protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0); 54 protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
55
58 public virtual Quaternion Rotation 56 public virtual Quaternion Rotation
59 { 57 {
60 get { return m_rotation; } 58 get { return m_rotation; }
@@ -62,6 +60,7 @@ namespace OpenSim.Region.Environment.Scenes
62 } 60 }
63 61
64 protected uint m_localId; 62 protected uint m_localId;
63
65 public virtual uint LocalId 64 public virtual uint LocalId
66 { 65 {
67 get { return m_localId; } 66 get { return m_localId; }
@@ -125,5 +124,5 @@ namespace OpenSim.Region.Environment.Scenes
125 } 124 }
126 125
127 public abstract void SetText(string text, Vector3 color, double alpha); 126 public abstract void SetText(string text, Vector3 color, double alpha);
128 } 127 }
129} \ No newline at end of file 128} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
index 8551b70..851ad4e 100644
--- a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
+++ b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
@@ -11,4 +11,4 @@ namespace OpenSim.Region.Environment.Scenes
11 void SendOurAppearance(IClientAPI OurClient); 11 void SendOurAppearance(IClientAPI OurClient);
12 void SendAppearanceToOtherAgent(ScenePresence avatarInfo); 12 void SendAppearanceToOtherAgent(ScenePresence avatarInfo);
13 } 13 }
14} 14} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index a259dd0..048d2b4 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1,15 +1,13 @@
1using System; 1using Axiom.Math;
2using System.IO; 2using libsecondlife;
3using System.Collections.Generic; 3using libsecondlife.Packets;
4using libsecondlife; 4using OpenSim.Framework.Communications.Caches;
5using libsecondlife.Packets; 5using OpenSim.Framework.Data;
6using OpenSim.Framework.Interfaces; 6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Framework.Communications.Caches; 8using OpenSim.Framework.Utilities;
9using OpenSim.Framework.Data; 9using OpenSim.Region.Physics.Manager;
10using OpenSim.Framework.Utilities; 10
11using OpenSim.Region.Physics.Manager;
12
13namespace OpenSim.Region.Environment.Scenes 11namespace OpenSim.Region.Environment.Scenes
14{ 12{
15 public partial class Scene 13 public partial class Scene
@@ -19,9 +17,9 @@ namespace OpenSim.Region.Environment.Scenes
19 17
20 public void AddInventoryItem(LLUUID userID, InventoryItemBase item) 18 public void AddInventoryItem(LLUUID userID, InventoryItemBase item)
21 { 19 {
22 if (this.Avatars.ContainsKey(userID)) 20 if (Avatars.ContainsKey(userID))
23 { 21 {
24 this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); 22 AddInventoryItem(Avatars[userID].ControllingClient, item);
25 } 23 }
26 } 24 }
27 25
@@ -37,9 +35,9 @@ namespace OpenSim.Region.Environment.Scenes
37 35
38 public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data) 36 public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data)
39 { 37 {
40 if (this.Avatars.ContainsKey(userID)) 38 if (Avatars.ContainsKey(userID))
41 { 39 {
42 return this.CapsUpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); 40 return CapsUpdateInventoryItemAsset(Avatars[userID].ControllingClient, itemID, data);
43 } 41 }
44 return LLUUID.Zero; 42 return LLUUID.Zero;
45 } 43 }
@@ -57,8 +55,8 @@ namespace OpenSim.Region.Environment.Scenes
57 AssetBase asset; 55 AssetBase asset;
58 asset = new AssetBase(); 56 asset = new AssetBase();
59 asset.FullID = LLUUID.Random(); 57 asset.FullID = LLUUID.Random();
60 asset.Type = (sbyte)item.assetType; 58 asset.Type = (sbyte) item.assetType;
61 asset.InvType = (sbyte)item.invType; 59 asset.InvType = (sbyte) item.invType;
62 asset.Name = item.inventoryName; 60 asset.Name = item.inventoryName;
63 asset.Data = data; 61 asset.Data = data;
64 commsManager.AssetCache.AddAsset(asset); 62 commsManager.AssetCache.AddAsset(asset);
@@ -83,7 +81,8 @@ namespace OpenSim.Region.Environment.Scenes
83 return LLUUID.Zero; 81 return LLUUID.Zero;
84 } 82 }
85 83
86 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID) 84 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
85 LLUUID itemID)
87 { 86 {
88 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 87 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
89 if (userInfo != null) 88 if (userInfo != null)
@@ -93,7 +92,8 @@ namespace OpenSim.Region.Environment.Scenes
93 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 92 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
94 if (item != null) 93 if (item != null)
95 { 94 {
96 AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); 95 AgentAssetTransactions transactions =
96 commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
97 if (transactions != null) 97 if (transactions != null)
98 { 98 {
99 AssetBase asset = null; 99 AssetBase asset = null;
@@ -112,8 +112,8 @@ namespace OpenSim.Region.Environment.Scenes
112 { 112 {
113 asset.Name = item.inventoryName; 113 asset.Name = item.inventoryName;
114 asset.Description = item.inventoryDescription; 114 asset.Description = item.inventoryDescription;
115 asset.InvType = (sbyte)item.invType; 115 asset.InvType = (sbyte) item.invType;
116 asset.Type = (sbyte)item.assetType; 116 asset.Type = (sbyte) item.assetType;
117 item.assetID = asset.FullID; 117 item.assetID = asset.FullID;
118 118
119 if (addToCache) 119 if (addToCache)
@@ -143,7 +143,9 @@ namespace OpenSim.Region.Environment.Scenes
143 /// <param name="type"></param> 143 /// <param name="type"></param>
144 /// <param name="wearableType"></param> 144 /// <param name="wearableType"></param>
145 /// <param name="nextOwnerMask"></param> 145 /// <param name="nextOwnerMask"></param>
146 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) 146 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID,
147 uint callbackID, string description, string name, sbyte invType, sbyte type,
148 byte wearableType, uint nextOwnerMask)
147 { 149 {
148 if (transActionID == LLUUID.Zero) 150 if (transActionID == LLUUID.Zero)
149 { 151 {
@@ -157,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes
157 asset.Type = type; 159 asset.Type = type;
158 asset.FullID = LLUUID.Random(); 160 asset.FullID = LLUUID.Random();
159 asset.Data = new byte[1]; 161 asset.Data = new byte[1];
160 this.commsManager.AssetCache.AddAsset(asset); 162 commsManager.AssetCache.AddAsset(asset);
161 163
162 InventoryItemBase item = new InventoryItemBase(); 164 InventoryItemBase item = new InventoryItemBase();
163 item.avatarID = remoteClient.AgentId; 165 item.avatarID = remoteClient.AgentId;
@@ -178,7 +180,9 @@ namespace OpenSim.Region.Environment.Scenes
178 } 180 }
179 else 181 else
180 { 182 {
181 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); 183 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID,
184 callbackID, description, name, invType,
185 type, wearableType, nextOwnerMask);
182 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); 186 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
183 } 187 }
184 } 188 }
@@ -195,15 +199,15 @@ namespace OpenSim.Region.Environment.Scenes
195 { 199 {
196 if (ent is SceneObjectGroup) 200 if (ent is SceneObjectGroup)
197 { 201 {
198 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 202 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
199 if (hasPrim != false) 203 if (hasPrim != false)
200 { 204 {
201 bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); 205 bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
202 if (fileChange) 206 if (fileChange)
203 { 207 {
204 if (this.XferManager != null) 208 if (XferManager != null)
205 { 209 {
206 ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager); 210 ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
207 } 211 }
208 } 212 }
209 break; 213 break;
@@ -219,14 +223,14 @@ namespace OpenSim.Region.Environment.Scenes
219 { 223 {
220 if (ent is SceneObjectGroup) 224 if (ent is SceneObjectGroup)
221 { 225 {
222 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 226 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
223 if (hasPrim != false) 227 if (hasPrim != false)
224 { 228 {
225 int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID); 229 int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
226 ((SceneObjectGroup)ent).GetProperites(remoteClient); 230 ((SceneObjectGroup) ent).GetProperites(remoteClient);
227 if (type == 10) 231 if (type == 10)
228 { 232 {
229 this.EventManager.TriggerRemoveScript(localID, itemID); 233 EventManager.TriggerRemoveScript(localID, itemID);
230 } 234 }
231 } 235 }
232 } 236 }
@@ -255,7 +259,7 @@ namespace OpenSim.Region.Environment.Scenes
255 { 259 {
256 string script = Util.FieldToString(rezAsset.Data); 260 string script = Util.FieldToString(rezAsset.Data);
257 //Console.WriteLine("rez script "+script); 261 //Console.WriteLine("rez script "+script);
258 this.EventManager.TriggerRezScript(localID, copyID, script); 262 EventManager.TriggerRezScript(localID, copyID, script);
259 rezzed = true; 263 rezzed = true;
260 } 264 }
261 else 265 else
@@ -266,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
266 { 270 {
267 string script = Util.FieldToString(rezAsset.Data); 271 string script = Util.FieldToString(rezAsset.Data);
268 // Console.WriteLine("rez script " + script); 272 // Console.WriteLine("rez script " + script);
269 this.EventManager.TriggerRezScript(localID, copyID, script); 273 EventManager.TriggerRezScript(localID, copyID, script);
270 rezzed = true; 274 rezzed = true;
271 } 275 }
272 } 276 }
@@ -278,12 +282,13 @@ namespace OpenSim.Region.Environment.Scenes
278 { 282 {
279 if (ent is SceneObjectGroup) 283 if (ent is SceneObjectGroup)
280 { 284 {
281 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 285 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
282 if (hasPrim != false) 286 if (hasPrim != false)
283 { 287 {
284 288 bool added =
285 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); 289 ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
286 ((SceneObjectGroup)ent).GetProperites(remoteClient); 290 copyID);
291 ((SceneObjectGroup) ent).GetProperites(remoteClient);
287 } 292 }
288 } 293 }
289 } 294 }
@@ -300,7 +305,7 @@ namespace OpenSim.Region.Environment.Scenes
300 /// <param name="simClient"></param> 305 /// <param name="simClient"></param>
301 public void DeRezObject(Packet packet, IClientAPI remoteClient) 306 public void DeRezObject(Packet packet, IClientAPI remoteClient)
302 { 307 {
303 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; 308 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
304 309
305 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 310 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
306 { 311 {
@@ -312,7 +317,7 @@ namespace OpenSim.Region.Environment.Scenes
312 { 317 {
313 EntityBase selectedEnt = null; 318 EntityBase selectedEnt = null;
314 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); 319 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
315 foreach (EntityBase ent in this.Entities.Values) 320 foreach (EntityBase ent in Entities.Values)
316 { 321 {
317 if (ent.LocalId == Data.ObjectLocalID) 322 if (ent.LocalId == Data.ObjectLocalID)
318 { 323 {
@@ -322,15 +327,16 @@ namespace OpenSim.Region.Environment.Scenes
322 } 327 }
323 if (selectedEnt != null) 328 if (selectedEnt != null)
324 { 329 {
325 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup)selectedEnt).UUID)) 330 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
326 { 331 {
327 string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString(); 332 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
328 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 333 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
329 if (userInfo != null) 334 if (userInfo != null)
330 { 335 {
331 AssetBase asset = new AssetBase(); 336 AssetBase asset = new AssetBase();
332 asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId); 337 asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
333 asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId); 338 asset.Description =
339 ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
334 asset.InvType = 6; 340 asset.InvType = 6;
335 asset.Type = 6; 341 asset.Type = 6;
336 asset.FullID = LLUUID.Random(); 342 asset.FullID = LLUUID.Random();
@@ -355,21 +361,23 @@ namespace OpenSim.Region.Environment.Scenes
355 remoteClient.SendInventoryItemUpdate(item); 361 remoteClient.SendInventoryItemUpdate(item);
356 } 362 }
357 363
358 SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID); 364 SceneObjectPart rootPart =
365 ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID);
359 if (rootPart.PhysActor != null) 366 if (rootPart.PhysActor != null)
360 { 367 {
361 this.phyScene.RemovePrim(rootPart.PhysActor); 368 phyScene.RemovePrim(rootPart.PhysActor);
362 rootPart.PhysActor = null; 369 rootPart.PhysActor = null;
363 } 370 }
364 371
365 storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); 372 storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID,
366 ((SceneObjectGroup)selectedEnt).DeleteGroup(); 373 m_regInfo.SimUUID);
374 ((SceneObjectGroup) selectedEnt).DeleteGroup();
367 375
368 lock (Entities) 376 lock (Entities)
369 { 377 {
370 Entities.Remove(((SceneObjectGroup)selectedEnt).UUID); 378 Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
371 } 379 }
372 ((SceneObjectGroup)selectedEnt).DeleteParts(); 380 ((SceneObjectGroup) selectedEnt).DeleteParts();
373 } 381 }
374 } 382 }
375 } 383 }
@@ -389,7 +397,7 @@ namespace OpenSim.Region.Environment.Scenes
389 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 397 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
390 if (rezAsset != null) 398 if (rezAsset != null)
391 { 399 {
392 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); 400 AddRezObject(Util.FieldToString(rezAsset.Data), pos);
393 userInfo.DeleteItem(remoteClient.AgentId, item); 401 userInfo.DeleteItem(remoteClient.AgentId, item);
394 remoteClient.SendRemoveInventoryItem(itemID); 402 remoteClient.SendRemoveInventoryItem(itemID);
395 } 403 }
@@ -399,7 +407,7 @@ namespace OpenSim.Region.Environment.Scenes
399 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 407 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
400 if (rezAsset != null) 408 if (rezAsset != null)
401 { 409 {
402 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); 410 AddRezObject(Util.FieldToString(rezAsset.Data), pos);
403 userInfo.DeleteItem(remoteClient.AgentId, item); 411 userInfo.DeleteItem(remoteClient.AgentId, item);
404 remoteClient.SendRemoveInventoryItem(itemID); 412 remoteClient.SendRemoveInventoryItem(itemID);
405 } 413 }
@@ -411,17 +419,17 @@ namespace OpenSim.Region.Environment.Scenes
411 419
412 private void AddRezObject(string xmlData, LLVector3 pos) 420 private void AddRezObject(string xmlData, LLVector3 pos)
413 { 421 {
414 SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); 422 SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
415 this.AddEntity(group); 423 AddEntity(group);
416 group.AbsolutePosition = pos; 424 group.AbsolutePosition = pos;
417 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 425 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
418 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 426 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
419 rootPart.PhysActor = phyScene.AddPrim( 427 rootPart.PhysActor = phyScene.AddPrim(
420 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), 428 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
429 rootPart.AbsolutePosition.Z),
421 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 430 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
422 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 431 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
423 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 432 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
424 } 433 }
425 } 434 }
426 435} \ No newline at end of file
427}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 881b4a1..5a7dda5 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -25,17 +25,11 @@
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*/
28using System;
29using System.IO;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using libsecondlife; 29using libsecondlife;
32using libsecondlife.Packets; 30using libsecondlife.Packets;
31using OpenSim.Framework.Console;
33using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
34using OpenSim.Framework.Types;
35using OpenSim.Framework.Communications.Caches;
36using OpenSim.Framework.Data;
37using OpenSim.Framework.Utilities;
38using OpenSim.Region.Environment.Interfaces;
39 33
40namespace OpenSim.Region.Environment.Scenes 34namespace OpenSim.Region.Environment.Scenes
41{ 35{
@@ -50,7 +44,8 @@ namespace OpenSim.Region.Environment.Scenes
50 /// <param name="action">The action to be performed</param> 44 /// <param name="action">The action to be performed</param>
51 /// <param name="north">Distance from the north border where the cursor is located</param> 45 /// <param name="north">Distance from the north border where the cursor is located</param>
52 /// <param name="west">Distance from the west border where the cursor is located</param> 46 /// <param name="west">Distance from the west border where the cursor is located</param>
53 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser) 47 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
48 IClientAPI remoteUser)
54 { 49 {
55 // Do a permissions check before allowing terraforming. 50 // Do a permissions check before allowing terraforming.
56 // random users are now no longer allowed to terraform 51 // random users are now no longer allowed to terraform
@@ -71,17 +66,19 @@ namespace OpenSim.Region.Environment.Scenes
71 /// <param name="timestamp"></param> 66 /// <param name="timestamp"></param>
72 /// <param name="fromAgentName"></param> 67 /// <param name="fromAgentName"></param>
73 /// <param name="message"></param> 68 /// <param name="message"></param>
74 public void InstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog) 69 public void InstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID,
70 uint timestamp, string fromAgentName, string message, byte dialog)
75 { 71 {
76 if (this.Avatars.ContainsKey(toAgentID)) 72 if (Avatars.ContainsKey(toAgentID))
77 { 73 {
78 if (this.Avatars.ContainsKey(fromAgentID)) 74 if (Avatars.ContainsKey(fromAgentID))
79 { 75 {
80 // Local sim message 76 // Local sim message
81 ScenePresence fromAvatar = this.Avatars[fromAgentID]; 77 ScenePresence fromAvatar = Avatars[fromAgentID];
82 ScenePresence toAvatar = this.Avatars[toAgentID]; 78 ScenePresence toAvatar = Avatars[toAgentID];
83 string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname; 79 string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname;
84 toAvatar.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, toAgentID, imSessionID, fromName, dialog, timestamp); 80 toAvatar.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, toAgentID,
81 imSessionID, fromName, dialog, timestamp);
85 } 82 }
86 else 83 else
87 { 84 {
@@ -102,7 +99,8 @@ namespace OpenSim.Region.Environment.Scenes
102 /// <param name="fromPos"></param> 99 /// <param name="fromPos"></param>
103 /// <param name="fromName"></param> 100 /// <param name="fromName"></param>
104 /// <param name="fromAgentID"></param> 101 /// <param name="fromAgentID"></param>
105 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 102 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
103 LLUUID fromAgentID)
106 { 104 {
107 if (m_simChatModule != null) 105 if (m_simChatModule != null)
108 { 106 {
@@ -123,9 +121,9 @@ namespace OpenSim.Region.Environment.Scenes
123 { 121 {
124 if (ent is SceneObjectGroup) 122 if (ent is SceneObjectGroup)
125 { 123 {
126 if (((SceneObjectGroup)ent).LocalId == originalPrim) 124 if (((SceneObjectGroup) ent).LocalId == originalPrim)
127 { 125 {
128 originPrim = (SceneObjectGroup)ent; 126 originPrim = (SceneObjectGroup) ent;
129 break; 127 break;
130 } 128 }
131 } 129 }
@@ -135,7 +133,7 @@ namespace OpenSim.Region.Environment.Scenes
135 { 133 {
136 SceneObjectGroup copy = originPrim.Copy(); 134 SceneObjectGroup copy = originPrim.Copy();
137 copy.AbsolutePosition = copy.AbsolutePosition + offset; 135 copy.AbsolutePosition = copy.AbsolutePosition + offset;
138 this.Entities.Add(copy.UUID, copy); 136 Entities.Add(copy.UUID, copy);
139 137
140 copy.ScheduleGroupForFullUpdate(); 138 copy.ScheduleGroupForFullUpdate();
141 /* List<ScenePresence> avatars = this.RequestAvatarList(); 139 /* List<ScenePresence> avatars = this.RequestAvatarList();
@@ -143,13 +141,11 @@ namespace OpenSim.Region.Environment.Scenes
143 { 141 {
144 // copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); 142 // copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
145 }*/ 143 }*/
146
147 } 144 }
148 else 145 else
149 { 146 {
150 OpenSim.Framework.Console.MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim"); 147 MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
151 } 148 }
152
153 } 149 }
154 150
155 /// <summary> 151 /// <summary>
@@ -164,9 +160,9 @@ namespace OpenSim.Region.Environment.Scenes
164 { 160 {
165 if (ent is SceneObjectGroup) 161 if (ent is SceneObjectGroup)
166 { 162 {
167 if (((SceneObjectGroup)ent).LocalId == parentPrim) 163 if (((SceneObjectGroup) ent).LocalId == parentPrim)
168 { 164 {
169 parenPrim = (SceneObjectGroup)ent; 165 parenPrim = (SceneObjectGroup) ent;
170 break; 166 break;
171 } 167 }
172 } 168 }
@@ -181,9 +177,9 @@ namespace OpenSim.Region.Environment.Scenes
181 { 177 {
182 if (ent is SceneObjectGroup) 178 if (ent is SceneObjectGroup)
183 { 179 {
184 if (((SceneObjectGroup)ent).LocalId == childPrims[i]) 180 if (((SceneObjectGroup) ent).LocalId == childPrims[i])
185 { 181 {
186 children.Add((SceneObjectGroup)ent); 182 children.Add((SceneObjectGroup) ent);
187 } 183 }
188 } 184 }
189 } 185 }
@@ -208,10 +204,10 @@ namespace OpenSim.Region.Environment.Scenes
208 { 204 {
209 if (ent is SceneObjectGroup) 205 if (ent is SceneObjectGroup)
210 { 206 {
211 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 207 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
212 if (hasPrim != false) 208 if (hasPrim != false)
213 { 209 {
214 ((SceneObjectGroup)ent).UpdateShape(shapeBlock, primLocalID); 210 ((SceneObjectGroup) ent).UpdateShape(shapeBlock, primLocalID);
215 break; 211 break;
216 } 212 }
217 } 213 }
@@ -225,10 +221,10 @@ namespace OpenSim.Region.Environment.Scenes
225 { 221 {
226 if (ent is SceneObjectGroup) 222 if (ent is SceneObjectGroup)
227 { 223 {
228 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 224 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
229 if (hasPrim != false) 225 if (hasPrim != false)
230 { 226 {
231 ((SceneObjectGroup)ent).UpdateExtraParam(primLocalID, type, inUse, data); 227 ((SceneObjectGroup) ent).UpdateExtraParam(primLocalID, type, inUse, data);
232 break; 228 break;
233 } 229 }
234 } 230 }
@@ -246,11 +242,11 @@ namespace OpenSim.Region.Environment.Scenes
246 { 242 {
247 if (ent is SceneObjectGroup) 243 if (ent is SceneObjectGroup)
248 { 244 {
249 if (((SceneObjectGroup)ent).LocalId == primLocalID) 245 if (((SceneObjectGroup) ent).LocalId == primLocalID)
250 { 246 {
251 ((SceneObjectGroup)ent).GetProperites(remoteClient); 247 ((SceneObjectGroup) ent).GetProperites(remoteClient);
252 ((SceneObjectGroup)ent).IsSelected = true; 248 ((SceneObjectGroup) ent).IsSelected = true;
253 this.LandManager.setPrimsTainted(); 249 LandManager.setPrimsTainted();
254 break; 250 break;
255 } 251 }
256 } 252 }
@@ -268,10 +264,10 @@ namespace OpenSim.Region.Environment.Scenes
268 { 264 {
269 if (ent is SceneObjectGroup) 265 if (ent is SceneObjectGroup)
270 { 266 {
271 if (((SceneObjectGroup)ent).LocalId == primLocalID) 267 if (((SceneObjectGroup) ent).LocalId == primLocalID)
272 { 268 {
273 ((SceneObjectGroup)ent).IsSelected = false; 269 ((SceneObjectGroup) ent).IsSelected = false;
274 this.LandManager.setPrimsTainted(); 270 LandManager.setPrimsTainted();
275 break; 271 break;
276 } 272 }
277 } 273 }
@@ -290,10 +286,10 @@ namespace OpenSim.Region.Environment.Scenes
290 { 286 {
291 if (ent is SceneObjectGroup) 287 if (ent is SceneObjectGroup)
292 { 288 {
293 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 289 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
294 if (hasPrim != false) 290 if (hasPrim != false)
295 { 291 {
296 ((SceneObjectGroup)ent).SetPartDescription(description, primLocalID); 292 ((SceneObjectGroup) ent).SetPartDescription(description, primLocalID);
297 break; 293 break;
298 } 294 }
299 } 295 }
@@ -312,10 +308,10 @@ namespace OpenSim.Region.Environment.Scenes
312 { 308 {
313 if (ent is SceneObjectGroup) 309 if (ent is SceneObjectGroup)
314 { 310 {
315 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 311 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
316 if (hasPrim != false) 312 if (hasPrim != false)
317 { 313 {
318 ((SceneObjectGroup)ent).SetPartName(name, primLocalID); 314 ((SceneObjectGroup) ent).SetPartName(name, primLocalID);
319 break; 315 break;
320 } 316 }
321 } 317 }
@@ -331,10 +327,10 @@ namespace OpenSim.Region.Environment.Scenes
331 { 327 {
332 if (ent is SceneObjectGroup) 328 if (ent is SceneObjectGroup)
333 { 329 {
334 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(objectID); 330 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(objectID);
335 if (hasPrim != false) 331 if (hasPrim != false)
336 { 332 {
337 ((SceneObjectGroup)ent).GrabMovement(offset, pos, remoteClient); 333 ((SceneObjectGroup) ent).GrabMovement(offset, pos, remoteClient);
338 break; 334 break;
339 } 335 }
340 } 336 }
@@ -350,7 +346,6 @@ namespace OpenSim.Region.Environment.Scenes
350 /// <param name="remoteClient"></param> 346 /// <param name="remoteClient"></param>
351 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) 347 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
352 { 348 {
353
354 } 349 }
355 350
356 /// <summary> 351 /// <summary>
@@ -366,10 +361,10 @@ namespace OpenSim.Region.Environment.Scenes
366 { 361 {
367 if (ent is SceneObjectGroup) 362 if (ent is SceneObjectGroup)
368 { 363 {
369 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 364 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
370 if (hasPrim != false) 365 if (hasPrim != false)
371 { 366 {
372 ((SceneObjectGroup)ent).UpdateTextureEntry(localID, texture); 367 ((SceneObjectGroup) ent).UpdateTextureEntry(localID, texture);
373 break; 368 break;
374 } 369 }
375 } 370 }
@@ -389,10 +384,10 @@ namespace OpenSim.Region.Environment.Scenes
389 { 384 {
390 if (ent is SceneObjectGroup) 385 if (ent is SceneObjectGroup)
391 { 386 {
392 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 387 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
393 if (hasPrim != false) 388 if (hasPrim != false)
394 { 389 {
395 ((SceneObjectGroup)ent).UpdateGroupPosition(pos); 390 ((SceneObjectGroup) ent).UpdateGroupPosition(pos);
396 break; 391 break;
397 } 392 }
398 } 393 }
@@ -406,10 +401,10 @@ namespace OpenSim.Region.Environment.Scenes
406 { 401 {
407 if (ent is SceneObjectGroup) 402 if (ent is SceneObjectGroup)
408 { 403 {
409 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 404 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
410 if (hasPrim != false) 405 if (hasPrim != false)
411 { 406 {
412 ((SceneObjectGroup)ent).UpdateSinglePosition(pos, localID); 407 ((SceneObjectGroup) ent).UpdateSinglePosition(pos, localID);
413 break; 408 break;
414 } 409 }
415 } 410 }
@@ -430,10 +425,10 @@ namespace OpenSim.Region.Environment.Scenes
430 { 425 {
431 if (ent is SceneObjectGroup) 426 if (ent is SceneObjectGroup)
432 { 427 {
433 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 428 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
434 if (hasPrim != false) 429 if (hasPrim != false)
435 { 430 {
436 ((SceneObjectGroup)ent).UpdateGroupRotation(pos, rot); 431 ((SceneObjectGroup) ent).UpdateGroupRotation(pos, rot);
437 break; 432 break;
438 } 433 }
439 } 434 }
@@ -453,10 +448,10 @@ namespace OpenSim.Region.Environment.Scenes
453 { 448 {
454 if (ent is SceneObjectGroup) 449 if (ent is SceneObjectGroup)
455 { 450 {
456 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 451 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
457 if (hasPrim != false) 452 if (hasPrim != false)
458 { 453 {
459 ((SceneObjectGroup)ent).UpdateGroupRotation(rot); 454 ((SceneObjectGroup) ent).UpdateGroupRotation(rot);
460 break; 455 break;
461 } 456 }
462 } 457 }
@@ -476,10 +471,10 @@ namespace OpenSim.Region.Environment.Scenes
476 { 471 {
477 if (ent is SceneObjectGroup) 472 if (ent is SceneObjectGroup)
478 { 473 {
479 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 474 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
480 if (hasPrim != false) 475 if (hasPrim != false)
481 { 476 {
482 ((SceneObjectGroup)ent).UpdateSingleRotation(rot, localID); 477 ((SceneObjectGroup) ent).UpdateSingleRotation(rot, localID);
483 break; 478 break;
484 } 479 }
485 } 480 }
@@ -499,10 +494,10 @@ namespace OpenSim.Region.Environment.Scenes
499 { 494 {
500 if (ent is SceneObjectGroup) 495 if (ent is SceneObjectGroup)
501 { 496 {
502 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 497 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
503 if (hasPrim != false) 498 if (hasPrim != false)
504 { 499 {
505 ((SceneObjectGroup)ent).Resize(scale, localID); 500 ((SceneObjectGroup) ent).Resize(scale, localID);
506 break; 501 break;
507 } 502 }
508 } 503 }
@@ -511,7 +506,7 @@ namespace OpenSim.Region.Environment.Scenes
511 506
512 public void StartAnimation(IClientAPI client, LLUUID animID, int seq) 507 public void StartAnimation(IClientAPI client, LLUUID animID, int seq)
513 { 508 {
514 List<ScenePresence> avatars = this.RequestAvatarList(); 509 List<ScenePresence> avatars = RequestAvatarList();
515 for (int i = 0; i < avatars.Count; i++) 510 for (int i = 0; i < avatars.Count; i++)
516 { 511 {
517 avatars[i].ControllingClient.SendAnimation(animID, seq, client.AgentId); 512 avatars[i].ControllingClient.SendAnimation(animID, seq, client.AgentId);
@@ -520,7 +515,7 @@ namespace OpenSim.Region.Environment.Scenes
520 515
521 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 516 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
522 { 517 {
523 this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient); 518 EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient);
524 } 519 }
525 } 520 }
526} 521} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index d763fe3..df125aa 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -27,28 +27,28 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Threading; 31using System.Threading;
31using System.Timers; 32using System.Timers;
32using System.IO;
33using System.Xml; 33using System.Xml;
34using Axiom.Math;
34using libsecondlife; 35using libsecondlife;
35using OpenSim.Framework; 36using OpenSim.Framework;
36using OpenSim.Framework.Communications; 37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Caches;
37using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
38using OpenSim.Framework.Interfaces; 40using OpenSim.Framework.Interfaces;
39using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
40using OpenSim.Framework.Types; 42using OpenSim.Framework.Types;
41using OpenSim.Framework.Utilities; 43using OpenSim.Framework.Utilities;
42using OpenSim.Region.Physics.Manager; 44using OpenSim.Region.Capabilities;
43using OpenSim.Framework.Communications.Caches;
44using OpenSim.Region.Environment.LandManagement;
45using OpenSim.Region.Environment;
46using OpenSim.Region.Environment.Interfaces; 45using OpenSim.Region.Environment.Interfaces;
46using OpenSim.Region.Environment.LandManagement;
47using OpenSim.Region.Environment.Scenes.Scripting;
47using OpenSim.Region.Environment.Types; 48using OpenSim.Region.Environment.Types;
49using OpenSim.Region.Physics.Manager;
48using OpenSim.Region.Terrain; 50using OpenSim.Region.Terrain;
49using OpenSim.Framework.Data; 51using Timer=System.Timers.Timer;
50using Caps = OpenSim.Region.Capabilities.Caps;
51using Timer = System.Timers.Timer;
52 52
53namespace OpenSim.Region.Environment.Scenes 53namespace OpenSim.Region.Environment.Scenes
54{ 54{
@@ -61,8 +61,11 @@ namespace OpenSim.Region.Environment.Scenes
61 protected Timer m_heartbeatTimer = new Timer(); 61 protected Timer m_heartbeatTimer = new Timer();
62 protected Dictionary<LLUUID, ScenePresence> Avatars; 62 protected Dictionary<LLUUID, ScenePresence> Avatars;
63 protected Dictionary<LLUUID, SceneObjectGroup> Prims; 63 protected Dictionary<LLUUID, SceneObjectGroup> Prims;
64 public PhysicsScene phyScene; /// publicized so it can be accessed from SceneObjectGroup. 64 public PhysicsScene phyScene;
65
66 /// publicized so it can be accessed from SceneObjectGroup.
65 protected float timeStep = 0.1f; 67 protected float timeStep = 0.1f;
68
66 private Random Rand = new Random(); 69 private Random Rand = new Random();
67 private uint _primCount = 702000; 70 private uint _primCount = 702000;
68 private Mutex _primAllocateMutex = new Mutex(false); 71 private Mutex _primAllocateMutex = new Mutex(false);
@@ -102,8 +105,9 @@ namespace OpenSim.Region.Environment.Scenes
102 105
103 public AgentCircuitManager AuthenticateHandler 106 public AgentCircuitManager AuthenticateHandler
104 { 107 {
105 get { return this.authenticateHandler; } 108 get { return authenticateHandler; }
106 } 109 }
110
107 /// <summary> 111 /// <summary>
108 /// 112 ///
109 /// </summary> 113 /// </summary>
@@ -141,7 +145,7 @@ namespace OpenSim.Region.Environment.Scenes
141 145
142 public int TimePhase 146 public int TimePhase
143 { 147 {
144 get { return this.m_timePhase; } 148 get { return m_timePhase; }
145 } 149 }
146 150
147 #endregion 151 #endregion
@@ -155,7 +159,8 @@ namespace OpenSim.Region.Environment.Scenes
155 /// <param name="regionHandle">Region Handle for this region</param> 159 /// <param name="regionHandle">Region Handle for this region</param>
156 /// <param name="regionName">Region Name for this region</param> 160 /// <param name="regionName">Region Name for this region</param>
157 public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, 161 public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan,
158 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, ModuleLoader moduleLoader) 162 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
163 ModuleLoader moduleLoader)
159 { 164 {
160 updateLock = new Mutex(false); 165 updateLock = new Mutex(false);
161 166
@@ -190,22 +195,21 @@ namespace OpenSim.Region.Environment.Scenes
190 Prims = new Dictionary<LLUUID, SceneObjectGroup>(); 195 Prims = new Dictionary<LLUUID, SceneObjectGroup>();
191 196
192 MainLog.Instance.Verbose("Creating LandMap"); 197 MainLog.Instance.Verbose("Creating LandMap");
193 Terrain = new TerrainEngine((int)this.RegionInfo.RegionLocX, (int)this.RegionInfo.RegionLocY); 198 Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY);
194 199
195 ScenePresence.LoadAnims(); 200 ScenePresence.LoadAnims();
196 201
197 httpListener = httpServer; 202 httpListener = httpServer;
198
199 } 203 }
200 204
201 #endregion 205 #endregion
202 206
203 public void SetModuleInterfaces() 207 public void SetModuleInterfaces()
204 { 208 {
205 m_simChatModule = this.RequestModuleInterface<ISimChat>(); 209 m_simChatModule = RequestModuleInterface<ISimChat>();
206 m_httpRequestModule = this.RequestModuleInterface<IHttpRequests>(); 210 m_httpRequestModule = RequestModuleInterface<IHttpRequests>();
207 211
208 XferManager = this.RequestModuleInterface<IXfer>(); 212 XferManager = RequestModuleInterface<IXfer>();
209 } 213 }
210 214
211 #region Script Handling Methods 215 #region Script Handling Methods
@@ -249,7 +253,8 @@ namespace OpenSim.Region.Environment.Scenes
249 { 253 {
250 if (phyScene.IsThreaded) 254 if (phyScene.IsThreaded)
251 { 255 {
252 phyScene.GetResults(); /// no engines implement this, and what does it have to do with threading? possible DEAD CODE 256 phyScene.GetResults();
257 /// no engines implement this, and what does it have to do with threading? possible DEAD CODE
253 } 258 }
254 259
255 List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values); 260 List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values);
@@ -308,9 +313,10 @@ namespace OpenSim.Region.Environment.Scenes
308 { 313 {
309 for (int y = 0; y < 16; y++) 314 for (int y = 0; y < 16; y++)
310 { 315 {
311 if (Terrain.Tainted(x * 16, y * 16)) 316 if (Terrain.Tainted(x*16, y*16))
312 { 317 {
313 SendLayerData(x, y, presence.ControllingClient, terData); 318 SendLayerData(x, y, presence.ControllingClient,
319 terData);
314 } 320 }
315 } 321 }
316 } 322 }
@@ -340,7 +346,7 @@ namespace OpenSim.Region.Environment.Scenes
340 m_timeUpdateCount++; 346 m_timeUpdateCount++;
341 if (m_timeUpdateCount > 600) 347 if (m_timeUpdateCount > 600)
342 { 348 {
343 List<ScenePresence> Avatars = this.RequestAvatarList(); 349 List<ScenePresence> Avatars = RequestAvatarList();
344 foreach (ScenePresence avatar in Avatars) 350 foreach (ScenePresence avatar in Avatars)
345 { 351 {
346 if (!avatar.childAgent) 352 if (!avatar.childAgent)
@@ -398,10 +404,7 @@ namespace OpenSim.Region.Environment.Scenes
398 404
399 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); 405 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
400 406
401 ForEachScenePresence(delegate(ScenePresence presence) 407 ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence.ControllingClient); });
402 {
403 SendLayerData(presence.ControllingClient);
404 });
405 408
406 foreach (LLUUID UUID in Entities.Keys) 409 foreach (LLUUID UUID in Entities.Keys)
407 { 410 {
@@ -429,10 +432,7 @@ namespace OpenSim.Region.Environment.Scenes
429 } 432 }
430 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); 433 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
431 434
432 ForEachScenePresence(delegate(ScenePresence presence) 435 ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence.ControllingClient); });
433 {
434 SendLayerData(presence.ControllingClient);
435 });
436 436
437 foreach (LLUUID UUID in Entities.Keys) 437 foreach (LLUUID UUID in Entities.Keys)
438 { 438 {
@@ -521,23 +521,23 @@ namespace OpenSim.Region.Environment.Scenes
521 public void LoadPrimsFromStorage() 521 public void LoadPrimsFromStorage()
522 { 522 {
523 MainLog.Instance.Verbose("Loading objects from datastore"); 523 MainLog.Instance.Verbose("Loading objects from datastore");
524 List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects(this.m_regInfo.SimUUID); 524 List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects(m_regInfo.SimUUID);
525 foreach (SceneObjectGroup prim in PrimsFromDB) 525 foreach (SceneObjectGroup prim in PrimsFromDB)
526 { 526 {
527 AddEntityFromStorage(prim); 527 AddEntityFromStorage(prim);
528 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); 528 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
529 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 529 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
530 rootPart.PhysActor = phyScene.AddPrim( 530 rootPart.PhysActor = phyScene.AddPrim(
531 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), 531 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
532 rootPart.AbsolutePosition.Z),
532 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 533 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
533 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 534 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
534 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 535 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
535 } 536 }
536 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 537 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
537 } 538 }
538 539
539 540
540
541 /// <summary> 541 /// <summary>
542 /// Returns a new unallocated primitive ID 542 /// Returns a new unallocated primitive ID
543 /// </summary> 543 /// </summary>
@@ -561,20 +561,23 @@ namespace OpenSim.Region.Environment.Scenes
561 /// <param name="ownerID"></param> 561 /// <param name="ownerID"></param>
562 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape) 562 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
563 { 563 {
564 if (this.PermissionsMngr.CanRezObject(ownerID, pos)) 564 if (PermissionsMngr.CanRezObject(ownerID, pos))
565 { 565 {
566 SceneObjectGroup sceneOb = new SceneObjectGroup(this, this.m_regionHandle, ownerID, PrimIDAllocate(), pos, shape); 566 SceneObjectGroup sceneOb =
567 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, shape);
567 AddEntity(sceneOb); 568 AddEntity(sceneOb);
568 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); 569 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
569 // if grass or tree, make phantom 570 // if grass or tree, make phantom
570 if ((rootPart.Shape.PCode==95) || (rootPart.Shape.PCode==255)) 571 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255))
571 { 572 {
572 rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; 573 rootPart.ObjectFlags += (uint) LLObject.ObjectFlags.Phantom;
573 } 574 }
574 // if not phantom, add to physics 575 // if not phantom, add to physics
575 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 576 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
576 rootPart.PhysActor = phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), 577 rootPart.PhysActor =
577 new Axiom.Math.Quaternion()); 578 phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z),
579 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
580 new Quaternion());
578 } 581 }
579 } 582 }
580 583
@@ -584,9 +587,9 @@ namespace OpenSim.Region.Environment.Scenes
584 { 587 {
585 if (obj is SceneObjectGroup) 588 if (obj is SceneObjectGroup)
586 { 589 {
587 if (((SceneObjectGroup)obj).LocalId == localID) 590 if (((SceneObjectGroup) obj).LocalId == localID)
588 { 591 {
589 RemoveEntity((SceneObjectGroup)obj); 592 RemoveEntity((SceneObjectGroup) obj);
590 return; 593 return;
591 } 594 }
592 } 595 }
@@ -595,21 +598,21 @@ namespace OpenSim.Region.Environment.Scenes
595 598
596 public void AddEntityFromStorage(SceneObjectGroup sceneObject) 599 public void AddEntityFromStorage(SceneObjectGroup sceneObject)
597 { 600 {
598 sceneObject.RegionHandle = this.m_regionHandle; 601 sceneObject.RegionHandle = m_regionHandle;
599 sceneObject.SetScene(this); 602 sceneObject.SetScene(this);
600 foreach (SceneObjectPart part in sceneObject.Children.Values) 603 foreach (SceneObjectPart part in sceneObject.Children.Values)
601 { 604 {
602 part.LocalID = this.PrimIDAllocate(); 605 part.LocalID = PrimIDAllocate();
603 } 606 }
604 sceneObject.UpdateParentIDs(); 607 sceneObject.UpdateParentIDs();
605 this.AddEntity(sceneObject); 608 AddEntity(sceneObject);
606 } 609 }
607 610
608 public void AddEntity(SceneObjectGroup sceneObject) 611 public void AddEntity(SceneObjectGroup sceneObject)
609 { 612 {
610 if (!Entities.ContainsKey(sceneObject.UUID)) 613 if (!Entities.ContainsKey(sceneObject.UUID))
611 { 614 {
612 // QuadTree.AddObject(sceneObject); 615 // QuadTree.AddObject(sceneObject);
613 Entities.Add(sceneObject.UUID, sceneObject); 616 Entities.Add(sceneObject.UUID, sceneObject);
614 } 617 }
615 } 618 }
@@ -648,18 +651,19 @@ namespace OpenSim.Region.Environment.Scenes
648 foreach (XmlNode aPrimNode in rootNode.ChildNodes) 651 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
649 { 652 {
650 SceneObjectGroup obj = new SceneObjectGroup(this, 653 SceneObjectGroup obj = new SceneObjectGroup(this,
651 this.m_regionHandle, aPrimNode.OuterXml); 654 m_regionHandle, aPrimNode.OuterXml);
652 //if we want this to be a import method then we need new uuids for the object to avoid any clashes 655 //if we want this to be a import method then we need new uuids for the object to avoid any clashes
653 //obj.RegenerateFullIDs(); 656 //obj.RegenerateFullIDs();
654 AddEntity(obj); 657 AddEntity(obj);
655 658
656 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 659 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
657 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 660 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
658 rootPart.PhysActor = phyScene.AddPrim( 661 rootPart.PhysActor = phyScene.AddPrim(
659 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), 662 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
660 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 663 rootPart.AbsolutePosition.Z),
661 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 664 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
662 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 665 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
666 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
663 primCount++; 667 primCount++;
664 } 668 }
665 } 669 }
@@ -679,7 +683,7 @@ namespace OpenSim.Region.Environment.Scenes
679 { 683 {
680 if (ent is SceneObjectGroup) 684 if (ent is SceneObjectGroup)
681 { 685 {
682 stream.WriteLine(((SceneObjectGroup)ent).ToXmlString()); 686 stream.WriteLine(((SceneObjectGroup) ent).ToXmlString());
683 primCount++; 687 primCount++;
684 } 688 }
685 } 689 }
@@ -688,7 +692,6 @@ namespace OpenSim.Region.Environment.Scenes
688 file.Close(); 692 file.Close();
689 } 693 }
690 694
691
692 #endregion 695 #endregion
693 696
694 #region Add/Remove Avatar Methods 697 #region Add/Remove Avatar Methods
@@ -703,7 +706,7 @@ namespace OpenSim.Region.Environment.Scenes
703 { 706 {
704 SubscribeToClientEvents(client); 707 SubscribeToClientEvents(client);
705 m_estateManager.sendRegionHandshake(client); 708 m_estateManager.sendRegionHandshake(client);
706 CreateAndAddScenePresence(client, child ); 709 CreateAndAddScenePresence(client, child);
707 m_LandManager.sendParcelOverlay(client); 710 m_LandManager.sendParcelOverlay(client);
708 commsManager.UserProfiles.AddNewUser(client.AgentId); 711 commsManager.UserProfiles.AddNewUser(client.AgentId);
709 commsManager.TransactionsManager.AddUser(client.AgentId); 712 commsManager.TransactionsManager.AddUser(client.AgentId);
@@ -744,9 +747,11 @@ namespace OpenSim.Region.Environment.Scenes
744 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest); 747 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest);
745 client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest); 748 client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest);
746 client.OnParcelJoinRequest += new ParcelJoinRequest(m_LandManager.handleParcelJoinRequest); 749 client.OnParcelJoinRequest += new ParcelJoinRequest(m_LandManager.handleParcelJoinRequest);
747 client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_LandManager.handleParcelPropertiesUpdateRequest); 750 client.OnParcelPropertiesUpdateRequest +=
751 new ParcelPropertiesUpdateRequest(m_LandManager.handleParcelPropertiesUpdateRequest);
748 client.OnParcelSelectObjects += new ParcelSelectObjects(m_LandManager.handleParcelSelectObjectsRequest); 752 client.OnParcelSelectObjects += new ParcelSelectObjects(m_LandManager.handleParcelSelectObjectsRequest);
749 client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); 753 client.OnParcelObjectOwnerRequest +=
754 new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
750 755
751 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); 756 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
752 757
@@ -768,7 +773,7 @@ namespace OpenSim.Region.Environment.Scenes
768 EventManager.TriggerOnNewClient(client); 773 EventManager.TriggerOnNewClient(client);
769 } 774 }
770 775
771 protected ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child ) 776 protected ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
772 { 777 {
773 ScenePresence newAvatar = null; 778 ScenePresence newAvatar = null;
774 779
@@ -777,16 +782,18 @@ namespace OpenSim.Region.Environment.Scenes
777 782
778 if (child) 783 if (child)
779 { 784 {
780 MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Creating new child agent."); 785 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new child agent.");
781 } 786 }
782 else 787 else
783 { 788 {
784 newAvatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement; 789 newAvatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement;
785 790
786 MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Creating new root agent."); 791 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new root agent.");
787 MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Adding Physical agent."); 792 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Adding Physical agent.");
788 793
789 PhysicsVector pVec = new PhysicsVector(newAvatar.AbsolutePosition.X, newAvatar.AbsolutePosition.Y, newAvatar.AbsolutePosition.Z); 794 PhysicsVector pVec =
795 new PhysicsVector(newAvatar.AbsolutePosition.X, newAvatar.AbsolutePosition.Y,
796 newAvatar.AbsolutePosition.Z);
790 lock (m_syncRoot) 797 lock (m_syncRoot)
791 { 798 {
792 newAvatar.PhysActor = phyScene.AddAvatar(pVec); 799 newAvatar.PhysActor = phyScene.AddAvatar(pVec);
@@ -832,14 +839,14 @@ namespace OpenSim.Region.Environment.Scenes
832 839
833 ForEachScenePresence( 840 ForEachScenePresence(
834 delegate(ScenePresence presence) 841 delegate(ScenePresence presence)
835 {
836 presence.CoarseLocationChange(avatar);
837 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
838 if (presence.PhysActor != null)
839 { 842 {
840 phyScene.RemoveAvatar(presence.PhysActor); 843 presence.CoarseLocationChange(avatar);
841 } 844 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
842 }); 845 if (presence.PhysActor != null)
846 {
847 phyScene.RemoveAvatar(presence.PhysActor);
848 }
849 });
843 850
844 lock (Avatars) 851 lock (Avatars)
845 { 852 {
@@ -943,7 +950,7 @@ namespace OpenSim.Region.Environment.Scenes
943 if (Entities.ContainsKey(entID)) 950 if (Entities.ContainsKey(entID))
944 { 951 {
945 Entities.Remove(entID); 952 Entities.Remove(entID);
946 storageManager.DataStore.RemoveObject(entID, this.m_regInfo.SimUUID); 953 storageManager.DataStore.RemoveObject(entID, m_regInfo.SimUUID);
947 return true; 954 return true;
948 } 955 }
949 return false; 956 return false;
@@ -951,10 +958,10 @@ namespace OpenSim.Region.Environment.Scenes
951 958
952 public void SendKillObject(uint localID) 959 public void SendKillObject(uint localID)
953 { 960 {
954 List<ScenePresence> avatars = this.RequestAvatarList(); 961 List<ScenePresence> avatars = RequestAvatarList();
955 for (int i = 0; i < avatars.Count; i++) 962 for (int i = 0; i < avatars.Count; i++)
956 { 963 {
957 avatars[i].ControllingClient.SendKillObject(this.m_regionHandle, localID); 964 avatars[i].ControllingClient.SendKillObject(m_regionHandle, localID);
958 } 965 }
959 } 966 }
960 967
@@ -964,8 +971,8 @@ namespace OpenSim.Region.Environment.Scenes
964 { 971 {
965 if (ent is SceneObjectGroup) 972 if (ent is SceneObjectGroup)
966 { 973 {
967 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client); 974 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
968 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); 975 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
969 } 976 }
970 } 977 }
971 } 978 }
@@ -999,15 +1006,19 @@ namespace OpenSim.Region.Environment.Scenes
999 if (agent.CapsPath != "") 1006 if (agent.CapsPath != "")
1000 { 1007 {
1001 //Console.WriteLine("new user, so creating caps handler for it"); 1008 //Console.WriteLine("new user, so creating caps handler for it");
1002 Caps cap = new Caps(commsManager.AssetCache, httpListener, m_regInfo.ExternalHostName, httpListener.Port, agent.CapsPath, agent.AgentID); 1009 Caps cap =
1003 Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + "/CAPS/" + agent.CapsPath + "0000/"); 1010 new Caps(commsManager.AssetCache, httpListener, m_regInfo.ExternalHostName, httpListener.Port,
1011 agent.CapsPath, agent.AgentID);
1012 Util.SetCapsURL(agent.AgentID,
1013 "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() +
1014 "/CAPS/" + agent.CapsPath + "0000/");
1004 cap.RegisterHandlers(); 1015 cap.RegisterHandlers();
1005 cap.AddNewInventoryItem = this.AddInventoryItem; 1016 cap.AddNewInventoryItem = AddInventoryItem;
1006 cap.ItemUpdatedCall = this.CapsUpdateInventoryItemAsset; 1017 cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
1007 if (capsHandlers.ContainsKey(agent.AgentID)) 1018 if (capsHandlers.ContainsKey(agent.AgentID))
1008 { 1019 {
1009 MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + 1020 MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " +
1010 agent.AgentID.ToStringHyphenated()); 1021 agent.AgentID.ToStringHyphenated());
1011 capsHandlers[agent.AgentID] = cap; 1022 capsHandlers[agent.AgentID] = cap;
1012 } 1023 }
1013 else 1024 else
@@ -1142,43 +1153,25 @@ namespace OpenSim.Region.Environment.Scenes
1142 1153
1143 public void AddModule(string name, IRegionModule module) 1154 public void AddModule(string name, IRegionModule module)
1144 { 1155 {
1145 if (!this.Modules.ContainsKey(name)) 1156 if (!Modules.ContainsKey(name))
1146 { 1157 {
1147 Modules.Add(name, module); 1158 Modules.Add(name, module);
1148 } 1159 }
1149 } 1160 }
1150 1161
1151 //following delegate methods will be removed, so use the interface methods (below these)
1152 public void RegisterAPIMethod(string name, object method)
1153 {
1154 if (!this.ModuleAPIMethods.ContainsKey(name))
1155 {
1156 this.ModuleAPIMethods.Add(name, method);
1157 }
1158 }
1159
1160 public object RequestAPIMethod(string name)
1161 {
1162 if (this.ModuleAPIMethods.ContainsKey(name))
1163 {
1164 return ModuleAPIMethods[name];
1165 }
1166 return false;
1167 }
1168
1169 public void RegisterModuleInterface<M>(M mod) 1162 public void RegisterModuleInterface<M>(M mod)
1170 { 1163 {
1171 if (!this.ModuleInterfaces.ContainsKey(typeof(M))) 1164 if (!ModuleInterfaces.ContainsKey(typeof (M)))
1172 { 1165 {
1173 ModuleInterfaces.Add(typeof(M), mod); 1166 ModuleInterfaces.Add(typeof (M), mod);
1174 } 1167 }
1175 } 1168 }
1176 1169
1177 public T RequestModuleInterface<T>() 1170 public T RequestModuleInterface<T>()
1178 { 1171 {
1179 if (ModuleInterfaces.ContainsKey(typeof(T))) 1172 if (ModuleInterfaces.ContainsKey(typeof (T)))
1180 { 1173 {
1181 return (T)ModuleInterfaces[typeof(T)]; 1174 return (T) ModuleInterfaces[typeof (T)];
1182 } 1175 }
1183 else 1176 else
1184 { 1177 {
@@ -1191,7 +1184,8 @@ namespace OpenSim.Region.Environment.Scenes
1191 m_timePhase = phase; 1184 m_timePhase = phase;
1192 } 1185 }
1193 1186
1194 public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) 1187 public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned,
1188 string message, string url)
1195 { 1189 {
1196 if (Avatars.ContainsKey(avatarID)) 1190 if (Avatars.ContainsKey(avatarID))
1197 { 1191 {
@@ -1201,7 +1195,7 @@ namespace OpenSim.Region.Environment.Scenes
1201 1195
1202 #region Alert Methods 1196 #region Alert Methods
1203 1197
1204 void SendPermissionAlert(LLUUID user, string reason) 1198 private void SendPermissionAlert(LLUUID user, string reason)
1205 { 1199 {
1206 SendAlertToUser(user, reason, false); 1200 SendAlertToUser(user, reason, false);
1207 } 1201 }
@@ -1209,7 +1203,7 @@ namespace OpenSim.Region.Environment.Scenes
1209 1203
1210 public void SendGeneralAlert(string message) 1204 public void SendGeneralAlert(string message)
1211 { 1205 {
1212 foreach (ScenePresence presence in this.Avatars.Values) 1206 foreach (ScenePresence presence in Avatars.Values)
1213 { 1207 {
1214 presence.ControllingClient.SendAlertMessage(message); 1208 presence.ControllingClient.SendAlertMessage(message);
1215 } 1209 }
@@ -1217,15 +1211,15 @@ namespace OpenSim.Region.Environment.Scenes
1217 1211
1218 public void SendAlertToUser(LLUUID agentID, string message, bool modal) 1212 public void SendAlertToUser(LLUUID agentID, string message, bool modal)
1219 { 1213 {
1220 if (this.Avatars.ContainsKey(agentID)) 1214 if (Avatars.ContainsKey(agentID))
1221 { 1215 {
1222 this.Avatars[agentID].ControllingClient.SendAgentAlertMessage(message, modal); 1216 Avatars[agentID].ControllingClient.SendAgentAlertMessage(message, modal);
1223 } 1217 }
1224 } 1218 }
1225 1219
1226 public void SendAlertToUser(string firstName, string lastName, string message, bool modal) 1220 public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
1227 { 1221 {
1228 foreach (ScenePresence presence in this.Avatars.Values) 1222 foreach (ScenePresence presence in Avatars.Values)
1229 { 1223 {
1230 if ((presence.Firstname == firstName) && (presence.Lastname == lastName)) 1224 if ((presence.Firstname == firstName) && (presence.Lastname == lastName))
1231 { 1225 {
@@ -1239,13 +1233,13 @@ namespace OpenSim.Region.Environment.Scenes
1239 { 1233 {
1240 if (commandParams[0] == "general") 1234 if (commandParams[0] == "general")
1241 { 1235 {
1242 string message = this.CombineParams(commandParams, 1); 1236 string message = CombineParams(commandParams, 1);
1243 this.SendGeneralAlert(message); 1237 SendGeneralAlert(message);
1244 } 1238 }
1245 else 1239 else
1246 { 1240 {
1247 string message = this.CombineParams(commandParams, 2); 1241 string message = CombineParams(commandParams, 2);
1248 this.SendAlertToUser(commandParams[0], commandParams[1], message, false); 1242 SendAlertToUser(commandParams[0], commandParams[1], message, false);
1249 } 1243 }
1250 } 1244 }
1251 1245
@@ -1258,36 +1252,39 @@ namespace OpenSim.Region.Environment.Scenes
1258 } 1252 }
1259 return result; 1253 return result;
1260 } 1254 }
1255
1261 #endregion 1256 #endregion
1262 1257
1263 public void ForceClientUpdate() 1258 public void ForceClientUpdate()
1264 { 1259 {
1265 foreach (EntityBase ent in this.Entities.Values) 1260 foreach (EntityBase ent in Entities.Values)
1266 { 1261 {
1267 if (ent is SceneObjectGroup) 1262 if (ent is SceneObjectGroup)
1268 { 1263 {
1269 ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); 1264 ((SceneObjectGroup) ent).ScheduleGroupForFullUpdate();
1270 } 1265 }
1271 } 1266 }
1272 } 1267 }
1273 1268
1274 public void HandleEditCommand(string[] cmmdparams) 1269 public void HandleEditCommand(string[] cmmdparams)
1275 { 1270 {
1276 Console.WriteLine("Searching for Primitive: '" + cmmdparams[0] + "'"); 1271 Console.WriteLine("Searching for Primitive: '" + cmmdparams[0] + "'");
1277 foreach (EntityBase ent in this.Entities.Values) 1272 foreach (EntityBase ent in Entities.Values)
1278 { 1273 {
1279 if (ent is SceneObjectGroup) 1274 if (ent is SceneObjectGroup)
1280 { 1275 {
1281 SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); 1276 SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID);
1282 if (part != null) 1277 if (part != null)
1283 { 1278 {
1284 if (part.Name == cmmdparams[0]) 1279 if (part.Name == cmmdparams[0])
1285 { 1280 {
1286 part.Resize( new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]), Convert.ToSingle(cmmdparams[3]))); 1281 part.Resize(
1287 1282 new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]),
1288 Console.WriteLine("Edited scale of Primitive: " + part.Name); 1283 Convert.ToSingle(cmmdparams[3])));
1289 } 1284
1290 } 1285 Console.WriteLine("Edited scale of Primitive: " + part.Name);
1286 }
1287 }
1291 } 1288 }
1292 } 1289 }
1293 } 1290 }
@@ -1298,7 +1295,9 @@ namespace OpenSim.Region.Environment.Scenes
1298 { 1295 {
1299 case "users": 1296 case "users":
1300 MainLog.Instance.Error("Current Region: " + RegionInfo.RegionName); 1297 MainLog.Instance.Error("Current Region: " + RegionInfo.RegionName);
1301 MainLog.Instance.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); 1298 MainLog.Instance.Error(
1299 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname",
1300 "Agent ID", "Session ID", "Circuit", "IP", "World"));
1302 1301
1303 foreach (EntityBase entity in Entities.Values) 1302 foreach (EntityBase entity in Entities.Values)
1304 { 1303 {
@@ -1321,8 +1320,8 @@ namespace OpenSim.Region.Environment.Scenes
1321 } 1320 }
1322 break; 1321 break;
1323 case "modules": 1322 case "modules":
1324 MainLog.Instance.Error("The currently loaded modules in " + this.RegionInfo.RegionName + " are:"); 1323 MainLog.Instance.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:");
1325 foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in this.Modules.Values) 1324 foreach (IRegionModule module in Modules.Values)
1326 { 1325 {
1327 if (!module.IsSharedModule()) 1326 if (!module.IsSharedModule())
1328 { 1327 {
@@ -1337,19 +1336,22 @@ namespace OpenSim.Region.Environment.Scenes
1337 { 1336 {
1338 if (m_httpRequestModule != null) 1337 if (m_httpRequestModule != null)
1339 { 1338 {
1340 return m_httpRequestModule.MakeHttpRequest(url, type, body); 1339 return m_httpRequestModule.MakeHttpRequest(url, type, body);
1341 } 1340 }
1342 return LLUUID.Zero; 1341 return LLUUID.Zero;
1343 } 1342 }
1344 1343
1345 #region Script Engine 1344 #region Script Engine
1346 private List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface> ScriptEngines = new List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface>(); 1345
1347 public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine, LogBase m_logger) 1346 private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>();
1347
1348 public void AddScriptEngine(ScriptEngineInterface ScriptEngine, LogBase m_logger)
1348 { 1349 {
1349 ScriptEngines.Add(ScriptEngine); 1350 ScriptEngines.Add(ScriptEngine);
1350 1351
1351 ScriptEngine.InitializeEngine(this, m_logger); 1352 ScriptEngine.InitializeEngine(this, m_logger);
1352 } 1353 }
1354
1353 #endregion 1355 #endregion
1354 1356
1355 public LLUUID ConvertLocalIDToFullID(uint localID) 1357 public LLUUID ConvertLocalIDToFullID(uint localID)
@@ -1359,10 +1361,10 @@ namespace OpenSim.Region.Environment.Scenes
1359 { 1361 {
1360 if (ent is SceneObjectGroup) 1362 if (ent is SceneObjectGroup)
1361 { 1363 {
1362 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 1364 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
1363 if (hasPrim != false) 1365 if (hasPrim != false)
1364 { 1366 {
1365 return ((SceneObjectGroup)ent).GetPartsFullID(localID); 1367 return ((SceneObjectGroup) ent).GetPartsFullID(localID);
1366 } 1368 }
1367 } 1369 }
1368 } 1370 }
@@ -1376,10 +1378,10 @@ namespace OpenSim.Region.Environment.Scenes
1376 { 1378 {
1377 if (ent is SceneObjectGroup) 1379 if (ent is SceneObjectGroup)
1378 { 1380 {
1379 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 1381 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
1380 if (hasPrim != false) 1382 if (hasPrim != false)
1381 { 1383 {
1382 return ((SceneObjectGroup)ent).GetChildPart(localID); 1384 return ((SceneObjectGroup) ent).GetChildPart(localID);
1383 } 1385 }
1384 } 1386 }
1385 } 1387 }
@@ -1393,14 +1395,14 @@ namespace OpenSim.Region.Environment.Scenes
1393 { 1395 {
1394 if (ent is SceneObjectGroup) 1396 if (ent is SceneObjectGroup)
1395 { 1397 {
1396 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(fullID); 1398 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(fullID);
1397 if (hasPrim != false) 1399 if (hasPrim != false)
1398 { 1400 {
1399 return ((SceneObjectGroup)ent).GetChildPart(fullID); 1401 return ((SceneObjectGroup) ent).GetChildPart(fullID);
1400 } 1402 }
1401 } 1403 }
1402 } 1404 }
1403 return null; 1405 return null;
1404 } 1406 }
1405 } 1407 }
1406} 1408} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index c01157d..7b2e17f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -27,15 +27,12 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
31using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework.Communications.Caches;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33using OpenSim.Framework.Interfaces; 33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework.Types; 34using OpenSim.Framework.Types;
35using OpenSim.Framework.Communications.Caches;
36using OpenSim.Region.Terrain; 35using OpenSim.Region.Terrain;
37using OpenSim.Framework;
38using OpenSim.Region.Environment.Interfaces;
39 36
40namespace OpenSim.Region.Environment.Scenes 37namespace OpenSim.Region.Environment.Scenes
41{ 38{
@@ -67,6 +64,7 @@ namespace OpenSim.Region.Environment.Scenes
67 protected AssetCache assetCache; 64 protected AssetCache assetCache;
68 65
69 #region Update Methods 66 #region Update Methods
67
70 /// <summary> 68 /// <summary>
71 /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) 69 /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation)
72 /// </summary> 70 /// </summary>
@@ -104,6 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
104 #endregion 102 #endregion
105 103
106 #region Add/Remove Agent/Avatar 104 #region Add/Remove Agent/Avatar
105
107 /// <summary> 106 /// <summary>
108 /// 107 ///
109 /// </summary> 108 /// </summary>
@@ -126,7 +125,7 @@ namespace OpenSim.Region.Environment.Scenes
126 /// <returns></returns> 125 /// <returns></returns>
127 public virtual RegionInfo RegionInfo 126 public virtual RegionInfo RegionInfo
128 { 127 {
129 get { return this.m_regInfo; } 128 get { return m_regInfo; }
130 } 129 }
131 130
132 public object SyncRoot 131 public object SyncRoot
@@ -140,6 +139,7 @@ namespace OpenSim.Region.Environment.Scenes
140 } 139 }
141 140
142 #region Shutdown 141 #region Shutdown
142
143 /// <summary> 143 /// <summary>
144 /// Tidy before shutdown 144 /// Tidy before shutdown
145 /// </summary> 145 /// </summary>
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Environment.Scenes
147 { 147 {
148 try 148 try
149 { 149 {
150 this.EventManager.TriggerShutdown(); 150 EventManager.TriggerShutdown();
151 } 151 }
152 catch (Exception e) 152 catch (Exception e)
153 { 153 {
@@ -156,7 +156,5 @@ namespace OpenSim.Region.Environment.Scenes
156 } 156 }
157 157
158 #endregion 158 #endregion
159
160
161 } 159 }
162} 160} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index a86a1bc..a5d8667 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -1,5 +1,6 @@
1using libsecondlife; 1using libsecondlife;
2using OpenSim.Framework.Interfaces; 2using OpenSim.Framework.Interfaces;
3using OpenSim.Region.Environment.Interfaces;
3 4
4namespace OpenSim.Region.Environment.Scenes 5namespace OpenSim.Region.Environment.Scenes
5{ 6{
@@ -9,41 +10,54 @@ namespace OpenSim.Region.Environment.Scenes
9 public class EventManager 10 public class EventManager
10 { 11 {
11 public delegate void OnFrameDelegate(); 12 public delegate void OnFrameDelegate();
13
12 public event OnFrameDelegate OnFrame; 14 public event OnFrameDelegate OnFrame;
13 15
14 public delegate void OnBackupDelegate(Interfaces.IRegionDataStore datastore); 16 public delegate void OnBackupDelegate(IRegionDataStore datastore);
17
15 public event OnBackupDelegate OnBackup; 18 public event OnBackupDelegate OnBackup;
16 19
17 public delegate void OnNewClientDelegate(IClientAPI client); 20 public delegate void OnNewClientDelegate(IClientAPI client);
21
18 public event OnNewClientDelegate OnNewClient; 22 public event OnNewClientDelegate OnNewClient;
19 23
20 public delegate void OnNewPresenceDelegate(ScenePresence presence); 24 public delegate void OnNewPresenceDelegate(ScenePresence presence);
25
21 public event OnNewPresenceDelegate OnNewPresence; 26 public event OnNewPresenceDelegate OnNewPresence;
22 27
23 public delegate void OnRemovePresenceDelegate(LLUUID uuid); 28 public delegate void OnRemovePresenceDelegate(LLUUID uuid);
29
24 public event OnRemovePresenceDelegate OnRemovePresence; 30 public event OnRemovePresenceDelegate OnRemovePresence;
25 31
26 public delegate void OnParcelPrimCountUpdateDelegate(); 32 public delegate void OnParcelPrimCountUpdateDelegate();
33
27 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; 34 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
28 35
29 public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj); 36 public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
37
30 public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd; 38 public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
31 39
32 public delegate void OnScriptConsoleDelegate(string[] args); 40 public delegate void OnScriptConsoleDelegate(string[] args);
41
33 public event OnScriptConsoleDelegate OnScriptConsole; 42 public event OnScriptConsoleDelegate OnScriptConsole;
34 43
35 public delegate void OnShutdownDelegate(); 44 public delegate void OnShutdownDelegate();
45
36 public event OnShutdownDelegate OnShutdown; 46 public event OnShutdownDelegate OnShutdown;
37 47
38 public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient); 48 public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
49
39 public delegate void OnPermissionErrorDelegate(LLUUID user, string reason); 50 public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
51
40 public event ObjectGrabDelegate OnObjectGrab; 52 public event ObjectGrabDelegate OnObjectGrab;
41 public event OnPermissionErrorDelegate OnPermissionError; 53 public event OnPermissionErrorDelegate OnPermissionError;
42 54
43 public delegate void NewRezScript(uint localID, LLUUID itemID, string script); 55 public delegate void NewRezScript(uint localID, LLUUID itemID, string script);
56
44 public event NewRezScript OnRezScript; 57 public event NewRezScript OnRezScript;
45 58
46 public delegate void RemoveScript(uint localID, LLUUID itemID); 59 public delegate void RemoveScript(uint localID, LLUUID itemID);
60
47 public event RemoveScript OnRemoveScript; 61 public event RemoveScript OnRemoveScript;
48 62
49 public void TriggerPermissionError(LLUUID user, string reason) 63 public void TriggerPermissionError(LLUUID user, string reason)
@@ -86,7 +100,7 @@ namespace OpenSim.Region.Environment.Scenes
86 } 100 }
87 } 101 }
88 102
89 public void TriggerOnBackup(Interfaces.IRegionDataStore dstore) 103 public void TriggerOnBackup(IRegionDataStore dstore)
90 { 104 {
91 if (OnBackup != null) 105 if (OnBackup != null)
92 { 106 {
@@ -101,6 +115,7 @@ namespace OpenSim.Region.Environment.Scenes
101 OnParcelPrimCountUpdate(); 115 OnParcelPrimCountUpdate();
102 } 116 }
103 } 117 }
118
104 public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) 119 public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
105 { 120 {
106 if (OnParcelPrimCountAdd != null) 121 if (OnParcelPrimCountAdd != null)
@@ -137,4 +152,4 @@ namespace OpenSim.Region.Environment.Scenes
137 } 152 }
138 } 153 }
139 } 154 }
140} 155} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 5655e72..effd4b2 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -1,20 +1,18 @@
1using System.Collections.Generic; 1using System;
2using System; 2using System.Collections.Generic;
3using OpenSim.Framework.Console; 3using OpenSim.Framework.Console;
4using OpenSim.Framework.Types; 4using OpenSim.Framework.Types;
5 5
6namespace OpenSim.Region.Environment.Scenes 6namespace OpenSim.Region.Environment.Scenes
7{ 7{
8 public class SceneManager 8 public class SceneManager
9 { 9 {
10 private readonly List<Scene> m_localScenes; 10 private readonly List<Scene> m_localScenes;
11 private Scene m_currentScene = null; 11 private Scene m_currentScene = null;
12
12 public Scene CurrentScene 13 public Scene CurrentScene
13 { 14 {
14 get 15 get { return m_currentScene; }
15 {
16 return m_currentScene;
17 }
18 } 16 }
19 17
20 private Scene CurrentOrFirstScene 18 private Scene CurrentOrFirstScene
@@ -83,18 +81,12 @@ namespace OpenSim.Region.Environment.Scenes
83 81
84 public void SendCommandToScripts(string[] cmdparams) 82 public void SendCommandToScripts(string[] cmdparams)
85 { 83 {
86 ForEach(delegate(Scene scene) 84 ForEach(delegate(Scene scene) { scene.SendCommandToScripts(cmdparams); });
87 {
88 scene.SendCommandToScripts(cmdparams);
89 });
90 } 85 }
91 86
92 public void BypassPermissions(bool bypassPermissions) 87 public void BypassPermissions(bool bypassPermissions)
93 { 88 {
94 ForEach(delegate(Scene scene) 89 ForEach(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; });
95 {
96 scene.PermissionsMngr.BypassPermissions = bypassPermissions;
97 });
98 } 90 }
99 91
100 private void ForEach(Action<Scene> func) 92 private void ForEach(Action<Scene> func)
@@ -111,18 +103,12 @@ namespace OpenSim.Region.Environment.Scenes
111 103
112 public void Backup() 104 public void Backup()
113 { 105 {
114 ForEach(delegate(Scene scene) 106 ForEach(delegate(Scene scene) { scene.Backup(); });
115 {
116 scene.Backup();
117 });
118 } 107 }
119 108
120 public void HandleAlertCommand(string[] cmdparams) 109 public void HandleAlertCommand(string[] cmdparams)
121 { 110 {
122 ForEach(delegate(Scene scene) 111 ForEach(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); });
123 {
124 scene.HandleAlertCommand(cmdparams);
125 });
126 } 112 }
127 113
128 public bool TrySetCurrentRegion(string regionName) 114 public bool TrySetCurrentRegion(string regionName)
@@ -161,8 +147,8 @@ namespace OpenSim.Region.Environment.Scenes
161 if (!scenePrescence.childAgent) 147 if (!scenePrescence.childAgent)
162 { 148 {
163 log.Error(String.Format("Packet debug for {0} {1} set to {2}", 149 log.Error(String.Format("Packet debug for {0} {1} set to {2}",
164 scenePrescence.Firstname, scenePrescence.Lastname, 150 scenePrescence.Firstname, scenePrescence.Lastname,
165 newDebug)); 151 newDebug));
166 152
167 scenePrescence.ControllingClient.SetDebug(newDebug); 153 scenePrescence.ControllingClient.SetDebug(newDebug);
168 } 154 }
@@ -219,18 +205,12 @@ namespace OpenSim.Region.Environment.Scenes
219 205
220 public void ForceClientUpdate() 206 public void ForceClientUpdate()
221 { 207 {
222 ForEach(delegate(Scene scene) 208 ForEach(delegate(Scene scene) { scene.ForceClientUpdate(); });
223 {
224 scene.ForceClientUpdate();
225 });
226 } 209 }
227 210
228 public void HandleEditCommand(string[] cmdparams) 211 public void HandleEditCommand(string[] cmdparams)
229 { 212 {
230 ForEach(delegate(Scene scene) 213 ForEach(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); });
231 {
232 scene.HandleEditCommand(cmdparams);
233 });
234 } 214 }
235 } 215 }
236} 216} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 99f1900..3182204 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1,17 +1,16 @@
1using System;
1using System.Collections.Generic; 2using System.Collections.Generic;
3using System.IO;
2using System.Text; 4using System.Text;
3using System.Xml; 5using System.Xml;
4using System.Xml.Serialization;
5using System.IO;
6using System;
7using Axiom.Math; 6using Axiom.Math;
8using libsecondlife; 7using libsecondlife;
9using libsecondlife.Packets; 8using libsecondlife.Packets;
9using OpenSim.Framework.Data;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Types; 11using OpenSim.Framework.Types;
12using OpenSim.Region.Physics.Manager;
13using OpenSim.Framework.Data;
14using OpenSim.Region.Environment.Interfaces; 12using OpenSim.Region.Environment.Interfaces;
13using OpenSim.Region.Physics.Manager;
15 14
16namespace OpenSim.Region.Environment.Scenes 15namespace OpenSim.Region.Environment.Scenes
17{ 16{
@@ -31,6 +30,7 @@ namespace OpenSim.Region.Environment.Scenes
31 public bool HasChanged = false; 30 public bool HasChanged = false;
32 31
33 #region Properties 32 #region Properties
33
34 /// <summary> 34 /// <summary>
35 /// 35 ///
36 /// </summary> 36 /// </summary>
@@ -54,13 +54,13 @@ namespace OpenSim.Region.Environment.Scenes
54 54
55 public Dictionary<LLUUID, SceneObjectPart> Children 55 public Dictionary<LLUUID, SceneObjectPart> Children
56 { 56 {
57 get { return this.m_parts; } 57 get { return m_parts; }
58 set { m_parts = value; } 58 set { m_parts = value; }
59 } 59 }
60 60
61 public SceneObjectPart RootPart 61 public SceneObjectPart RootPart
62 { 62 {
63 get { return this.m_rootPart; } 63 get { return m_rootPart; }
64 set { m_rootPart = value; } 64 set { m_rootPart = value; }
65 } 65 }
66 66
@@ -70,9 +70,9 @@ namespace OpenSim.Region.Environment.Scenes
70 set 70 set
71 { 71 {
72 m_regionHandle = value; 72 m_regionHandle = value;
73 lock (this.m_parts) 73 lock (m_parts)
74 { 74 {
75 foreach (SceneObjectPart part in this.m_parts.Values) 75 foreach (SceneObjectPart part in m_parts.Values)
76 { 76 {
77 part.RegionHandle = m_regionHandle; 77 part.RegionHandle = m_regionHandle;
78 } 78 }
@@ -104,16 +104,18 @@ namespace OpenSim.Region.Environment.Scenes
104 val.Y = 0.4f; 104 val.Y = 0.4f;
105 } 105 }
106 106
107 lock (this.m_parts) 107 lock (m_parts)
108 { 108 {
109 foreach (SceneObjectPart part in this.m_parts.Values) 109 foreach (SceneObjectPart part in m_parts.Values)
110 { 110 {
111 part.GroupPosition = val; 111 part.GroupPosition = val;
112 } 112 }
113 } 113 }
114 if (m_rootPart.PhysActor != null) 114 if (m_rootPart.PhysActor != null)
115 { 115 {
116 m_rootPart.PhysActor.Position = new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y, m_rootPart.GroupPosition.Z); 116 m_rootPart.PhysActor.Position =
117 new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y,
118 m_rootPart.GroupPosition.Z);
117 } 119 }
118 } 120 }
119 } 121 }
@@ -152,10 +154,7 @@ namespace OpenSim.Region.Environment.Scenes
152 154
153 protected virtual bool InSceneBackup 155 protected virtual bool InSceneBackup
154 { 156 {
155 get 157 get { return true; }
156 {
157 return true;
158 }
159 } 158 }
160 159
161 public bool IsSelected 160 public bool IsSelected
@@ -170,19 +169,22 @@ namespace OpenSim.Region.Environment.Scenes
170 get 169 get
171 { 170 {
172 if (m_scene != null) 171 if (m_scene != null)
173 { return m_scene.RegionInfo.SimUUID; } 172 {
173 return m_scene.RegionInfo.SimUUID;
174 }
174 return LLUUID.Zero; 175 return LLUUID.Zero;
175 } 176 }
176 } 177 }
178
177 #endregion 179 #endregion
178 180
179 #region Constructors 181 #region Constructors
182
180 /// <summary> 183 /// <summary>
181 /// 184 ///
182 /// </summary> 185 /// </summary>
183 public SceneObjectGroup() 186 public SceneObjectGroup()
184 { 187 {
185
186 } 188 }
187 189
188 /// <summary> 190 /// <summary>
@@ -198,7 +200,7 @@ namespace OpenSim.Region.Environment.Scenes
198 reader.Read(); 200 reader.Read();
199 reader.ReadStartElement("SceneObjectGroup"); 201 reader.ReadStartElement("SceneObjectGroup");
200 reader.ReadStartElement("RootPart"); 202 reader.ReadStartElement("RootPart");
201 this.m_rootPart = SceneObjectPart.FromXml(reader); 203 m_rootPart = SceneObjectPart.FromXml(reader);
202 reader.ReadEndElement(); 204 reader.ReadEndElement();
203 205
204 while (reader.Read()) 206 while (reader.Read())
@@ -211,7 +213,7 @@ namespace OpenSim.Region.Environment.Scenes
211 reader.Read(); 213 reader.Read();
212 SceneObjectPart Part = SceneObjectPart.FromXml(reader); 214 SceneObjectPart Part = SceneObjectPart.FromXml(reader);
213 Part.LocalID = m_scene.PrimIDAllocate(); 215 Part.LocalID = m_scene.PrimIDAllocate();
214 this.AddPart(Part); 216 AddPart(Part);
215 Part.RegionHandle = m_regionHandle; 217 Part.RegionHandle = m_regionHandle;
216 } 218 }
217 break; 219 break;
@@ -221,23 +223,23 @@ namespace OpenSim.Region.Environment.Scenes
221 } 223 }
222 reader.Close(); 224 reader.Close();
223 sr.Close(); 225 sr.Close();
224 this.m_rootPart.SetParent(this); 226 m_rootPart.SetParent(this);
225 this.m_parts.Add(m_rootPart.UUID, m_rootPart); 227 m_parts.Add(m_rootPart.UUID, m_rootPart);
226 this.m_rootPart.LocalID = m_scene.PrimIDAllocate(); 228 m_rootPart.LocalID = m_scene.PrimIDAllocate();
227 this.m_rootPart.ParentID = 0; 229 m_rootPart.ParentID = 0;
228 this.m_rootPart.RegionHandle = m_regionHandle; 230 m_rootPart.RegionHandle = m_regionHandle;
229 this.UpdateParentIDs(); 231 UpdateParentIDs();
230 232
231 AttachToBackup(); 233 AttachToBackup();
232 234
233 this.ScheduleGroupForFullUpdate(); 235 ScheduleGroupForFullUpdate();
234 } 236 }
235 237
236 private void AttachToBackup() 238 private void AttachToBackup()
237 { 239 {
238 if (InSceneBackup) 240 if (InSceneBackup)
239 { 241 {
240 m_scene.EventManager.OnBackup += this.ProcessBackup; 242 m_scene.EventManager.OnBackup += ProcessBackup;
241 } 243 }
242 } 244 }
243 245
@@ -246,25 +248,27 @@ namespace OpenSim.Region.Environment.Scenes
246 /// </summary> 248 /// </summary>
247 public SceneObjectGroup(byte[] data) 249 public SceneObjectGroup(byte[] data)
248 { 250 {
249
250 } 251 }
251 252
252 /// <summary> 253 /// <summary>
253 /// 254 ///
254 /// </summary> 255 /// </summary>
255 public SceneObjectGroup(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 256 public SceneObjectGroup(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos,
257 PrimitiveBaseShape shape)
256 { 258 {
257 m_regionHandle = regionHandle; 259 m_regionHandle = regionHandle;
258 m_scene = scene; 260 m_scene = scene;
259 261
260 // this.Pos = pos; 262 // this.Pos = pos;
261 LLVector3 rootOffset = new LLVector3(0, 0, 0); 263 LLVector3 rootOffset = new LLVector3(0, 0, 0);
262 SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset); 264 SceneObjectPart newPart =
263 this.m_parts.Add(newPart.UUID, newPart); 265 new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset);
264 this.SetPartAsRoot(newPart); 266 m_parts.Add(newPart.UUID, newPart);
267 SetPartAsRoot(newPart);
265 268
266 AttachToBackup(); 269 AttachToBackup();
267 } 270 }
271
268 #endregion 272 #endregion
269 273
270 public string ToXmlString() 274 public string ToXmlString()
@@ -276,9 +280,9 @@ namespace OpenSim.Region.Environment.Scenes
276 m_rootPart.ToXml(writer); 280 m_rootPart.ToXml(writer);
277 writer.WriteEndElement(); 281 writer.WriteEndElement();
278 writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); 282 writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);
279 foreach (SceneObjectPart part in this.m_parts.Values) 283 foreach (SceneObjectPart part in m_parts.Values)
280 { 284 {
281 if (part.UUID != this.m_rootPart.UUID) 285 if (part.UUID != m_rootPart.UUID)
282 { 286 {
283 writer.WriteStartElement(String.Empty, "Part", String.Empty); 287 writer.WriteStartElement(String.Empty, "Part", String.Empty);
284 part.ToXml(writer); 288 part.ToXml(writer);
@@ -292,35 +296,36 @@ namespace OpenSim.Region.Environment.Scenes
292 } 296 }
293 297
294 #region Copying 298 #region Copying
299
295 /// <summary> 300 /// <summary>
296 /// 301 ///
297 /// </summary> 302 /// </summary>
298 /// <returns></returns> 303 /// <returns></returns>
299 public new SceneObjectGroup Copy() 304 public new SceneObjectGroup Copy()
300 { 305 {
301 SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone(); 306 SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone();
302 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>(); 307 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>();
303 dupe.m_parts.Clear(); 308 dupe.m_parts.Clear();
304 dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 309 dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
305 dupe.m_scene = m_scene; 310 dupe.m_scene = m_scene;
306 dupe.m_regionHandle = this.m_regionHandle; 311 dupe.m_regionHandle = m_regionHandle;
307 dupe.CopyRootPart(this.m_rootPart); 312 dupe.CopyRootPart(m_rootPart);
308 313
309 /// may need to create a new Physics actor. 314 /// may need to create a new Physics actor.
310 if (dupe.RootPart.PhysActor != null) 315 if (dupe.RootPart.PhysActor != null)
311 { 316 {
312 dupe.RootPart.PhysActor = m_scene.phyScene.AddPrim( 317 dupe.RootPart.PhysActor = m_scene.phyScene.AddPrim(
313 new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, dupe.RootPart.AbsolutePosition.Z), 318 new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y,
314 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z), 319 dupe.RootPart.AbsolutePosition.Z),
315 new Axiom.Math.Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, 320 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
316 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z)); 321 new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X,
317 322 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z));
318 } 323 }
319 324
320 List<SceneObjectPart> partList = new List<SceneObjectPart>(this.m_parts.Values); 325 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values);
321 foreach (SceneObjectPart part in partList) 326 foreach (SceneObjectPart part in partList)
322 { 327 {
323 if (part.UUID != this.m_rootPart.UUID) 328 if (part.UUID != m_rootPart.UUID)
324 { 329 {
325 dupe.CopyPart(part); 330 dupe.CopyPart(part);
326 } 331 }
@@ -328,7 +333,7 @@ namespace OpenSim.Region.Environment.Scenes
328 dupe.UpdateParentIDs(); 333 dupe.UpdateParentIDs();
329 334
330 dupe.AttachToBackup(); 335 dupe.AttachToBackup();
331 336
332 return dupe; 337 return dupe;
333 } 338 }
334 339
@@ -340,8 +345,8 @@ namespace OpenSim.Region.Environment.Scenes
340 { 345 {
341 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); 346 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate());
342 newPart.SetParent(this); 347 newPart.SetParent(this);
343 this.m_parts.Add(newPart.UUID, newPart); 348 m_parts.Add(newPart.UUID, newPart);
344 this.SetPartAsRoot(newPart); 349 SetPartAsRoot(newPart);
345 } 350 }
346 351
347 /// <summary> 352 /// <summary>
@@ -352,18 +357,20 @@ namespace OpenSim.Region.Environment.Scenes
352 { 357 {
353 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); 358 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate());
354 newPart.SetParent(this); 359 newPart.SetParent(this);
355 this.m_parts.Add(newPart.UUID, newPart); 360 m_parts.Add(newPart.UUID, newPart);
356 this.SetPartAsNonRoot(newPart); 361 SetPartAsNonRoot(newPart);
357 } 362 }
363
358 #endregion 364 #endregion
359 365
360 #region Scheduling 366 #region Scheduling
367
361 /// <summary> 368 /// <summary>
362 /// 369 ///
363 /// </summary> 370 /// </summary>
364 public override void Update() 371 public override void Update()
365 { 372 {
366 foreach (SceneObjectPart part in this.m_parts.Values) 373 foreach (SceneObjectPart part in m_parts.Values)
367 { 374 {
368 part.SendScheduledUpdates(); 375 part.SendScheduledUpdates();
369 } 376 }
@@ -371,7 +378,7 @@ namespace OpenSim.Region.Environment.Scenes
371 378
372 public void ScheduleFullUpdateToAvatar(ScenePresence presence) 379 public void ScheduleFullUpdateToAvatar(ScenePresence presence)
373 { 380 {
374 foreach (SceneObjectPart part in this.m_parts.Values) 381 foreach (SceneObjectPart part in m_parts.Values)
375 { 382 {
376 part.AddFullUpdateToAvatar(presence); 383 part.AddFullUpdateToAvatar(presence);
377 } 384 }
@@ -379,7 +386,7 @@ namespace OpenSim.Region.Environment.Scenes
379 386
380 public void ScheduleTerseUpdateToAvatar(ScenePresence presence) 387 public void ScheduleTerseUpdateToAvatar(ScenePresence presence)
381 { 388 {
382 foreach (SceneObjectPart part in this.m_parts.Values) 389 foreach (SceneObjectPart part in m_parts.Values)
383 { 390 {
384 part.AddTerseUpdateToAvatar(presence); 391 part.AddTerseUpdateToAvatar(presence);
385 } 392 }
@@ -391,7 +398,7 @@ namespace OpenSim.Region.Environment.Scenes
391 public void ScheduleGroupForFullUpdate() 398 public void ScheduleGroupForFullUpdate()
392 { 399 {
393 HasChanged = true; 400 HasChanged = true;
394 foreach (SceneObjectPart part in this.m_parts.Values) 401 foreach (SceneObjectPart part in m_parts.Values)
395 { 402 {
396 part.ScheduleFullUpdate(); 403 part.ScheduleFullUpdate();
397 } 404 }
@@ -403,7 +410,7 @@ namespace OpenSim.Region.Environment.Scenes
403 public void ScheduleGroupForTerseUpdate() 410 public void ScheduleGroupForTerseUpdate()
404 { 411 {
405 HasChanged = true; 412 HasChanged = true;
406 foreach (SceneObjectPart part in this.m_parts.Values) 413 foreach (SceneObjectPart part in m_parts.Values)
407 { 414 {
408 part.ScheduleTerseUpdate(); 415 part.ScheduleTerseUpdate();
409 } 416 }
@@ -415,7 +422,7 @@ namespace OpenSim.Region.Environment.Scenes
415 public void SendGroupFullUpdate() 422 public void SendGroupFullUpdate()
416 { 423 {
417 HasChanged = true; 424 HasChanged = true;
418 foreach (SceneObjectPart part in this.m_parts.Values) 425 foreach (SceneObjectPart part in m_parts.Values)
419 { 426 {
420 part.SendFullUpdateToAllClients(); 427 part.SendFullUpdateToAllClients();
421 } 428 }
@@ -427,7 +434,7 @@ namespace OpenSim.Region.Environment.Scenes
427 public void SendGroupTerseUpdate() 434 public void SendGroupTerseUpdate()
428 { 435 {
429 HasChanged = true; 436 HasChanged = true;
430 foreach (SceneObjectPart part in this.m_parts.Values) 437 foreach (SceneObjectPart part in m_parts.Values)
431 { 438 {
432 part.SendTerseUpdateToAllClients(); 439 part.SendTerseUpdateToAllClients();
433 } 440 }
@@ -436,6 +443,7 @@ namespace OpenSim.Region.Environment.Scenes
436 #endregion 443 #endregion
437 444
438 #region SceneGroupPart Methods 445 #region SceneGroupPart Methods
446
439 /// <summary> 447 /// <summary>
440 /// 448 ///
441 /// </summary> 449 /// </summary>
@@ -444,9 +452,9 @@ namespace OpenSim.Region.Environment.Scenes
444 public SceneObjectPart GetChildPart(LLUUID primID) 452 public SceneObjectPart GetChildPart(LLUUID primID)
445 { 453 {
446 SceneObjectPart childPart = null; 454 SceneObjectPart childPart = null;
447 if (this.m_parts.ContainsKey(primID)) 455 if (m_parts.ContainsKey(primID))
448 { 456 {
449 childPart = this.m_parts[primID]; 457 childPart = m_parts[primID];
450 } 458 }
451 return childPart; 459 return childPart;
452 } 460 }
@@ -458,7 +466,7 @@ namespace OpenSim.Region.Environment.Scenes
458 /// <returns></returns> 466 /// <returns></returns>
459 public SceneObjectPart GetChildPart(uint localID) 467 public SceneObjectPart GetChildPart(uint localID)
460 { 468 {
461 foreach (SceneObjectPart part in this.m_parts.Values) 469 foreach (SceneObjectPart part in m_parts.Values)
462 { 470 {
463 if (part.LocalID == localID) 471 if (part.LocalID == localID)
464 { 472 {
@@ -477,9 +485,9 @@ namespace OpenSim.Region.Environment.Scenes
477 public bool HasChildPrim(LLUUID primID) 485 public bool HasChildPrim(LLUUID primID)
478 { 486 {
479 SceneObjectPart childPart = null; 487 SceneObjectPart childPart = null;
480 if (this.m_parts.ContainsKey(primID)) 488 if (m_parts.ContainsKey(primID))
481 { 489 {
482 childPart = this.m_parts[primID]; 490 childPart = m_parts[primID];
483 return true; 491 return true;
484 } 492 }
485 return false; 493 return false;
@@ -493,7 +501,7 @@ namespace OpenSim.Region.Environment.Scenes
493 /// <returns></returns> 501 /// <returns></returns>
494 public bool HasChildPrim(uint localID) 502 public bool HasChildPrim(uint localID)
495 { 503 {
496 foreach (SceneObjectPart part in this.m_parts.Values) 504 foreach (SceneObjectPart part in m_parts.Values)
497 { 505 {
498 if (part.LocalID == localID) 506 if (part.LocalID == localID)
499 { 507 {
@@ -502,9 +510,11 @@ namespace OpenSim.Region.Environment.Scenes
502 } 510 }
503 return false; 511 return false;
504 } 512 }
513
505 #endregion 514 #endregion
506 515
507 #region Packet Handlers 516 #region Packet Handlers
517
508 /// <summary> 518 /// <summary>
509 /// 519 ///
510 /// </summary> 520 /// </summary>
@@ -512,21 +522,28 @@ namespace OpenSim.Region.Environment.Scenes
512 public void LinkToGroup(SceneObjectGroup objectGroup) 522 public void LinkToGroup(SceneObjectGroup objectGroup)
513 { 523 {
514 SceneObjectPart linkPart = objectGroup.m_rootPart; 524 SceneObjectPart linkPart = objectGroup.m_rootPart;
515 Axiom.Math.Vector3 oldGroupPosition = new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z); 525 Vector3 oldGroupPosition =
516 Axiom.Math.Quaternion oldRootRotation = new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, linkPart.RotationOffset.Z); 526 new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z);
527 Quaternion oldRootRotation =
528 new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y,
529 linkPart.RotationOffset.Z);
517 530
518 linkPart.OffsetPosition = linkPart.GroupPosition - this.AbsolutePosition; 531 linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition;
519 linkPart.GroupPosition = this.AbsolutePosition; 532 linkPart.GroupPosition = AbsolutePosition;
520 533
521 Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z); 534 Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z);
522 Quaternion parentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); 535 Quaternion parentRot =
523 axPos = parentRot.Inverse() * axPos; 536 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
537 m_rootPart.RotationOffset.Z);
538 axPos = parentRot.Inverse()*axPos;
524 linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); 539 linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
525 Quaternion oldRot = new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, linkPart.RotationOffset.Z); 540 Quaternion oldRot =
526 Quaternion newRot = parentRot.Inverse() * oldRot; 541 new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y,
542 linkPart.RotationOffset.Z);
543 Quaternion newRot = parentRot.Inverse()*oldRot;
527 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); 544 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
528 linkPart.ParentID = this.m_rootPart.LocalID; 545 linkPart.ParentID = m_rootPart.LocalID;
529 this.m_parts.Add(linkPart.UUID, linkPart); 546 m_parts.Add(linkPart.UUID, linkPart);
530 linkPart.SetParent(this); 547 linkPart.SetParent(this);
531 548
532 if (linkPart.PhysActor != null) 549 if (linkPart.PhysActor != null)
@@ -540,7 +557,7 @@ namespace OpenSim.Region.Environment.Scenes
540 { 557 {
541 if (part.UUID != objectGroup.m_rootPart.UUID) 558 if (part.UUID != objectGroup.m_rootPart.UUID)
542 { 559 {
543 this.LinkNonRootPart(part, oldGroupPosition, oldRootRotation); 560 LinkNonRootPart(part, oldGroupPosition, oldRootRotation);
544 } 561 }
545 } 562 }
546 563
@@ -549,7 +566,7 @@ namespace OpenSim.Region.Environment.Scenes
549 m_scene.DeleteEntity(objectGroup.UUID); 566 m_scene.DeleteEntity(objectGroup.UUID);
550 567
551 objectGroup.DeleteParts(); 568 objectGroup.DeleteParts();
552 this.ScheduleGroupForFullUpdate(); 569 ScheduleGroupForFullUpdate();
553 } 570 }
554 571
555 private void DetachFromBackup(SceneObjectGroup objectGroup) 572 private void DetachFromBackup(SceneObjectGroup objectGroup)
@@ -561,26 +578,31 @@ namespace OpenSim.Region.Environment.Scenes
561 private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation) 578 private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation)
562 { 579 {
563 part.SetParent(this); 580 part.SetParent(this);
564 part.ParentID = this.m_rootPart.LocalID; 581 part.ParentID = m_rootPart.LocalID;
565 this.m_parts.Add(part.UUID, part); 582 m_parts.Add(part.UUID, part);
566 583
567 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); 584 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
568 axiomOldPos = oldGroupRotation * axiomOldPos; 585 axiomOldPos = oldGroupRotation*axiomOldPos;
569 axiomOldPos += oldGroupPosition; 586 axiomOldPos += oldGroupPosition;
570 LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z); 587 LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z);
571 part.OffsetPosition = oldAbsolutePosition - this.AbsolutePosition; 588 part.OffsetPosition = oldAbsolutePosition - AbsolutePosition;
572 589
573 Quaternion axiomRootRotation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); 590 Quaternion axiomRootRotation =
591 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
592 m_rootPart.RotationOffset.Z);
574 593
575 Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); 594 Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
576 axiomPos = axiomRootRotation.Inverse() * axiomPos; 595 axiomPos = axiomRootRotation.Inverse()*axiomPos;
577 part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z); 596 part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z);
578 597
579 Quaternion axiomPartRotation = new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z); 598 Quaternion axiomPartRotation =
599 new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y,
600 part.RotationOffset.Z);
580 601
581 axiomPartRotation = oldGroupRotation * axiomPartRotation; 602 axiomPartRotation = oldGroupRotation*axiomPartRotation;
582 axiomPartRotation = axiomRootRotation.Inverse() * axiomPartRotation; 603 axiomPartRotation = axiomRootRotation.Inverse()*axiomPartRotation;
583 part.RotationOffset = new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w); 604 part.RotationOffset =
605 new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w);
584 } 606 }
585 607
586 /// <summary> 608 /// <summary>
@@ -591,8 +613,8 @@ namespace OpenSim.Region.Environment.Scenes
591 /// <param name="remoteClient"></param> 613 /// <param name="remoteClient"></param>
592 public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 614 public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
593 { 615 {
594 this.AbsolutePosition = pos; 616 AbsolutePosition = pos;
595 this.m_rootPart.SendTerseUpdateToAllClients(); 617 m_rootPart.SendTerseUpdateToAllClients();
596 } 618 }
597 619
598 /// <summary> 620 /// <summary>
@@ -605,25 +627,25 @@ namespace OpenSim.Region.Environment.Scenes
605 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 627 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
606 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); 628 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
607 proper.ObjectData[0].ItemID = LLUUID.Zero; 629 proper.ObjectData[0].ItemID = LLUUID.Zero;
608 proper.ObjectData[0].CreationDate = (ulong)this.m_rootPart.CreationDate; 630 proper.ObjectData[0].CreationDate = (ulong) m_rootPart.CreationDate;
609 proper.ObjectData[0].CreatorID = this.m_rootPart.CreatorID; 631 proper.ObjectData[0].CreatorID = m_rootPart.CreatorID;
610 proper.ObjectData[0].FolderID = LLUUID.Zero; 632 proper.ObjectData[0].FolderID = LLUUID.Zero;
611 proper.ObjectData[0].FromTaskID = LLUUID.Zero; 633 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
612 proper.ObjectData[0].GroupID = LLUUID.Zero; 634 proper.ObjectData[0].GroupID = LLUUID.Zero;
613 proper.ObjectData[0].InventorySerial = (short)this.m_rootPart.InventorySerial; 635 proper.ObjectData[0].InventorySerial = (short) m_rootPart.InventorySerial;
614 proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; 636 proper.ObjectData[0].LastOwnerID = m_rootPart.LastOwnerID;
615 proper.ObjectData[0].ObjectID = this.UUID; 637 proper.ObjectData[0].ObjectID = UUID;
616 proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; 638 proper.ObjectData[0].OwnerID = m_rootPart.OwnerID;
617 proper.ObjectData[0].TouchName = enc.GetBytes(this.m_rootPart.TouchName + "\0"); 639 proper.ObjectData[0].TouchName = enc.GetBytes(m_rootPart.TouchName + "\0");
618 proper.ObjectData[0].TextureID = new byte[0]; 640 proper.ObjectData[0].TextureID = new byte[0];
619 proper.ObjectData[0].SitName = enc.GetBytes(this.m_rootPart.SitName + "\0"); 641 proper.ObjectData[0].SitName = enc.GetBytes(m_rootPart.SitName + "\0");
620 proper.ObjectData[0].Name = enc.GetBytes(this.m_rootPart.Name + "\0"); 642 proper.ObjectData[0].Name = enc.GetBytes(m_rootPart.Name + "\0");
621 proper.ObjectData[0].Description = enc.GetBytes(this.m_rootPart.Description + "\0"); 643 proper.ObjectData[0].Description = enc.GetBytes(m_rootPart.Description + "\0");
622 proper.ObjectData[0].OwnerMask = this.m_rootPart.OwnerMask; 644 proper.ObjectData[0].OwnerMask = m_rootPart.OwnerMask;
623 proper.ObjectData[0].NextOwnerMask = this.m_rootPart.NextOwnerMask; 645 proper.ObjectData[0].NextOwnerMask = m_rootPart.NextOwnerMask;
624 proper.ObjectData[0].GroupMask = this.m_rootPart.GroupMask; 646 proper.ObjectData[0].GroupMask = m_rootPart.GroupMask;
625 proper.ObjectData[0].EveryoneMask = this.m_rootPart.EveryoneMask; 647 proper.ObjectData[0].EveryoneMask = m_rootPart.EveryoneMask;
626 proper.ObjectData[0].BaseMask = this.m_rootPart.BaseMask; 648 proper.ObjectData[0].BaseMask = m_rootPart.BaseMask;
627 649
628 client.OutPacket(proper); 650 client.OutPacket(proper);
629 } 651 }
@@ -635,7 +657,7 @@ namespace OpenSim.Region.Environment.Scenes
635 public void SetPartName(string name, uint localID) 657 public void SetPartName(string name, uint localID)
636 { 658 {
637 name = name.Remove(name.Length - 1, 1); 659 name = name.Remove(name.Length - 1, 1);
638 SceneObjectPart part = this.GetChildPart(localID); 660 SceneObjectPart part = GetChildPart(localID);
639 if (part != null) 661 if (part != null)
640 { 662 {
641 part.Name = name; 663 part.Name = name;
@@ -644,7 +666,7 @@ namespace OpenSim.Region.Environment.Scenes
644 666
645 public void SetPartDescription(string des, uint localID) 667 public void SetPartDescription(string des, uint localID)
646 { 668 {
647 SceneObjectPart part = this.GetChildPart(localID); 669 SceneObjectPart part = GetChildPart(localID);
648 if (part != null) 670 if (part != null)
649 { 671 {
650 part.Description = des; 672 part.Description = des;
@@ -653,7 +675,7 @@ namespace OpenSim.Region.Environment.Scenes
653 675
654 public void SetPartText(string text, uint localID) 676 public void SetPartText(string text, uint localID)
655 { 677 {
656 SceneObjectPart part = this.GetChildPart(localID); 678 SceneObjectPart part = GetChildPart(localID);
657 if (part != null) 679 if (part != null)
658 { 680 {
659 part.Text = text; 681 part.Text = text;
@@ -662,7 +684,7 @@ namespace OpenSim.Region.Environment.Scenes
662 684
663 public void SetPartText(string text, LLUUID partID) 685 public void SetPartText(string text, LLUUID partID)
664 { 686 {
665 SceneObjectPart part = this.GetChildPart(partID); 687 SceneObjectPart part = GetChildPart(partID);
666 if (part != null) 688 if (part != null)
667 { 689 {
668 part.Text = text; 690 part.Text = text;
@@ -671,7 +693,7 @@ namespace OpenSim.Region.Environment.Scenes
671 693
672 public string GetPartName(uint localID) 694 public string GetPartName(uint localID)
673 { 695 {
674 SceneObjectPart part = this.GetChildPart(localID); 696 SceneObjectPart part = GetChildPart(localID);
675 if (part != null) 697 if (part != null)
676 { 698 {
677 return part.Name; 699 return part.Name;
@@ -681,7 +703,7 @@ namespace OpenSim.Region.Environment.Scenes
681 703
682 public string GetPartDescription(uint localID) 704 public string GetPartDescription(uint localID)
683 { 705 {
684 SceneObjectPart part = this.GetChildPart(localID); 706 SceneObjectPart part = GetChildPart(localID);
685 if (part != null) 707 if (part != null)
686 { 708 {
687 return part.Description; 709 return part.Description;
@@ -696,7 +718,7 @@ namespace OpenSim.Region.Environment.Scenes
696 /// <param name="localID"></param> 718 /// <param name="localID"></param>
697 public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) 719 public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID)
698 { 720 {
699 SceneObjectPart part = this.GetChildPart(localID); 721 SceneObjectPart part = GetChildPart(localID);
700 if (part != null) 722 if (part != null)
701 { 723 {
702 return part.GetInventoryFileName(remoteClient, localID); 724 return part.GetInventoryFileName(remoteClient, localID);
@@ -706,7 +728,7 @@ namespace OpenSim.Region.Environment.Scenes
706 728
707 public string RequestInventoryFile(uint localID, IXfer xferManager) 729 public string RequestInventoryFile(uint localID, IXfer xferManager)
708 { 730 {
709 SceneObjectPart part = this.GetChildPart(localID); 731 SceneObjectPart part = GetChildPart(localID);
710 if (part != null) 732 if (part != null)
711 { 733 {
712 part.RequestInventoryFile(xferManager); 734 part.RequestInventoryFile(xferManager);
@@ -716,7 +738,7 @@ namespace OpenSim.Region.Environment.Scenes
716 738
717 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item) 739 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item)
718 { 740 {
719 SceneObjectPart part = this.GetChildPart(localID); 741 SceneObjectPart part = GetChildPart(localID);
720 if (part != null) 742 if (part != null)
721 { 743 {
722 SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); 744 SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem();
@@ -732,14 +754,13 @@ namespace OpenSim.Region.Environment.Scenes
732 return true; 754 return true;
733 } 755 }
734 return false; 756 return false;
735
736 } 757 }
737 758
738 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) 759 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID)
739 { 760 {
740 if (copyItemID != LLUUID.Zero) 761 if (copyItemID != LLUUID.Zero)
741 { 762 {
742 SceneObjectPart part = this.GetChildPart(localID); 763 SceneObjectPart part = GetChildPart(localID);
743 if (part != null) 764 if (part != null)
744 { 765 {
745 SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); 766 SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem();
@@ -764,7 +785,7 @@ namespace OpenSim.Region.Environment.Scenes
764 785
765 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) 786 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
766 { 787 {
767 SceneObjectPart part = this.GetChildPart(localID); 788 SceneObjectPart part = GetChildPart(localID);
768 if (part != null) 789 if (part != null)
769 { 790 {
770 return part.RemoveInventoryItem(remoteClient, localID, itemID); 791 return part.RemoveInventoryItem(remoteClient, localID, itemID);
@@ -781,7 +802,7 @@ namespace OpenSim.Region.Environment.Scenes
781 /// <param name="data"></param> 802 /// <param name="data"></param>
782 public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data) 803 public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data)
783 { 804 {
784 SceneObjectPart part = this.GetChildPart(localID); 805 SceneObjectPart part = GetChildPart(localID);
785 if (part != null) 806 if (part != null)
786 { 807 {
787 part.UpdateExtraParam(type, inUse, data); 808 part.UpdateExtraParam(type, inUse, data);
@@ -795,30 +816,34 @@ namespace OpenSim.Region.Environment.Scenes
795 /// <param name="textureEntry"></param> 816 /// <param name="textureEntry"></param>
796 public void UpdateTextureEntry(uint localID, byte[] textureEntry) 817 public void UpdateTextureEntry(uint localID, byte[] textureEntry)
797 { 818 {
798 SceneObjectPart part = this.GetChildPart(localID); 819 SceneObjectPart part = GetChildPart(localID);
799 if (part != null) 820 if (part != null)
800 { 821 {
801 part.UpdateTextureEntry(textureEntry); 822 part.UpdateTextureEntry(textureEntry);
802 } 823 }
803 } 824 }
825
804 #endregion 826 #endregion
805 827
806 #region Shape 828 #region Shape
829
807 /// <summary> 830 /// <summary>
808 /// 831 ///
809 /// </summary> 832 /// </summary>
810 /// <param name="shapeBlock"></param> 833 /// <param name="shapeBlock"></param>
811 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID) 834 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID)
812 { 835 {
813 SceneObjectPart part = this.GetChildPart(localID); 836 SceneObjectPart part = GetChildPart(localID);
814 if (part != null) 837 if (part != null)
815 { 838 {
816 part.UpdateShape(shapeBlock); 839 part.UpdateShape(shapeBlock);
817 } 840 }
818 } 841 }
842
819 #endregion 843 #endregion
820 844
821 #region Resize 845 #region Resize
846
822 /// <summary> 847 /// <summary>
823 /// 848 ///
824 /// </summary> 849 /// </summary>
@@ -826,30 +851,33 @@ namespace OpenSim.Region.Environment.Scenes
826 /// <param name="localID"></param> 851 /// <param name="localID"></param>
827 public void Resize(LLVector3 scale, uint localID) 852 public void Resize(LLVector3 scale, uint localID)
828 { 853 {
829 SceneObjectPart part = this.GetChildPart(localID); 854 SceneObjectPart part = GetChildPart(localID);
830 if (part != null) 855 if (part != null)
831 { 856 {
832 part.Resize(scale); 857 part.Resize(scale);
833 if (part.UUID == this.m_rootPart.UUID) 858 if (part.UUID == m_rootPart.UUID)
834 { 859 {
835 if (m_rootPart.PhysActor != null) 860 if (m_rootPart.PhysActor != null)
836 { 861 {
837 m_rootPart.PhysActor.Size = new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z); 862 m_rootPart.PhysActor.Size =
863 new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z);
838 } 864 }
839 } 865 }
840 } 866 }
841 } 867 }
868
842 #endregion 869 #endregion
843 870
844 #region Position 871 #region Position
872
845 /// <summary> 873 /// <summary>
846 /// 874 ///
847 /// </summary> 875 /// </summary>
848 /// <param name="pos"></param> 876 /// <param name="pos"></param>
849 public void UpdateGroupPosition(LLVector3 pos) 877 public void UpdateGroupPosition(LLVector3 pos)
850 { 878 {
851 this.AbsolutePosition = pos; 879 AbsolutePosition = pos;
852 this.ScheduleGroupForTerseUpdate(); 880 ScheduleGroupForTerseUpdate();
853 } 881 }
854 882
855 /// <summary> 883 /// <summary>
@@ -859,12 +887,12 @@ namespace OpenSim.Region.Environment.Scenes
859 /// <param name="localID"></param> 887 /// <param name="localID"></param>
860 public void UpdateSinglePosition(LLVector3 pos, uint localID) 888 public void UpdateSinglePosition(LLVector3 pos, uint localID)
861 { 889 {
862 SceneObjectPart part = this.GetChildPart(localID); 890 SceneObjectPart part = GetChildPart(localID);
863 if (part != null) 891 if (part != null)
864 { 892 {
865 if (part.UUID == this.m_rootPart.UUID) 893 if (part.UUID == m_rootPart.UUID)
866 { 894 {
867 this.UpdateRootPosition(pos); 895 UpdateRootPosition(pos);
868 } 896 }
869 else 897 else
870 { 898 {
@@ -880,40 +908,49 @@ namespace OpenSim.Region.Environment.Scenes
880 private void UpdateRootPosition(LLVector3 pos) 908 private void UpdateRootPosition(LLVector3 pos)
881 { 909 {
882 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 910 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
883 LLVector3 oldPos = new LLVector3(this.AbsolutePosition.X + this.m_rootPart.OffsetPosition.X, this.AbsolutePosition.Y + this.m_rootPart.OffsetPosition.Y, this.AbsolutePosition.Z + this.m_rootPart.OffsetPosition.Z); 911 LLVector3 oldPos =
912 new LLVector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
913 AbsolutePosition.Y + m_rootPart.OffsetPosition.Y,
914 AbsolutePosition.Z + m_rootPart.OffsetPosition.Z);
884 LLVector3 diff = oldPos - newPos; 915 LLVector3 diff = oldPos - newPos;
885 Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); 916 Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
886 Axiom.Math.Quaternion partRotation = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); 917 Quaternion partRotation =
887 axDiff = partRotation.Inverse() * axDiff; 918 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
919 m_rootPart.RotationOffset.Z);
920 axDiff = partRotation.Inverse()*axDiff;
888 diff.X = axDiff.x; 921 diff.X = axDiff.x;
889 diff.Y = axDiff.y; 922 diff.Y = axDiff.y;
890 diff.Z = axDiff.z; 923 diff.Z = axDiff.z;
891 924
892 foreach (SceneObjectPart obPart in this.m_parts.Values) 925 foreach (SceneObjectPart obPart in m_parts.Values)
893 { 926 {
894 if (obPart.UUID != this.m_rootPart.UUID) 927 if (obPart.UUID != m_rootPart.UUID)
895 { 928 {
896 obPart.OffsetPosition = obPart.OffsetPosition + diff; 929 obPart.OffsetPosition = obPart.OffsetPosition + diff;
897 } 930 }
898 } 931 }
899 this.AbsolutePosition = newPos; 932 AbsolutePosition = newPos;
900 this.ScheduleGroupForTerseUpdate(); 933 ScheduleGroupForTerseUpdate();
901 } 934 }
935
902 #endregion 936 #endregion
903 937
904 #region Rotation 938 #region Rotation
939
905 /// <summary> 940 /// <summary>
906 /// 941 ///
907 /// </summary> 942 /// </summary>
908 /// <param name="rot"></param> 943 /// <param name="rot"></param>
909 public void UpdateGroupRotation(LLQuaternion rot) 944 public void UpdateGroupRotation(LLQuaternion rot)
910 { 945 {
911 this.m_rootPart.UpdateRotation(rot); 946 m_rootPart.UpdateRotation(rot);
912 if (m_rootPart.PhysActor != null) 947 if (m_rootPart.PhysActor != null)
913 { 948 {
914 m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); 949 m_rootPart.PhysActor.Orientation =
950 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
951 m_rootPart.RotationOffset.Z);
915 } 952 }
916 this.ScheduleGroupForTerseUpdate(); 953 ScheduleGroupForTerseUpdate();
917 } 954 }
918 955
919 /// <summary> 956 /// <summary>
@@ -923,13 +960,15 @@ namespace OpenSim.Region.Environment.Scenes
923 /// <param name="rot"></param> 960 /// <param name="rot"></param>
924 public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) 961 public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot)
925 { 962 {
926 this.m_rootPart.UpdateRotation(rot); 963 m_rootPart.UpdateRotation(rot);
927 if (m_rootPart.PhysActor != null) 964 if (m_rootPart.PhysActor != null)
928 { 965 {
929 m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); 966 m_rootPart.PhysActor.Orientation =
967 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
968 m_rootPart.RotationOffset.Z);
930 } 969 }
931 this.AbsolutePosition = pos; 970 AbsolutePosition = pos;
932 this.ScheduleGroupForTerseUpdate(); 971 ScheduleGroupForTerseUpdate();
933 } 972 }
934 973
935 /// <summary> 974 /// <summary>
@@ -939,12 +978,12 @@ namespace OpenSim.Region.Environment.Scenes
939 /// <param name="localID"></param> 978 /// <param name="localID"></param>
940 public void UpdateSingleRotation(LLQuaternion rot, uint localID) 979 public void UpdateSingleRotation(LLQuaternion rot, uint localID)
941 { 980 {
942 SceneObjectPart part = this.GetChildPart(localID); 981 SceneObjectPart part = GetChildPart(localID);
943 if (part != null) 982 if (part != null)
944 { 983 {
945 if (part.UUID == this.m_rootPart.UUID) 984 if (part.UUID == m_rootPart.UUID)
946 { 985 {
947 this.UpdateRootRotation(rot); 986 UpdateRootRotation(rot);
948 } 987 }
949 else 988 else
950 { 989 {
@@ -959,40 +998,48 @@ namespace OpenSim.Region.Environment.Scenes
959 /// <param name="rot"></param> 998 /// <param name="rot"></param>
960 private void UpdateRootRotation(LLQuaternion rot) 999 private void UpdateRootRotation(LLQuaternion rot)
961 { 1000 {
962 Axiom.Math.Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); 1001 Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
963 Axiom.Math.Quaternion oldParentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); 1002 Quaternion oldParentRot =
1003 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
1004 m_rootPart.RotationOffset.Z);
964 1005
965 this.m_rootPart.UpdateRotation(rot); 1006 m_rootPart.UpdateRotation(rot);
966 if (m_rootPart.PhysActor != null) 1007 if (m_rootPart.PhysActor != null)
967 { 1008 {
968 m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); 1009 m_rootPart.PhysActor.Orientation =
1010 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
1011 m_rootPart.RotationOffset.Z);
969 } 1012 }
970 1013
971 foreach (SceneObjectPart prim in this.m_parts.Values) 1014 foreach (SceneObjectPart prim in m_parts.Values)
972 { 1015 {
973 if (prim.UUID != this.m_rootPart.UUID) 1016 if (prim.UUID != m_rootPart.UUID)
974 { 1017 {
975 Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z); 1018 Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z);
976 axPos = oldParentRot * axPos; 1019 axPos = oldParentRot*axPos;
977 axPos = axRot.Inverse() * axPos; 1020 axPos = axRot.Inverse()*axPos;
978 prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); 1021 prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
979 Axiom.Math.Quaternion primsRot = new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y, prim.RotationOffset.Z); 1022 Quaternion primsRot =
980 Axiom.Math.Quaternion newRot = oldParentRot * primsRot; 1023 new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y,
981 newRot = axRot.Inverse() * newRot; 1024 prim.RotationOffset.Z);
1025 Quaternion newRot = oldParentRot*primsRot;
1026 newRot = axRot.Inverse()*newRot;
982 prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); 1027 prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
983 prim.ScheduleTerseUpdate(); 1028 prim.ScheduleTerseUpdate();
984 } 1029 }
985 } 1030 }
986 this.m_rootPart.ScheduleTerseUpdate(); 1031 m_rootPart.ScheduleTerseUpdate();
987 } 1032 }
1033
988 #endregion 1034 #endregion
1035
989 /// <summary> 1036 /// <summary>
990 /// 1037 ///
991 /// </summary> 1038 /// </summary>
992 /// <param name="part"></param> 1039 /// <param name="part"></param>
993 private void SetPartAsRoot(SceneObjectPart part) 1040 private void SetPartAsRoot(SceneObjectPart part)
994 { 1041 {
995 this.m_rootPart = part; 1042 m_rootPart = part;
996 } 1043 }
997 1044
998 /// <summary> 1045 /// <summary>
@@ -1001,7 +1048,7 @@ namespace OpenSim.Region.Environment.Scenes
1001 /// <param name="part"></param> 1048 /// <param name="part"></param>
1002 private void SetPartAsNonRoot(SceneObjectPart part) 1049 private void SetPartAsNonRoot(SceneObjectPart part)
1003 { 1050 {
1004 part.ParentID = this.m_rootPart.LocalID; 1051 part.ParentID = m_rootPart.LocalID;
1005 } 1052 }
1006 1053
1007 /// <summary> 1054 /// <summary>
@@ -1014,6 +1061,7 @@ namespace OpenSim.Region.Environment.Scenes
1014 } 1061 }
1015 1062
1016 #region Events 1063 #region Events
1064
1017 /// <summary> 1065 /// <summary>
1018 /// 1066 ///
1019 /// </summary> 1067 /// </summary>
@@ -1021,7 +1069,7 @@ namespace OpenSim.Region.Environment.Scenes
1021 { 1069 {
1022 if (OnPrimCountTainted != null) 1070 if (OnPrimCountTainted != null)
1023 { 1071 {
1024 this.OnPrimCountTainted(); 1072 OnPrimCountTainted();
1025 } 1073 }
1026 } 1074 }
1027 1075
@@ -1029,7 +1077,7 @@ namespace OpenSim.Region.Environment.Scenes
1029 /// Processes backup 1077 /// Processes backup
1030 /// </summary> 1078 /// </summary>
1031 /// <param name="datastore"></param> 1079 /// <param name="datastore"></param>
1032 public void ProcessBackup(OpenSim.Region.Environment.Interfaces.IRegionDataStore datastore) 1080 public void ProcessBackup(IRegionDataStore datastore)
1033 { 1081 {
1034 if (HasChanged) 1082 if (HasChanged)
1035 { 1083 {
@@ -1037,16 +1085,18 @@ namespace OpenSim.Region.Environment.Scenes
1037 HasChanged = false; 1085 HasChanged = false;
1038 } 1086 }
1039 } 1087 }
1088
1040 #endregion 1089 #endregion
1041 1090
1042 #region Client Updating 1091 #region Client Updating
1092
1043 public void SendFullUpdateToClient(IClientAPI remoteClient) 1093 public void SendFullUpdateToClient(IClientAPI remoteClient)
1044 { 1094 {
1045 lock (this.m_parts) 1095 lock (m_parts)
1046 { 1096 {
1047 foreach (SceneObjectPart part in this.m_parts.Values) 1097 foreach (SceneObjectPart part in m_parts.Values)
1048 { 1098 {
1049 this.SendPartFullUpdate(remoteClient, part); 1099 SendPartFullUpdate(remoteClient, part);
1050 } 1100 }
1051 } 1101 }
1052 } 1102 }
@@ -1084,6 +1134,7 @@ namespace OpenSim.Region.Environment.Scenes
1084 part.SendTerseUpdateToClient(remoteClient); 1134 part.SendTerseUpdateToClient(remoteClient);
1085 } 1135 }
1086 } 1136 }
1137
1087 #endregion 1138 #endregion
1088 1139
1089 public override void UpdateMovement() 1140 public override void UpdateMovement()
@@ -1114,7 +1165,7 @@ namespace OpenSim.Region.Environment.Scenes
1114 public void AddPart(SceneObjectPart part) 1165 public void AddPart(SceneObjectPart part)
1115 { 1166 {
1116 part.SetParent(this); 1167 part.SetParent(this);
1117 this.m_parts.Add(part.UUID, part); 1168 m_parts.Add(part.UUID, part);
1118 } 1169 }
1119 1170
1120 /// <summary> 1171 /// <summary>
@@ -1122,18 +1173,18 @@ namespace OpenSim.Region.Environment.Scenes
1122 /// </summary> 1173 /// </summary>
1123 public void UpdateParentIDs() 1174 public void UpdateParentIDs()
1124 { 1175 {
1125 foreach (SceneObjectPart part in this.m_parts.Values) 1176 foreach (SceneObjectPart part in m_parts.Values)
1126 { 1177 {
1127 if (part.UUID != this.m_rootPart.UUID) 1178 if (part.UUID != m_rootPart.UUID)
1128 { 1179 {
1129 part.ParentID = this.m_rootPart.LocalID; 1180 part.ParentID = m_rootPart.LocalID;
1130 } 1181 }
1131 } 1182 }
1132 } 1183 }
1133 1184
1134 public void RegenerateFullIDs() 1185 public void RegenerateFullIDs()
1135 { 1186 {
1136 foreach (SceneObjectPart part in this.m_parts.Values) 1187 foreach (SceneObjectPart part in m_parts.Values)
1137 { 1188 {
1138 part.UUID = LLUUID.Random(); 1189 part.UUID = LLUUID.Random();
1139 } 1190 }
@@ -1141,7 +1192,7 @@ namespace OpenSim.Region.Environment.Scenes
1141 1192
1142 public LLUUID GetPartsFullID(uint localID) 1193 public LLUUID GetPartsFullID(uint localID)
1143 { 1194 {
1144 SceneObjectPart part = this.GetChildPart(localID); 1195 SceneObjectPart part = GetChildPart(localID);
1145 if (part != null) 1196 if (part != null)
1146 { 1197 {
1147 return part.UUID; 1198 return part.UUID;
@@ -1175,26 +1226,25 @@ namespace OpenSim.Region.Environment.Scenes
1175 1226
1176 public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) 1227 public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient)
1177 { 1228 {
1178
1179 } 1229 }
1180 1230
1181 public void DeleteGroup() 1231 public void DeleteGroup()
1182 { 1232 {
1183 DetachFromBackup( this ); 1233 DetachFromBackup(this);
1184 foreach (SceneObjectPart part in this.m_parts.Values) 1234 foreach (SceneObjectPart part in m_parts.Values)
1185 { 1235 {
1186 List<ScenePresence> avatars = this.RequestSceneAvatars(); 1236 List<ScenePresence> avatars = RequestSceneAvatars();
1187 for (int i = 0; i < avatars.Count; i++) 1237 for (int i = 0; i < avatars.Count; i++)
1188 { 1238 {
1189 avatars[i].ControllingClient.SendKillObject(this.m_regionHandle, part.LocalID); 1239 avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalID);
1190 } 1240 }
1191 } 1241 }
1192 } 1242 }
1193 1243
1194 public void DeleteParts() 1244 public void DeleteParts()
1195 { 1245 {
1196 this.m_rootPart = null; 1246 m_rootPart = null;
1197 this.m_parts.Clear(); 1247 m_parts.Clear();
1198 } 1248 }
1199 1249
1200 public override void SetText(string text, Vector3 color, double alpha) 1250 public override void SetText(string text, Vector3 color, double alpha)
@@ -1202,4 +1252,4 @@ namespace OpenSim.Region.Environment.Scenes
1202 Text = text; 1252 Text = text;
1203 } 1253 }
1204 } 1254 }
1205} 1255} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index abb69f4..deacd18 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -1,23 +1,19 @@
1using System;
1using System.Collections.Generic; 2using System.Collections.Generic;
2using System.Text;
3using System.Xml; 3using System.Xml;
4using System.Xml.Serialization; 4using System.Xml.Serialization;
5using System.IO;
6using System;
7using Axiom.Math; 5using Axiom.Math;
8using libsecondlife; 6using libsecondlife;
9using libsecondlife.Packets; 7using libsecondlife.Packets;
10using OpenSim.Framework.Interfaces; 8using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Types; 9using OpenSim.Framework.Types;
12using OpenSim.Framework.Utilities; 10using OpenSim.Framework.Utilities;
11using OpenSim.Region.Environment.Interfaces;
13using OpenSim.Region.Environment.Scenes.Scripting; 12using OpenSim.Region.Environment.Scenes.Scripting;
14using OpenSim.Framework;
15using OpenSim.Region.Physics.Manager; 13using OpenSim.Region.Physics.Manager;
16using OpenSim.Region.Environment.Interfaces;
17 14
18namespace OpenSim.Region.Environment.Scenes 15namespace OpenSim.Region.Environment.Scenes
19{ 16{
20
21 public class SceneObjectPart : IScriptHost 17 public class SceneObjectPart : IScriptHost
22 { 18 {
23 private const uint FULL_MASK_PERMISSIONS = 2147483647; 19 private const uint FULL_MASK_PERMISSIONS = 2147483647;
@@ -25,8 +21,7 @@ namespace OpenSim.Region.Environment.Scenes
25 private string m_inventoryFileName = ""; 21 private string m_inventoryFileName = "";
26 private LLUUID m_folderID = LLUUID.Zero; 22 private LLUUID m_folderID = LLUUID.Zero;
27 23
28 [XmlIgnore] 24 [XmlIgnore] public PhysicsActor PhysActor = null;
29 public PhysicsActor PhysActor = null;
30 25
31 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); 26 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
32 27
@@ -57,19 +52,25 @@ namespace OpenSim.Region.Environment.Scenes
57 #region Properties 52 #region Properties
58 53
59 public LLUUID CreatorID; 54 public LLUUID CreatorID;
60 public LLUUID ObjectCreator { get { return CreatorID; } } 55
56 public LLUUID ObjectCreator
57 {
58 get { return CreatorID; }
59 }
61 60
62 /// <summary> 61 /// <summary>
63 /// Serial count for inventory file , used to tell if inventory has changed 62 /// Serial count for inventory file , used to tell if inventory has changed
64 /// no need for this to be part of Database backup 63 /// no need for this to be part of Database backup
65 /// </summary> 64 /// </summary>
66 protected uint m_inventorySerial = 0; 65 protected uint m_inventorySerial = 0;
66
67 public uint InventorySerial 67 public uint InventorySerial
68 { 68 {
69 get { return m_inventorySerial; } 69 get { return m_inventorySerial; }
70 } 70 }
71 71
72 protected LLUUID m_uuid; 72 protected LLUUID m_uuid;
73
73 public LLUUID UUID 74 public LLUUID UUID
74 { 75 {
75 get { return m_uuid; } 76 get { return m_uuid; }
@@ -77,6 +78,7 @@ namespace OpenSim.Region.Environment.Scenes
77 } 78 }
78 79
79 protected uint m_localID; 80 protected uint m_localID;
81
80 public uint LocalID 82 public uint LocalID
81 { 83 {
82 get { return m_localID; } 84 get { return m_localID; }
@@ -84,6 +86,7 @@ namespace OpenSim.Region.Environment.Scenes
84 } 86 }
85 87
86 protected string m_name; 88 protected string m_name;
89
87 public virtual string Name 90 public virtual string Name
88 { 91 {
89 get { return m_name; } 92 get { return m_name; }
@@ -91,20 +94,23 @@ namespace OpenSim.Region.Environment.Scenes
91 } 94 }
92 95
93 protected LLObject.ObjectFlags m_flags; 96 protected LLObject.ObjectFlags m_flags;
97
94 public uint ObjectFlags 98 public uint ObjectFlags
95 { 99 {
96 get { return (uint)m_flags; } 100 get { return (uint) m_flags; }
97 set { m_flags = (LLObject.ObjectFlags)value; } 101 set { m_flags = (LLObject.ObjectFlags) value; }
98 } 102 }
99 103
100 protected LLObject.MaterialType m_material; 104 protected LLObject.MaterialType m_material;
105
101 public byte Material 106 public byte Material
102 { 107 {
103 get { return (byte)m_material; } 108 get { return (byte) m_material; }
104 set { m_material = (LLObject.MaterialType)value; } 109 set { m_material = (LLObject.MaterialType) value; }
105 } 110 }
106 111
107 protected ulong m_regionHandle; 112 protected ulong m_regionHandle;
113
108 public ulong RegionHandle 114 public ulong RegionHandle
109 { 115 {
110 get { return m_regionHandle; } 116 get { return m_regionHandle; }
@@ -113,6 +119,7 @@ namespace OpenSim.Region.Environment.Scenes
113 119
114 //unkown if this will be kept, added as a way of removing the group position from the group class 120 //unkown if this will be kept, added as a way of removing the group position from the group class
115 protected LLVector3 m_groupPosition; 121 protected LLVector3 m_groupPosition;
122
116 public LLVector3 GroupPosition 123 public LLVector3 GroupPosition
117 { 124 {
118 get { return m_groupPosition; } 125 get { return m_groupPosition; }
@@ -120,6 +127,7 @@ namespace OpenSim.Region.Environment.Scenes
120 } 127 }
121 128
122 protected LLVector3 m_offsetPosition; 129 protected LLVector3 m_offsetPosition;
130
123 public LLVector3 OffsetPosition 131 public LLVector3 OffsetPosition
124 { 132 {
125 get { return m_offsetPosition; } 133 get { return m_offsetPosition; }
@@ -132,6 +140,7 @@ namespace OpenSim.Region.Environment.Scenes
132 } 140 }
133 141
134 protected LLQuaternion m_rotationOffset; 142 protected LLQuaternion m_rotationOffset;
143
135 public LLQuaternion RotationOffset 144 public LLQuaternion RotationOffset
136 { 145 {
137 get { return m_rotationOffset; } 146 get { return m_rotationOffset; }
@@ -139,6 +148,7 @@ namespace OpenSim.Region.Environment.Scenes
139 } 148 }
140 149
141 protected LLVector3 m_velocity; 150 protected LLVector3 m_velocity;
151
142 /// <summary></summary> 152 /// <summary></summary>
143 public LLVector3 Velocity 153 public LLVector3 Velocity
144 { 154 {
@@ -147,6 +157,7 @@ namespace OpenSim.Region.Environment.Scenes
147 } 157 }
148 158
149 protected LLVector3 m_angularVelocity; 159 protected LLVector3 m_angularVelocity;
160
150 /// <summary></summary> 161 /// <summary></summary>
151 public LLVector3 AngularVelocity 162 public LLVector3 AngularVelocity
152 { 163 {
@@ -155,6 +166,7 @@ namespace OpenSim.Region.Environment.Scenes
155 } 166 }
156 167
157 protected LLVector3 m_acceleration; 168 protected LLVector3 m_acceleration;
169
158 /// <summary></summary> 170 /// <summary></summary>
159 public LLVector3 Acceleration 171 public LLVector3 Acceleration
160 { 172 {
@@ -163,13 +175,15 @@ namespace OpenSim.Region.Environment.Scenes
163 } 175 }
164 176
165 private string m_description = ""; 177 private string m_description = "";
178
166 public string Description 179 public string Description
167 { 180 {
168 get { return this.m_description; } 181 get { return m_description; }
169 set { this.m_description = value; } 182 set { m_description = value; }
170 } 183 }
171 184
172 private string m_text = ""; 185 private string m_text = "";
186
173 public string Text 187 public string Text
174 { 188 {
175 get { return m_text; } 189 get { return m_text; }
@@ -181,6 +195,7 @@ namespace OpenSim.Region.Environment.Scenes
181 } 195 }
182 196
183 private string m_sitName = ""; 197 private string m_sitName = "";
198
184 public string SitName 199 public string SitName
185 { 200 {
186 get { return m_sitName; } 201 get { return m_sitName; }
@@ -188,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
188 } 203 }
189 204
190 private string m_touchName = ""; 205 private string m_touchName = "";
206
191 public string TouchName 207 public string TouchName
192 { 208 {
193 get { return m_touchName; } 209 get { return m_touchName; }
@@ -195,17 +211,19 @@ namespace OpenSim.Region.Environment.Scenes
195 } 211 }
196 212
197 protected PrimitiveBaseShape m_shape; 213 protected PrimitiveBaseShape m_shape;
214
198 public PrimitiveBaseShape Shape 215 public PrimitiveBaseShape Shape
199 { 216 {
200 get { return this.m_shape; } 217 get { return m_shape; }
201 set { m_shape = value; } 218 set { m_shape = value; }
202 } 219 }
203 220
204 public LLVector3 Scale 221 public LLVector3 Scale
205 { 222 {
206 set { this.m_shape.Scale = value; } 223 set { m_shape.Scale = value; }
207 get { return this.m_shape.Scale; } 224 get { return m_shape.Scale; }
208 } 225 }
226
209 #endregion 227 #endregion
210 228
211 public LLUUID ObjectOwner 229 public LLUUID ObjectOwner
@@ -215,16 +233,16 @@ namespace OpenSim.Region.Environment.Scenes
215 233
216 public SceneObjectGroup ParentGroup 234 public SceneObjectGroup ParentGroup
217 { 235 {
218 get { return m_parentGroup; } 236 get { return m_parentGroup; }
219 } 237 }
220 238
221 #region Constructors 239 #region Constructors
240
222 /// <summary> 241 /// <summary>
223 /// 242 ///
224 /// </summary> 243 /// </summary>
225 public SceneObjectPart() 244 public SceneObjectPart()
226 { 245 {
227
228 } 246 }
229 247
230 /// <summary> 248 /// <summary>
@@ -236,43 +254,44 @@ namespace OpenSim.Region.Environment.Scenes
236 /// <param name="localID"></param> 254 /// <param name="localID"></param>
237 /// <param name="shape"></param> 255 /// <param name="shape"></param>
238 /// <param name="position"></param> 256 /// <param name="position"></param>
239 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition) 257 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID,
240 { 258 PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition)
241 this.m_name = "Primitive"; 259 {
242 this.m_regionHandle = regionHandle; 260 m_name = "Primitive";
243 this.m_parentGroup = parent; 261 m_regionHandle = regionHandle;
244 262 m_parentGroup = parent;
245 this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 263
246 this.OwnerID = ownerID; 264 CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
247 this.CreatorID = this.OwnerID; 265 OwnerID = ownerID;
248 this.LastOwnerID = LLUUID.Zero; 266 CreatorID = OwnerID;
249 this.UUID = LLUUID.Random(); 267 LastOwnerID = LLUUID.Zero;
250 this.LocalID = (uint)(localID); 268 UUID = LLUUID.Random();
251 this.Shape = shape; 269 LocalID = (uint) (localID);
252 270 Shape = shape;
253 this.GroupPosition = groupPosition; 271
254 this.OffsetPosition = offsetPosition; 272 GroupPosition = groupPosition;
255 this.RotationOffset = LLQuaternion.Identity; 273 OffsetPosition = offsetPosition;
256 this.Velocity = new LLVector3(0, 0, 0); 274 RotationOffset = LLQuaternion.Identity;
257 this.AngularVelocity = new LLVector3(0, 0, 0); 275 Velocity = new LLVector3(0, 0, 0);
258 this.Acceleration = new LLVector3(0, 0, 0); 276 AngularVelocity = new LLVector3(0, 0, 0);
259 277 Acceleration = new LLVector3(0, 0, 0);
278
260 m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString(); 279 m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString();
261 m_folderID = LLUUID.Random(); 280 m_folderID = LLUUID.Random();
262 281
263 m_flags = 0; 282 m_flags = 0;
264 m_flags |= LLObject.ObjectFlags.ObjectModify | 283 m_flags |= LLObject.ObjectFlags.ObjectModify |
265 LLObject.ObjectFlags.ObjectCopy | 284 LLObject.ObjectFlags.ObjectCopy |
266 LLObject.ObjectFlags.ObjectYouOwner | 285 LLObject.ObjectFlags.ObjectYouOwner |
267 LLObject.ObjectFlags.Touch | 286 LLObject.ObjectFlags.Touch |
268 LLObject.ObjectFlags.ObjectMove | 287 LLObject.ObjectFlags.ObjectMove |
269 LLObject.ObjectFlags.AllowInventoryDrop | 288 LLObject.ObjectFlags.AllowInventoryDrop |
270 LLObject.ObjectFlags.ObjectTransfer | 289 LLObject.ObjectFlags.ObjectTransfer |
271 LLObject.ObjectFlags.ObjectOwnerModify; 290 LLObject.ObjectFlags.ObjectOwnerModify;
272 291
273 ScheduleFullUpdate(); 292 ScheduleFullUpdate();
274 } 293 }
275 294
276 /// <summary> 295 /// <summary>
277 /// Re/create a SceneObjectPart (prim) 296 /// Re/create a SceneObjectPart (prim)
278 /// currently not used, and maybe won't be 297 /// currently not used, and maybe won't be
@@ -283,23 +302,26 @@ namespace OpenSim.Region.Environment.Scenes
283 /// <param name="localID"></param> 302 /// <param name="localID"></param>
284 /// <param name="shape"></param> 303 /// <param name="shape"></param>
285 /// <param name="position"></param> 304 /// <param name="position"></param>
286 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, int creationDate, LLUUID ownerID, LLUUID creatorID, LLUUID lastOwnerID, uint localID, PrimitiveBaseShape shape, LLVector3 position, LLQuaternion rotation, uint flags) 305 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, int creationDate, LLUUID ownerID,
306 LLUUID creatorID, LLUUID lastOwnerID, uint localID, PrimitiveBaseShape shape,
307 LLVector3 position, LLQuaternion rotation, uint flags)
287 { 308 {
288 this.m_regionHandle = regionHandle; 309 m_regionHandle = regionHandle;
289 this.m_parentGroup = parent; 310 m_parentGroup = parent;
290 311
291 this.CreationDate = creationDate; 312 CreationDate = creationDate;
292 this.OwnerID = ownerID; 313 OwnerID = ownerID;
293 this.CreatorID = creatorID; 314 CreatorID = creatorID;
294 this.LastOwnerID = lastOwnerID; 315 LastOwnerID = lastOwnerID;
295 this.UUID = LLUUID.Random(); 316 UUID = LLUUID.Random();
296 this.LocalID = (uint)(localID); 317 LocalID = (uint) (localID);
297 this.Shape = shape; 318 Shape = shape;
298 319
299 this.OffsetPosition = position; 320 OffsetPosition = position;
300 this.RotationOffset = rotation; 321 RotationOffset = rotation;
301 this.ObjectFlags = flags; 322 ObjectFlags = flags;
302 } 323 }
324
303 #endregion 325 #endregion
304 326
305 /// <summary> 327 /// <summary>
@@ -309,8 +331,8 @@ namespace OpenSim.Region.Environment.Scenes
309 /// <returns></returns> 331 /// <returns></returns>
310 public static SceneObjectPart FromXml(XmlReader xmlReader) 332 public static SceneObjectPart FromXml(XmlReader xmlReader)
311 { 333 {
312 XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); 334 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
313 return (SceneObjectPart)serializer.Deserialize(xmlReader); 335 return (SceneObjectPart) serializer.Deserialize(xmlReader);
314 } 336 }
315 337
316 /// <summary> 338 /// <summary>
@@ -319,7 +341,7 @@ namespace OpenSim.Region.Environment.Scenes
319 /// <param name="xmlWriter"></param> 341 /// <param name="xmlWriter"></param>
320 public void ToXml(XmlWriter xmlWriter) 342 public void ToXml(XmlWriter xmlWriter)
321 { 343 {
322 XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); 344 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
323 serializer.Serialize(xmlWriter, this); 345 serializer.Serialize(xmlWriter, this);
324 } 346 }
325 347
@@ -329,7 +351,6 @@ namespace OpenSim.Region.Environment.Scenes
329 public void SetParent(SceneObjectGroup parent) 351 public void SetParent(SceneObjectGroup parent)
330 { 352 {
331 m_parentGroup = parent; 353 m_parentGroup = parent;
332
333 } 354 }
334 355
335 public LLUUID GetRootPartUUID() 356 public LLUUID GetRootPartUUID()
@@ -342,34 +363,38 @@ namespace OpenSim.Region.Environment.Scenes
342 } 363 }
343 364
344 #region Copying 365 #region Copying
366
345 /// <summary> 367 /// <summary>
346 /// 368 ///
347 /// </summary> 369 /// </summary>
348 /// <returns></returns> 370 /// <returns></returns>
349 public SceneObjectPart Copy(uint localID) 371 public SceneObjectPart Copy(uint localID)
350 { 372 {
351 SceneObjectPart dupe = (SceneObjectPart)this.MemberwiseClone(); 373 SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone();
352 dupe.m_shape = m_shape.Copy(); 374 dupe.m_shape = m_shape.Copy();
353 dupe.m_regionHandle = m_regionHandle; 375 dupe.m_regionHandle = m_regionHandle;
354 dupe.UUID = LLUUID.Random(); 376 dupe.UUID = LLUUID.Random();
355 dupe.LocalID = localID; 377 dupe.LocalID = localID;
356 dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z); 378 dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z);
357 dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); 379 dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z);
358 dupe.RotationOffset = new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); 380 dupe.RotationOffset =
381 new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W);
359 dupe.Velocity = new LLVector3(0, 0, 0); 382 dupe.Velocity = new LLVector3(0, 0, 0);
360 dupe.Acceleration = new LLVector3(0, 0, 0); 383 dupe.Acceleration = new LLVector3(0, 0, 0);
361 dupe.AngularVelocity = new LLVector3(0, 0, 0); 384 dupe.AngularVelocity = new LLVector3(0, 0, 0);
362 dupe.ObjectFlags = this.ObjectFlags; 385 dupe.ObjectFlags = ObjectFlags;
363 386
364 byte[] extraP = new byte[this.Shape.ExtraParams.Length]; 387 byte[] extraP = new byte[Shape.ExtraParams.Length];
365 Array.Copy(this.Shape.ExtraParams, extraP, extraP.Length); 388 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
366 dupe.Shape.ExtraParams = extraP; 389 dupe.Shape.ExtraParams = extraP;
367 390
368 return dupe; 391 return dupe;
369 } 392 }
393
370 #endregion 394 #endregion
371 395
372 #region Update Scheduling 396 #region Update Scheduling
397
373 /// <summary> 398 /// <summary>
374 /// 399 ///
375 /// </summary> 400 /// </summary>
@@ -387,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes
387 { 412 {
388 m_parentGroup.HasChanged = true; 413 m_parentGroup.HasChanged = true;
389 } 414 }
390 this.TimeStampFull =(uint) Util.UnixTimeSinceEpoch(); 415 TimeStampFull = (uint) Util.UnixTimeSinceEpoch();
391 m_updateFlag = 2; 416 m_updateFlag = 2;
392 } 417 }
393 418
@@ -402,7 +427,7 @@ namespace OpenSim.Region.Environment.Scenes
402 { 427 {
403 m_parentGroup.HasChanged = true; 428 m_parentGroup.HasChanged = true;
404 } 429 }
405 this.TimeStampTerse = (uint)Util.UnixTimeSinceEpoch(); 430 TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
406 m_updateFlag = 1; 431 m_updateFlag = 1;
407 } 432 }
408 } 433 }
@@ -426,56 +451,60 @@ namespace OpenSim.Region.Environment.Scenes
426 } 451 }
427 } 452 }
428 } 453 }
454
429 #endregion 455 #endregion
430 456
431 #region Shape 457 #region Shape
458
432 /// <summary> 459 /// <summary>
433 /// 460 ///
434 /// </summary> 461 /// </summary>
435 /// <param name="shapeBlock"></param> 462 /// <param name="shapeBlock"></param>
436 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) 463 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
437 { 464 {
438 this.m_shape.PathBegin = shapeBlock.PathBegin; 465 m_shape.PathBegin = shapeBlock.PathBegin;
439 this.m_shape.PathEnd = shapeBlock.PathEnd; 466 m_shape.PathEnd = shapeBlock.PathEnd;
440 this.m_shape.PathScaleX = shapeBlock.PathScaleX; 467 m_shape.PathScaleX = shapeBlock.PathScaleX;
441 this.m_shape.PathScaleY = shapeBlock.PathScaleY; 468 m_shape.PathScaleY = shapeBlock.PathScaleY;
442 this.m_shape.PathShearX = shapeBlock.PathShearX; 469 m_shape.PathShearX = shapeBlock.PathShearX;
443 this.m_shape.PathShearY = shapeBlock.PathShearY; 470 m_shape.PathShearY = shapeBlock.PathShearY;
444 this.m_shape.PathSkew = shapeBlock.PathSkew; 471 m_shape.PathSkew = shapeBlock.PathSkew;
445 this.m_shape.ProfileBegin = shapeBlock.ProfileBegin; 472 m_shape.ProfileBegin = shapeBlock.ProfileBegin;
446 this.m_shape.ProfileEnd = shapeBlock.ProfileEnd; 473 m_shape.ProfileEnd = shapeBlock.ProfileEnd;
447 this.m_shape.PathCurve = shapeBlock.PathCurve; 474 m_shape.PathCurve = shapeBlock.PathCurve;
448 this.m_shape.ProfileCurve = shapeBlock.ProfileCurve; 475 m_shape.ProfileCurve = shapeBlock.ProfileCurve;
449 this.m_shape.ProfileHollow = shapeBlock.ProfileHollow; 476 m_shape.ProfileHollow = shapeBlock.ProfileHollow;
450 this.m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; 477 m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
451 this.m_shape.PathRevolutions = shapeBlock.PathRevolutions; 478 m_shape.PathRevolutions = shapeBlock.PathRevolutions;
452 this.m_shape.PathTaperX = shapeBlock.PathTaperX; 479 m_shape.PathTaperX = shapeBlock.PathTaperX;
453 this.m_shape.PathTaperY = shapeBlock.PathTaperY; 480 m_shape.PathTaperY = shapeBlock.PathTaperY;
454 this.m_shape.PathTwist = shapeBlock.PathTwist; 481 m_shape.PathTwist = shapeBlock.PathTwist;
455 this.m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; 482 m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
456 ScheduleFullUpdate(); 483 ScheduleFullUpdate();
457 } 484 }
485
458 #endregion 486 #endregion
459 487
460 #region Inventory 488 #region Inventory
489
461 public void AddInventoryItem(TaskInventoryItem item) 490 public void AddInventoryItem(TaskInventoryItem item)
462 { 491 {
463 item.parent_id = m_folderID; 492 item.parent_id = m_folderID;
464 item.creation_date = 1000; 493 item.creation_date = 1000;
465 item.ParentPartID = this.UUID; 494 item.ParentPartID = UUID;
466 this.TaskInventory.Add(item.item_id, item); 495 TaskInventory.Add(item.item_id, item);
467 this.m_inventorySerial++; 496 m_inventorySerial++;
468 } 497 }
469 498
470 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) 499 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
471 { 500 {
472 if (localID == this.LocalID) 501 if (localID == LocalID)
473 { 502 {
474 if (this.TaskInventory.ContainsKey(itemID)) 503 if (TaskInventory.ContainsKey(itemID))
475 { 504 {
476 string type = TaskInventory[itemID].inv_type; 505 string type = TaskInventory[itemID].inv_type;
477 this.TaskInventory.Remove(itemID); 506 TaskInventory.Remove(itemID);
478 this.m_inventorySerial++; 507 m_inventorySerial++;
479 if (type == "lsltext") 508 if (type == "lsltext")
480 { 509 {
481 return 10; 510 return 10;
@@ -496,16 +525,17 @@ namespace OpenSim.Region.Environment.Scenes
496 /// <param name="localID"></param> 525 /// <param name="localID"></param>
497 public bool GetInventoryFileName(IClientAPI client, uint localID) 526 public bool GetInventoryFileName(IClientAPI client, uint localID)
498 { 527 {
499 if (localID == this.m_localID) 528 if (localID == m_localID)
500 { 529 {
501 if (this.m_inventorySerial > 0) 530 if (m_inventorySerial > 0)
502 { 531 {
503 client.SendTaskInventory(this.m_uuid, (short)m_inventorySerial, Helpers.StringToField(m_inventoryFileName)); 532 client.SendTaskInventory(m_uuid, (short) m_inventorySerial,
533 Helpers.StringToField(m_inventoryFileName));
504 return true; 534 return true;
505 } 535 }
506 else 536 else
507 { 537 {
508 client.SendTaskInventory(this.m_uuid, 0, new byte[0]); 538 client.SendTaskInventory(m_uuid, 0, new byte[0]);
509 return false; 539 return false;
510 } 540 }
511 } 541 }
@@ -515,8 +545,8 @@ namespace OpenSim.Region.Environment.Scenes
515 public string RequestInventoryFile(IXfer xferManager) 545 public string RequestInventoryFile(IXfer xferManager)
516 { 546 {
517 byte[] fileData = new byte[0]; 547 byte[] fileData = new byte[0];
518 InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, this.UUID); 548 InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID);
519 foreach (TaskInventoryItem item in this.TaskInventory.Values) 549 foreach (TaskInventoryItem item in TaskInventory.Values)
520 { 550 {
521 invString.AddItemStart(); 551 invString.AddItemStart();
522 invString.AddNameValueLine("item_id", item.item_id.ToStringHyphenated()); 552 invString.AddNameValueLine("item_id", item.item_id.ToStringHyphenated());
@@ -550,49 +580,56 @@ namespace OpenSim.Region.Environment.Scenes
550 } 580 }
551 return ""; 581 return "";
552 } 582 }
583
553 #endregion 584 #endregion
554 585
555 #region ExtraParams 586 #region ExtraParams
587
556 public void UpdateExtraParam(ushort type, bool inUse, byte[] data) 588 public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
557 { 589 {
558 this.m_shape.ExtraParams = new byte[data.Length + 7]; 590 m_shape.ExtraParams = new byte[data.Length + 7];
559 int i = 0; 591 int i = 0;
560 uint length = (uint)data.Length; 592 uint length = (uint) data.Length;
561 this.m_shape.ExtraParams[i++] = 1; 593 m_shape.ExtraParams[i++] = 1;
562 this.m_shape.ExtraParams[i++] = (byte)(type % 256); 594 m_shape.ExtraParams[i++] = (byte) (type%256);
563 this.m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256); 595 m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256);
564 596
565 this.m_shape.ExtraParams[i++] = (byte)(length % 256); 597 m_shape.ExtraParams[i++] = (byte) (length%256);
566 this.m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256); 598 m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256);
567 this.m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256); 599 m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256);
568 this.m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256); 600 m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256);
569 Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length); 601 Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length);
570
571 this.ScheduleFullUpdate();
572 602
603 ScheduleFullUpdate();
573 } 604 }
605
574 #endregion 606 #endregion
575 607
576 #region Texture 608 #region Texture
609
577 /// <summary> 610 /// <summary>
578 /// 611 ///
579 /// </summary> 612 /// </summary>
580 /// <param name="textureEntry"></param> 613 /// <param name="textureEntry"></param>
581 public void UpdateTextureEntry(byte[] textureEntry) 614 public void UpdateTextureEntry(byte[] textureEntry)
582 { 615 {
583 this.m_shape.TextureEntry = textureEntry; 616 m_shape.TextureEntry = textureEntry;
584 ScheduleFullUpdate(); 617 ScheduleFullUpdate();
585 } 618 }
619
586 #endregion 620 #endregion
587 621
588 #region ParticleSystem 622 #region ParticleSystem
589 public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem) 623
624 public void AddNewParticleSystem(Primitive.ParticleSystem pSystem)
590 { 625 {
591 this.m_particleSystem = pSystem.GetBytes(); 626 m_particleSystem = pSystem.GetBytes();
592 } 627 }
628
593 #endregion 629 #endregion
594 630
595 #region Position 631 #region Position
632
596 /// <summary> 633 /// <summary>
597 /// 634 ///
598 /// </summary> 635 /// </summary>
@@ -600,46 +637,52 @@ namespace OpenSim.Region.Environment.Scenes
600 public void UpdateOffSet(LLVector3 pos) 637 public void UpdateOffSet(LLVector3 pos)
601 { 638 {
602 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 639 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
603 this.OffsetPosition = newPos; 640 OffsetPosition = newPos;
604 ScheduleTerseUpdate(); 641 ScheduleTerseUpdate();
605 } 642 }
606 643
607 public void UpdateGroupPosition(LLVector3 pos) 644 public void UpdateGroupPosition(LLVector3 pos)
608 { 645 {
609 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 646 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
610 this.GroupPosition = newPos; 647 GroupPosition = newPos;
611 ScheduleTerseUpdate(); 648 ScheduleTerseUpdate();
612 } 649 }
650
613 #endregion 651 #endregion
614 652
615 #region rotation 653 #region rotation
654
616 public void UpdateRotation(LLQuaternion rot) 655 public void UpdateRotation(LLQuaternion rot)
617 { 656 {
618 this.RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); 657 RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W);
619 ScheduleTerseUpdate(); 658 ScheduleTerseUpdate();
620 } 659 }
660
621 #endregion 661 #endregion
622 662
623 #region Resizing/Scale 663 #region Resizing/Scale
664
624 /// <summary> 665 /// <summary>
625 /// 666 ///
626 /// </summary> 667 /// </summary>
627 /// <param name="scale"></param> 668 /// <param name="scale"></param>
628 public void Resize(LLVector3 scale) 669 public void Resize(LLVector3 scale)
629 { 670 {
630 this.m_shape.Scale = scale; 671 m_shape.Scale = scale;
631 ScheduleFullUpdate(); 672 ScheduleFullUpdate();
632 } 673 }
674
633 #endregion 675 #endregion
634 676
635 #region Client Update Methods 677 #region Client Update Methods
678
636 public void AddFullUpdateToAllAvatars() 679 public void AddFullUpdateToAllAvatars()
637 { 680 {
638 List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); 681 List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
639 for (int i = 0; i < avatars.Count; i++) 682 for (int i = 0; i < avatars.Count; i++)
640 { 683 {
641 avatars[i].AddFullPart(this); 684 avatars[i].AddFullPart(this);
642 // avatars[i].QueuePartForUpdate(this); 685 // avatars[i].QueuePartForUpdate(this);
643 } 686 }
644 } 687 }
645 688
@@ -654,7 +697,7 @@ namespace OpenSim.Region.Environment.Scenes
654 /// </summary> 697 /// </summary>
655 public void SendFullUpdateToAllClients() 698 public void SendFullUpdateToAllClients()
656 { 699 {
657 List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); 700 List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
658 for (int i = 0; i < avatars.Count; i++) 701 for (int i = 0; i < avatars.Count; i++)
659 { 702 {
660 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this); 703 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this);
@@ -691,26 +734,26 @@ namespace OpenSim.Region.Environment.Scenes
691 LLQuaternion lRot; 734 LLQuaternion lRot;
692 lRot = RotationOffset; 735 lRot = RotationOffset;
693 736
694 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, this.ObjectFlags, m_uuid, OwnerID, 737 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, ObjectFlags, m_uuid,
695 m_text, ParentID, this.m_particleSystem, lRot); 738 OwnerID,
739 m_text, ParentID, m_particleSystem, lRot);
696 } 740 }
697 741
698 /// Terse updates 742 /// Terse updates
699
700 public void AddTerseUpdateToAllAvatars() 743 public void AddTerseUpdateToAllAvatars()
701 { 744 {
702 List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); 745 List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
703 for (int i = 0; i < avatars.Count; i++) 746 for (int i = 0; i < avatars.Count; i++)
704 { 747 {
705 avatars[i].AddTersePart(this); 748 avatars[i].AddTersePart(this);
706 // avatars[i].QueuePartForUpdate(this); 749 // avatars[i].QueuePartForUpdate(this);
707 } 750 }
708 } 751 }
709 752
710 public void AddTerseUpdateToAvatar(ScenePresence presence) 753 public void AddTerseUpdateToAvatar(ScenePresence presence)
711 { 754 {
712 presence.AddTersePart(this); 755 presence.AddTersePart(this);
713 // presence.QueuePartForUpdate(this); 756 // presence.QueuePartForUpdate(this);
714 } 757 }
715 758
716 /// <summary> 759 /// <summary>
@@ -718,7 +761,7 @@ namespace OpenSim.Region.Environment.Scenes
718 /// </summary> 761 /// </summary>
719 public void SendTerseUpdateToAllClients() 762 public void SendTerseUpdateToAllClients()
720 { 763 {
721 List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); 764 List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
722 for (int i = 0; i < avatars.Count; i++) 765 for (int i = 0; i < avatars.Count; i++)
723 { 766 {
724 m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); 767 m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this);
@@ -741,8 +784,8 @@ namespace OpenSim.Region.Environment.Scenes
741 public void SendTerseUpdateToClient(IClientAPI remoteClient) 784 public void SendTerseUpdateToClient(IClientAPI remoteClient)
742 { 785 {
743 LLVector3 lPos; 786 LLVector3 lPos;
744 lPos = this.OffsetPosition; 787 lPos = OffsetPosition;
745 LLQuaternion mRot = this.RotationOffset; 788 LLQuaternion mRot = RotationOffset;
746 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); 789 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
747 } 790 }
748 791
@@ -753,9 +796,10 @@ namespace OpenSim.Region.Environment.Scenes
753 /// <param name="lPos"></param> 796 /// <param name="lPos"></param>
754 public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) 797 public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos)
755 { 798 {
756 LLQuaternion mRot = this.RotationOffset; 799 LLQuaternion mRot = RotationOffset;
757 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); 800 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
758 } 801 }
802
759 #endregion 803 #endregion
760 804
761 public virtual void UpdateMovement() 805 public virtual void UpdateMovement()
@@ -778,11 +822,11 @@ namespace OpenSim.Region.Environment.Scenes
778 public InventoryStringBuilder(LLUUID folderID, LLUUID parentID) 822 public InventoryStringBuilder(LLUUID folderID, LLUUID parentID)
779 { 823 {
780 BuildString += "\tinv_object\t0\n\t{\n"; 824 BuildString += "\tinv_object\t0\n\t{\n";
781 this.AddNameValueLine("obj_id", folderID.ToStringHyphenated()); 825 AddNameValueLine("obj_id", folderID.ToStringHyphenated());
782 this.AddNameValueLine("parent_id", parentID.ToStringHyphenated()); 826 AddNameValueLine("parent_id", parentID.ToStringHyphenated());
783 this.AddNameValueLine("type", "category"); 827 AddNameValueLine("type", "category");
784 this.AddNameValueLine("name", "Contents"); 828 AddNameValueLine("name", "Contents");
785 this.AddSectionEnd(); 829 AddSectionEnd();
786 } 830 }
787 831
788 public void AddItemStart() 832 public void AddItemStart()
@@ -831,7 +875,7 @@ namespace OpenSim.Region.Environment.Scenes
831 "", 875 "",
832 "", 876 "",
833 "", 877 "",
834 "", 878 "",
835 "", 879 "",
836 "lsltext", 880 "lsltext",
837 "" 881 ""
@@ -865,5 +909,4 @@ namespace OpenSim.Region.Environment.Scenes
865 } 909 }
866 } 910 }
867 } 911 }
868} 912} \ No newline at end of file
869
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
index 8c8cebe..e8f29c8 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Environment.Scenes
35 { 35 {
36 public class AvatarAnimations 36 public class AvatarAnimations
37 { 37 {
38
39 public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>(); 38 public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>();
40 public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>(); 39 public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>();
41 40
@@ -52,12 +51,10 @@ namespace OpenSim.Region.Environment.Scenes
52 doc.Load(reader); 51 doc.Load(reader);
53 foreach (XmlNode nod in doc.DocumentElement.ChildNodes) 52 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
54 { 53 {
55
56 if (nod.Attributes["name"] != null) 54 if (nod.Attributes["name"] != null)
57 { 55 {
58 AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); 56 AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText);
59 } 57 }
60
61 } 58 }
62 59
63 reader.Close(); 60 reader.Close();
@@ -71,4 +68,4 @@ namespace OpenSim.Region.Environment.Scenes
71 } 68 }
72 } 69 }
73 } 70 }
74} 71} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
index efe613f..605e8a1 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
@@ -37,7 +37,6 @@ namespace OpenSim.Region.Environment.Scenes
37 { 37 {
38 public Avatar() 38 public Avatar()
39 { 39 {
40
41 } 40 }
42 41
43 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) 42 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
@@ -61,7 +60,6 @@ namespace OpenSim.Region.Environment.Scenes
61 { 60 {
62 public ChildAgent() 61 public ChildAgent()
63 { 62 {
64
65 } 63 }
66 64
67 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) 65 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
@@ -81,5 +79,4 @@ namespace OpenSim.Region.Environment.Scenes
81 } 79 }
82 } 80 }
83 } 81 }
84 82} \ No newline at end of file
85}
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 6d51fbc..64c6eaa 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -27,7 +27,6 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
31using Axiom.Math; 30using Axiom.Math;
32using libsecondlife; 31using libsecondlife;
33using libsecondlife.Packets; 32using libsecondlife.Packets;
@@ -72,7 +71,8 @@ namespace OpenSim.Region.Environment.Scenes
72 private IScenePresenceBody m_body; 71 private IScenePresenceBody m_body;
73 72
74 private Vector3[] Dir_Vectors = new Vector3[6]; 73 private Vector3[] Dir_Vectors = new Vector3[6];
75 private libsecondlife.LLVector3 lastPhysPos = new libsecondlife.LLVector3(); 74 private LLVector3 lastPhysPos = new LLVector3();
75
76 private enum Dir_ControlFlags 76 private enum Dir_ControlFlags
77 { 77 {
78 DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS, 78 DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS,
@@ -82,48 +82,39 @@ namespace OpenSim.Region.Environment.Scenes
82 DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS, 82 DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS,
83 DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG 83 DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG
84 } 84 }
85
85 /// <summary> 86 /// <summary>
86 /// Position at which a significant movement was made 87 /// Position at which a significant movement was made
87 /// </summary> 88 /// </summary>
88 private LLVector3 posLastSignificantMove = new LLVector3(); 89 private LLVector3 posLastSignificantMove = new LLVector3();
89 90
90 public delegate void SignificantClientMovement(IClientAPI remote_client); 91 public delegate void SignificantClientMovement(IClientAPI remote_client);
92
91 public event SignificantClientMovement OnSignificantClientMovement; 93 public event SignificantClientMovement OnSignificantClientMovement;
92 94
93 //public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>(); 95 //public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>();
94 96
95 // private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>(); 97 // private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>();
96 // private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>(); 98 // private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>();
97 99
98 private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); 100 private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>();
99 private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>(); 101 private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>();
100 102
101 #region Properties 103 #region Properties
104
102 /// <summary> 105 /// <summary>
103 /// 106 ///
104 /// </summary> 107 /// </summary>
105 public PhysicsActor PhysActor 108 public PhysicsActor PhysActor
106 { 109 {
107 set 110 set { _physActor = value; }
108 { 111 get { return _physActor; }
109 this._physActor = value;
110 }
111 get
112 {
113 return _physActor;
114 }
115 } 112 }
116 113
117 public bool Updated 114 public bool Updated
118 { 115 {
119 set 116 set { updateflag = value; }
120 { 117 get { return updateflag; }
121 this.updateflag = value;
122 }
123 get
124 {
125 return this.updateflag;
126 }
127 } 118 }
128 119
129 public ulong RegionHandle 120 public ulong RegionHandle
@@ -132,12 +123,14 @@ namespace OpenSim.Region.Environment.Scenes
132 } 123 }
133 124
134 private string m_firstname; 125 private string m_firstname;
126
135 public string Firstname 127 public string Firstname
136 { 128 {
137 get { return m_firstname; } 129 get { return m_firstname; }
138 } 130 }
139 131
140 private string m_lastname; 132 private string m_lastname;
133
141 public string Lastname 134 public string Lastname
142 { 135 {
143 get { return m_lastname; } 136 get { return m_lastname; }
@@ -146,6 +139,7 @@ namespace OpenSim.Region.Environment.Scenes
146 #endregion 139 #endregion
147 140
148 #region Constructor(s) 141 #region Constructor(s)
142
149 /// <summary> 143 /// <summary>
150 /// 144 ///
151 /// </summary> 145 /// </summary>
@@ -155,19 +149,18 @@ namespace OpenSim.Region.Environment.Scenes
155 /// <param name="regionDat"></param> 149 /// <param name="regionDat"></param>
156 public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo) 150 public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo)
157 { 151 {
158
159 m_scene = world; 152 m_scene = world;
160 this.m_uuid = theClient.AgentId; 153 m_uuid = theClient.AgentId;
161 154
162 m_regionInfo = reginfo; 155 m_regionInfo = reginfo;
163 m_regionHandle = reginfo.RegionHandle; 156 m_regionHandle = reginfo.RegionHandle;
164 MainLog.Instance.Verbose("Avatar.cs "); 157 MainLog.Instance.Verbose("Avatar.cs ");
165 ControllingClient = theClient; 158 ControllingClient = theClient;
166 this.m_firstname = ControllingClient.FirstName; 159 m_firstname = ControllingClient.FirstName;
167 this.m_lastname = ControllingClient.LastName; 160 m_lastname = ControllingClient.LastName;
168 m_localId = m_scene.NextLocalId; 161 m_localId = m_scene.NextLocalId;
169 AbsolutePosition = ControllingClient.StartPos; 162 AbsolutePosition = ControllingClient.StartPos;
170 163
171 visualParams = new byte[218]; 164 visualParams = new byte[218];
172 for (int i = 0; i < 218; i++) 165 for (int i = 0; i < 218; i++)
173 { 166 {
@@ -175,37 +168,37 @@ namespace OpenSim.Region.Environment.Scenes
175 } 168 }
176 169
177 Wearables = AvatarWearable.DefaultWearables; 170 Wearables = AvatarWearable.DefaultWearables;
178 Animations = new ScenePresence.AvatarAnimations(); 171 Animations = new AvatarAnimations();
179 Animations.LoadAnims(); 172 Animations.LoadAnims();
180 173
181 //register for events 174 //register for events
182 ControllingClient.OnRequestWearables += this.SendOurAppearance; 175 ControllingClient.OnRequestWearables += SendOurAppearance;
183 ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); 176 ControllingClient.OnSetAppearance += new SetAppearance(SetAppearance);
184 ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement; 177 ControllingClient.OnCompleteMovementToRegion += CompleteMovement;
185 ControllingClient.OnCompleteMovementToRegion += this.SendInitialData; 178 ControllingClient.OnCompleteMovementToRegion += SendInitialData;
186 ControllingClient.OnAgentUpdate += this.HandleAgentUpdate; 179 ControllingClient.OnAgentUpdate += HandleAgentUpdate;
187 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 180 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
188 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 181 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
189 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 182 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
190 183
191 Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD 184 Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD
192 Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK 185 Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK
193 Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT 186 Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT
194 Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT 187 Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT
195 Dir_Vectors[4] = new Vector3(0, 0, 1); //UP 188 Dir_Vectors[4] = new Vector3(0, 0, 1); //UP
196 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN 189 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN
197 190
198 this.m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length); 191 m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length);
199 192
200 //temporary until we move some code into the body classes 193 //temporary until we move some code into the body classes
201 this.m_body = new ChildAgent(); 194 m_body = new ChildAgent();
202 195
203 if (newAvatar) 196 if (newAvatar)
204 { 197 {
205 //do we need to use newAvatar? not sure so have added this to kill the compile warning 198 //do we need to use newAvatar? not sure so have added this to kill the compile warning
206 } 199 }
207
208 } 200 }
201
209 #endregion 202 #endregion
210 203
211 public void AddTersePart(SceneObjectPart part) 204 public void AddTersePart(SceneObjectPart part)
@@ -228,10 +221,10 @@ namespace OpenSim.Region.Environment.Scenes
228 while (terse) 221 while (terse)
229 { 222 {
230 SceneObjectPart part = m_tersePartUpdates.Dequeue(); 223 SceneObjectPart part = m_tersePartUpdates.Dequeue();
231 part.SendTerseUpdate(this.ControllingClient); 224 part.SendTerseUpdate(ControllingClient);
232 terseCount++; 225 terseCount++;
233 226
234 if ((m_tersePartUpdates.Count < 1) |(terseCount > 30)) 227 if ((m_tersePartUpdates.Count < 1) | (terseCount > 30))
235 { 228 {
236 terse = false; 229 terse = false;
237 } 230 }
@@ -245,31 +238,30 @@ namespace OpenSim.Region.Environment.Scenes
245 while (full) 238 while (full)
246 { 239 {
247 SceneObjectPart part = m_fullPartUpdates.Dequeue(); 240 SceneObjectPart part = m_fullPartUpdates.Dequeue();
248 part.SendFullUpdate(this.ControllingClient); 241 part.SendFullUpdate(ControllingClient);
249 fullCount++; 242 fullCount++;
250 if ((m_fullPartUpdates.Count < 1) | (fullCount > 40)) 243 if ((m_fullPartUpdates.Count < 1) | (fullCount > 40))
251 { 244 {
252 full = false; 245 full = false;
253 } 246 }
254
255 } 247 }
256 } 248 }
257 } 249 }
258 250
259 #region Status Methods 251 #region Status Methods
252
260 /// <summary> 253 /// <summary>
261 /// Not Used, most likely can be deleted 254 /// Not Used, most likely can be deleted
262 /// </summary> 255 /// </summary>
263 /// <param name="status"></param> 256 /// <param name="status"></param>
264 public void ChildStatusChange(bool status) 257 public void ChildStatusChange(bool status)
265 { 258 {
266 this.childAgent = status; 259 childAgent = status;
267 260
268 if (this.childAgent == true) 261 if (childAgent == true)
269 { 262 {
270 this.Velocity = new LLVector3(0, 0, 0); 263 Velocity = new LLVector3(0, 0, 0);
271 this.AbsolutePosition = new LLVector3(128, 128, 70); 264 AbsolutePosition = new LLVector3(128, 128, 70);
272
273 } 265 }
274 } 266 }
275 267
@@ -280,17 +272,17 @@ namespace OpenSim.Region.Environment.Scenes
280 public void MakeAvatar(LLVector3 pos, bool isFlying) 272 public void MakeAvatar(LLVector3 pos, bool isFlying)
281 { 273 {
282 //this.childAvatar = false; 274 //this.childAvatar = false;
283 this.AbsolutePosition = pos; 275 AbsolutePosition = pos;
284 this._physActor.Flying = isFlying; 276 _physActor.Flying = isFlying;
285 this.newAvatar = true; 277 newAvatar = true;
286 this.childAgent = false; 278 childAgent = false;
287 this.m_scene.SendAllSceneObjectsToClient(this); 279 m_scene.SendAllSceneObjectsToClient(this);
288 } 280 }
289 281
290 protected void MakeChildAgent() 282 protected void MakeChildAgent()
291 { 283 {
292 this.Velocity = new LLVector3(0, 0, 0); 284 Velocity = new LLVector3(0, 0, 0);
293 this.childAgent = true; 285 childAgent = true;
294 //this.Pos = new LLVector3(128, 128, 70); 286 //this.Pos = new LLVector3(128, 128, 70);
295 } 287 }
296 288
@@ -300,8 +292,8 @@ namespace OpenSim.Region.Environment.Scenes
300 /// <param name="pos"></param> 292 /// <param name="pos"></param>
301 public void Teleport(LLVector3 pos) 293 public void Teleport(LLVector3 pos)
302 { 294 {
303 this.AbsolutePosition = pos; 295 AbsolutePosition = pos;
304 this.SendTerseUpdateToALLClients(); 296 SendTerseUpdateToALLClients();
305 } 297 }
306 298
307 /// <summary> 299 /// <summary>
@@ -309,11 +301,12 @@ namespace OpenSim.Region.Environment.Scenes
309 /// </summary> 301 /// </summary>
310 public void StopMovement() 302 public void StopMovement()
311 { 303 {
312
313 } 304 }
305
314 #endregion 306 #endregion
315 307
316 #region Event Handlers 308 #region Event Handlers
309
317 /// <summary> 310 /// <summary>
318 /// 311 ///
319 /// </summary> 312 /// </summary>
@@ -322,14 +315,14 @@ namespace OpenSim.Region.Environment.Scenes
322 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) 315 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
323 { 316 {
324 LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); 317 LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length);
325 this.m_textureEntry = textureEnt; 318 m_textureEntry = textureEnt;
326 319
327 for (int i = 0; i < visualParam.Length; i++) 320 for (int i = 0; i < visualParam.Length; i++)
328 { 321 {
329 this.visualParams[i] = visualParam[i].ParamValue; 322 visualParams[i] = visualParam[i].ParamValue;
330 } 323 }
331 324
332 this.SendArrearanceToAllOtherAgents(); 325 SendArrearanceToAllOtherAgents();
333 } 326 }
334 327
335 /// <summary> 328 /// <summary>
@@ -337,16 +330,16 @@ namespace OpenSim.Region.Environment.Scenes
337 /// </summary> 330 /// </summary>
338 public void CompleteMovement() 331 public void CompleteMovement()
339 { 332 {
340 LLVector3 look = this.Velocity; 333 LLVector3 look = Velocity;
341 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 334 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
342 { 335 {
343 look = new LLVector3(0.99f, 0.042f, 0); 336 look = new LLVector3(0.99f, 0.042f, 0);
344 } 337 }
345 this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); 338 ControllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
346 if (this.childAgent) 339 if (childAgent)
347 { 340 {
348 this.childAgent = false; 341 childAgent = false;
349 342
350 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); 343 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
351 } 344 }
352 } 345 }
@@ -363,47 +356,45 @@ namespace OpenSim.Region.Environment.Scenes
363 bool DCFlagKeyPressed = false; 356 bool DCFlagKeyPressed = false;
364 Vector3 agent_control_v3 = new Vector3(0, 0, 0); 357 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
365 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 358 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
366 bool oldflying = this.PhysActor.Flying; 359 bool oldflying = PhysActor.Flying;
367 this.PhysActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); 360 PhysActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
368 if (this.PhysActor.Flying != oldflying) 361 if (PhysActor.Flying != oldflying)
369 { 362 {
370 update_movementflag = true; 363 update_movementflag = true;
371 } 364 }
372 365
373 if (q != this.bodyRot) 366 if (q != bodyRot)
374 { 367 {
375 this.bodyRot = q; 368 bodyRot = q;
376 update_rotation = true; 369 update_rotation = true;
377 } 370 }
378 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) 371 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
379 { 372 {
380 if ((flags & (uint)DCF) != 0) 373 if ((flags & (uint) DCF) != 0)
381 { 374 {
382 DCFlagKeyPressed = true; 375 DCFlagKeyPressed = true;
383 agent_control_v3 += Dir_Vectors[i]; 376 agent_control_v3 += Dir_Vectors[i];
384 if ((movementflag & (uint)DCF) == 0) 377 if ((movementflag & (uint) DCF) == 0)
385 { 378 {
386 movementflag += (byte)(uint)DCF; 379 movementflag += (byte) (uint) DCF;
387 update_movementflag = true; 380 update_movementflag = true;
388 } 381 }
389 } 382 }
390 else 383 else
391 { 384 {
392 if ((movementflag & (uint)DCF) != 0) 385 if ((movementflag & (uint) DCF) != 0)
393 { 386 {
394 movementflag -= (byte)(uint)DCF; 387 movementflag -= (byte) (uint) DCF;
395 update_movementflag = true; 388 update_movementflag = true;
396
397 } 389 }
398 } 390 }
399 i++; 391 i++;
400 } 392 }
401 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) 393 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
402 { 394 {
403 this.AddNewMovement(agent_control_v3, q); 395 AddNewMovement(agent_control_v3, q);
404 } 396 }
405 UpdateMovementAnimations(update_movementflag); 397 UpdateMovementAnimations(update_movementflag);
406
407 } 398 }
408 399
409 protected void UpdateMovementAnimations(bool update_movementflag) 400 protected void UpdateMovementAnimations(bool update_movementflag)
@@ -412,49 +403,48 @@ namespace OpenSim.Region.Environment.Scenes
412 { 403 {
413 if (movementflag != 0) 404 if (movementflag != 0)
414 { 405 {
415 if (this._physActor.Flying) 406 if (_physActor.Flying)
416 { 407 {
417 this.SendAnimPack(Animations.AnimsLLUUID["FLY"], 1); 408 SendAnimPack(Animations.AnimsLLUUID["FLY"], 1);
418 } 409 }
419 else 410 else
420 { 411 {
421 this.SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); 412 SendAnimPack(Animations.AnimsLLUUID["WALK"], 1);
422 } 413 }
423 } 414 }
424 else 415 else
425 { 416 {
426 this.SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); 417 SendAnimPack(Animations.AnimsLLUUID["STAND"], 1);
427 } 418 }
428 } 419 }
429
430 } 420 }
431 421
432 422
433 protected void AddNewMovement(Vector3 vec, Quaternion rotation) 423 protected void AddNewMovement(Vector3 vec, Quaternion rotation)
434 { 424 {
435 NewForce newVelocity = new NewForce(); 425 NewForce newVelocity = new NewForce();
436 Vector3 direc = rotation * vec; 426 Vector3 direc = rotation*vec;
437 direc.Normalize(); 427 direc.Normalize();
438 428
439 direc = direc * ((0.03f) * 128f); 429 direc = direc*((0.03f)*128f);
440 if (this._physActor.Flying) 430 if (_physActor.Flying)
441 direc *= 4; 431 direc *= 4;
442 432
443 newVelocity.X = direc.x; 433 newVelocity.X = direc.x;
444 newVelocity.Y = direc.y; 434 newVelocity.Y = direc.y;
445 newVelocity.Z = direc.z; 435 newVelocity.Z = direc.z;
446 this.forcesList.Add(newVelocity); 436 forcesList.Add(newVelocity);
447 } 437 }
448 438
449 #endregion 439 #endregion
450 440
451 #region Overridden Methods 441 #region Overridden Methods
442
452 /// <summary> 443 /// <summary>
453 /// 444 ///
454 /// </summary> 445 /// </summary>
455 public override void LandRenegerated() 446 public override void LandRenegerated()
456 { 447 {
457
458 } 448 }
459 449
460 /// <summary> 450 /// <summary>
@@ -462,63 +452,65 @@ namespace OpenSim.Region.Environment.Scenes
462 /// </summary> 452 /// </summary>
463 public override void Update() 453 public override void Update()
464 { 454 {
465 this.SendPrimUpdates(); 455 SendPrimUpdates();
466 456
467 if (this.newCoarseLocations) { 457 if (newCoarseLocations)
468 this.SendCoarseLocations(); 458 {
469 this.newCoarseLocations = false; 459 SendCoarseLocations();
460 newCoarseLocations = false;
470 } 461 }
471 462
472 if (this.childAgent == false) 463 if (childAgent == false)
473 { 464 {
474
475 /// check for user movement 'forces' (ie commands to move) 465 /// check for user movement 'forces' (ie commands to move)
476 if (this.newForce) 466 if (newForce)
477 { 467 {
478 this.SendTerseUpdateToALLClients(); 468 SendTerseUpdateToALLClients();
479 _updateCount = 0; 469 _updateCount = 0;
480 } 470 }
481 471
482 /// check for scripted movement (?) 472 /// check for scripted movement (?)
483 else if (movementflag != 0) 473 else if (movementflag != 0)
484 { 474 {
485 _updateCount++; 475 _updateCount++;
486 if (_updateCount > 3) 476 if (_updateCount > 3)
487 { 477 {
488 this.SendTerseUpdateToALLClients(); 478 SendTerseUpdateToALLClients();
489 _updateCount = 0; 479 _updateCount = 0;
490 } 480 }
491 } 481 }
492 482
493 /// check for physics-related movement 483 /// check for physics-related movement
494 else if (this.lastPhysPos.GetDistanceTo(this.AbsolutePosition) > 0.02 ) 484 else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02)
495 { 485 {
496 this.SendTerseUpdateToALLClients(); 486 SendTerseUpdateToALLClients();
497 _updateCount = 0; 487 _updateCount = 0;
498 this.lastPhysPos = this.AbsolutePosition; 488 lastPhysPos = AbsolutePosition;
499 } 489 }
500 this.CheckForSignificantMovement(); 490 CheckForSignificantMovement();
501 this.CheckForBorderCrossing(); 491 CheckForBorderCrossing();
502
503 } 492 }
504 } 493 }
494
505 #endregion 495 #endregion
506 496
507 #region Update Client(s) 497 #region Update Client(s)
498
508 /// <summary> 499 /// <summary>
509 /// 500 ///
510 /// </summary> 501 /// </summary>
511 /// <param name="RemoteClient"></param> 502 /// <param name="RemoteClient"></param>
512 public void SendTerseUpdateToClient(IClientAPI RemoteClient) 503 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
513 { 504 {
514 LLVector3 pos = this.AbsolutePosition; 505 LLVector3 pos = AbsolutePosition;
515 LLVector3 vel = this.Velocity; 506 LLVector3 vel = Velocity;
516 LLQuaternion rot; 507 LLQuaternion rot;
517 rot.X = this.bodyRot.x; 508 rot.X = bodyRot.x;
518 rot.Y = this.bodyRot.y; 509 rot.Y = bodyRot.y;
519 rot.Z = this.bodyRot.z; 510 rot.Z = bodyRot.z;
520 rot.W = this.bodyRot.w; 511 rot.W = bodyRot.w;
521 RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z), rot); 512 RemoteClient.SendAvatarTerseUpdate(m_regionHandle, 64096, LocalId, new LLVector3(pos.X, pos.Y, pos.Z),
513 new LLVector3(vel.X, vel.Y, vel.Z), rot);
522 } 514 }
523 515
524 /// <summary> 516 /// <summary>
@@ -526,42 +518,44 @@ namespace OpenSim.Region.Environment.Scenes
526 /// </summary> 518 /// </summary>
527 public void SendTerseUpdateToALLClients() 519 public void SendTerseUpdateToALLClients()
528 { 520 {
529 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 521 List<ScenePresence> avatars = m_scene.RequestAvatarList();
530 for (int i = 0; i < avatars.Count; i++) 522 for (int i = 0; i < avatars.Count; i++)
531 { 523 {
532 this.SendTerseUpdateToClient(avatars[i].ControllingClient); 524 SendTerseUpdateToClient(avatars[i].ControllingClient);
533 } 525 }
534 } 526 }
535 527
536 528
537 public void SendCoarseLocations() 529 public void SendCoarseLocations()
538 { 530 {
539 List<LLVector3> CoarseLocations = new List<LLVector3>(); 531 List<LLVector3> CoarseLocations = new List<LLVector3>();
540 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 532 List<ScenePresence> avatars = m_scene.RequestAvatarList();
541 for (int i = 0; i < avatars.Count; i++) 533 for (int i = 0; i < avatars.Count; i++)
542 { 534 {
543 if (avatars[i] != this && (!avatars[i].childAgent) ) { 535 if (avatars[i] != this && (!avatars[i].childAgent))
544 CoarseLocations.Add(avatars[i].AbsolutePosition); 536 {
545 } 537 CoarseLocations.Add(avatars[i].AbsolutePosition);
538 }
546 } 539 }
547 this.ControllingClient.SendCoarseLocationUpdate(CoarseLocations); 540 ControllingClient.SendCoarseLocationUpdate(CoarseLocations);
548 } 541 }
549 542
550 public void CoarseLocationChange(ScenePresence avatar) 543 public void CoarseLocationChange(ScenePresence avatar)
551 { 544 {
552 newCoarseLocations = true; 545 newCoarseLocations = true;
553 } 546 }
554 547
555 private void NotifyMyCoarseLocationChange() 548 private void NotifyMyCoarseLocationChange()
556 { 549 {
557 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 550 List<ScenePresence> avatars = m_scene.RequestAvatarList();
558 for (int i = 0; i < avatars.Count; i++) { 551 for (int i = 0; i < avatars.Count; i++)
559 if (avatars[i] != this) { 552 {
560 avatars[i].CoarseLocationChange(this); 553 if (avatars[i] != this)
561 } 554 {
555 avatars[i].CoarseLocationChange(this);
556 }
562 } 557 }
563 558 }
564 }
565 559
566 560
567 /// <summary> 561 /// <summary>
@@ -570,16 +564,17 @@ namespace OpenSim.Region.Environment.Scenes
570 /// <param name="remoteAvatar"></param> 564 /// <param name="remoteAvatar"></param>
571 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) 565 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
572 { 566 {
573 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.AbsolutePosition, this.m_textureEntry.ToBytes()); 567 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
568 LocalId, AbsolutePosition, m_textureEntry.ToBytes());
574 } 569 }
575 570
576 public void SendFullUpdateToALLClients() 571 public void SendFullUpdateToALLClients()
577 { 572 {
578 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 573 List<ScenePresence> avatars = m_scene.RequestAvatarList();
579 foreach (ScenePresence avatar in this.m_scene.RequestAvatarList()) 574 foreach (ScenePresence avatar in m_scene.RequestAvatarList())
580 { 575 {
581 this.SendFullUpdateToOtherClient(avatar); 576 SendFullUpdateToOtherClient(avatar);
582 if (avatar.LocalId != this.LocalId) 577 if (avatar.LocalId != LocalId)
583 { 578 {
584 if (!avatar.childAgent) 579 if (!avatar.childAgent)
585 { 580 {
@@ -595,15 +590,16 @@ namespace OpenSim.Region.Environment.Scenes
595 /// </summary> 590 /// </summary>
596 public void SendInitialData() 591 public void SendInitialData()
597 { 592 {
598 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.AbsolutePosition, this.m_textureEntry.ToBytes()); 593 ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
599 if (!this.childAgent) 594 AbsolutePosition, m_textureEntry.ToBytes());
595 if (!childAgent)
600 { 596 {
601 this.m_scene.InformClientOfNeighbours(this.ControllingClient); 597 m_scene.InformClientOfNeighbours(ControllingClient);
602 this.newAvatar = false; 598 newAvatar = false;
603 } 599 }
604 600
605 this.SendFullUpdateToALLClients(); 601 SendFullUpdateToALLClients();
606 this.SendArrearanceToAllOtherAgents(); 602 SendArrearanceToAllOtherAgents();
607 } 603 }
608 604
609 /// <summary> 605 /// <summary>
@@ -612,13 +608,13 @@ namespace OpenSim.Region.Environment.Scenes
612 /// <param name="OurClient"></param> 608 /// <param name="OurClient"></param>
613 public void SendOurAppearance(IClientAPI OurClient) 609 public void SendOurAppearance(IClientAPI OurClient)
614 { 610 {
615 this.ControllingClient.SendWearables(this.Wearables); 611 ControllingClient.SendWearables(Wearables);
616 612
617 //this.SendFullUpdateToALLClients(); 613 //this.SendFullUpdateToALLClients();
618 //this.SendArrearanceToAllOtherAgents(); 614 //this.SendArrearanceToAllOtherAgents();
619 615
620 this.m_scene.SendAllSceneObjectsToClient(this); 616 m_scene.SendAllSceneObjectsToClient(this);
621 this.ControllingClient.SendViewerTime(this.m_scene.TimePhase); 617 ControllingClient.SendViewerTime(m_scene.TimePhase);
622 618
623 //Please don't remove the following code (at least not yet), just leave it commented out 619 //Please don't remove the following code (at least not yet), just leave it commented out
624 //gives the user god powers, should help with debuging things in the future 620 //gives the user god powers, should help with debuging things in the future
@@ -636,10 +632,10 @@ namespace OpenSim.Region.Environment.Scenes
636 /// </summary> 632 /// </summary>
637 public void SendArrearanceToAllOtherAgents() 633 public void SendArrearanceToAllOtherAgents()
638 { 634 {
639 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 635 List<ScenePresence> avatars = m_scene.RequestAvatarList();
640 foreach (ScenePresence avatar in this.m_scene.RequestAvatarList()) 636 foreach (ScenePresence avatar in m_scene.RequestAvatarList())
641 { 637 {
642 this.SendAppearanceToOtherAgent(avatar); 638 SendAppearanceToOtherAgent(avatar);
643 } 639 }
644 } 640 }
645 641
@@ -649,7 +645,8 @@ namespace OpenSim.Region.Environment.Scenes
649 /// <param name="avatarInfo"></param> 645 /// <param name="avatarInfo"></param>
650 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) 646 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
651 { 647 {
652 avatarInfo.ControllingClient.SendAppearance(this.ControllingClient.AgentId, this.visualParams, this.m_textureEntry.ToBytes()); 648 avatarInfo.ControllingClient.SendAppearance(ControllingClient.AgentId, visualParams,
649 m_textureEntry.ToBytes());
653 } 650 }
654 651
655 /// <summary> 652 /// <summary>
@@ -659,12 +656,12 @@ namespace OpenSim.Region.Environment.Scenes
659 /// <param name="seq"></param> 656 /// <param name="seq"></param>
660 public void SendAnimPack(LLUUID animID, int seq) 657 public void SendAnimPack(LLUUID animID, int seq)
661 { 658 {
662 this.current_anim = animID; 659 current_anim = animID;
663 this.anim_seq = seq; 660 anim_seq = seq;
664 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 661 List<ScenePresence> avatars = m_scene.RequestAvatarList();
665 for (int i = 0; i < avatars.Count; i++) 662 for (int i = 0; i < avatars.Count; i++)
666 { 663 {
667 avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); 664 avatars[i].ControllingClient.SendAnimation(animID, seq, ControllingClient.AgentId);
668 } 665 }
669 } 666 }
670 667
@@ -673,48 +670,51 @@ namespace OpenSim.Region.Environment.Scenes
673 /// </summary> 670 /// </summary>
674 public void SendAnimPack() 671 public void SendAnimPack()
675 { 672 {
676 this.SendAnimPack(this.current_anim, this.anim_seq); 673 SendAnimPack(current_anim, anim_seq);
677 } 674 }
675
678 #endregion 676 #endregion
679 677
680 #region Significant Movement Method 678 #region Significant Movement Method
681 679
682 protected void CheckForSignificantMovement() 680 protected void CheckForSignificantMovement()
683 { 681 {
684 if (libsecondlife.Helpers.VecDist(this.AbsolutePosition, this.posLastSignificantMove) > 2.0) 682 if (Helpers.VecDist(AbsolutePosition, posLastSignificantMove) > 2.0)
685 { 683 {
686 this.posLastSignificantMove = this.AbsolutePosition; 684 posLastSignificantMove = AbsolutePosition;
687 if (OnSignificantClientMovement != null) 685 if (OnSignificantClientMovement != null)
688 { 686 {
689 OnSignificantClientMovement(this.ControllingClient); 687 OnSignificantClientMovement(ControllingClient);
690 NotifyMyCoarseLocationChange(); 688 NotifyMyCoarseLocationChange();
691 } 689 }
692 } 690 }
693 } 691 }
692
694 #endregion 693 #endregion
695 694
696 #region Border Crossing Methods 695 #region Border Crossing Methods
696
697 /// <summary> 697 /// <summary>
698 /// 698 ///
699 /// </summary> 699 /// </summary>
700 protected void CheckForBorderCrossing() 700 protected void CheckForBorderCrossing()
701 { 701 {
702 LLVector3 pos2 = this.AbsolutePosition; 702 LLVector3 pos2 = AbsolutePosition;
703 LLVector3 vel = this.Velocity; 703 LLVector3 vel = Velocity;
704 704
705 float timeStep = 0.1f; 705 float timeStep = 0.1f;
706 pos2.X = pos2.X + (vel.X * timeStep); 706 pos2.X = pos2.X + (vel.X*timeStep);
707 pos2.Y = pos2.Y + (vel.Y * timeStep); 707 pos2.Y = pos2.Y + (vel.Y*timeStep);
708 pos2.Z = pos2.Z + (vel.Z * timeStep); 708 pos2.Z = pos2.Z + (vel.Z*timeStep);
709 709
710 if ((pos2.X < 0) || (pos2.X > 256)) 710 if ((pos2.X < 0) || (pos2.X > 256))
711 { 711 {
712 this.CrossToNewRegion(); 712 CrossToNewRegion();
713 } 713 }
714 714
715 if ((pos2.Y < 0) || (pos2.Y > 256)) 715 if ((pos2.Y < 0) || (pos2.Y > 256))
716 { 716 {
717 this.CrossToNewRegion(); 717 CrossToNewRegion();
718 } 718 }
719 } 719 }
720 720
@@ -723,10 +723,10 @@ namespace OpenSim.Region.Environment.Scenes
723 /// </summary> 723 /// </summary>
724 protected void CrossToNewRegion() 724 protected void CrossToNewRegion()
725 { 725 {
726 LLVector3 pos = this.AbsolutePosition; 726 LLVector3 pos = AbsolutePosition;
727 LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); 727 LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z);
728 uint neighbourx = this.m_regionInfo.RegionLocX; 728 uint neighbourx = m_regionInfo.RegionLocX;
729 uint neighboury = this.m_regionInfo.RegionLocY; 729 uint neighboury = m_regionInfo.RegionLocY;
730 730
731 if (pos.X < 1.7F) 731 if (pos.X < 1.7F)
732 { 732 {
@@ -749,24 +749,28 @@ namespace OpenSim.Region.Environment.Scenes
749 newpos.Y = 0.1F; 749 newpos.Y = 0.1F;
750 } 750 }
751 751
752 LLVector3 vel = this.m_velocity; 752 LLVector3 vel = m_velocity;
753 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); 753 ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256));
754 RegionInfo neighbourRegion = this.m_scene.RequestNeighbouringRegionInfo(neighbourHandle); 754 RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
755 if (neighbourRegion != null) 755 if (neighbourRegion != null)
756 { 756 {
757 bool res = this.m_scene.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos, this._physActor.Flying); 757 bool res =
758 m_scene.InformNeighbourOfCrossing(neighbourHandle, ControllingClient.AgentId, newpos,
759 _physActor.Flying);
758 if (res) 760 if (res)
759 { 761 {
760 //TODO: following line is hard coded to port 9000, really need to change this as soon as possible 762 //TODO: following line is hard coded to port 9000, really need to change this as soon as possible
761 AgentCircuitData circuitdata = this.ControllingClient.RequestClientInfo(); 763 AgentCircuitData circuitdata = ControllingClient.RequestClientInfo();
762 string capsPath = Util.GetCapsURL(this.ControllingClient.AgentId); 764 string capsPath = Util.GetCapsURL(ControllingClient.AgentId);
763 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, capsPath); 765 ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
764 this.MakeChildAgent(); 766 capsPath);
765 this.m_scene.SendKillObject(this.m_localId); 767 MakeChildAgent();
766 this.NotifyMyCoarseLocationChange(); 768 m_scene.SendKillObject(m_localId);
769 NotifyMyCoarseLocationChange();
767 } 770 }
768 } 771 }
769 } 772 }
773
770 #endregion 774 #endregion
771 775
772 /// <summary> 776 /// <summary>
@@ -774,7 +778,6 @@ namespace OpenSim.Region.Environment.Scenes
774 /// </summary> 778 /// </summary>
775 public static void LoadAnims() 779 public static void LoadAnims()
776 { 780 {
777
778 } 781 }
779 782
780 /// <summary> 783 /// <summary>
@@ -783,21 +786,21 @@ namespace OpenSim.Region.Environment.Scenes
783 public override void UpdateMovement() 786 public override void UpdateMovement()
784 { 787 {
785 newForce = false; 788 newForce = false;
786 lock (this.forcesList) 789 lock (forcesList)
787 { 790 {
788 if (this.forcesList.Count > 0) 791 if (forcesList.Count > 0)
789 { 792 {
790 for (int i = 0; i < this.forcesList.Count; i++) 793 for (int i = 0; i < forcesList.Count; i++)
791 { 794 {
792 NewForce force = this.forcesList[i]; 795 NewForce force = forcesList[i];
793 796
794 this.updateflag = true; 797 updateflag = true;
795 this.Velocity = new LLVector3(force.X, force.Y, force.Z); 798 Velocity = new LLVector3(force.X, force.Y, force.Z);
796 this.newForce = true; 799 newForce = true;
797 } 800 }
798 for (int i = 0; i < this.forcesList.Count; i++) 801 for (int i = 0; i < forcesList.Count; i++)
799 { 802 {
800 this.forcesList.RemoveAt(0); 803 forcesList.RemoveAt(0);
801 } 804 }
802 } 805 }
803 } 806 }
@@ -824,7 +827,6 @@ namespace OpenSim.Region.Environment.Scenes
824 827
825 public NewForce() 828 public NewForce()
826 { 829 {
827
828 } 830 }
829 } 831 }
830 832
@@ -833,5 +835,4 @@ namespace OpenSim.Region.Environment.Scenes
833 throw new Exception("The method or operation is not implemented."); 835 throw new Exception("The method or operation is not implemented.");
834 } 836 }
835 } 837 }
836 838} \ No newline at end of file
837}
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
index 7cf9cb7..dbd43be 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
@@ -1,20 +1,18 @@
1using System; 1using Axiom.Math;
2using System.Collections.Generic; 2using libsecondlife;
3using System.Text; 3
4using libsecondlife;
5
6namespace OpenSim.Region.Environment.Scenes.Scripting 4namespace OpenSim.Region.Environment.Scenes.Scripting
7{ 5{
8 public interface IScriptHost 6 public interface IScriptHost
9 { 7 {
10 string Name { get; set;} 8 string Name { get; set; }
11 string SitName{ get; set;} 9 string SitName { get; set; }
12 string TouchName { get; set;} 10 string TouchName { get; set; }
13 string Description { get; set; } 11 string Description { get; set; }
14 LLUUID UUID { get; } 12 LLUUID UUID { get; }
15 LLUUID ObjectOwner { get;} 13 LLUUID ObjectOwner { get; }
16 LLUUID ObjectCreator { get; } 14 LLUUID ObjectCreator { get; }
17 LLVector3 AbsolutePosition { get; } 15 LLVector3 AbsolutePosition { get; }
18 void SetText(string text, Axiom.Math.Vector3 color, double alpha); 16 void SetText(string text, Vector3 color, double alpha);
19 } 17 }
20} 18} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
index 875e4cb..6876cfb 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
@@ -1,14 +1,13 @@
1using System; 1using System;
2using System.Collections.Generic; 2using Axiom.Math;
3using System.Text; 3using libsecondlife;
4using libsecondlife; 4
5
6namespace OpenSim.Region.Environment.Scenes.Scripting 5namespace OpenSim.Region.Environment.Scenes.Scripting
7{ 6{
8 public class NullScriptHost : IScriptHost 7 public class NullScriptHost : IScriptHost
9 { 8 {
10 9 private LLVector3 m_pos = new LLVector3(128, 128, 30);
11 LLVector3 m_pos = new LLVector3( 128, 128, 30 ); 10
12 public string Name 11 public string Name
13 { 12 {
14 get { return "Object"; } 13 get { return "Object"; }
@@ -39,18 +38,23 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
39 } 38 }
40 39
41 public LLUUID ObjectOwner 40 public LLUUID ObjectOwner
42 { get { return LLUUID.Zero; } } 41 {
42 get { return LLUUID.Zero; }
43 }
43 44
44 public LLUUID ObjectCreator { get { return LLUUID.Zero; } } 45 public LLUUID ObjectCreator
46 {
47 get { return LLUUID.Zero; }
48 }
45 49
46 public LLVector3 AbsolutePosition 50 public LLVector3 AbsolutePosition
47 { 51 {
48 get { return m_pos; } 52 get { return m_pos; }
49 } 53 }
50 54
51 public void SetText(string text, Axiom.Math.Vector3 color, double alpha) 55 public void SetText(string text, Vector3 color, double alpha)
52 { 56 {
53 Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); 57 Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text);
54 } 58 }
55 } 59 }
56} 60} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
index 5e8ff87..06bedaf 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
@@ -26,18 +26,16 @@
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using OpenSim.Framework.Console;
30using System.Collections.Generic; 30
31using System.Text; 31//TODO: WHERE TO PLACE THIS?
32using OpenSim.Region.Environment.Scenes.Scripting; 32
33
34//TODO: WHERE TO PLACE THIS?
35namespace OpenSim.Region.Environment.Scenes.Scripting 33namespace OpenSim.Region.Environment.Scenes.Scripting
36{ 34{
37 public interface ScriptEngineInterface 35 public interface ScriptEngineInterface
38 { 36 {
39 void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger); 37 void InitializeEngine(Scene Sceneworld, LogBase logger);
40 void Shutdown(); 38 void Shutdown();
41// void StartScript(string ScriptID, IScriptHost ObjectID); 39// void StartScript(string ScriptID, IScriptHost ObjectID);
42 } 40 }
43} 41} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
index 83bd0ab..5355388 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
@@ -26,18 +26,18 @@
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic; 30using System.IO;
31using System.IO; 31using System.Reflection;
32using System.Text; 32using OpenSim.Framework.Console;
33using System.Reflection; 33
34
35namespace OpenSim.Region.Environment.Scenes.Scripting 34namespace OpenSim.Region.Environment.Scenes.Scripting
36{ 35{
37 public class ScriptEngineLoader 36 public class ScriptEngineLoader
38 { 37 {
39 private OpenSim.Framework.Console.LogBase m_log; 38 private LogBase m_log;
40 public ScriptEngineLoader(OpenSim.Framework.Console.LogBase logger) 39
40 public ScriptEngineLoader(LogBase logger)
41 { 41 {
42 m_log = logger; 42 m_log = logger;
43 } 43 }
@@ -47,12 +47,16 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
47 ScriptEngineInterface ret = null; 47 ScriptEngineInterface ret = null;
48 try 48 try
49 { 49 {
50 ret = LoadAndInitAssembly(Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"), 50 ret =
51 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine"); 51 LoadAndInitAssembly(
52 Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
53 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
52 } 54 }
53 catch (Exception e) 55 catch (Exception e)
54 { 56 {
55 m_log.Error("ScriptEngine", "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString()); 57 m_log.Error("ScriptEngine",
58 "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
59 e.StackTrace.ToString());
56 } 60 }
57 return ret; 61 return ret;
58 } 62 }
@@ -107,18 +111,14 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
107 ScriptEngineInterface ret; 111 ScriptEngineInterface ret;
108 //try 112 //try
109 //{ 113 //{
110 ret = (ScriptEngineInterface)Activator.CreateInstance(t); 114 ret = (ScriptEngineInterface) Activator.CreateInstance(t);
111 //} 115 //}
112 //catch (Exception e) 116 //catch (Exception e)
113 //{ 117 //{
114 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); 118 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
115 //} 119 //}
116 120
117 return ret; 121 return ret;
118 122 }
119
120 }
121
122
123 } 123 }
124} 124} \ No newline at end of file