diff options
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/Scenes/Primitive.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Primitive.cs | 44 |
1 files changed, 29 insertions, 15 deletions
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 | ||
10 | namespace OpenSim.Region.Environment.Scenes | 10 | namespace 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 | } |