diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 345 |
1 files changed, 194 insertions, 151 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index abb69f4..deacd18 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1,23 +1,19 @@ | |||
1 | using System; | ||
1 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
2 | using System.Text; | ||
3 | using System.Xml; | 3 | using System.Xml; |
4 | using System.Xml.Serialization; | 4 | using System.Xml.Serialization; |
5 | using System.IO; | ||
6 | using System; | ||
7 | using Axiom.Math; | 5 | using Axiom.Math; |
8 | using libsecondlife; | 6 | using libsecondlife; |
9 | using libsecondlife.Packets; | 7 | using libsecondlife.Packets; |
10 | using OpenSim.Framework.Interfaces; | 8 | using OpenSim.Framework.Interfaces; |
11 | using OpenSim.Framework.Types; | 9 | using OpenSim.Framework.Types; |
12 | using OpenSim.Framework.Utilities; | 10 | using OpenSim.Framework.Utilities; |
11 | using OpenSim.Region.Environment.Interfaces; | ||
13 | using OpenSim.Region.Environment.Scenes.Scripting; | 12 | using OpenSim.Region.Environment.Scenes.Scripting; |
14 | using OpenSim.Framework; | ||
15 | using OpenSim.Region.Physics.Manager; | 13 | using OpenSim.Region.Physics.Manager; |
16 | using OpenSim.Region.Environment.Interfaces; | ||
17 | 14 | ||
18 | namespace OpenSim.Region.Environment.Scenes | 15 | namespace OpenSim.Region.Environment.Scenes |
19 | { | 16 | { |
20 | |||
21 | public class SceneObjectPart : IScriptHost | 17 | public class SceneObjectPart : IScriptHost |
22 | { | 18 | { |
23 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | 19 | private const uint FULL_MASK_PERMISSIONS = 2147483647; |
@@ -25,8 +21,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
25 | private string m_inventoryFileName = ""; | 21 | private string m_inventoryFileName = ""; |
26 | private LLUUID m_folderID = LLUUID.Zero; | 22 | private LLUUID m_folderID = LLUUID.Zero; |
27 | 23 | ||
28 | [XmlIgnore] | 24 | [XmlIgnore] public PhysicsActor PhysActor = null; |
29 | public PhysicsActor PhysActor = null; | ||
30 | 25 | ||
31 | protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); | 26 | protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); |
32 | 27 | ||
@@ -57,19 +52,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
57 | #region Properties | 52 | #region Properties |
58 | 53 | ||
59 | public LLUUID CreatorID; | 54 | public LLUUID CreatorID; |
60 | public LLUUID ObjectCreator { get { return CreatorID; } } | 55 | |
56 | public LLUUID ObjectCreator | ||
57 | { | ||
58 | get { return CreatorID; } | ||
59 | } | ||
61 | 60 | ||
62 | /// <summary> | 61 | /// <summary> |
63 | /// Serial count for inventory file , used to tell if inventory has changed | 62 | /// Serial count for inventory file , used to tell if inventory has changed |
64 | /// no need for this to be part of Database backup | 63 | /// no need for this to be part of Database backup |
65 | /// </summary> | 64 | /// </summary> |
66 | protected uint m_inventorySerial = 0; | 65 | protected uint m_inventorySerial = 0; |
66 | |||
67 | public uint InventorySerial | 67 | public uint InventorySerial |
68 | { | 68 | { |
69 | get { return m_inventorySerial; } | 69 | get { return m_inventorySerial; } |
70 | } | 70 | } |
71 | 71 | ||
72 | protected LLUUID m_uuid; | 72 | protected LLUUID m_uuid; |
73 | |||
73 | public LLUUID UUID | 74 | public LLUUID UUID |
74 | { | 75 | { |
75 | get { return m_uuid; } | 76 | get { return m_uuid; } |
@@ -77,6 +78,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
77 | } | 78 | } |
78 | 79 | ||
79 | protected uint m_localID; | 80 | protected uint m_localID; |
81 | |||
80 | public uint LocalID | 82 | public uint LocalID |
81 | { | 83 | { |
82 | get { return m_localID; } | 84 | get { return m_localID; } |
@@ -84,6 +86,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
84 | } | 86 | } |
85 | 87 | ||
86 | protected string m_name; | 88 | protected string m_name; |
89 | |||
87 | public virtual string Name | 90 | public virtual string Name |
88 | { | 91 | { |
89 | get { return m_name; } | 92 | get { return m_name; } |
@@ -91,20 +94,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
91 | } | 94 | } |
92 | 95 | ||
93 | protected LLObject.ObjectFlags m_flags; | 96 | protected LLObject.ObjectFlags m_flags; |
97 | |||
94 | public uint ObjectFlags | 98 | public uint ObjectFlags |
95 | { | 99 | { |
96 | get { return (uint)m_flags; } | 100 | get { return (uint) m_flags; } |
97 | set { m_flags = (LLObject.ObjectFlags)value; } | 101 | set { m_flags = (LLObject.ObjectFlags) value; } |
98 | } | 102 | } |
99 | 103 | ||
100 | protected LLObject.MaterialType m_material; | 104 | protected LLObject.MaterialType m_material; |
105 | |||
101 | public byte Material | 106 | public byte Material |
102 | { | 107 | { |
103 | get { return (byte)m_material; } | 108 | get { return (byte) m_material; } |
104 | set { m_material = (LLObject.MaterialType)value; } | 109 | set { m_material = (LLObject.MaterialType) value; } |
105 | } | 110 | } |
106 | 111 | ||
107 | protected ulong m_regionHandle; | 112 | protected ulong m_regionHandle; |
113 | |||
108 | public ulong RegionHandle | 114 | public ulong RegionHandle |
109 | { | 115 | { |
110 | get { return m_regionHandle; } | 116 | get { return m_regionHandle; } |
@@ -113,6 +119,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
113 | 119 | ||
114 | //unkown if this will be kept, added as a way of removing the group position from the group class | 120 | //unkown if this will be kept, added as a way of removing the group position from the group class |
115 | protected LLVector3 m_groupPosition; | 121 | protected LLVector3 m_groupPosition; |
122 | |||
116 | public LLVector3 GroupPosition | 123 | public LLVector3 GroupPosition |
117 | { | 124 | { |
118 | get { return m_groupPosition; } | 125 | get { return m_groupPosition; } |
@@ -120,6 +127,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
120 | } | 127 | } |
121 | 128 | ||
122 | protected LLVector3 m_offsetPosition; | 129 | protected LLVector3 m_offsetPosition; |
130 | |||
123 | public LLVector3 OffsetPosition | 131 | public LLVector3 OffsetPosition |
124 | { | 132 | { |
125 | get { return m_offsetPosition; } | 133 | get { return m_offsetPosition; } |
@@ -132,6 +140,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
132 | } | 140 | } |
133 | 141 | ||
134 | protected LLQuaternion m_rotationOffset; | 142 | protected LLQuaternion m_rotationOffset; |
143 | |||
135 | public LLQuaternion RotationOffset | 144 | public LLQuaternion RotationOffset |
136 | { | 145 | { |
137 | get { return m_rotationOffset; } | 146 | get { return m_rotationOffset; } |
@@ -139,6 +148,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
139 | } | 148 | } |
140 | 149 | ||
141 | protected LLVector3 m_velocity; | 150 | protected LLVector3 m_velocity; |
151 | |||
142 | /// <summary></summary> | 152 | /// <summary></summary> |
143 | public LLVector3 Velocity | 153 | public LLVector3 Velocity |
144 | { | 154 | { |
@@ -147,6 +157,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
147 | } | 157 | } |
148 | 158 | ||
149 | protected LLVector3 m_angularVelocity; | 159 | protected LLVector3 m_angularVelocity; |
160 | |||
150 | /// <summary></summary> | 161 | /// <summary></summary> |
151 | public LLVector3 AngularVelocity | 162 | public LLVector3 AngularVelocity |
152 | { | 163 | { |
@@ -155,6 +166,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
155 | } | 166 | } |
156 | 167 | ||
157 | protected LLVector3 m_acceleration; | 168 | protected LLVector3 m_acceleration; |
169 | |||
158 | /// <summary></summary> | 170 | /// <summary></summary> |
159 | public LLVector3 Acceleration | 171 | public LLVector3 Acceleration |
160 | { | 172 | { |
@@ -163,13 +175,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
163 | } | 175 | } |
164 | 176 | ||
165 | private string m_description = ""; | 177 | private string m_description = ""; |
178 | |||
166 | public string Description | 179 | public string Description |
167 | { | 180 | { |
168 | get { return this.m_description; } | 181 | get { return m_description; } |
169 | set { this.m_description = value; } | 182 | set { m_description = value; } |
170 | } | 183 | } |
171 | 184 | ||
172 | private string m_text = ""; | 185 | private string m_text = ""; |
186 | |||
173 | public string Text | 187 | public string Text |
174 | { | 188 | { |
175 | get { return m_text; } | 189 | get { return m_text; } |
@@ -181,6 +195,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
181 | } | 195 | } |
182 | 196 | ||
183 | private string m_sitName = ""; | 197 | private string m_sitName = ""; |
198 | |||
184 | public string SitName | 199 | public string SitName |
185 | { | 200 | { |
186 | get { return m_sitName; } | 201 | get { return m_sitName; } |
@@ -188,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
188 | } | 203 | } |
189 | 204 | ||
190 | private string m_touchName = ""; | 205 | private string m_touchName = ""; |
206 | |||
191 | public string TouchName | 207 | public string TouchName |
192 | { | 208 | { |
193 | get { return m_touchName; } | 209 | get { return m_touchName; } |
@@ -195,17 +211,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
195 | } | 211 | } |
196 | 212 | ||
197 | protected PrimitiveBaseShape m_shape; | 213 | protected PrimitiveBaseShape m_shape; |
214 | |||
198 | public PrimitiveBaseShape Shape | 215 | public PrimitiveBaseShape Shape |
199 | { | 216 | { |
200 | get { return this.m_shape; } | 217 | get { return m_shape; } |
201 | set { m_shape = value; } | 218 | set { m_shape = value; } |
202 | } | 219 | } |
203 | 220 | ||
204 | public LLVector3 Scale | 221 | public LLVector3 Scale |
205 | { | 222 | { |
206 | set { this.m_shape.Scale = value; } | 223 | set { m_shape.Scale = value; } |
207 | get { return this.m_shape.Scale; } | 224 | get { return m_shape.Scale; } |
208 | } | 225 | } |
226 | |||
209 | #endregion | 227 | #endregion |
210 | 228 | ||
211 | public LLUUID ObjectOwner | 229 | public LLUUID ObjectOwner |
@@ -215,16 +233,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
215 | 233 | ||
216 | public SceneObjectGroup ParentGroup | 234 | public SceneObjectGroup ParentGroup |
217 | { | 235 | { |
218 | get { return m_parentGroup; } | 236 | get { return m_parentGroup; } |
219 | } | 237 | } |
220 | 238 | ||
221 | #region Constructors | 239 | #region Constructors |
240 | |||
222 | /// <summary> | 241 | /// <summary> |
223 | /// | 242 | /// |
224 | /// </summary> | 243 | /// </summary> |
225 | public SceneObjectPart() | 244 | public SceneObjectPart() |
226 | { | 245 | { |
227 | |||
228 | } | 246 | } |
229 | 247 | ||
230 | /// <summary> | 248 | /// <summary> |
@@ -236,43 +254,44 @@ namespace OpenSim.Region.Environment.Scenes | |||
236 | /// <param name="localID"></param> | 254 | /// <param name="localID"></param> |
237 | /// <param name="shape"></param> | 255 | /// <param name="shape"></param> |
238 | /// <param name="position"></param> | 256 | /// <param name="position"></param> |
239 | public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition) | 257 | public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, |
240 | { | 258 | PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition) |
241 | this.m_name = "Primitive"; | 259 | { |
242 | this.m_regionHandle = regionHandle; | 260 | m_name = "Primitive"; |
243 | this.m_parentGroup = parent; | 261 | m_regionHandle = regionHandle; |
244 | 262 | m_parentGroup = parent; | |
245 | this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 263 | |
246 | this.OwnerID = ownerID; | 264 | CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
247 | this.CreatorID = this.OwnerID; | 265 | OwnerID = ownerID; |
248 | this.LastOwnerID = LLUUID.Zero; | 266 | CreatorID = OwnerID; |
249 | this.UUID = LLUUID.Random(); | 267 | LastOwnerID = LLUUID.Zero; |
250 | this.LocalID = (uint)(localID); | 268 | UUID = LLUUID.Random(); |
251 | this.Shape = shape; | 269 | LocalID = (uint) (localID); |
252 | 270 | Shape = shape; | |
253 | this.GroupPosition = groupPosition; | 271 | |
254 | this.OffsetPosition = offsetPosition; | 272 | GroupPosition = groupPosition; |
255 | this.RotationOffset = LLQuaternion.Identity; | 273 | OffsetPosition = offsetPosition; |
256 | this.Velocity = new LLVector3(0, 0, 0); | 274 | RotationOffset = LLQuaternion.Identity; |
257 | this.AngularVelocity = new LLVector3(0, 0, 0); | 275 | Velocity = new LLVector3(0, 0, 0); |
258 | this.Acceleration = new LLVector3(0, 0, 0); | 276 | AngularVelocity = new LLVector3(0, 0, 0); |
259 | 277 | Acceleration = new LLVector3(0, 0, 0); | |
278 | |||
260 | m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString(); | 279 | m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString(); |
261 | m_folderID = LLUUID.Random(); | 280 | m_folderID = LLUUID.Random(); |
262 | 281 | ||
263 | m_flags = 0; | 282 | m_flags = 0; |
264 | m_flags |= LLObject.ObjectFlags.ObjectModify | | 283 | m_flags |= LLObject.ObjectFlags.ObjectModify | |
265 | LLObject.ObjectFlags.ObjectCopy | | 284 | LLObject.ObjectFlags.ObjectCopy | |
266 | LLObject.ObjectFlags.ObjectYouOwner | | 285 | LLObject.ObjectFlags.ObjectYouOwner | |
267 | LLObject.ObjectFlags.Touch | | 286 | LLObject.ObjectFlags.Touch | |
268 | LLObject.ObjectFlags.ObjectMove | | 287 | LLObject.ObjectFlags.ObjectMove | |
269 | LLObject.ObjectFlags.AllowInventoryDrop | | 288 | LLObject.ObjectFlags.AllowInventoryDrop | |
270 | LLObject.ObjectFlags.ObjectTransfer | | 289 | LLObject.ObjectFlags.ObjectTransfer | |
271 | LLObject.ObjectFlags.ObjectOwnerModify; | 290 | LLObject.ObjectFlags.ObjectOwnerModify; |
272 | 291 | ||
273 | ScheduleFullUpdate(); | 292 | ScheduleFullUpdate(); |
274 | } | 293 | } |
275 | 294 | ||
276 | /// <summary> | 295 | /// <summary> |
277 | /// Re/create a SceneObjectPart (prim) | 296 | /// Re/create a SceneObjectPart (prim) |
278 | /// currently not used, and maybe won't be | 297 | /// currently not used, and maybe won't be |
@@ -283,23 +302,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
283 | /// <param name="localID"></param> | 302 | /// <param name="localID"></param> |
284 | /// <param name="shape"></param> | 303 | /// <param name="shape"></param> |
285 | /// <param name="position"></param> | 304 | /// <param name="position"></param> |
286 | public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, int creationDate, LLUUID ownerID, LLUUID creatorID, LLUUID lastOwnerID, uint localID, PrimitiveBaseShape shape, LLVector3 position, LLQuaternion rotation, uint flags) | 305 | public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, int creationDate, LLUUID ownerID, |
306 | LLUUID creatorID, LLUUID lastOwnerID, uint localID, PrimitiveBaseShape shape, | ||
307 | LLVector3 position, LLQuaternion rotation, uint flags) | ||
287 | { | 308 | { |
288 | this.m_regionHandle = regionHandle; | 309 | m_regionHandle = regionHandle; |
289 | this.m_parentGroup = parent; | 310 | m_parentGroup = parent; |
290 | 311 | ||
291 | this.CreationDate = creationDate; | 312 | CreationDate = creationDate; |
292 | this.OwnerID = ownerID; | 313 | OwnerID = ownerID; |
293 | this.CreatorID = creatorID; | 314 | CreatorID = creatorID; |
294 | this.LastOwnerID = lastOwnerID; | 315 | LastOwnerID = lastOwnerID; |
295 | this.UUID = LLUUID.Random(); | 316 | UUID = LLUUID.Random(); |
296 | this.LocalID = (uint)(localID); | 317 | LocalID = (uint) (localID); |
297 | this.Shape = shape; | 318 | Shape = shape; |
298 | 319 | ||
299 | this.OffsetPosition = position; | 320 | OffsetPosition = position; |
300 | this.RotationOffset = rotation; | 321 | RotationOffset = rotation; |
301 | this.ObjectFlags = flags; | 322 | ObjectFlags = flags; |
302 | } | 323 | } |
324 | |||
303 | #endregion | 325 | #endregion |
304 | 326 | ||
305 | /// <summary> | 327 | /// <summary> |
@@ -309,8 +331,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
309 | /// <returns></returns> | 331 | /// <returns></returns> |
310 | public static SceneObjectPart FromXml(XmlReader xmlReader) | 332 | public static SceneObjectPart FromXml(XmlReader xmlReader) |
311 | { | 333 | { |
312 | XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); | 334 | XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); |
313 | return (SceneObjectPart)serializer.Deserialize(xmlReader); | 335 | return (SceneObjectPart) serializer.Deserialize(xmlReader); |
314 | } | 336 | } |
315 | 337 | ||
316 | /// <summary> | 338 | /// <summary> |
@@ -319,7 +341,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
319 | /// <param name="xmlWriter"></param> | 341 | /// <param name="xmlWriter"></param> |
320 | public void ToXml(XmlWriter xmlWriter) | 342 | public void ToXml(XmlWriter xmlWriter) |
321 | { | 343 | { |
322 | XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); | 344 | XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); |
323 | serializer.Serialize(xmlWriter, this); | 345 | serializer.Serialize(xmlWriter, this); |
324 | } | 346 | } |
325 | 347 | ||
@@ -329,7 +351,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
329 | public void SetParent(SceneObjectGroup parent) | 351 | public void SetParent(SceneObjectGroup parent) |
330 | { | 352 | { |
331 | m_parentGroup = parent; | 353 | m_parentGroup = parent; |
332 | |||
333 | } | 354 | } |
334 | 355 | ||
335 | public LLUUID GetRootPartUUID() | 356 | public LLUUID GetRootPartUUID() |
@@ -342,34 +363,38 @@ namespace OpenSim.Region.Environment.Scenes | |||
342 | } | 363 | } |
343 | 364 | ||
344 | #region Copying | 365 | #region Copying |
366 | |||
345 | /// <summary> | 367 | /// <summary> |
346 | /// | 368 | /// |
347 | /// </summary> | 369 | /// </summary> |
348 | /// <returns></returns> | 370 | /// <returns></returns> |
349 | public SceneObjectPart Copy(uint localID) | 371 | public SceneObjectPart Copy(uint localID) |
350 | { | 372 | { |
351 | SceneObjectPart dupe = (SceneObjectPart)this.MemberwiseClone(); | 373 | SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone(); |
352 | dupe.m_shape = m_shape.Copy(); | 374 | dupe.m_shape = m_shape.Copy(); |
353 | dupe.m_regionHandle = m_regionHandle; | 375 | dupe.m_regionHandle = m_regionHandle; |
354 | dupe.UUID = LLUUID.Random(); | 376 | dupe.UUID = LLUUID.Random(); |
355 | dupe.LocalID = localID; | 377 | dupe.LocalID = localID; |
356 | dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z); | 378 | dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z); |
357 | dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); | 379 | dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); |
358 | dupe.RotationOffset = new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); | 380 | dupe.RotationOffset = |
381 | new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); | ||
359 | dupe.Velocity = new LLVector3(0, 0, 0); | 382 | dupe.Velocity = new LLVector3(0, 0, 0); |
360 | dupe.Acceleration = new LLVector3(0, 0, 0); | 383 | dupe.Acceleration = new LLVector3(0, 0, 0); |
361 | dupe.AngularVelocity = new LLVector3(0, 0, 0); | 384 | dupe.AngularVelocity = new LLVector3(0, 0, 0); |
362 | dupe.ObjectFlags = this.ObjectFlags; | 385 | dupe.ObjectFlags = ObjectFlags; |
363 | 386 | ||
364 | byte[] extraP = new byte[this.Shape.ExtraParams.Length]; | 387 | byte[] extraP = new byte[Shape.ExtraParams.Length]; |
365 | Array.Copy(this.Shape.ExtraParams, extraP, extraP.Length); | 388 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); |
366 | dupe.Shape.ExtraParams = extraP; | 389 | dupe.Shape.ExtraParams = extraP; |
367 | 390 | ||
368 | return dupe; | 391 | return dupe; |
369 | } | 392 | } |
393 | |||
370 | #endregion | 394 | #endregion |
371 | 395 | ||
372 | #region Update Scheduling | 396 | #region Update Scheduling |
397 | |||
373 | /// <summary> | 398 | /// <summary> |
374 | /// | 399 | /// |
375 | /// </summary> | 400 | /// </summary> |
@@ -387,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
387 | { | 412 | { |
388 | m_parentGroup.HasChanged = true; | 413 | m_parentGroup.HasChanged = true; |
389 | } | 414 | } |
390 | this.TimeStampFull =(uint) Util.UnixTimeSinceEpoch(); | 415 | TimeStampFull = (uint) Util.UnixTimeSinceEpoch(); |
391 | m_updateFlag = 2; | 416 | m_updateFlag = 2; |
392 | } | 417 | } |
393 | 418 | ||
@@ -402,7 +427,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
402 | { | 427 | { |
403 | m_parentGroup.HasChanged = true; | 428 | m_parentGroup.HasChanged = true; |
404 | } | 429 | } |
405 | this.TimeStampTerse = (uint)Util.UnixTimeSinceEpoch(); | 430 | TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); |
406 | m_updateFlag = 1; | 431 | m_updateFlag = 1; |
407 | } | 432 | } |
408 | } | 433 | } |
@@ -426,56 +451,60 @@ namespace OpenSim.Region.Environment.Scenes | |||
426 | } | 451 | } |
427 | } | 452 | } |
428 | } | 453 | } |
454 | |||
429 | #endregion | 455 | #endregion |
430 | 456 | ||
431 | #region Shape | 457 | #region Shape |
458 | |||
432 | /// <summary> | 459 | /// <summary> |
433 | /// | 460 | /// |
434 | /// </summary> | 461 | /// </summary> |
435 | /// <param name="shapeBlock"></param> | 462 | /// <param name="shapeBlock"></param> |
436 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) | 463 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) |
437 | { | 464 | { |
438 | this.m_shape.PathBegin = shapeBlock.PathBegin; | 465 | m_shape.PathBegin = shapeBlock.PathBegin; |
439 | this.m_shape.PathEnd = shapeBlock.PathEnd; | 466 | m_shape.PathEnd = shapeBlock.PathEnd; |
440 | this.m_shape.PathScaleX = shapeBlock.PathScaleX; | 467 | m_shape.PathScaleX = shapeBlock.PathScaleX; |
441 | this.m_shape.PathScaleY = shapeBlock.PathScaleY; | 468 | m_shape.PathScaleY = shapeBlock.PathScaleY; |
442 | this.m_shape.PathShearX = shapeBlock.PathShearX; | 469 | m_shape.PathShearX = shapeBlock.PathShearX; |
443 | this.m_shape.PathShearY = shapeBlock.PathShearY; | 470 | m_shape.PathShearY = shapeBlock.PathShearY; |
444 | this.m_shape.PathSkew = shapeBlock.PathSkew; | 471 | m_shape.PathSkew = shapeBlock.PathSkew; |
445 | this.m_shape.ProfileBegin = shapeBlock.ProfileBegin; | 472 | m_shape.ProfileBegin = shapeBlock.ProfileBegin; |
446 | this.m_shape.ProfileEnd = shapeBlock.ProfileEnd; | 473 | m_shape.ProfileEnd = shapeBlock.ProfileEnd; |
447 | this.m_shape.PathCurve = shapeBlock.PathCurve; | 474 | m_shape.PathCurve = shapeBlock.PathCurve; |
448 | this.m_shape.ProfileCurve = shapeBlock.ProfileCurve; | 475 | m_shape.ProfileCurve = shapeBlock.ProfileCurve; |
449 | this.m_shape.ProfileHollow = shapeBlock.ProfileHollow; | 476 | m_shape.ProfileHollow = shapeBlock.ProfileHollow; |
450 | this.m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; | 477 | m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; |
451 | this.m_shape.PathRevolutions = shapeBlock.PathRevolutions; | 478 | m_shape.PathRevolutions = shapeBlock.PathRevolutions; |
452 | this.m_shape.PathTaperX = shapeBlock.PathTaperX; | 479 | m_shape.PathTaperX = shapeBlock.PathTaperX; |
453 | this.m_shape.PathTaperY = shapeBlock.PathTaperY; | 480 | m_shape.PathTaperY = shapeBlock.PathTaperY; |
454 | this.m_shape.PathTwist = shapeBlock.PathTwist; | 481 | m_shape.PathTwist = shapeBlock.PathTwist; |
455 | this.m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; | 482 | m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; |
456 | ScheduleFullUpdate(); | 483 | ScheduleFullUpdate(); |
457 | } | 484 | } |
485 | |||
458 | #endregion | 486 | #endregion |
459 | 487 | ||
460 | #region Inventory | 488 | #region Inventory |
489 | |||
461 | public void AddInventoryItem(TaskInventoryItem item) | 490 | public void AddInventoryItem(TaskInventoryItem item) |
462 | { | 491 | { |
463 | item.parent_id = m_folderID; | 492 | item.parent_id = m_folderID; |
464 | item.creation_date = 1000; | 493 | item.creation_date = 1000; |
465 | item.ParentPartID = this.UUID; | 494 | item.ParentPartID = UUID; |
466 | this.TaskInventory.Add(item.item_id, item); | 495 | TaskInventory.Add(item.item_id, item); |
467 | this.m_inventorySerial++; | 496 | m_inventorySerial++; |
468 | } | 497 | } |
469 | 498 | ||
470 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) | 499 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) |
471 | { | 500 | { |
472 | if (localID == this.LocalID) | 501 | if (localID == LocalID) |
473 | { | 502 | { |
474 | if (this.TaskInventory.ContainsKey(itemID)) | 503 | if (TaskInventory.ContainsKey(itemID)) |
475 | { | 504 | { |
476 | string type = TaskInventory[itemID].inv_type; | 505 | string type = TaskInventory[itemID].inv_type; |
477 | this.TaskInventory.Remove(itemID); | 506 | TaskInventory.Remove(itemID); |
478 | this.m_inventorySerial++; | 507 | m_inventorySerial++; |
479 | if (type == "lsltext") | 508 | if (type == "lsltext") |
480 | { | 509 | { |
481 | return 10; | 510 | return 10; |
@@ -496,16 +525,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
496 | /// <param name="localID"></param> | 525 | /// <param name="localID"></param> |
497 | public bool GetInventoryFileName(IClientAPI client, uint localID) | 526 | public bool GetInventoryFileName(IClientAPI client, uint localID) |
498 | { | 527 | { |
499 | if (localID == this.m_localID) | 528 | if (localID == m_localID) |
500 | { | 529 | { |
501 | if (this.m_inventorySerial > 0) | 530 | if (m_inventorySerial > 0) |
502 | { | 531 | { |
503 | client.SendTaskInventory(this.m_uuid, (short)m_inventorySerial, Helpers.StringToField(m_inventoryFileName)); | 532 | client.SendTaskInventory(m_uuid, (short) m_inventorySerial, |
533 | Helpers.StringToField(m_inventoryFileName)); | ||
504 | return true; | 534 | return true; |
505 | } | 535 | } |
506 | else | 536 | else |
507 | { | 537 | { |
508 | client.SendTaskInventory(this.m_uuid, 0, new byte[0]); | 538 | client.SendTaskInventory(m_uuid, 0, new byte[0]); |
509 | return false; | 539 | return false; |
510 | } | 540 | } |
511 | } | 541 | } |
@@ -515,8 +545,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
515 | public string RequestInventoryFile(IXfer xferManager) | 545 | public string RequestInventoryFile(IXfer xferManager) |
516 | { | 546 | { |
517 | byte[] fileData = new byte[0]; | 547 | byte[] fileData = new byte[0]; |
518 | InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, this.UUID); | 548 | InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID); |
519 | foreach (TaskInventoryItem item in this.TaskInventory.Values) | 549 | foreach (TaskInventoryItem item in TaskInventory.Values) |
520 | { | 550 | { |
521 | invString.AddItemStart(); | 551 | invString.AddItemStart(); |
522 | invString.AddNameValueLine("item_id", item.item_id.ToStringHyphenated()); | 552 | invString.AddNameValueLine("item_id", item.item_id.ToStringHyphenated()); |
@@ -550,49 +580,56 @@ namespace OpenSim.Region.Environment.Scenes | |||
550 | } | 580 | } |
551 | return ""; | 581 | return ""; |
552 | } | 582 | } |
583 | |||
553 | #endregion | 584 | #endregion |
554 | 585 | ||
555 | #region ExtraParams | 586 | #region ExtraParams |
587 | |||
556 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) | 588 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) |
557 | { | 589 | { |
558 | this.m_shape.ExtraParams = new byte[data.Length + 7]; | 590 | m_shape.ExtraParams = new byte[data.Length + 7]; |
559 | int i = 0; | 591 | int i = 0; |
560 | uint length = (uint)data.Length; | 592 | uint length = (uint) data.Length; |
561 | this.m_shape.ExtraParams[i++] = 1; | 593 | m_shape.ExtraParams[i++] = 1; |
562 | this.m_shape.ExtraParams[i++] = (byte)(type % 256); | 594 | m_shape.ExtraParams[i++] = (byte) (type%256); |
563 | this.m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256); | 595 | m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256); |
564 | 596 | ||
565 | this.m_shape.ExtraParams[i++] = (byte)(length % 256); | 597 | m_shape.ExtraParams[i++] = (byte) (length%256); |
566 | this.m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256); | 598 | m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256); |
567 | this.m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256); | 599 | m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256); |
568 | this.m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256); | 600 | m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256); |
569 | Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length); | 601 | Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length); |
570 | |||
571 | this.ScheduleFullUpdate(); | ||
572 | 602 | ||
603 | ScheduleFullUpdate(); | ||
573 | } | 604 | } |
605 | |||
574 | #endregion | 606 | #endregion |
575 | 607 | ||
576 | #region Texture | 608 | #region Texture |
609 | |||
577 | /// <summary> | 610 | /// <summary> |
578 | /// | 611 | /// |
579 | /// </summary> | 612 | /// </summary> |
580 | /// <param name="textureEntry"></param> | 613 | /// <param name="textureEntry"></param> |
581 | public void UpdateTextureEntry(byte[] textureEntry) | 614 | public void UpdateTextureEntry(byte[] textureEntry) |
582 | { | 615 | { |
583 | this.m_shape.TextureEntry = textureEntry; | 616 | m_shape.TextureEntry = textureEntry; |
584 | ScheduleFullUpdate(); | 617 | ScheduleFullUpdate(); |
585 | } | 618 | } |
619 | |||
586 | #endregion | 620 | #endregion |
587 | 621 | ||
588 | #region ParticleSystem | 622 | #region ParticleSystem |
589 | public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem) | 623 | |
624 | public void AddNewParticleSystem(Primitive.ParticleSystem pSystem) | ||
590 | { | 625 | { |
591 | this.m_particleSystem = pSystem.GetBytes(); | 626 | m_particleSystem = pSystem.GetBytes(); |
592 | } | 627 | } |
628 | |||
593 | #endregion | 629 | #endregion |
594 | 630 | ||
595 | #region Position | 631 | #region Position |
632 | |||
596 | /// <summary> | 633 | /// <summary> |
597 | /// | 634 | /// |
598 | /// </summary> | 635 | /// </summary> |
@@ -600,46 +637,52 @@ namespace OpenSim.Region.Environment.Scenes | |||
600 | public void UpdateOffSet(LLVector3 pos) | 637 | public void UpdateOffSet(LLVector3 pos) |
601 | { | 638 | { |
602 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | 639 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); |
603 | this.OffsetPosition = newPos; | 640 | OffsetPosition = newPos; |
604 | ScheduleTerseUpdate(); | 641 | ScheduleTerseUpdate(); |
605 | } | 642 | } |
606 | 643 | ||
607 | public void UpdateGroupPosition(LLVector3 pos) | 644 | public void UpdateGroupPosition(LLVector3 pos) |
608 | { | 645 | { |
609 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | 646 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); |
610 | this.GroupPosition = newPos; | 647 | GroupPosition = newPos; |
611 | ScheduleTerseUpdate(); | 648 | ScheduleTerseUpdate(); |
612 | } | 649 | } |
650 | |||
613 | #endregion | 651 | #endregion |
614 | 652 | ||
615 | #region rotation | 653 | #region rotation |
654 | |||
616 | public void UpdateRotation(LLQuaternion rot) | 655 | public void UpdateRotation(LLQuaternion rot) |
617 | { | 656 | { |
618 | this.RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); | 657 | RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); |
619 | ScheduleTerseUpdate(); | 658 | ScheduleTerseUpdate(); |
620 | } | 659 | } |
660 | |||
621 | #endregion | 661 | #endregion |
622 | 662 | ||
623 | #region Resizing/Scale | 663 | #region Resizing/Scale |
664 | |||
624 | /// <summary> | 665 | /// <summary> |
625 | /// | 666 | /// |
626 | /// </summary> | 667 | /// </summary> |
627 | /// <param name="scale"></param> | 668 | /// <param name="scale"></param> |
628 | public void Resize(LLVector3 scale) | 669 | public void Resize(LLVector3 scale) |
629 | { | 670 | { |
630 | this.m_shape.Scale = scale; | 671 | m_shape.Scale = scale; |
631 | ScheduleFullUpdate(); | 672 | ScheduleFullUpdate(); |
632 | } | 673 | } |
674 | |||
633 | #endregion | 675 | #endregion |
634 | 676 | ||
635 | #region Client Update Methods | 677 | #region Client Update Methods |
678 | |||
636 | public void AddFullUpdateToAllAvatars() | 679 | public void AddFullUpdateToAllAvatars() |
637 | { | 680 | { |
638 | List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); | 681 | List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars(); |
639 | for (int i = 0; i < avatars.Count; i++) | 682 | for (int i = 0; i < avatars.Count; i++) |
640 | { | 683 | { |
641 | avatars[i].AddFullPart(this); | 684 | avatars[i].AddFullPart(this); |
642 | // avatars[i].QueuePartForUpdate(this); | 685 | // avatars[i].QueuePartForUpdate(this); |
643 | } | 686 | } |
644 | } | 687 | } |
645 | 688 | ||
@@ -654,7 +697,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
654 | /// </summary> | 697 | /// </summary> |
655 | public void SendFullUpdateToAllClients() | 698 | public void SendFullUpdateToAllClients() |
656 | { | 699 | { |
657 | List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); | 700 | List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars(); |
658 | for (int i = 0; i < avatars.Count; i++) | 701 | for (int i = 0; i < avatars.Count; i++) |
659 | { | 702 | { |
660 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this); | 703 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this); |
@@ -691,26 +734,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
691 | LLQuaternion lRot; | 734 | LLQuaternion lRot; |
692 | lRot = RotationOffset; | 735 | lRot = RotationOffset; |
693 | 736 | ||
694 | remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, this.ObjectFlags, m_uuid, OwnerID, | 737 | remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, ObjectFlags, m_uuid, |
695 | m_text, ParentID, this.m_particleSystem, lRot); | 738 | OwnerID, |
739 | m_text, ParentID, m_particleSystem, lRot); | ||
696 | } | 740 | } |
697 | 741 | ||
698 | /// Terse updates | 742 | /// Terse updates |
699 | |||
700 | public void AddTerseUpdateToAllAvatars() | 743 | public void AddTerseUpdateToAllAvatars() |
701 | { | 744 | { |
702 | List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); | 745 | List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars(); |
703 | for (int i = 0; i < avatars.Count; i++) | 746 | for (int i = 0; i < avatars.Count; i++) |
704 | { | 747 | { |
705 | avatars[i].AddTersePart(this); | 748 | avatars[i].AddTersePart(this); |
706 | // avatars[i].QueuePartForUpdate(this); | 749 | // avatars[i].QueuePartForUpdate(this); |
707 | } | 750 | } |
708 | } | 751 | } |
709 | 752 | ||
710 | public void AddTerseUpdateToAvatar(ScenePresence presence) | 753 | public void AddTerseUpdateToAvatar(ScenePresence presence) |
711 | { | 754 | { |
712 | presence.AddTersePart(this); | 755 | presence.AddTersePart(this); |
713 | // presence.QueuePartForUpdate(this); | 756 | // presence.QueuePartForUpdate(this); |
714 | } | 757 | } |
715 | 758 | ||
716 | /// <summary> | 759 | /// <summary> |
@@ -718,7 +761,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
718 | /// </summary> | 761 | /// </summary> |
719 | public void SendTerseUpdateToAllClients() | 762 | public void SendTerseUpdateToAllClients() |
720 | { | 763 | { |
721 | List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); | 764 | List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars(); |
722 | for (int i = 0; i < avatars.Count; i++) | 765 | for (int i = 0; i < avatars.Count; i++) |
723 | { | 766 | { |
724 | m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); | 767 | m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); |
@@ -741,8 +784,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
741 | public void SendTerseUpdateToClient(IClientAPI remoteClient) | 784 | public void SendTerseUpdateToClient(IClientAPI remoteClient) |
742 | { | 785 | { |
743 | LLVector3 lPos; | 786 | LLVector3 lPos; |
744 | lPos = this.OffsetPosition; | 787 | lPos = OffsetPosition; |
745 | LLQuaternion mRot = this.RotationOffset; | 788 | LLQuaternion mRot = RotationOffset; |
746 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); | 789 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); |
747 | } | 790 | } |
748 | 791 | ||
@@ -753,9 +796,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
753 | /// <param name="lPos"></param> | 796 | /// <param name="lPos"></param> |
754 | public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) | 797 | public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) |
755 | { | 798 | { |
756 | LLQuaternion mRot = this.RotationOffset; | 799 | LLQuaternion mRot = RotationOffset; |
757 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); | 800 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); |
758 | } | 801 | } |
802 | |||
759 | #endregion | 803 | #endregion |
760 | 804 | ||
761 | public virtual void UpdateMovement() | 805 | public virtual void UpdateMovement() |
@@ -778,11 +822,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
778 | public InventoryStringBuilder(LLUUID folderID, LLUUID parentID) | 822 | public InventoryStringBuilder(LLUUID folderID, LLUUID parentID) |
779 | { | 823 | { |
780 | BuildString += "\tinv_object\t0\n\t{\n"; | 824 | BuildString += "\tinv_object\t0\n\t{\n"; |
781 | this.AddNameValueLine("obj_id", folderID.ToStringHyphenated()); | 825 | AddNameValueLine("obj_id", folderID.ToStringHyphenated()); |
782 | this.AddNameValueLine("parent_id", parentID.ToStringHyphenated()); | 826 | AddNameValueLine("parent_id", parentID.ToStringHyphenated()); |
783 | this.AddNameValueLine("type", "category"); | 827 | AddNameValueLine("type", "category"); |
784 | this.AddNameValueLine("name", "Contents"); | 828 | AddNameValueLine("name", "Contents"); |
785 | this.AddSectionEnd(); | 829 | AddSectionEnd(); |
786 | } | 830 | } |
787 | 831 | ||
788 | public void AddItemStart() | 832 | public void AddItemStart() |
@@ -831,7 +875,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
831 | "", | 875 | "", |
832 | "", | 876 | "", |
833 | "", | 877 | "", |
834 | "", | 878 | "", |
835 | "", | 879 | "", |
836 | "lsltext", | 880 | "lsltext", |
837 | "" | 881 | "" |
@@ -865,5 +909,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
865 | } | 909 | } |
866 | } | 910 | } |
867 | } | 911 | } |
868 | } | 912 | } \ No newline at end of file |
869 | |||