aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorlbsa712007-07-17 17:47:23 +0000
committerlbsa712007-07-17 17:47:23 +0000
commitd95918f2288967de3937ec7aa648a5303eba4027 (patch)
tree7eeb692e0939d566da2e246a7077b8fcc68ec1b3 /OpenSim/Region/Environment/Scenes
parent* Added "backup" console command for sdague (diff)
downloadopensim-SC_OLD-d95918f2288967de3937ec7aa648a5303eba4027.zip
opensim-SC_OLD-d95918f2288967de3937ec7aa648a5303eba4027.tar.gz
opensim-SC_OLD-d95918f2288967de3937ec7aa648a5303eba4027.tar.bz2
opensim-SC_OLD-d95918f2288967de3937ec7aa648a5303eba4027.tar.xz
* Changed SimpleApp to use EventManager and Scene timer
* Refactored a lot of m_* and public -> wrappers
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs447
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs326
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs8
5 files changed, 425 insertions, 386 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 04cf595..fc75bdc 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -6,9 +6,9 @@ namespace OpenSim.Region.Environment.Scenes
6{ 6{
7 public abstract class EntityBase 7 public abstract class EntityBase
8 { 8 {
9 public LLUUID uuid; 9 public LLUUID m_uuid;
10 10
11 protected List<EntityBase> children; 11 protected List<EntityBase> m_children;
12 12
13 protected Scene m_world; 13 protected Scene m_world;
14 protected string m_name; 14 protected string m_name;
@@ -82,13 +82,13 @@ namespace OpenSim.Region.Environment.Scenes
82 /// </summary> 82 /// </summary>
83 public EntityBase() 83 public EntityBase()
84 { 84 {
85 uuid = new LLUUID(); 85 m_uuid = new LLUUID();
86 86
87 m_pos = new LLVector3(); 87 m_pos = new LLVector3();
88 m_velocity = new LLVector3(); 88 m_velocity = new LLVector3();
89 Rotation = new Quaternion(); 89 Rotation = new Quaternion();
90 m_name = "(basic entity)"; 90 m_name = "(basic entity)";
91 children = new List<EntityBase>(); 91 m_children = new List<EntityBase>();
92 } 92 }
93 93
94 /// <summary> 94 /// <summary>
@@ -96,7 +96,7 @@ namespace OpenSim.Region.Environment.Scenes
96 /// </summary> 96 /// </summary>
97 public virtual void updateMovement() 97 public virtual void updateMovement()
98 { 98 {
99 foreach (EntityBase child in children) 99 foreach (EntityBase child in m_children)
100 { 100 {
101 child.updateMovement(); 101 child.updateMovement();
102 } 102 }
@@ -105,12 +105,12 @@ namespace OpenSim.Region.Environment.Scenes
105 /// <summary> 105 /// <summary>
106 /// Performs any updates that need to be done at each frame. This function is overridable from it's children. 106 /// Performs any updates that need to be done at each frame. This function is overridable from it's children.
107 /// </summary> 107 /// </summary>
108 public virtual void update() 108 public virtual void Update()
109 { 109 {
110 // Do any per-frame updates needed that are applicable to every type of entity 110 // Do any per-frame updates needed that are applicable to every type of entity
111 foreach (EntityBase child in children) 111 foreach (EntityBase child in m_children)
112 { 112 {
113 child.update(); 113 child.Update();
114 } 114 }
115 } 115 }
116 116
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index b413758..5b6b13d 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -15,19 +15,15 @@ namespace OpenSim.Region.Environment.Scenes
15 { 15 {
16 private const uint FULL_MASK_PERMISSIONS = 2147483647; 16 private const uint FULL_MASK_PERMISSIONS = 2147483647;
17 17
18 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); 18 private LLVector3 m_positionLastFrame = new LLVector3(0, 0, 0);
19 private ulong m_regionHandle; 19 private ulong m_regionHandle;
20 private byte updateFlag = 0; 20 private byte m_updateFlag;
21 private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; 21 private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
22 22
23 private Dictionary<LLUUID, InventoryItem> inventoryItems; 23 private Dictionary<LLUUID, InventoryItem> m_inventoryItems;
24 24
25 private string m_description = ""; 25 private string m_description = "";
26 26
27 public string SitName = "";
28 public string TouchName = "";
29 public string Text = "";
30
31 public LLUUID CreatorID; 27 public LLUUID CreatorID;
32 public LLUUID OwnerID; 28 public LLUUID OwnerID;
33 public LLUUID LastOwnerID; 29 public LLUUID LastOwnerID;
@@ -52,22 +48,23 @@ namespace OpenSim.Region.Environment.Scenes
52 public event PrimCountTaintedDelegate OnPrimCountTainted; 48 public event PrimCountTaintedDelegate OnPrimCountTainted;
53 49
54 #region Properties 50 #region Properties
51
55 /// <summary> 52 /// <summary>
56 /// If rootprim, will return world position 53 /// If rootprim, will return world position
57 /// otherwise will return local offset from rootprim 54 /// otherwise will return local offset from rootprim
58 /// </summary> 55 /// </summary>
59 public override LLVector3 Pos 56 public override LLVector3 Pos
60 { 57 {
61 get 58 get
62 { 59 {
63 if (m_isRootPrim) 60 if (m_isRootPrim)
64 { 61 {
65 //if we are rootprim then our offset should be zero 62 //if we are rootprim then our offset should be zero
66 return this.m_pos + m_Parent.Pos; 63 return m_pos + m_Parent.Pos;
67 } 64 }
68 else 65 else
69 { 66 {
70 return this.m_pos; 67 return m_pos;
71 } 68 }
72 } 69 }
73 set 70 set
@@ -76,63 +73,72 @@ namespace OpenSim.Region.Environment.Scenes
76 { 73 {
77 m_Parent.Pos = value; 74 m_Parent.Pos = value;
78 } 75 }
79 this.m_pos = value - m_Parent.Pos; 76 m_pos = value - m_Parent.Pos;
80 } 77 }
81
82 } 78 }
83 79
84 public PrimitiveBaseShape Shape 80 public PrimitiveBaseShape Shape
85 { 81 {
86 get 82 get { return m_Shape; }
87 {
88 return this.m_Shape;
89 }
90 } 83 }
91 84
92 public LLVector3 WorldPos 85 public LLVector3 WorldPos
93 { 86 {
94 get 87 get
95 { 88 {
96 if (!this.m_isRootPrim) 89 if (!m_isRootPrim)
97 { 90 {
98 Primitive parentPrim = (Primitive)this.m_Parent; 91 Primitive parentPrim = (Primitive)m_Parent;
99 Axiom.Math.Vector3 offsetPos = new Vector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z); 92 Vector3 offsetPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
100 offsetPos = parentPrim.Rotation * offsetPos; 93 offsetPos = parentPrim.Rotation * offsetPos;
101 return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z); 94 return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z);
102 } 95 }
103 else 96 else
104 { 97 {
105 return this.Pos; 98 return Pos;
106 } 99 }
107 } 100 }
108 } 101 }
109 102
110 public string Description 103 public string Description
111 { 104 {
112 get 105 get { return m_description; }
113 { 106 set { m_description = value; }
114 return this.m_description;
115 }
116 set
117 {
118 this.m_description = value;
119 }
120 } 107 }
121 108
122 public LLVector3 Scale 109 public LLVector3 Scale
123 { 110 {
111 set { m_Shape.Scale = value; }
112 get { return m_Shape.Scale; }
113 }
114
115 private string m_sitName = "";
116 public string SitName
117 {
118 get { return m_sitName; }
119 }
120
121 private string m_touchName = "";
122 public string TouchName
123 {
124 get { return m_touchName; }
125 }
126
127 private string m_text = "";
128 public string Text
129 {
130 get { return m_text; }
124 set 131 set
125 { 132 {
126 this.m_Shape.Scale = value; 133 m_text = value;
127 } 134 ScheduleFullUpdate();
128 get
129 {
130 return this.m_Shape.Scale;
131 } 135 }
132 } 136 }
137
133 #endregion 138 #endregion
134 139
135 #region Constructors 140 #region Constructors
141
136 /// <summary> 142 /// <summary>
137 /// 143 ///
138 /// </summary> 144 /// </summary>
@@ -144,21 +150,23 @@ namespace OpenSim.Region.Environment.Scenes
144 /// <param name="isRoot"></param> 150 /// <param name="isRoot"></param>
145 /// <param name="parent"></param> 151 /// <param name="parent"></param>
146 /// <param name="rootObject"></param> 152 /// <param name="rootObject"></param>
147 public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos) 153 public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent,
154 SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
148 { 155 {
149
150 m_regionHandle = regionHandle; 156 m_regionHandle = regionHandle;
151 m_world = world; 157 m_world = world;
152 inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 158 m_inventoryItems = new Dictionary<LLUUID, InventoryItem>();
153 this.m_Parent = parent; 159 m_Parent = parent;
154 this.m_isRootPrim = isRoot; 160 m_isRootPrim = isRoot;
155 this.m_RootParent = rootObject; 161 m_RootParent = rootObject;
156 this.CreateFromShape(ownerID, localID, pos, shape); 162 ClearUpdateSchedule();
157 this.Rotation = Axiom.Math.Quaternion.Identity; 163 CreateFromShape(ownerID, localID, pos, shape);
164
165 Rotation = Quaternion.Identity;
158 166
159 m_world.AcknowledgeNewPrim(this); 167 m_world.AcknowledgeNewPrim(this);
160 168
161 this.OnPrimCountTainted(); 169 OnPrimCountTainted();
162 } 170 }
163 171
164 /// <summary> 172 /// <summary>
@@ -167,7 +175,6 @@ namespace OpenSim.Region.Environment.Scenes
167 /// <remarks>Empty constructor for duplication</remarks> 175 /// <remarks>Empty constructor for duplication</remarks>
168 public Primitive() 176 public Primitive()
169 { 177 {
170
171 } 178 }
172 179
173 #endregion 180 #endregion
@@ -176,33 +183,34 @@ namespace OpenSim.Region.Environment.Scenes
176 183
177 ~Primitive() 184 ~Primitive()
178 { 185 {
179 this.OnPrimCountTainted(); 186 OnPrimCountTainted();
180 } 187 }
188
181 #endregion 189 #endregion
182 190
183 #region Duplication 191 #region Duplication
184 192
185 public Primitive Copy(EntityBase parent, SceneObject rootParent) 193 public Primitive Copy(EntityBase parent, SceneObject rootParent)
186 { 194 {
187 Primitive dupe = (Primitive)this.MemberwiseClone(); 195 Primitive dupe = (Primitive)MemberwiseClone();
188 196
189 dupe.m_Parent = parent; 197 dupe.m_Parent = parent;
190 dupe.m_RootParent = rootParent; 198 dupe.m_RootParent = rootParent;
191 199
192 // TODO: Copy this properly. 200 // TODO: Copy this properly.
193 dupe.inventoryItems = this.inventoryItems; 201 dupe.m_inventoryItems = m_inventoryItems;
194 dupe.children = new List<EntityBase>(); 202 dupe.m_children = new List<EntityBase>();
195 dupe.m_Shape = this.m_Shape.Copy(); 203 dupe.m_Shape = m_Shape.Copy();
196 dupe.m_regionHandle = this.m_regionHandle; 204 dupe.m_regionHandle = m_regionHandle;
197 dupe.m_world = this.m_world; 205 dupe.m_world = m_world;
198 206
199 uint newLocalID = this.m_world.PrimIDAllocate(); 207 uint newLocalID = m_world.PrimIDAllocate();
200 dupe.uuid = LLUUID.Random(); 208 dupe.m_uuid = LLUUID.Random();
201 dupe.LocalId = newLocalID; 209 dupe.LocalId = newLocalID;
202 210
203 if (parent is SceneObject) 211 if (parent is SceneObject)
204 { 212 {
205 dupe.m_isRootPrim = true; 213 dupe.m_isRootPrim = true;
206 dupe.ParentID = 0; 214 dupe.ParentID = 0;
207 } 215 }
208 else 216 else
@@ -211,18 +219,18 @@ namespace OpenSim.Region.Environment.Scenes
211 dupe.ParentID = ((Primitive)parent).LocalId; 219 dupe.ParentID = ((Primitive)parent).LocalId;
212 } 220 }
213 221
214 dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z); 222 dupe.Scale = new LLVector3(Scale.X, Scale.Y, Scale.Z);
215 dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 223 dupe.Rotation = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
216 dupe.m_pos = new LLVector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z); 224 dupe.m_pos = new LLVector3(m_pos.X, m_pos.Y, m_pos.Z);
217 225
218 rootParent.AddChildToList(dupe); 226 rootParent.AddChildToList(dupe);
219 this.m_world.AcknowledgeNewPrim(dupe); 227 m_world.AcknowledgeNewPrim(dupe);
220 dupe.TriggerOnPrimCountTainted(); 228 dupe.TriggerOnPrimCountTainted();
221 229
222 foreach (Primitive prim in this.children) 230 foreach (Primitive prim in m_children)
223 { 231 {
224 Primitive primClone = prim.Copy(dupe, rootParent); 232 Primitive primClone = prim.Copy(dupe, rootParent);
225 dupe.children.Add(primClone); 233 dupe.m_children.Add(primClone);
226 } 234 }
227 235
228 return dupe; 236 return dupe;
@@ -231,30 +239,41 @@ namespace OpenSim.Region.Environment.Scenes
231 #endregion 239 #endregion
232 240
233 #region Override from EntityBase 241 #region Override from EntityBase
242
234 /// <summary> 243 /// <summary>
235 /// 244 ///
236 /// </summary> 245 /// </summary>
237 public override void update() 246 public override void Update()
238 { 247 {
239 if (this.updateFlag == 1) // is a new prim just been created/reloaded or has major changes 248 if (m_updateFlag == 1) //some change has been made so update the clients
240 { 249 {
241 this.SendFullUpdateToAllClients(); 250 SendTerseUpdateToALLClients();
242 this.updateFlag = 0; 251 ClearUpdateSchedule();
243 } 252 }
244 if (this.updateFlag == 2) //some change has been made so update the clients 253 else
245 { 254 {
246 this.SendTerseUpdateToALLClients(); 255 if (m_updateFlag == 2) // is a new prim just been created/reloaded or has major changes
247 this.updateFlag = 0; 256 {
257 SendFullUpdateToAllClients();
258 ClearUpdateSchedule();
259 }
248 } 260 }
249 261
250 foreach (EntityBase child in children) 262 foreach (EntityBase child in m_children)
251 { 263 {
252 child.update(); 264 child.Update();
253 } 265 }
254 } 266 }
267
268 private void ClearUpdateSchedule()
269 {
270 m_updateFlag = 0;
271 }
272
255 #endregion 273 #endregion
256 274
257 #region Setup 275 #region Setup
276
258 /// <summary> 277 /// <summary>
259 /// 278 ///
260 /// </summary> 279 /// </summary>
@@ -263,21 +282,36 @@ namespace OpenSim.Region.Environment.Scenes
263 /// <param name="localID"></param> 282 /// <param name="localID"></param>
264 public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 283 public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
265 { 284 {
266 this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 285 CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
267 this.OwnerID = ownerID; 286 OwnerID = ownerID;
268 this.CreatorID = this.OwnerID; 287 CreatorID = OwnerID;
269 this.LastOwnerID = LLUUID.Zero; 288 LastOwnerID = LLUUID.Zero;
270 this.Pos = pos; 289 Pos = pos;
271 this.uuid = LLUUID.Random(); 290 m_uuid = LLUUID.Random();
272 this.m_localId = (uint)(localID); 291 m_localId = (uint)(localID);
292
293 m_Shape = shape;
294
295 ScheduleFullUpdate();
296 }
297
298 private void ScheduleFullUpdate()
299 {
300 m_updateFlag = 2;
301 }
273 302
274 this.m_Shape = shape; 303 private void ScheduleTerseUpdate()
275 this.updateFlag = 1; 304 {
305 if (m_updateFlag < 1)
306 {
307 m_updateFlag = 1;
308 }
276 } 309 }
277 310
278 #endregion 311 #endregion
279 312
280 #region Linking / unlinking 313 #region Linking / unlinking
314
281 /// <summary> 315 /// <summary>
282 /// 316 ///
283 /// </summary> 317 /// </summary>
@@ -286,13 +320,13 @@ namespace OpenSim.Region.Environment.Scenes
286 { 320 {
287 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")"); 321 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")");
288 //TODO check permissions 322 //TODO check permissions
289 this.children.Add(linkObject.rootPrimitive); 323 m_children.Add(linkObject.rootPrimitive);
290 linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent); 324 linkObject.rootPrimitive.SetNewParent(this, m_RootParent);
291 325
292 this.m_world.DeleteEntity(linkObject.rootUUID); 326 m_world.DeleteEntity(linkObject.rootUUID);
293 linkObject.DeleteAllChildren(); 327 linkObject.DeleteAllChildren();
294 328
295 this.OnPrimCountTainted(); 329 OnPrimCountTainted();
296 } 330 }
297 331
298 /// <summary> 332 /// <summary>
@@ -302,59 +336,58 @@ namespace OpenSim.Region.Environment.Scenes
302 /// <param name="rootParent"></param> 336 /// <param name="rootParent"></param>
303 public void SetNewParent(Primitive newParent, SceneObject rootParent) 337 public void SetNewParent(Primitive newParent, SceneObject rootParent)
304 { 338 {
305 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); 339 LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z);
306 this.m_isRootPrim = false; 340 m_isRootPrim = false;
307 this.m_Parent = newParent; 341 m_Parent = newParent;
308 this.ParentID = newParent.LocalId; 342 ParentID = newParent.LocalId;
309 this.m_RootParent = rootParent; 343 m_RootParent = rootParent;
310 this.m_RootParent.AddChildToList(this); 344 m_RootParent.AddChildToList(this);
311 this.Pos = oldPos; 345 Pos = oldPos;
312 Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); 346 Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
313 axPos = this.m_Parent.Rotation.Inverse() * axPos; 347 axPos = m_Parent.Rotation.Inverse() * axPos;
314 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); 348 m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
315 Axiom.Math.Quaternion oldRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 349 Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
316 this.Rotation = this.m_Parent.Rotation.Inverse() * this.Rotation; 350 Rotation = m_Parent.Rotation.Inverse() * Rotation;
317 this.updateFlag = 1; 351 ScheduleFullUpdate();
318 352
319 foreach (Primitive child in children) 353 foreach (Primitive child in m_children)
320 { 354 {
321 child.SetRootParent(rootParent, newParent, oldPos, oldRot); 355 child.SetRootParent(rootParent, newParent, oldPos, oldRot);
322 } 356 }
323 children.Clear(); 357 m_children.Clear();
324
325
326 } 358 }
327 359
328 /// <summary> 360 /// <summary>
329 /// 361 ///
330 /// </summary> 362 /// </summary>
331 /// <param name="newRoot"></param> 363 /// <param name="newRoot"></param>
332 public void SetRootParent(SceneObject newRoot , Primitive newParent, LLVector3 oldParentPosition, Axiom.Math.Quaternion oldParentRotation) 364 public void SetRootParent(SceneObject newRoot, Primitive newParent, LLVector3 oldParentPosition,
365 Quaternion oldParentRotation)
333 { 366 {
334 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); 367 LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z);
335 Axiom.Math.Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z); 368 Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z);
336 axOldPos = oldParentRotation * axOldPos; 369 axOldPos = oldParentRotation * axOldPos;
337 oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z); 370 oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z);
338 oldPos += oldParentPosition; 371 oldPos += oldParentPosition;
339 Axiom.Math.Quaternion oldRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 372 Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
340 this.m_isRootPrim = false; 373 m_isRootPrim = false;
341 this.m_Parent = newParent; 374 m_Parent = newParent;
342 this.ParentID = newParent.LocalId; 375 ParentID = newParent.LocalId;
343 newParent.AddToChildrenList(this); 376 newParent.AddToChildrenList(this);
344 this.m_RootParent = newRoot; 377 m_RootParent = newRoot;
345 this.m_RootParent.AddChildToList(this); 378 m_RootParent.AddChildToList(this);
346 this.Pos = oldPos; 379 Pos = oldPos;
347 Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); 380 Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
348 axPos = this.m_Parent.Rotation.Inverse() * axPos; 381 axPos = m_Parent.Rotation.Inverse() * axPos;
349 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); 382 m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
350 this.Rotation = oldParentRotation * this.Rotation; 383 Rotation = oldParentRotation * Rotation;
351 this.Rotation = this.m_Parent.Rotation.Inverse()* this.Rotation ; 384 Rotation = m_Parent.Rotation.Inverse() * Rotation;
352 this.updateFlag = 1; 385 ScheduleFullUpdate();
353 foreach (Primitive child in children) 386 foreach (Primitive child in m_children)
354 { 387 {
355 child.SetRootParent(newRoot, newParent, oldPos, oldRot); 388 child.SetRootParent(newRoot, newParent, oldPos, oldRot);
356 } 389 }
357 children.Clear(); 390 m_children.Clear();
358 } 391 }
359 392
360 /// <summary> 393 /// <summary>
@@ -363,12 +396,12 @@ namespace OpenSim.Region.Environment.Scenes
363 /// <param name="offset"></param> 396 /// <param name="offset"></param>
364 public void AddOffsetToChildren(LLVector3 offset) 397 public void AddOffsetToChildren(LLVector3 offset)
365 { 398 {
366 foreach (Primitive prim in this.children) 399 foreach (Primitive prim in m_children)
367 { 400 {
368 prim.m_pos += offset; 401 prim.m_pos += offset;
369 prim.updateFlag = 2; 402 prim.ScheduleTerseUpdate();
370 } 403 }
371 this.OnPrimCountTainted(); 404 OnPrimCountTainted();
372 } 405 }
373 406
374 /// <summary> 407 /// <summary>
@@ -377,38 +410,42 @@ namespace OpenSim.Region.Environment.Scenes
377 /// <param name="prim"></param> 410 /// <param name="prim"></param>
378 public void AddToChildrenList(Primitive prim) 411 public void AddToChildrenList(Primitive prim)
379 { 412 {
380 this.children.Add(prim); 413 m_children.Add(prim);
381 } 414 }
415
382 #endregion 416 #endregion
383 417
384 #region Resizing/Scale 418 #region Resizing/Scale
419
385 /// <summary> 420 /// <summary>
386 /// 421 ///
387 /// </summary> 422 /// </summary>
388 /// <param name="scale"></param> 423 /// <param name="scale"></param>
389 public void ResizeGoup(LLVector3 scale) 424 public void ResizeGoup(LLVector3 scale)
390 { 425 {
391 LLVector3 offset = (scale - this.m_Shape.Scale); 426 LLVector3 offset = (scale - m_Shape.Scale);
392 offset.X /= 2; 427 offset.X /= 2;
393 offset.Y /= 2; 428 offset.Y /= 2;
394 offset.Z /= 2; 429 offset.Z /= 2;
395 if (this.m_isRootPrim) 430 if (m_isRootPrim)
396 { 431 {
397 this.m_Parent.Pos += offset; 432 m_Parent.Pos += offset;
398 } 433 }
399 else 434 else
400 { 435 {
401 this.m_pos += offset; 436 m_pos += offset;
402 } 437 }
403 438
404 this.AddOffsetToChildren(new LLVector3(-offset.X, -offset.Y, -offset.Z)); 439 AddOffsetToChildren(new LLVector3(-offset.X, -offset.Y, -offset.Z));
405 this.m_Shape.Scale = scale; 440 m_Shape.Scale = scale;
406 441
407 this.updateFlag = 1; 442 ScheduleFullUpdate();
408 } 443 }
444
409 #endregion 445 #endregion
410 446
411 #region Position 447 #region Position
448
412 /// <summary> 449 /// <summary>
413 /// 450 ///
414 /// </summary> 451 /// </summary>
@@ -417,10 +454,10 @@ namespace OpenSim.Region.Environment.Scenes
417 { 454 {
418 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 455 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
419 456
420 this.Pos = newPos; 457 Pos = newPos;
421 this.updateFlag = 2; 458 ScheduleTerseUpdate();
422 459
423 this.OnPrimCountTainted(); 460 OnPrimCountTainted();
424 } 461 }
425 462
426 /// <summary> 463 /// <summary>
@@ -429,48 +466,46 @@ namespace OpenSim.Region.Environment.Scenes
429 /// <param name="pos"></param> 466 /// <param name="pos"></param>
430 public void UpdateSinglePosition(LLVector3 pos) 467 public void UpdateSinglePosition(LLVector3 pos)
431 { 468 {
432 // Console.WriteLine("updating single prim position"); 469 // Console.WriteLine("updating single prim position");
433 if (this.m_isRootPrim) 470 if (m_isRootPrim)
434 { 471 {
435 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 472 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
436 LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); 473 LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z);
437 LLVector3 diff = oldPos - newPos; 474 LLVector3 diff = oldPos - newPos;
438 Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); 475 Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
439 axDiff = this.Rotation.Inverse() * axDiff; 476 axDiff = Rotation.Inverse() * axDiff;
440 diff.X = axDiff.x; 477 diff.X = axDiff.x;
441 diff.Y = axDiff.y; 478 diff.Y = axDiff.y;
442 diff.Z = axDiff.z; 479 diff.Z = axDiff.z;
443 this.Pos = newPos; 480 Pos = newPos;
444 481
445 foreach (Primitive prim in this.children) 482 foreach (Primitive prim in m_children)
446 { 483 {
447 prim.m_pos += diff; 484 prim.m_pos += diff;
448 prim.updateFlag = 2; 485 prim.ScheduleTerseUpdate();
449 } 486 }
450 this.updateFlag = 2; 487 ScheduleTerseUpdate();
451 } 488 }
452 else 489 else
453 { 490 {
454 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 491 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
455 this.m_pos = newPos; 492 m_pos = newPos;
456 this.updateFlag = 2; 493 ScheduleTerseUpdate();
457 } 494 }
458
459
460 } 495 }
461 496
462 #endregion 497 #endregion
463 498
464 #region Rotation 499 #region Rotation
500
465 /// <summary> 501 /// <summary>
466 /// 502 ///
467 /// </summary> 503 /// </summary>
468 /// <param name="rot"></param> 504 /// <param name="rot"></param>
469 public void UpdateGroupRotation(LLQuaternion rot) 505 public void UpdateGroupRotation(LLQuaternion rot)
470 { 506 {
471 this.Rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); 507 Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
472 this.updateFlag = 2; 508 ScheduleTerseUpdate();
473
474 } 509 }
475 510
476 /// <summary> 511 /// <summary>
@@ -480,9 +515,9 @@ namespace OpenSim.Region.Environment.Scenes
480 /// <param name="rot"></param> 515 /// <param name="rot"></param>
481 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) 516 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot)
482 { 517 {
483 this.Rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); 518 Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
484 this.Pos = pos; 519 Pos = pos;
485 this.updateFlag = 2; 520 ScheduleTerseUpdate();
486 } 521 }
487 522
488 /// <summary> 523 /// <summary>
@@ -492,62 +527,67 @@ namespace OpenSim.Region.Environment.Scenes
492 public void UpdateSingleRotation(LLQuaternion rot) 527 public void UpdateSingleRotation(LLQuaternion rot)
493 { 528 {
494 //Console.WriteLine("updating single prim rotation"); 529 //Console.WriteLine("updating single prim rotation");
495 Axiom.Math.Quaternion axRot = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); 530 Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
496 Axiom.Math.Quaternion oldParentRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 531 Quaternion oldParentRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
497 this.Rotation = axRot; 532 Rotation = axRot;
498 foreach (Primitive prim in this.children) 533 foreach (Primitive prim in m_children)
499 { 534 {
500 Axiom.Math.Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z); 535 Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z);
501 axPos = oldParentRot * axPos; 536 axPos = oldParentRot * axPos;
502 axPos = axRot.Inverse() * axPos; 537 axPos = axRot.Inverse() * axPos;
503 prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); 538 prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
504 prim.Rotation = oldParentRot * prim.Rotation ; 539 prim.Rotation = oldParentRot * prim.Rotation;
505 prim.Rotation = axRot.Inverse()* prim.Rotation; 540 prim.Rotation = axRot.Inverse() * prim.Rotation;
506 prim.updateFlag = 2; 541 prim.ScheduleTerseUpdate();
507 } 542 }
508 this.updateFlag = 2; 543 ScheduleTerseUpdate();
509 } 544 }
545
510 #endregion 546 #endregion
511 547
512 #region Shape 548 #region Shape
549
513 /// <summary> 550 /// <summary>
514 /// 551 ///
515 /// </summary> 552 /// </summary>
516 /// <param name="shapeBlock"></param> 553 /// <param name="shapeBlock"></param>
517 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) 554 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
518 { 555 {
519 this.m_Shape.PathBegin = shapeBlock.PathBegin; 556 m_Shape.PathBegin = shapeBlock.PathBegin;
520 this.m_Shape.PathEnd = shapeBlock.PathEnd; 557 m_Shape.PathEnd = shapeBlock.PathEnd;
521 this.m_Shape.PathScaleX = shapeBlock.PathScaleX; 558 m_Shape.PathScaleX = shapeBlock.PathScaleX;
522 this.m_Shape.PathScaleY = shapeBlock.PathScaleY; 559 m_Shape.PathScaleY = shapeBlock.PathScaleY;
523 this.m_Shape.PathShearX = shapeBlock.PathShearX; 560 m_Shape.PathShearX = shapeBlock.PathShearX;
524 this.m_Shape.PathShearY = shapeBlock.PathShearY; 561 m_Shape.PathShearY = shapeBlock.PathShearY;
525 this.m_Shape.PathSkew = shapeBlock.PathSkew; 562 m_Shape.PathSkew = shapeBlock.PathSkew;
526 this.m_Shape.ProfileBegin = shapeBlock.ProfileBegin; 563 m_Shape.ProfileBegin = shapeBlock.ProfileBegin;
527 this.m_Shape.ProfileEnd = shapeBlock.ProfileEnd; 564 m_Shape.ProfileEnd = shapeBlock.ProfileEnd;
528 this.m_Shape.PathCurve = shapeBlock.PathCurve; 565 m_Shape.PathCurve = shapeBlock.PathCurve;
529 this.m_Shape.ProfileCurve = shapeBlock.ProfileCurve; 566 m_Shape.ProfileCurve = shapeBlock.ProfileCurve;
530 this.m_Shape.ProfileHollow = shapeBlock.ProfileHollow; 567 m_Shape.ProfileHollow = shapeBlock.ProfileHollow;
531 this.m_Shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; 568 m_Shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
532 this.m_Shape.PathRevolutions = shapeBlock.PathRevolutions; 569 m_Shape.PathRevolutions = shapeBlock.PathRevolutions;
533 this.m_Shape.PathTaperX = shapeBlock.PathTaperX; 570 m_Shape.PathTaperX = shapeBlock.PathTaperX;
534 this.m_Shape.PathTaperY = shapeBlock.PathTaperY; 571 m_Shape.PathTaperY = shapeBlock.PathTaperY;
535 this.m_Shape.PathTwist = shapeBlock.PathTwist; 572 m_Shape.PathTwist = shapeBlock.PathTwist;
536 this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin; 573 m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin;
537 this.updateFlag = 1; 574 ScheduleFullUpdate();
538 } 575 }
576
539 #endregion 577 #endregion
540 578
541 #region Texture 579 #region Texture
580
542 /// <summary> 581 /// <summary>
543 /// 582 ///
544 /// </summary> 583 /// </summary>
545 /// <param name="textureEntry"></param> 584 /// <param name="textureEntry"></param>
546 public void UpdateTextureEntry(byte[] textureEntry) 585 public void UpdateTextureEntry(byte[] textureEntry)
547 { 586 {
548 this.m_Shape.TextureEntry = textureEntry; 587 m_Shape.TextureEntry = textureEntry;
549 this.updateFlag = 1; 588 ScheduleFullUpdate();
550 } 589 }
590
551 #endregion 591 #endregion
552 592
553 #region Client Update Methods 593 #region Client Update Methods
@@ -558,12 +598,12 @@ namespace OpenSim.Region.Environment.Scenes
558 /// <param name="remoteClient"></param> 598 /// <param name="remoteClient"></param>
559 public void SendFullUpdateForAllChildren(IClientAPI remoteClient) 599 public void SendFullUpdateForAllChildren(IClientAPI remoteClient)
560 { 600 {
561 this.SendFullUpdateToClient(remoteClient); 601 SendFullUpdateToClient(remoteClient);
562 for (int i = 0; i < this.children.Count; i++) 602 for (int i = 0; i < m_children.Count; i++)
563 { 603 {
564 if (this.children[i] is Primitive) 604 if (m_children[i] is Primitive)
565 { 605 {
566 ((Primitive)this.children[i]).SendFullUpdateForAllChildren(remoteClient); 606 ((Primitive)m_children[i]).SendFullUpdateForAllChildren(remoteClient);
567 } 607 }
568 } 608 }
569 } 609 }
@@ -575,11 +615,12 @@ namespace OpenSim.Region.Environment.Scenes
575 public void SendFullUpdateToClient(IClientAPI remoteClient) 615 public void SendFullUpdateToClient(IClientAPI remoteClient)
576 { 616 {
577 LLVector3 lPos; 617 LLVector3 lPos;
578 lPos = this.Pos; 618 lPos = Pos;
579 LLQuaternion lRot; 619 LLQuaternion lRot;
580 lRot = new LLQuaternion(this.Rotation.x, this.Rotation.y, this.Rotation.z, this.Rotation.w); 620 lRot = new LLQuaternion(Rotation.x, Rotation.y, Rotation.z, Rotation.w);
581 621
582 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, lRot, this.m_flags, this.uuid, this.OwnerID, this.Text, this.ParentID); 622 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalId, m_Shape, lPos, lRot, m_flags, m_uuid,
623 OwnerID, m_text, ParentID);
583 } 624 }
584 625
585 /// <summary> 626 /// <summary>
@@ -587,10 +628,10 @@ namespace OpenSim.Region.Environment.Scenes
587 /// </summary> 628 /// </summary>
588 public void SendFullUpdateToAllClients() 629 public void SendFullUpdateToAllClients()
589 { 630 {
590 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 631 List<ScenePresence> avatars = m_world.RequestAvatarList();
591 for (int i = 0; i < avatars.Count; i++) 632 for (int i = 0; i < avatars.Count; i++)
592 { 633 {
593 this.SendFullUpdateToClient(avatars[i].ControllingClient); 634 SendFullUpdateToClient(avatars[i].ControllingClient);
594 } 635 }
595 } 636 }
596 637
@@ -600,12 +641,12 @@ namespace OpenSim.Region.Environment.Scenes
600 /// <param name="remoteClient"></param> 641 /// <param name="remoteClient"></param>
601 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient) 642 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient)
602 { 643 {
603 this.SendTerseUpdateToClient(remoteClient); 644 SendTerseUpdateToClient(remoteClient);
604 for (int i = 0; i < this.children.Count; i++) 645 for (int i = 0; i < m_children.Count; i++)
605 { 646 {
606 if (this.children[i] is Primitive) 647 if (m_children[i] is Primitive)
607 { 648 {
608 ((Primitive)this.children[i]).SendTerseUpdateForAllChildren(remoteClient); 649 ((Primitive)m_children[i]).SendTerseUpdateForAllChildren(remoteClient);
609 } 650 }
610 } 651 }
611 } 652 }
@@ -619,11 +660,11 @@ namespace OpenSim.Region.Environment.Scenes
619 LLVector3 lPos; 660 LLVector3 lPos;
620 Quaternion lRot; 661 Quaternion lRot;
621 662
622 lPos = this.Pos; 663 lPos = Pos;
623 lRot = this.Rotation; 664 lRot = Rotation;
624 665
625 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); 666 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w);
626 RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); 667 RemoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalId, lPos, mRot);
627 } 668 }
628 669
629 /// <summary> 670 /// <summary>
@@ -631,10 +672,10 @@ namespace OpenSim.Region.Environment.Scenes
631 /// </summary> 672 /// </summary>
632 public void SendTerseUpdateToALLClients() 673 public void SendTerseUpdateToALLClients()
633 { 674 {
634 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 675 List<ScenePresence> avatars = m_world.RequestAvatarList();
635 for (int i = 0; i < avatars.Count; i++) 676 for (int i = 0; i < avatars.Count; i++)
636 { 677 {
637 this.SendTerseUpdateToClient(avatars[i].ControllingClient); 678 SendTerseUpdateToClient(avatars[i].ControllingClient);
638 } 679 }
639 } 680 }
640 681
@@ -642,7 +683,7 @@ namespace OpenSim.Region.Environment.Scenes
642 683
643 public void TriggerOnPrimCountTainted() 684 public void TriggerOnPrimCountTainted()
644 { 685 {
645 this.OnPrimCountTainted(); 686 OnPrimCountTainted();
646 } 687 }
647 } 688 }
648} 689} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 5bba87a..b6a2a34 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Threading; 30using System.Threading;
31using System.Timers; 31using System.Timers;
32using libsecondlife; 32using libsecondlife;
33using libsecondlife.Packets;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
36using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
@@ -39,17 +38,16 @@ using OpenSim.Framework.Servers;
39using OpenSim.Framework.Types; 38using OpenSim.Framework.Types;
40using OpenSim.Physics.Manager; 39using OpenSim.Physics.Manager;
41using OpenSim.Region.Caches; 40using OpenSim.Region.Caches;
42using OpenSim.Region.Interfaces; 41using OpenSim.Region.Environment.LandManagement;
43using OpenSim.Region.Scripting; 42using OpenSim.Region.Scripting;
44using OpenSim.Region.Terrain; 43using OpenSim.Region.Terrain;
45using Caps = OpenSim.Region.Capabilities.Caps; 44using Caps=OpenSim.Region.Capabilities.Caps;
46using Timer = System.Timers.Timer; 45using Timer=System.Timers.Timer;
47
48using OpenSim.Region.Environment.LandManagement;
49 46
50namespace OpenSim.Region.Environment.Scenes 47namespace OpenSim.Region.Environment.Scenes
51{ 48{
52 public delegate bool FilterAvatarList(ScenePresence avatar); 49 public delegate bool FilterAvatarList(ScenePresence avatar);
50
53 public delegate void ForEachScenePresenceDelegate(ScenePresence presence); 51 public delegate void ForEachScenePresenceDelegate(ScenePresence presence);
54 52
55 public partial class Scene : SceneBase, ILocalStorageReceiver 53 public partial class Scene : SceneBase, ILocalStorageReceiver
@@ -61,7 +59,7 @@ namespace OpenSim.Region.Environment.Scenes
61 protected float timeStep = 0.1f; 59 protected float timeStep = 0.1f;
62 private Random Rand = new Random(); 60 private Random Rand = new Random();
63 private uint _primCount = 702000; 61 private uint _primCount = 702000;
64 private System.Threading.Mutex _primAllocateMutex = new Mutex(false); 62 private Mutex _primAllocateMutex = new Mutex(false);
65 private int storageCount; 63 private int storageCount;
66 private int landPrimCheckCount; 64 private int landPrimCheckCount;
67 private Mutex updateLock; 65 private Mutex updateLock;
@@ -75,40 +73,39 @@ namespace OpenSim.Region.Environment.Scenes
75 protected BaseHttpServer httpListener; 73 protected BaseHttpServer httpListener;
76 74
77 #region Properties 75 #region Properties
76
78 /// <summary> 77 /// <summary>
79 /// 78 ///
80 /// </summary> 79 /// </summary>
81 public PhysicsScene PhysScene 80 public PhysicsScene PhysScene
82 { 81 {
83 set 82 set { phyScene = value; }
84 { 83 get { return (phyScene); }
85 this.phyScene = value;
86 }
87 get
88 {
89 return (this.phyScene);
90 }
91 } 84 }
92 85
93 private LandManager m_LandManager; 86 private LandManager m_LandManager;
87
94 public LandManager LandManager 88 public LandManager LandManager
95 { 89 {
96 get { return m_LandManager; } 90 get { return m_LandManager; }
97 } 91 }
98 92
99 private EstateManager m_estateManager; 93 private EstateManager m_estateManager;
94
100 public EstateManager EstateManager 95 public EstateManager EstateManager
101 { 96 {
102 get { return m_estateManager; } 97 get { return m_estateManager; }
103 } 98 }
104 99
105 private EventManager m_eventManager; 100 private EventManager m_eventManager;
101
106 public EventManager EventManager 102 public EventManager EventManager
107 { 103 {
108 get { return m_eventManager; } 104 get { return m_eventManager; }
109 } 105 }
110 106
111 private ScriptManager m_scriptManager; 107 private ScriptManager m_scriptManager;
108
112 public ScriptManager ScriptManager 109 public ScriptManager ScriptManager
113 { 110 {
114 get { return m_scriptManager; } 111 get { return m_scriptManager; }
@@ -122,31 +119,34 @@ namespace OpenSim.Region.Environment.Scenes
122 #endregion 119 #endregion
123 120
124 #region Constructors 121 #region Constructors
122
125 /// <summary> 123 /// <summary>
126 /// Creates a new World class, and a region to go with it. 124 /// Creates a new World class, and a region to go with it.
127 /// </summary> 125 /// </summary>
128 /// <param name="clientThreads">Dictionary to contain client threads</param> 126 /// <param name="clientThreads">Dictionary to contain client threads</param>
129 /// <param name="regionHandle">Region Handle for this region</param> 127 /// <param name="regionHandle">Region Handle for this region</param>
130 /// <param name="regionName">Region Name for this region</param> 128 /// <param name="regionName">Region Name for this region</param>
131 public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer) 129 public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan,
130 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer)
132 { 131 {
133 updateLock = new Mutex(false); 132 updateLock = new Mutex(false);
134 this.authenticateHandler = authen; 133 authenticateHandler = authen;
135 this.commsManager = commsMan; 134 commsManager = commsMan;
136 this.storageManager = storeManager; 135 storageManager = storeManager;
137 this.assetCache = assetCach; 136 assetCache = assetCach;
138 m_regInfo = regInfo; 137 m_regInfo = regInfo;
139 m_regionHandle = m_regInfo.RegionHandle; 138 m_regionHandle = m_regInfo.RegionHandle;
140 m_regionName = m_regInfo.RegionName; 139 m_regionName = m_regInfo.RegionName;
141 this.m_datastore = m_regInfo.DataStore; 140 m_datastore = m_regInfo.DataStore;
142 this.RegisterRegionWithComms(); 141 RegisterRegionWithComms();
143 142
144 m_LandManager = new LandManager(this, this.m_regInfo); 143 m_LandManager = new LandManager(this, m_regInfo);
145 m_estateManager = new EstateManager(this, this.m_regInfo); 144 m_estateManager = new EstateManager(this, m_regInfo);
146 m_scriptManager = new ScriptManager(this); 145 m_scriptManager = new ScriptManager(this);
147 m_eventManager = new EventManager(); 146 m_eventManager = new EventManager();
148 147
149 m_eventManager.OnParcelPrimCountAdd += new EventManager.OnParcelPrimCountAddDelegate(m_LandManager.addPrimToLandPrimCounts); 148 m_eventManager.OnParcelPrimCountAdd +=
149 new EventManager.OnParcelPrimCountAddDelegate(m_LandManager.addPrimToLandPrimCounts);
150 150
151 MainLog.Instance.Verbose("World.cs - creating new entitities instance"); 151 MainLog.Instance.Verbose("World.cs - creating new entitities instance");
152 Entities = new Dictionary<LLUUID, EntityBase>(); 152 Entities = new Dictionary<LLUUID, EntityBase>();
@@ -167,8 +167,9 @@ namespace OpenSim.Region.Environment.Scenes
167 167
168 ScenePresence.LoadAnims(); 168 ScenePresence.LoadAnims();
169 169
170 this.httpListener = httpServer; 170 httpListener = httpServer;
171 } 171 }
172
172 #endregion 173 #endregion
173 174
174 #region Script Handling Methods 175 #region Script Handling Methods
@@ -187,21 +188,19 @@ namespace OpenSim.Region.Environment.Scenes
187 { 188 {
188 m_heartbeatTimer.Enabled = true; 189 m_heartbeatTimer.Enabled = true;
189 m_heartbeatTimer.Interval = 100; 190 m_heartbeatTimer.Interval = 100;
190 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); 191 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
191 } 192 }
192 193
193
194 #region Update Methods 194 #region Update Methods
195 195
196
197 /// <summary> 196 /// <summary>
198 /// Performs per-frame updates regularly 197 /// Performs per-frame updates regularly
199 /// </summary> 198 /// </summary>
200 /// <param name="sender"></param> 199 /// <param name="sender"></param>
201 /// <param name="e"></param> 200 /// <param name="e"></param>
202 void Heartbeat(object sender, EventArgs e) 201 private void Heartbeat(object sender, EventArgs e)
203 { 202 {
204 this.Update(); 203 Update();
205 } 204 }
206 205
207 /// <summary> 206 /// <summary>
@@ -212,10 +211,9 @@ namespace OpenSim.Region.Environment.Scenes
212 updateLock.WaitOne(); 211 updateLock.WaitOne();
213 try 212 try
214 { 213 {
215 if (this.phyScene.IsThreaded) 214 if (phyScene.IsThreaded)
216 { 215 {
217 this.phyScene.GetResults(); 216 phyScene.GetResults();
218
219 } 217 }
220 218
221 foreach (LLUUID UUID in Entities.Keys) 219 foreach (LLUUID UUID in Entities.Keys)
@@ -223,45 +221,43 @@ namespace OpenSim.Region.Environment.Scenes
223 Entities[UUID].updateMovement(); 221 Entities[UUID].updateMovement();
224 } 222 }
225 223
226 lock (this.m_syncRoot) 224 lock (m_syncRoot)
227 { 225 {
228 this.phyScene.Simulate(timeStep); 226 phyScene.Simulate(timeStep);
229 } 227 }
230 228
231 foreach (LLUUID UUID in Entities.Keys) 229 foreach (LLUUID UUID in Entities.Keys)
232 { 230 {
233 Entities[UUID].update(); 231 Entities[UUID].Update();
234 } 232 }
235 233
236 // General purpose event manager 234 // General purpose event manager
237 m_eventManager.TriggerOnFrame(); 235 m_eventManager.TriggerOnFrame();
238 236
239 //backup world data 237 //backup world data
240 this.storageCount++; 238 storageCount++;
241 if (storageCount > 1200) //set to how often you want to backup 239 if (storageCount > 1200) //set to how often you want to backup
242 { 240 {
243 this.Backup(); 241 Backup();
244 storageCount = 0; 242 storageCount = 0;
245 } 243 }
246 244
247 this.landPrimCheckCount++; 245 landPrimCheckCount++;
248 if (this.landPrimCheckCount > 50) //check every 5 seconds for tainted prims 246 if (landPrimCheckCount > 50) //check every 5 seconds for tainted prims
249 { 247 {
250 if (m_LandManager.landPrimCountTainted) 248 if (m_LandManager.landPrimCountTainted)
251 { 249 {
252 //Perform land update of prim count 250 //Perform land update of prim count
253 performParcelPrimCountUpdate(); 251 performParcelPrimCountUpdate();
254 this.landPrimCheckCount = 0; 252 landPrimCheckCount = 0;
255 } 253 }
256 } 254 }
257
258 } 255 }
259 catch (Exception e) 256 catch (Exception e)
260 { 257 {
261 MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); 258 MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString());
262 } 259 }
263 updateLock.ReleaseMutex(); 260 updateLock.ReleaseMutex();
264
265 } 261 }
266 262
267 /// <summary> 263 /// <summary>
@@ -270,9 +266,10 @@ namespace OpenSim.Region.Environment.Scenes
270 /// <returns></returns> 266 /// <returns></returns>
271 public bool Backup() 267 public bool Backup()
272 { 268 {
273 EventManager.TriggerOnBackup(this.storageManager.DataStore); 269 EventManager.TriggerOnBackup(storageManager.DataStore);
274 return true; 270 return true;
275 } 271 }
272
276 #endregion 273 #endregion
277 274
278 #region Regenerate Terrain 275 #region Regenerate Terrain
@@ -286,17 +283,17 @@ namespace OpenSim.Region.Environment.Scenes
286 { 283 {
287 Terrain.hills(); 284 Terrain.hills();
288 285
289 lock (this.m_syncRoot) 286 lock (m_syncRoot)
290 { 287 {
291 this.phyScene.SetTerrain(Terrain.getHeights1D()); 288 phyScene.SetTerrain(Terrain.getHeights1D());
292 } 289 }
293 290
294 this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); 291 storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD());
295 292
296 this.ForEachScenePresence(delegate(ScenePresence presence) 293 ForEachScenePresence(delegate(ScenePresence presence)
297 { 294 {
298 this.SendLayerData(presence.ControllingClient); 295 SendLayerData(presence.ControllingClient);
299 }); 296 });
300 297
301 foreach (LLUUID UUID in Entities.Keys) 298 foreach (LLUUID UUID in Entities.Keys)
302 { 299 {
@@ -317,17 +314,17 @@ namespace OpenSim.Region.Environment.Scenes
317 { 314 {
318 try 315 try
319 { 316 {
320 this.Terrain.setHeights2D(newMap); 317 Terrain.setHeights2D(newMap);
321 lock (this.m_syncRoot) 318 lock (m_syncRoot)
322 { 319 {
323 this.phyScene.SetTerrain(this.Terrain.getHeights1D()); 320 phyScene.SetTerrain(Terrain.getHeights1D());
324 } 321 }
325 this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); 322 storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD());
326 323
327 this.ForEachScenePresence(delegate(ScenePresence presence) 324 ForEachScenePresence(delegate(ScenePresence presence)
328 { 325 {
329 this.SendLayerData(presence.ControllingClient); 326 SendLayerData(presence.ControllingClient);
330 }); 327 });
331 328
332 foreach (LLUUID UUID in Entities.Keys) 329 foreach (LLUUID UUID in Entities.Keys)
333 { 330 {
@@ -354,10 +351,10 @@ namespace OpenSim.Region.Environment.Scenes
354 { 351 {
355 /* Dont save here, rely on tainting system instead */ 352 /* Dont save here, rely on tainting system instead */
356 353
357 this.ForEachScenePresence(delegate(ScenePresence presence) 354 ForEachScenePresence(delegate(ScenePresence presence)
358 { 355 {
359 this.SendLayerData(pointx, pointy, presence.ControllingClient); 356 SendLayerData(pointx, pointy, presence.ControllingClient);
360 }); 357 });
361 } 358 }
362 } 359 }
363 catch (Exception e) 360 catch (Exception e)
@@ -369,6 +366,7 @@ namespace OpenSim.Region.Environment.Scenes
369 #endregion 366 #endregion
370 367
371 #region Load Terrain 368 #region Load Terrain
369
372 /// <summary> 370 /// <summary>
373 /// Loads the World heightmap 371 /// Loads the World heightmap
374 /// </summary> 372 /// </summary>
@@ -377,38 +375,37 @@ namespace OpenSim.Region.Environment.Scenes
377 { 375 {
378 try 376 try
379 { 377 {
380 double[,] map = this.storageManager.DataStore.LoadTerrain(); 378 double[,] map = storageManager.DataStore.LoadTerrain();
381 if (map == null) 379 if (map == null)
382 { 380 {
383 if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) 381 if (string.IsNullOrEmpty(m_regInfo.estateSettings.terrainFile))
384 { 382 {
385 Console.WriteLine("No default terrain, procedurally generating..."); 383 Console.WriteLine("No default terrain, procedurally generating...");
386 this.Terrain.hills(); 384 Terrain.hills();
387 385
388 this.storageManager.DataStore.StoreTerrain(this.Terrain.getHeights2DD()); 386 storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD());
389 } 387 }
390 else 388 else
391 { 389 {
392 try 390 try
393 { 391 {
394 this.Terrain.loadFromFileF32(this.m_regInfo.estateSettings.terrainFile); 392 Terrain.loadFromFileF32(m_regInfo.estateSettings.terrainFile);
395 this.Terrain *= this.m_regInfo.estateSettings.terrainMultiplier; 393 Terrain *= m_regInfo.estateSettings.terrainMultiplier;
396 } 394 }
397 catch 395 catch
398 { 396 {
399 Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); 397 Console.WriteLine("Unable to load default terrain, procedurally generating instead...");
400 Terrain.hills(); 398 Terrain.hills();
401 } 399 }
402 this.storageManager.DataStore.StoreTerrain(this.Terrain.getHeights2DD()); 400 storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD());
403 } 401 }
404 } 402 }
405 else 403 else
406 { 404 {
407 this.Terrain.setHeights2D(map); 405 Terrain.setHeights2D(map);
408 } 406 }
409 407
410 CreateTerrainTexture(); 408 CreateTerrainTexture();
411
412 } 409 }
413 catch (Exception e) 410 catch (Exception e)
414 { 411 {
@@ -422,27 +419,27 @@ namespace OpenSim.Region.Environment.Scenes
422 public void CreateTerrainTexture() 419 public void CreateTerrainTexture()
423 { 420 {
424 //create a texture asset of the terrain 421 //create a texture asset of the terrain
425 byte[] data = this.Terrain.exportJpegImage("defaultstripe.png"); 422 byte[] data = Terrain.exportJpegImage("defaultstripe.png");
426 this.m_regInfo.estateSettings.terrainImageID = LLUUID.Random(); 423 m_regInfo.estateSettings.terrainImageID = LLUUID.Random();
427 AssetBase asset = new AssetBase(); 424 AssetBase asset = new AssetBase();
428 asset.FullID = this.m_regInfo.estateSettings.terrainImageID; 425 asset.FullID = m_regInfo.estateSettings.terrainImageID;
429 asset.Data = data; 426 asset.Data = data;
430 asset.Name = "terrainImage"; 427 asset.Name = "terrainImage";
431 asset.Type = 0; 428 asset.Type = 0;
432 this.assetCache.AddAsset(asset); 429 assetCache.AddAsset(asset);
433 } 430 }
431
434 #endregion 432 #endregion
435 433
436 #region Primitives Methods 434 #region Primitives Methods
437 435
438
439 /// <summary> 436 /// <summary>
440 /// Loads the World's objects 437 /// Loads the World's objects
441 /// </summary> 438 /// </summary>
442 public void LoadPrimsFromStorage() 439 public void LoadPrimsFromStorage()
443 { 440 {
444 MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives"); 441 MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives");
445 this.localStorage.LoadPrimitives(this); 442 localStorage.LoadPrimitives(this);
446 } 443 }
447 444
448 /// <summary> 445 /// <summary>
@@ -476,8 +473,7 @@ namespace OpenSim.Region.Environment.Scenes
476 /// <param name="ownerID"></param> 473 /// <param name="ownerID"></param>
477 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape) 474 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
478 { 475 {
479 476 SceneObject sceneOb = new SceneObject(this, m_eventManager, ownerID, PrimIDAllocate(), pos, shape);
480 SceneObject sceneOb = new SceneObject(this, m_eventManager, ownerID, this.PrimIDAllocate(), pos, shape);
481 AddEntity(sceneOb); 477 AddEntity(sceneOb);
482 } 478 }
483 479
@@ -487,27 +483,26 @@ namespace OpenSim.Region.Environment.Scenes
487 { 483 {
488 if (obj is SceneObject) 484 if (obj is SceneObject)
489 { 485 {
490 if (((SceneObject)obj).LocalId == localID) 486 if (((SceneObject) obj).LocalId == localID)
491 { 487 {
492 RemoveEntity((SceneObject)obj); 488 RemoveEntity((SceneObject) obj);
493 return; 489 return;
494 } 490 }
495 } 491 }
496 } 492 }
497
498 } 493 }
499 494
500 public void AddEntity(SceneObject sceneObject) 495 public void AddEntity(SceneObject sceneObject)
501 { 496 {
502 this.Entities.Add(sceneObject.rootUUID, sceneObject); 497 Entities.Add(sceneObject.rootUUID, sceneObject);
503 } 498 }
504 499
505 public void RemoveEntity(SceneObject sceneObject) 500 public void RemoveEntity(SceneObject sceneObject)
506 { 501 {
507 if (this.Entities.ContainsKey(sceneObject.rootUUID)) 502 if (Entities.ContainsKey(sceneObject.rootUUID))
508 { 503 {
509 m_LandManager.removePrimFromLandPrimCounts(sceneObject); 504 m_LandManager.removePrimFromLandPrimCounts(sceneObject);
510 this.Entities.Remove(sceneObject.rootUUID); 505 Entities.Remove(sceneObject.rootUUID);
511 m_LandManager.setPrimsTainted(); 506 m_LandManager.setPrimsTainted();
512 } 507 }
513 } 508 }
@@ -520,6 +515,7 @@ namespace OpenSim.Region.Environment.Scenes
520 { 515 {
521 prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; 516 prim.OnPrimCountTainted += m_LandManager.setPrimsTainted;
522 } 517 }
518
523 #endregion 519 #endregion
524 520
525 #region Add/Remove Avatar Methods 521 #region Add/Remove Avatar Methods
@@ -533,48 +529,48 @@ namespace OpenSim.Region.Environment.Scenes
533 public override void AddNewClient(IClientAPI client, bool child) 529 public override void AddNewClient(IClientAPI client, bool child)
534 { 530 {
535 SubscribeToClientEvents(client); 531 SubscribeToClientEvents(client);
536 this.m_estateManager.sendRegionHandshake(client); 532 m_estateManager.sendRegionHandshake(client);
537 CreateAndAddScenePresence(client); 533 CreateAndAddScenePresence(client);
538 this.m_LandManager.sendParcelOverlay(client); 534 m_LandManager.sendParcelOverlay(client);
539
540 } 535 }
541 536
542 protected virtual void SubscribeToClientEvents(IClientAPI client) 537 protected virtual void SubscribeToClientEvents(IClientAPI client)
543 { 538 {
544 client.OnRegionHandShakeReply += this.SendLayerData; 539 client.OnRegionHandShakeReply += SendLayerData;
545 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); 540 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
546 client.OnChatFromViewer += this.SimChat; 541 client.OnChatFromViewer += SimChat;
547 client.OnInstantMessage += this.InstantMessage; 542 client.OnInstantMessage += InstantMessage;
548 client.OnRequestWearables += this.InformClientOfNeighbours; 543 client.OnRequestWearables += InformClientOfNeighbours;
549 client.OnAddPrim += this.AddNewPrim; 544 client.OnAddPrim += AddNewPrim;
550 client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; 545 client.OnUpdatePrimGroupPosition += UpdatePrimPosition;
551 client.OnUpdatePrimSinglePosition += this.UpdatePrimSinglePosition; 546 client.OnUpdatePrimSinglePosition += UpdatePrimSinglePosition;
552 client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation; 547 client.OnUpdatePrimGroupRotation += UpdatePrimRotation;
553 client.OnUpdatePrimGroupMouseRotation += this.UpdatePrimRotation; 548 client.OnUpdatePrimGroupMouseRotation += UpdatePrimRotation;
554 client.OnUpdatePrimSingleRotation += this.UpdatePrimSingleRotation; 549 client.OnUpdatePrimSingleRotation += UpdatePrimSingleRotation;
555 client.OnUpdatePrimScale += this.UpdatePrimScale; 550 client.OnUpdatePrimScale += UpdatePrimScale;
556 client.OnUpdatePrimShape += this.UpdatePrimShape; 551 client.OnUpdatePrimShape += UpdatePrimShape;
557 client.OnRequestMapBlocks += this.RequestMapBlocks; 552 client.OnRequestMapBlocks += RequestMapBlocks;
558 client.OnUpdatePrimTexture += this.UpdatePrimTexture; 553 client.OnUpdatePrimTexture += UpdatePrimTexture;
559 client.OnTeleportLocationRequest += this.RequestTeleportLocation; 554 client.OnTeleportLocationRequest += RequestTeleportLocation;
560 client.OnObjectSelect += this.SelectPrim; 555 client.OnObjectSelect += SelectPrim;
561 client.OnObjectDeselect += this.DeselectPrim; 556 client.OnObjectDeselect += DeselectPrim;
562 client.OnGrapUpdate += this.MoveObject; 557 client.OnGrapUpdate += MoveObject;
563 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; 558 client.OnNameFromUUIDRequest += commsManager.HandleUUIDNameRequest;
564 client.OnObjectDescription += this.PrimDescription; 559 client.OnObjectDescription += PrimDescription;
565 client.OnObjectName += this.PrimName; 560 client.OnObjectName += PrimName;
566 client.OnLinkObjects += this.LinkObjects; 561 client.OnLinkObjects += LinkObjects;
567 client.OnObjectDuplicate += this.DuplicateObject; 562 client.OnObjectDuplicate += DuplicateObject;
568 563
569 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest); 564 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest);
570 client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest); 565 client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest);
571 client.OnParcelJoinRequest += new ParcelJoinRequest(m_LandManager.handleParcelJoinRequest); 566 client.OnParcelJoinRequest += new ParcelJoinRequest(m_LandManager.handleParcelJoinRequest);
572 client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_LandManager.handleParcelPropertiesUpdateRequest); 567 client.OnParcelPropertiesUpdateRequest +=
568 new ParcelPropertiesUpdateRequest(m_LandManager.handleParcelPropertiesUpdateRequest);
573 client.OnParcelSelectObjects += new ParcelSelectObjects(m_LandManager.handleParcelSelectObjectsRequest); 569 client.OnParcelSelectObjects += new ParcelSelectObjects(m_LandManager.handleParcelSelectObjectsRequest);
574 client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); 570 client.OnParcelObjectOwnerRequest +=
571 new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
575 572
576 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); 573 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
577
578 } 574 }
579 575
580 protected ScenePresence CreateAndAddScenePresence(IClientAPI client) 576 protected ScenePresence CreateAndAddScenePresence(IClientAPI client)
@@ -582,21 +578,21 @@ namespace OpenSim.Region.Environment.Scenes
582 ScenePresence newAvatar = null; 578 ScenePresence newAvatar = null;
583 579
584 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 580 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
585 newAvatar = new ScenePresence(client, this, this.m_regInfo); 581 newAvatar = new ScenePresence(client, this, m_regInfo);
586 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); 582 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world");
587 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); 583 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake ");
588 584
589 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); 585 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
590 lock (this.m_syncRoot) 586 lock (m_syncRoot)
591 { 587 {
592 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); 588 newAvatar.PhysActor = phyScene.AddAvatar(pVec);
593 } 589 }
594 590
595 lock (Entities) 591 lock (Entities)
596 { 592 {
597 if (!Entities.ContainsKey(client.AgentId)) 593 if (!Entities.ContainsKey(client.AgentId))
598 { 594 {
599 this.Entities.Add(client.AgentId, newAvatar); 595 Entities.Add(client.AgentId, newAvatar);
600 } 596 }
601 else 597 else
602 { 598 {
@@ -611,7 +607,7 @@ namespace OpenSim.Region.Environment.Scenes
611 } 607 }
612 else 608 else
613 { 609 {
614 this.Avatars.Add(client.AgentId, newAvatar); 610 Avatars.Add(client.AgentId, newAvatar);
615 } 611 }
616 } 612 }
617 newAvatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement; 613 newAvatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement;
@@ -627,13 +623,13 @@ namespace OpenSim.Region.Environment.Scenes
627 { 623 {
628 m_eventManager.TriggerOnRemovePresence(agentID); 624 m_eventManager.TriggerOnRemovePresence(agentID);
629 625
630 ScenePresence avatar = this.RequestAvatar(agentID); 626 ScenePresence avatar = RequestAvatar(agentID);
631 627
632 this.ForEachScenePresence( 628 ForEachScenePresence(
633 delegate(ScenePresence presence) 629 delegate(ScenePresence presence)
634 { 630 {
635 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId); 631 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
636 }); 632 });
637 633
638 lock (Avatars) 634 lock (Avatars)
639 { 635 {
@@ -652,12 +648,13 @@ namespace OpenSim.Region.Environment.Scenes
652 // TODO: Add the removal from physics ? 648 // TODO: Add the removal from physics ?
653 649
654 650
655
656 return; 651 return;
657 } 652 }
653
658 #endregion 654 #endregion
659 655
660 #region Request Avatars List Methods 656 #region Request Avatars List Methods
657
661 //The idea is to have a group of method that return a list of avatars meeting some requirement 658 //The idea is to have a group of method that return a list of avatars meeting some requirement
662 // ie it could be all Avatars within a certain range of the calling prim/avatar. 659 // ie it could be all Avatars within a certain range of the calling prim/avatar.
663 660
@@ -703,7 +700,7 @@ namespace OpenSim.Region.Environment.Scenes
703 /// <returns></returns> 700 /// <returns></returns>
704 public ScenePresence RequestAvatar(LLUUID avatarID) 701 public ScenePresence RequestAvatar(LLUUID avatarID)
705 { 702 {
706 if (this.Avatars.ContainsKey(avatarID)) 703 if (Avatars.ContainsKey(avatarID))
707 { 704 {
708 return Avatars[avatarID]; 705 return Avatars[avatarID];
709 } 706 }
@@ -712,13 +709,13 @@ namespace OpenSim.Region.Environment.Scenes
712 709
713 public void ForEachScenePresence(ForEachScenePresenceDelegate whatToDo) 710 public void ForEachScenePresence(ForEachScenePresenceDelegate whatToDo)
714 { 711 {
715 foreach (ScenePresence presence in this.Avatars.Values) 712 foreach (ScenePresence presence in Avatars.Values)
716 { 713 {
717 whatToDo(presence); 714 whatToDo(presence);
718 } 715 }
719 } 716 }
720 #endregion
721 717
718 #endregion
722 719
723 /// <summary> 720 /// <summary>
724 /// 721 ///
@@ -727,9 +724,9 @@ namespace OpenSim.Region.Environment.Scenes
727 /// <returns></returns> 724 /// <returns></returns>
728 public bool DeleteEntity(LLUUID entID) 725 public bool DeleteEntity(LLUUID entID)
729 { 726 {
730 if (this.Entities.ContainsKey(entID)) 727 if (Entities.ContainsKey(entID))
731 { 728 {
732 this.Entities.Remove(entID); 729 Entities.Remove(entID);
733 return true; 730 return true;
734 } 731 }
735 return false; 732 return false;
@@ -741,7 +738,7 @@ namespace OpenSim.Region.Environment.Scenes
741 { 738 {
742 if (ent is SceneObject) 739 if (ent is SceneObject)
743 { 740 {
744 ((SceneObject)ent).SendAllChildPrimsToClient(client); 741 ((SceneObject) ent).SendAllChildPrimsToClient(client);
745 } 742 }
746 } 743 }
747 } 744 }
@@ -753,12 +750,11 @@ namespace OpenSim.Region.Environment.Scenes
753 /// </summary> 750 /// </summary>
754 public void RegisterRegionWithComms() 751 public void RegisterRegionWithComms()
755 { 752 {
756 753 regionCommsHost = commsManager.GridServer.RegisterRegion(m_regInfo);
757 this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo); 754 if (regionCommsHost != null)
758 if (this.regionCommsHost != null)
759 { 755 {
760 this.regionCommsHost.OnExpectUser += this.NewUserConnection; 756 regionCommsHost.OnExpectUser += NewUserConnection;
761 this.regionCommsHost.OnAvatarCrossingIntoRegion += this.AgentCrossing; 757 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
762 } 758 }
763 } 759 }
764 760
@@ -771,35 +767,37 @@ namespace OpenSim.Region.Environment.Scenes
771 { 767 {
772 // Console.WriteLine("World.cs - add new user connection"); 768 // Console.WriteLine("World.cs - add new user connection");
773 //should just check that its meant for this region 769 //should just check that its meant for this region
774 if (regionHandle == this.m_regInfo.RegionHandle) 770 if (regionHandle == m_regInfo.RegionHandle)
775 { 771 {
776 if (agent.CapsPath != "") 772 if (agent.CapsPath != "")
777 { 773 {
778 //Console.WriteLine("new user, so creating caps handler for it"); 774 //Console.WriteLine("new user, so creating caps handler for it");
779 Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.ExternalHostName, this.m_regInfo.ExternalEndPoint.Port, agent.CapsPath, agent.AgentID); 775 Caps cap =
776 new Caps(assetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port,
777 agent.CapsPath, agent.AgentID);
780 cap.RegisterHandlers(); 778 cap.RegisterHandlers();
781 if (capsHandlers.ContainsKey(agent.AgentID)) 779 if (capsHandlers.ContainsKey(agent.AgentID))
782 { 780 {
783 OpenSim.Framework.Console.MainLog.Instance.Warn("Adding duplicate CAPS entry for user " + agent.AgentID.ToStringHyphenated()); 781 MainLog.Instance.Warn("Adding duplicate CAPS entry for user " +
784 this.capsHandlers[agent.AgentID] = cap; 782 agent.AgentID.ToStringHyphenated());
783 capsHandlers[agent.AgentID] = cap;
785 } 784 }
786 else 785 else
787 { 786 {
788 this.capsHandlers.Add(agent.AgentID, cap); 787 capsHandlers.Add(agent.AgentID, cap);
789 } 788 }
790
791 } 789 }
792 this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 790 authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
793 } 791 }
794 } 792 }
795 793
796 public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) 794 public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position)
797 { 795 {
798 if (regionHandle == this.m_regInfo.RegionHandle) 796 if (regionHandle == m_regInfo.RegionHandle)
799 { 797 {
800 if (this.Avatars.ContainsKey(agentID)) 798 if (Avatars.ContainsKey(agentID))
801 { 799 {
802 this.Avatars[agentID].MakeAvatar(position); 800 Avatars[agentID].MakeAvatar(position);
803 } 801 }
804 } 802 }
805 } 803 }
@@ -809,7 +807,7 @@ namespace OpenSim.Region.Environment.Scenes
809 /// </summary> 807 /// </summary>
810 public void InformClientOfNeighbours(IClientAPI remoteClient) 808 public void InformClientOfNeighbours(IClientAPI remoteClient)
811 { 809 {
812 List<RegionInfo> neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); 810 List<RegionInfo> neighbours = commsManager.GridServer.RequestNeighbours(m_regInfo);
813 811
814 if (neighbours != null) 812 if (neighbours != null)
815 { 813 {
@@ -820,7 +818,7 @@ namespace OpenSim.Region.Environment.Scenes
820 agent.InventoryFolder = LLUUID.Zero; 818 agent.InventoryFolder = LLUUID.Zero;
821 agent.startpos = new LLVector3(128, 128, 70); 819 agent.startpos = new LLVector3(128, 128, 70);
822 agent.child = true; 820 agent.child = true;
823 this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); 821 commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent);
824 remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint); 822 remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint);
825 //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); 823 //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort);
826 } 824 }
@@ -834,7 +832,7 @@ namespace OpenSim.Region.Environment.Scenes
834 /// <returns></returns> 832 /// <returns></returns>
835 public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) 833 public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
836 { 834 {
837 return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle); 835 return commsManager.GridServer.RequestNeighbourInfo(regionHandle);
838 } 836 }
839 837
840 /// <summary> 838 /// <summary>
@@ -847,7 +845,7 @@ namespace OpenSim.Region.Environment.Scenes
847 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) 845 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY)
848 { 846 {
849 List<MapBlockData> mapBlocks; 847 List<MapBlockData> mapBlocks;
850 mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); 848 mapBlocks = commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
851 remoteClient.SendMapBlock(mapBlocks); 849 remoteClient.SendMapBlock(mapBlocks);
852 } 850 }
853 851
@@ -859,20 +857,21 @@ namespace OpenSim.Region.Environment.Scenes
859 /// <param name="position"></param> 857 /// <param name="position"></param>
860 /// <param name="lookAt"></param> 858 /// <param name="lookAt"></param>
861 /// <param name="flags"></param> 859 /// <param name="flags"></param>
862 public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) 860 public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position,
861 LLVector3 lookAt, uint flags)
863 { 862 {
864 if (regionHandle == this.m_regionHandle) 863 if (regionHandle == m_regionHandle)
865 { 864 {
866 if (this.Avatars.ContainsKey(remoteClient.AgentId)) 865 if (Avatars.ContainsKey(remoteClient.AgentId))
867 { 866 {
868 remoteClient.SendTeleportLocationStart(); 867 remoteClient.SendTeleportLocationStart();
869 remoteClient.SendLocalTeleport(position, lookAt, flags); 868 remoteClient.SendLocalTeleport(position, lookAt, flags);
870 this.Avatars[remoteClient.AgentId].Teleport(position); 869 Avatars[remoteClient.AgentId].Teleport(position);
871 } 870 }
872 } 871 }
873 else 872 else
874 { 873 {
875 RegionInfo reg = this.RequestNeighbouringRegionInfo(regionHandle); 874 RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle);
876 if (reg != null) 875 if (reg != null)
877 { 876 {
878 remoteClient.SendTeleportLocationStart(); 877 remoteClient.SendTeleportLocationStart();
@@ -881,11 +880,10 @@ namespace OpenSim.Region.Environment.Scenes
881 agent.InventoryFolder = LLUUID.Zero; 880 agent.InventoryFolder = LLUUID.Zero;
882 agent.startpos = new LLVector3(128, 128, 70); 881 agent.startpos = new LLVector3(128, 128, 70);
883 agent.child = true; 882 agent.child = true;
884 this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); 883 commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
885 this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); 884 commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position);
886 885
887 remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); 886 remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4));
888
889 } 887 }
890 } 888 }
891 } 889 }
@@ -898,7 +896,7 @@ namespace OpenSim.Region.Environment.Scenes
898 /// <param name="position"></param> 896 /// <param name="position"></param>
899 public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) 897 public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position)
900 { 898 {
901 return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); 899 return commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position);
902 } 900 }
903 901
904 public void performParcelPrimCountUpdate() 902 public void performParcelPrimCountUpdate()
@@ -908,7 +906,7 @@ namespace OpenSim.Region.Environment.Scenes
908 m_LandManager.finalizeLandPrimCountUpdate(); 906 m_LandManager.finalizeLandPrimCountUpdate();
909 m_LandManager.landPrimCountTainted = false; 907 m_LandManager.landPrimCountTainted = false;
910 } 908 }
911 #endregion
912 909
910 #endregion
913 } 911 }
914} 912} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index f0b25ce..ed27fa9 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -55,8 +55,8 @@ namespace OpenSim.Region.Environment.Scenes
55 { 55 {
56 get 56 get
57 { 57 {
58 this.uuid = this.rootPrimitive.uuid; 58 this.m_uuid = this.rootPrimitive.m_uuid;
59 return this.uuid; 59 return this.m_uuid;
60 } 60 }
61 } 61 }
62 62
@@ -151,7 +151,7 @@ namespace OpenSim.Region.Environment.Scenes
151 151
152 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos); 152 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos);
153 153
154 this.children.Add(rootPrimitive); 154 this.m_children.Add(rootPrimitive);
155 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); 155 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
156 } 156 }
157 157
@@ -177,7 +177,7 @@ namespace OpenSim.Region.Environment.Scenes
177 dupe.m_regionHandle = this.m_regionHandle; 177 dupe.m_regionHandle = this.m_regionHandle;
178 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe); 178 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe);
179 dupe.rootPrimitive = newRoot; 179 dupe.rootPrimitive = newRoot;
180 dupe.children.Add(dupe.rootPrimitive); 180 dupe.m_children.Add(dupe.rootPrimitive);
181 dupe.rootPrimitive.Pos = this.Pos; 181 dupe.rootPrimitive.Pos = this.Pos;
182 dupe.Rotation = this.Rotation; 182 dupe.Rotation = this.Rotation;
183 dupe.LocalId = m_world.PrimIDAllocate(); 183 dupe.LocalId = m_world.PrimIDAllocate();
@@ -191,7 +191,7 @@ namespace OpenSim.Region.Environment.Scenes
191 /// </summary> 191 /// </summary>
192 public void DeleteAllChildren() 192 public void DeleteAllChildren()
193 { 193 {
194 this.children.Clear(); 194 this.m_children.Clear();
195 this.ChildPrimitives.Clear(); 195 this.ChildPrimitives.Clear();
196 this.rootPrimitive = null; 196 this.rootPrimitive = null;
197 unregisterEvents(); 197 unregisterEvents();
@@ -208,9 +208,9 @@ namespace OpenSim.Region.Environment.Scenes
208 208
209 public void AddChildToList(Primitive prim) 209 public void AddChildToList(Primitive prim)
210 { 210 {
211 if (!this.ChildPrimitives.ContainsKey(prim.uuid)) 211 if (!this.ChildPrimitives.ContainsKey(prim.m_uuid))
212 { 212 {
213 this.ChildPrimitives.Add(prim.uuid, prim); 213 this.ChildPrimitives.Add(prim.m_uuid, prim);
214 } 214 }
215 } 215 }
216 /// <summary> 216 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index ae49d9f..31c311c 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Scenes
120 { 120 {
121 121
122 m_world = world; 122 m_world = world;
123 this.uuid = theClient.AgentId; 123 this.m_uuid = theClient.AgentId;
124 124
125 m_regionInfo = reginfo; 125 m_regionInfo = reginfo;
126 m_regionHandle = reginfo.RegionHandle; 126 m_regionHandle = reginfo.RegionHandle;
@@ -349,7 +349,7 @@ namespace OpenSim.Region.Environment.Scenes
349 /// <summary> 349 /// <summary>
350 /// 350 ///
351 /// </summary> 351 /// </summary>
352 public override void update() 352 public override void Update()
353 { 353 {
354 if (this.childAgent == false) 354 if (this.childAgent == false)
355 { 355 {
@@ -405,7 +405,7 @@ namespace OpenSim.Region.Environment.Scenes
405 /// <param name="remoteAvatar"></param> 405 /// <param name="remoteAvatar"></param>
406 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) 406 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
407 { 407 {
408 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); 408 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, DefaultTexture);
409 } 409 }
410 410
411 public void SendFullUpdateToALLClients() 411 public void SendFullUpdateToALLClients()
@@ -423,7 +423,7 @@ namespace OpenSim.Region.Environment.Scenes
423 /// </summary> 423 /// </summary>
424 public void SendInitialData() 424 public void SendInitialData()
425 { 425 {
426 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); 426 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, DefaultTexture);
427 if (this.newAvatar) 427 if (this.newAvatar)
428 { 428 {
429 this.m_world.InformClientOfNeighbours(this.ControllingClient); 429 this.m_world.InformClientOfNeighbours(this.ControllingClient);