aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorMW2007-07-15 17:40:21 +0000
committerMW2007-07-15 17:40:21 +0000
commita87ebda8950d4ab3bb8ceb2afe2801d530703d8f (patch)
tree877a42b4ca882b80e408dec2796ee4e6a2d50920 /OpenSim/Region/Environment
parent* PROTIP: It helps to know what your doing when playing with reflection. (diff)
downloadopensim-SC_OLD-a87ebda8950d4ab3bb8ceb2afe2801d530703d8f.zip
opensim-SC_OLD-a87ebda8950d4ab3bb8ceb2afe2801d530703d8f.tar.gz
opensim-SC_OLD-a87ebda8950d4ab3bb8ceb2afe2801d530703d8f.tar.bz2
opensim-SC_OLD-a87ebda8950d4ab3bb8ceb2afe2801d530703d8f.tar.xz
Removed reference to Scene EventManager from primitive. In its place, primitive now has its own event (OnPrimCountTainted) that ParcelManager subscribes to.
Removed some unused code from SimpleApp.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/ParcelManager.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs44
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs17
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs19
5 files changed, 51 insertions, 41 deletions
diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs
index 1b8b16f..4f836ef 100644
--- a/OpenSim/Region/Environment/ParcelManager.cs
+++ b/OpenSim/Region/Environment/ParcelManager.cs
@@ -206,7 +206,7 @@ namespace OpenSim.Region.Environment
206 } 206 }
207 else 207 else
208 { 208 {
209 Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")"); 209 // Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")");
210 return parcelList[parcelIDList[x, y]]; 210 return parcelList[parcelIDList[x, y]];
211 } 211 }
212 } 212 }
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 833bf85..23dcf6e 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -9,6 +9,8 @@ using OpenSim.Framework.Types;
9 9
10namespace OpenSim.Region.Environment.Scenes 10namespace OpenSim.Region.Environment.Scenes
11{ 11{
12 public delegate void PrimCountTaintedDelegate();
13
12 public class Primitive : EntityBase 14 public class Primitive : EntityBase
13 { 15 {
14 private const uint FULL_MASK_PERMISSIONS = 2147483647; 16 private const uint FULL_MASK_PERMISSIONS = 2147483647;
@@ -47,6 +49,8 @@ namespace OpenSim.Region.Environment.Scenes
47 49
48 private EventManager m_eventManager; 50 private EventManager m_eventManager;
49 51
52 public event PrimCountTaintedDelegate OnPrimCountTainted;
53
50 #region Properties 54 #region Properties
51 /// <summary> 55 /// <summary>
52 /// If rootprim, will return world position 56 /// If rootprim, will return world position
@@ -132,22 +136,21 @@ namespace OpenSim.Region.Environment.Scenes
132 /// <param name="isRoot"></param> 136 /// <param name="isRoot"></param>
133 /// <param name="parent"></param> 137 /// <param name="parent"></param>
134 /// <param name="rootObject"></param> 138 /// <param name="rootObject"></param>
135 public Primitive(ulong regionHandle, Scene world, EventManager eventManager, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos) 139 public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
136 { 140 {
137 141
138 m_regionHandle = regionHandle; 142 m_regionHandle = regionHandle;
139 m_world = world; 143 m_world = world;
140 m_eventManager = eventManager;
141 inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 144 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
142 this.m_Parent = parent; 145 this.m_Parent = parent;
143 this.m_isRootPrim = isRoot; 146 this.m_isRootPrim = isRoot;
144 this.m_RootParent = rootObject; 147 this.m_RootParent = rootObject;
145
146 this.CreateFromShape(ownerID, localID, pos, shape); 148 this.CreateFromShape(ownerID, localID, pos, shape);
147 this.Rotation = Axiom.Math.Quaternion.Identity; 149 this.Rotation = Axiom.Math.Quaternion.Identity;
148 150
149 151 m_world.AcknowledgeNewPrim(this);
150 m_eventManager.TriggerParcelPrimCountTainted(); 152
153 this.OnPrimCountTainted();
151 } 154 }
152 155
153 /// <summary> 156 /// <summary>
@@ -156,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes
156 /// <remarks>Empty constructor for duplication</remarks> 159 /// <remarks>Empty constructor for duplication</remarks>
157 public Primitive() 160 public Primitive()
158 { 161 {
159 m_eventManager.TriggerParcelPrimCountTainted(); 162
160 } 163 }
161 164
162 #endregion 165 #endregion
@@ -165,7 +168,7 @@ namespace OpenSim.Region.Environment.Scenes
165 168
166 ~Primitive() 169 ~Primitive()
167 { 170 {
168 m_eventManager.TriggerParcelPrimCountTainted(); 171 this.OnPrimCountTainted();
169 } 172 }
170 #endregion 173 #endregion
171 174
@@ -174,17 +177,20 @@ namespace OpenSim.Region.Environment.Scenes
174 public Primitive Copy(EntityBase parent, SceneObject rootParent) 177 public Primitive Copy(EntityBase parent, SceneObject rootParent)
175 { 178 {
176 Primitive dupe = (Primitive)this.MemberwiseClone(); 179 Primitive dupe = (Primitive)this.MemberwiseClone();
177 // TODO: Copy this properly. 180
178 dupe.inventoryItems = this.inventoryItems;
179 dupe.m_Parent = parent; 181 dupe.m_Parent = parent;
180 dupe.m_RootParent = rootParent; 182 dupe.m_RootParent = rootParent;
181 183
182 dupe.m_Shape = this.m_Shape.Copy(); 184 // TODO: Copy this properly.
185 dupe.inventoryItems = this.inventoryItems;
183 dupe.children = new List<EntityBase>(); 186 dupe.children = new List<EntityBase>();
187 dupe.m_Shape = this.m_Shape.Copy();
188 dupe.m_regionHandle = this.m_regionHandle;
189 dupe.m_world = this.m_world;
190
184 uint newLocalID = this.m_world.PrimIDAllocate(); 191 uint newLocalID = this.m_world.PrimIDAllocate();
185 dupe.uuid = LLUUID.Random(); 192 dupe.uuid = LLUUID.Random();
186 dupe.LocalId = newLocalID; 193 dupe.LocalId = newLocalID;
187 dupe.m_regionHandle = this.m_regionHandle;
188 194
189 if (parent is SceneObject) 195 if (parent is SceneObject)
190 { 196 {
@@ -200,7 +206,10 @@ namespace OpenSim.Region.Environment.Scenes
200 dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z); 206 dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z);
201 dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 207 dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z);
202 dupe.m_pos = new LLVector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z); 208 dupe.m_pos = new LLVector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z);
209
203 rootParent.AddChildToList(dupe); 210 rootParent.AddChildToList(dupe);
211 this.m_world.AcknowledgeNewPrim(dupe);
212 dupe.TriggerOnPrimCountTainted();
204 213
205 foreach (Primitive prim in this.children) 214 foreach (Primitive prim in this.children)
206 { 215 {
@@ -213,7 +222,6 @@ namespace OpenSim.Region.Environment.Scenes
213 222
214 #endregion 223 #endregion
215 224
216
217 #region Override from EntityBase 225 #region Override from EntityBase
218 /// <summary> 226 /// <summary>
219 /// 227 ///
@@ -276,7 +284,7 @@ namespace OpenSim.Region.Environment.Scenes
276 this.m_world.DeleteEntity(linkObject.rootUUID); 284 this.m_world.DeleteEntity(linkObject.rootUUID);
277 linkObject.DeleteAllChildren(); 285 linkObject.DeleteAllChildren();
278 286
279 m_eventManager.TriggerParcelPrimCountTainted(); 287 this.OnPrimCountTainted();
280 } 288 }
281 289
282 /// <summary> 290 /// <summary>
@@ -352,7 +360,7 @@ namespace OpenSim.Region.Environment.Scenes
352 prim.m_pos += offset; 360 prim.m_pos += offset;
353 prim.updateFlag = 2; 361 prim.updateFlag = 2;
354 } 362 }
355 m_eventManager.TriggerParcelPrimCountTainted(); 363 this.OnPrimCountTainted();
356 } 364 }
357 365
358 /// <summary> 366 /// <summary>
@@ -404,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes
404 this.Pos = newPos; 412 this.Pos = newPos;
405 this.updateFlag = 2; 413 this.updateFlag = 2;
406 414
407 m_eventManager.TriggerParcelPrimCountTainted(); 415 this.OnPrimCountTainted();
408 } 416 }
409 417
410 /// <summary> 418 /// <summary>
@@ -533,6 +541,7 @@ namespace OpenSim.Region.Environment.Scenes
533 this.updateFlag = 1; 541 this.updateFlag = 1;
534 } 542 }
535 #endregion 543 #endregion
544
536 #region Client Update Methods 545 #region Client Update Methods
537 546
538 /// <summary> 547 /// <summary>
@@ -622,5 +631,10 @@ namespace OpenSim.Region.Environment.Scenes
622 } 631 }
623 632
624 #endregion 633 #endregion
634
635 public void TriggerOnPrimCountTainted()
636 {
637 this.OnPrimCountTainted();
638 }
625 } 639 }
626} 640}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index e370047..ad46322 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -139,7 +139,6 @@ namespace OpenSim.Region.Environment.Scenes
139 m_scriptManager = new ScriptManager(this); 139 m_scriptManager = new ScriptManager(this);
140 m_eventManager = new EventManager(); 140 m_eventManager = new EventManager();
141 141
142 m_eventManager.OnParcelPrimCountTainted += new EventManager.OnParcelPrimCountTaintedDelegate(m_parcelManager.setPrimsTainted);
143 m_eventManager.OnParcelPrimCountAdd += new EventManager.OnParcelPrimCountAddDelegate(m_parcelManager.addPrimToParcelCounts); 142 m_eventManager.OnParcelPrimCountAdd += new EventManager.OnParcelPrimCountAddDelegate(m_parcelManager.addPrimToParcelCounts);
144 143
145 MainLog.Instance.Verbose("World.cs - creating new entitities instance"); 144 MainLog.Instance.Verbose("World.cs - creating new entitities instance");
@@ -221,14 +220,14 @@ namespace OpenSim.Region.Environment.Scenes
221 } 220 }
222 221
223 this.parcelPrimCheckCount++; 222 this.parcelPrimCheckCount++;
224 if (this.parcelPrimCheckCount > 50) //check every 5 seconds for tainted prims 223 if (this.parcelPrimCheckCount > 100) //check every 10 seconds for tainted prims
225 { 224 {
226 if (m_parcelManager.parcelPrimCountTainted) 225 if (m_parcelManager.parcelPrimCountTainted)
227 { 226 {
228 //Perform parcel update of prim count 227 //Perform parcel update of prim count
229 performParcelPrimCountUpdate(); 228 performParcelPrimCountUpdate();
230 this.parcelPrimCheckCount = 0; 229 this.parcelPrimCheckCount = 0;
231 } 230 }
232 } 231 }
233 232
234 } 233 }
@@ -434,7 +433,6 @@ namespace OpenSim.Region.Environment.Scenes
434 /// <param name="prim">The object to load</param> 433 /// <param name="prim">The object to load</param>
435 public void PrimFromStorage(PrimData prim) 434 public void PrimFromStorage(PrimData prim)
436 { 435 {
437
438 } 436 }
439 437
440 /// <summary> 438 /// <summary>
@@ -460,7 +458,8 @@ namespace OpenSim.Region.Environment.Scenes
460 /// <param name="ownerID"></param> 458 /// <param name="ownerID"></param>
461 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape) 459 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
462 { 460 {
463 SceneObject sceneOb = new SceneObject(this, m_eventManager, ownerID, this.PrimIDAllocate(), pos, shape); 461
462 SceneObject sceneOb = new SceneObject(this, m_eventManager, ownerID, this.PrimIDAllocate(), pos, shape);
464 AddNewEntity(sceneOb); 463 AddNewEntity(sceneOb);
465 } 464 }
466 465
@@ -469,6 +468,14 @@ namespace OpenSim.Region.Environment.Scenes
469 this.Entities.Add(sceneObject.rootUUID, sceneObject); 468 this.Entities.Add(sceneObject.rootUUID, sceneObject);
470 } 469 }
471 470
471 /// <summary>
472 /// Called by a prim when it has been created/cloned, so that its events can be subscribed to
473 /// </summary>
474 /// <param name="prim"></param>
475 public void AcknowledgeNewPrim(Primitive prim)
476 {
477 prim.OnPrimCountTainted += m_parcelManager.setPrimsTainted;
478 }
472 #endregion 479 #endregion
473 480
474 #region Add/Remove Avatar Methods 481 #region Add/Remove Avatar Methods
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index 46768d5..f8ebb2f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -19,9 +19,6 @@ namespace OpenSim.Region.Environment.Scenes
19 public delegate void OnRemovePresenceDelegate(LLUUID uuid); 19 public delegate void OnRemovePresenceDelegate(LLUUID uuid);
20 public event OnRemovePresenceDelegate OnRemovePresence; 20 public event OnRemovePresenceDelegate OnRemovePresence;
21 21
22 public delegate void OnParcelPrimCountTaintedDelegate();
23 public event OnParcelPrimCountTaintedDelegate OnParcelPrimCountTainted;
24
25 public delegate void OnParcelPrimCountUpdateDelegate(); 22 public delegate void OnParcelPrimCountUpdateDelegate();
26 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; 23 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
27 24
@@ -58,13 +55,6 @@ namespace OpenSim.Region.Environment.Scenes
58 } 55 }
59 } 56 }
60 57
61 public void TriggerParcelPrimCountTainted()
62 {
63 if (OnParcelPrimCountTainted != null)
64 {
65 OnParcelPrimCountTainted();
66 }
67 }
68 public void TriggerParcelPrimCountUpdate() 58 public void TriggerParcelPrimCountUpdate()
69 { 59 {
70 if (OnParcelPrimCountUpdate != null) 60 if (OnParcelPrimCountUpdate != null)
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 7992b17..95db271 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Environment.Scenes
88 this.CreateRootFromShape(ownerID, localID, shape, pos); 88 this.CreateRootFromShape(ownerID, localID, shape, pos);
89 89
90 registerEvents(); 90 registerEvents();
91 91
92 } 92 }
93 93
94 /// <summary> 94 /// <summary>
@@ -97,7 +97,7 @@ namespace OpenSim.Region.Environment.Scenes
97 /// <remarks>Need a null constructor for duplication</remarks> 97 /// <remarks>Need a null constructor for duplication</remarks>
98 public SceneObject() 98 public SceneObject()
99 { 99 {
100 100
101 } 101 }
102 102
103 public void registerEvents() 103 public void registerEvents()
@@ -121,18 +121,15 @@ namespace OpenSim.Region.Environment.Scenes
121 datastore.StoreObject(this); 121 datastore.StoreObject(this);
122 } 122 }
123 123
124
125 /// <summary> 124 /// <summary>
126 /// Sends my primitive info to the parcel manager for it to keep tally of all of the prims! 125 /// Sends my primitive info to the parcel manager for it to keep tally of all of the prims!
127 /// </summary> 126 /// </summary>
128 private void ProcessParcelPrimCountUpdate() 127 private void ProcessParcelPrimCountUpdate()
129 { 128 {
129
130 m_eventManager.TriggerParcelPrimCountAdd(this); 130 m_eventManager.TriggerParcelPrimCountAdd(this);
131 } 131 }
132 132
133
134
135
136 /// <summary> 133 /// <summary>
137 /// 134 ///
138 /// </summary> 135 /// </summary>
@@ -141,7 +138,9 @@ namespace OpenSim.Region.Environment.Scenes
141 /// <param name="localID"></param> 138 /// <param name="localID"></param>
142 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos) 139 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
143 { 140 {
144 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world,this.m_eventManager, agentID, localID, true, this, this, shape, pos); 141
142 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos);
143
145 this.children.Add(rootPrimitive); 144 this.children.Add(rootPrimitive);
146 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); 145 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
147 } 146 }
@@ -156,7 +155,7 @@ namespace OpenSim.Region.Environment.Scenes
156 } 155 }
157 156
158 /// <summary> 157 /// <summary>
159 /// Copies a prim or group of prims (SceneObject) -- TODO: cleanup code 158 /// Makes a copy of this SceneObject (and child primitives)
160 /// </summary> 159 /// </summary>
161 /// <returns>A complete copy of the object</returns> 160 /// <returns>A complete copy of the object</returns>
162 public new SceneObject Copy() 161 public new SceneObject Copy()
@@ -171,8 +170,8 @@ namespace OpenSim.Region.Environment.Scenes
171 dupe.children.Add(dupe.rootPrimitive); 170 dupe.children.Add(dupe.rootPrimitive);
172 dupe.rootPrimitive.Pos = this.Pos; 171 dupe.rootPrimitive.Pos = this.Pos;
173 dupe.Rotation = this.Rotation; 172 dupe.Rotation = this.Rotation;
174 LLUUID rootu= dupe.rootUUID; 173 LLUUID rootu = dupe.rootUUID;
175 uint rooti = dupe.rootLocalID; 174 uint rooti = dupe.rootLocalID;
176 175
177 dupe.registerEvents(); 176 dupe.registerEvents();
178 return dupe; 177 return dupe;