diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 1964 |
1 files changed, 997 insertions, 967 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 3a9e1c2..3dbd809 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -56,7 +56,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
56 | Something5 = 64, | 56 | Something5 = 64, |
57 | Something6 = 128 | 57 | Something6 = 128 |
58 | } | 58 | } |
59 | |||
60 | [Flags] | 59 | [Flags] |
61 | public enum Changed : uint | 60 | public enum Changed : uint |
62 | { | 61 | { |
@@ -69,7 +68,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
69 | ALLOWED_DROP = 64, | 68 | ALLOWED_DROP = 64, |
70 | OWNER = 128 | 69 | OWNER = 128 |
71 | } | 70 | } |
72 | |||
73 | [Flags] | 71 | [Flags] |
74 | public enum TextureAnimFlags : byte | 72 | public enum TextureAnimFlags : byte |
75 | { | 73 | { |
@@ -83,36 +81,70 @@ namespace OpenSim.Region.Environment.Scenes | |||
83 | SCALE = 0x40 | 81 | SCALE = 0x40 |
84 | } | 82 | } |
85 | 83 | ||
86 | 84 | ||
87 | [Serializable] | 85 | [Serializable] |
88 | public partial class SceneObjectPart : IScriptHost, ISerializable | 86 | public partial class SceneObjectPart : IScriptHost, ISerializable |
89 | { | 87 | { |
90 | public uint Category; | ||
91 | public Int32 CreationDate; | ||
92 | [XmlIgnore] public LLUUID fromAssetID = LLUUID.Zero; | ||
93 | public LLUUID GroupID; | ||
94 | public LLUUID LastOwnerID; | ||
95 | 88 | ||
89 | [XmlIgnore] public PhysicsActor PhysActor = null; | ||
90 | |||
91 | public LLUUID LastOwnerID; | ||
92 | public LLUUID OwnerID; | ||
93 | public LLUUID GroupID; | ||
94 | public int OwnershipCost; | ||
95 | public byte ObjectSaleType; | ||
96 | public int SalePrice; | ||
97 | public uint Category; | ||
98 | |||
96 | // TODO: This needs to be persisted in next XML version update! | 99 | // TODO: This needs to be persisted in next XML version update! |
100 | [XmlIgnore] public int[] PayPrice = {-2,-2,-2,-2,-2}; | ||
101 | [XmlIgnore] private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>(); | ||
102 | [XmlIgnore] public scriptEvents m_aggregateScriptEvents=0; | ||
97 | [XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None; | 103 | [XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None; |
98 | [XmlIgnore] public scriptEvents m_aggregateScriptEvents = 0; | ||
99 | 104 | ||
100 | 105 | ||
106 | [XmlIgnore] public bool m_IsAttachment = false; | ||
107 | [XmlIgnore] public uint m_attachmentPoint = (byte)0; | ||
101 | [XmlIgnore] public LLUUID m_attachedAvatar = LLUUID.Zero; | 108 | [XmlIgnore] public LLUUID m_attachedAvatar = LLUUID.Zero; |
102 | [XmlIgnore] public LLVector3 m_attachedPos = LLVector3.Zero; | 109 | [XmlIgnore] public LLVector3 m_attachedPos = LLVector3.Zero; |
103 | [XmlIgnore] public uint m_attachmentPoint = 0; | 110 | [XmlIgnore] public LLUUID fromAssetID = LLUUID.Zero; |
104 | [XmlIgnore] public bool m_IsAttachment; | 111 | |
112 | [XmlIgnore] public bool m_undoing = false; | ||
113 | |||
114 | public Int32 CreationDate; | ||
115 | public uint ParentID = 0; | ||
105 | 116 | ||
106 | private PhysicsVector m_lastRotationalVelocity = PhysicsVector.Zero; | 117 | private PhysicsVector m_lastRotationalVelocity = PhysicsVector.Zero; |
107 | protected SceneObjectGroup m_parentGroup; | 118 | private Vector3 m_sitTargetPosition = new Vector3(0, 0, 0); |
119 | private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1); | ||
120 | public LLUUID m_sitTargetAvatar = LLUUID.Zero; | ||
121 | [XmlIgnore] public PhysicsVector m_rotationAxis = new PhysicsVector(1f,1f,1f); | ||
122 | |||
123 | #region Permissions | ||
124 | |||
125 | public uint BaseMask = (uint)PermissionMask.All; | ||
126 | public uint OwnerMask = (uint)PermissionMask.All; | ||
127 | public uint GroupMask = (uint)PermissionMask.None; | ||
128 | public uint EveryoneMask = (uint)PermissionMask.None; | ||
129 | public uint NextOwnerMask = (uint)PermissionMask.All; | ||
130 | |||
131 | private UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | ||
132 | |||
133 | public LLObject.ObjectFlags Flags = LLObject.ObjectFlags.None; | ||
134 | |||
135 | public uint ObjectFlags | ||
136 | { | ||
137 | get { return (uint)Flags; } | ||
138 | set { Flags = (LLObject.ObjectFlags)value; } | ||
139 | } | ||
140 | |||
141 | #endregion | ||
108 | 142 | ||
109 | protected byte[] m_particleSystem = new byte[0]; | 143 | protected byte[] m_particleSystem = new byte[0]; |
110 | [XmlIgnore] public PhysicsVector m_rotationAxis = new PhysicsVector(1f, 1f, 1f); | 144 | |
111 | [XmlIgnore] private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>(); | 145 | [XmlIgnore] public uint TimeStampFull = 0; |
112 | public LLUUID m_sitTargetAvatar = LLUUID.Zero; | 146 | [XmlIgnore] public uint TimeStampTerse = 0; |
113 | private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1); | 147 | [XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn |
114 | private Vector3 m_sitTargetPosition = new Vector3(0, 0, 0); | ||
115 | [XmlIgnore] public bool m_undoing; | ||
116 | 148 | ||
117 | /// <summary> | 149 | /// <summary> |
118 | /// Only used internally to schedule client updates. | 150 | /// Only used internally to schedule client updates. |
@@ -124,44 +156,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
124 | /// </summary> | 156 | /// </summary> |
125 | private byte m_updateFlag; | 157 | private byte m_updateFlag; |
126 | 158 | ||
127 | public byte ObjectSaleType; | ||
128 | public LLUUID OwnerID; | ||
129 | public int OwnershipCost; | ||
130 | public uint ParentID; | ||
131 | [XmlIgnore] public int[] PayPrice = {-2, -2, -2, -2, -2}; | ||
132 | [XmlIgnore] public PhysicsActor PhysActor; | ||
133 | public int SalePrice; | ||
134 | |||
135 | [XmlIgnore] public uint TimeStampFull; | ||
136 | [XmlIgnore] public uint TimeStampLastActivity; // Will be used for AutoReturn | ||
137 | [XmlIgnore] public uint TimeStampTerse; | ||
138 | |||
139 | #region Properties | 159 | #region Properties |
140 | 160 | ||
141 | public LLUUID CreatorID; | 161 | public LLUUID CreatorID; |
142 | protected LLVector3 m_acceleration; | ||
143 | protected LLVector3 m_angularVelocity; | ||
144 | private byte m_clickAction; | ||
145 | private Color m_color = Color.Black; | ||
146 | private string m_description = String.Empty; | ||
147 | protected LLVector3 m_groupPosition; | ||
148 | private int m_linkNum; | ||
149 | 162 | ||
150 | protected uint m_localId; | 163 | public LLUUID ObjectCreator |
151 | protected LLObject.MaterialType m_material = 0; | 164 | { |
165 | get { return CreatorID; } | ||
166 | } | ||
152 | 167 | ||
153 | protected string m_name; | ||
154 | protected LLVector3 m_offsetPosition; | ||
155 | protected ulong m_regionHandle; | ||
156 | protected LLVector3 m_rotationalvelocity; | ||
157 | protected LLQuaternion m_rotationOffset; | ||
158 | protected PrimitiveBaseShape m_shape; | ||
159 | private string m_sitName = String.Empty; | ||
160 | private string m_text = String.Empty; | ||
161 | private byte[] m_TextureAnimation; | ||
162 | private string m_touchName = String.Empty; | ||
163 | protected LLUUID m_uuid; | 168 | protected LLUUID m_uuid; |
164 | protected LLVector3 m_velocity; | 169 | |
170 | public LLUUID UUID | ||
171 | { | ||
172 | get { return m_uuid; } | ||
173 | set { m_uuid = value; } | ||
174 | } | ||
175 | |||
176 | protected uint m_localId; | ||
165 | 177 | ||
166 | public uint LocalId | 178 | public uint LocalId |
167 | { | 179 | { |
@@ -169,23 +181,145 @@ namespace OpenSim.Region.Environment.Scenes | |||
169 | set { m_localId = value; } | 181 | set { m_localId = value; } |
170 | } | 182 | } |
171 | 183 | ||
172 | public scriptEvents ScriptEvents | 184 | protected string m_name; |
185 | |||
186 | public virtual string Name | ||
173 | { | 187 | { |
174 | get { return m_aggregateScriptEvents; } | 188 | get { return m_name; } |
189 | set { m_name = value; } | ||
175 | } | 190 | } |
176 | 191 | ||
192 | public scriptEvents ScriptEvents | ||
193 | { | ||
194 | get { return m_aggregateScriptEvents; } | ||
195 | } | ||
196 | |||
197 | protected LLObject.MaterialType m_material = 0; | ||
198 | |||
177 | public byte Material | 199 | public byte Material |
178 | { | 200 | { |
179 | get { return (byte) m_material; } | 201 | get { return (byte) m_material; } |
180 | set { m_material = (LLObject.MaterialType) value; } | 202 | set { m_material = (LLObject.MaterialType) value; } |
181 | } | 203 | } |
182 | 204 | ||
205 | protected ulong m_regionHandle; | ||
206 | |||
183 | public ulong RegionHandle | 207 | public ulong RegionHandle |
184 | { | 208 | { |
185 | get { return m_regionHandle; } | 209 | get { return m_regionHandle; } |
186 | set { m_regionHandle = value; } | 210 | set { m_regionHandle = value; } |
187 | } | 211 | } |
188 | 212 | ||
213 | public uint GetEffectiveObjectFlags() | ||
214 | { | ||
215 | LLObject.ObjectFlags f=Flags; | ||
216 | if(m_parentGroup == null || m_parentGroup.RootPart == this) | ||
217 | f &= ~(LLObject.ObjectFlags.Touch | LLObject.ObjectFlags.Money); | ||
218 | |||
219 | return (uint)Flags | (uint)LocalFlags; | ||
220 | } | ||
221 | |||
222 | //unkown if this will be kept, added as a way of removing the group position from the group class | ||
223 | protected LLVector3 m_groupPosition; | ||
224 | |||
225 | /// <summary> | ||
226 | /// Method for a prim to get it's world position from the group. | ||
227 | /// Remember, the Group Position simply gives the position of the group itself | ||
228 | /// </summary> | ||
229 | /// <returns>A Linked Child Prim objects position in world</returns> | ||
230 | public LLVector3 GetWorldPosition() | ||
231 | { | ||
232 | |||
233 | Quaternion parentRot = new Quaternion( | ||
234 | ParentGroup.RootPart.RotationOffset.W, | ||
235 | ParentGroup.RootPart.RotationOffset.X, | ||
236 | ParentGroup.RootPart.RotationOffset.Y, | ||
237 | ParentGroup.RootPart.RotationOffset.Z); | ||
238 | |||
239 | Vector3 axPos | ||
240 | = new Vector3( | ||
241 | OffsetPosition.X, | ||
242 | OffsetPosition.Y, | ||
243 | OffsetPosition.Z); | ||
244 | |||
245 | axPos = parentRot * axPos; | ||
246 | LLVector3 translationOffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); | ||
247 | return GroupPosition + translationOffsetPosition; | ||
248 | |||
249 | //return (new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z) + AbsolutePosition); | ||
250 | } | ||
251 | |||
252 | /// <summary> | ||
253 | /// Gets the rotation of this prim offset by the group rotation | ||
254 | /// </summary> | ||
255 | /// <returns></returns> | ||
256 | public LLQuaternion GetWorldRotation() | ||
257 | { | ||
258 | |||
259 | Quaternion newRot; | ||
260 | |||
261 | if (this.LinkNum == 0) | ||
262 | { | ||
263 | newRot = new Quaternion(RotationOffset.W,RotationOffset.X,RotationOffset.Y,RotationOffset.Z); | ||
264 | |||
265 | } | ||
266 | else | ||
267 | { | ||
268 | Quaternion parentRot = new Quaternion( | ||
269 | ParentGroup.RootPart.RotationOffset.W, | ||
270 | ParentGroup.RootPart.RotationOffset.X, | ||
271 | ParentGroup.RootPart.RotationOffset.Y, | ||
272 | ParentGroup.RootPart.RotationOffset.Z); | ||
273 | |||
274 | Quaternion oldRot | ||
275 | = new Quaternion( | ||
276 | RotationOffset.W, | ||
277 | RotationOffset.X, | ||
278 | RotationOffset.Y, | ||
279 | RotationOffset.Z); | ||
280 | |||
281 | newRot = parentRot * oldRot; | ||
282 | } | ||
283 | return new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); | ||
284 | |||
285 | //return new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w); | ||
286 | |||
287 | } | ||
288 | |||
289 | public void StoreUndoState() | ||
290 | { | ||
291 | if (!m_undoing) | ||
292 | { | ||
293 | if (m_parentGroup != null) | ||
294 | { | ||
295 | if (m_undo.Count > 0) | ||
296 | { | ||
297 | UndoState last = m_undo.Peek(); | ||
298 | if (last != null) | ||
299 | { | ||
300 | if (last.Compare(this)) | ||
301 | return; | ||
302 | } | ||
303 | } | ||
304 | |||
305 | |||
306 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
307 | { | ||
308 | UndoState nUndo = new UndoState(this); | ||
309 | |||
310 | m_undo.Push(nUndo); | ||
311 | |||
312 | } | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | |||
317 | public void ClearUndoState() | ||
318 | { | ||
319 | m_undo.Clear(); | ||
320 | StoreUndoState(); | ||
321 | } | ||
322 | |||
189 | public LLVector3 GroupPosition | 323 | public LLVector3 GroupPosition |
190 | { | 324 | { |
191 | get | 325 | get |
@@ -218,13 +352,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
218 | { | 352 | { |
219 | try | 353 | try |
220 | { | 354 | { |
355 | |||
221 | // Root prim actually goes at Position | 356 | // Root prim actually goes at Position |
222 | if (ParentID == 0) | 357 | if (ParentID == 0) |
223 | { | 358 | { |
224 | PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); | 359 | PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); |
360 | |||
225 | } | 361 | } |
226 | else | 362 | else |
227 | { | 363 | { |
364 | |||
228 | // To move the child prim in respect to the group position and rotation we have to calculate | 365 | // To move the child prim in respect to the group position and rotation we have to calculate |
229 | 366 | ||
230 | LLVector3 resultingposition = GetWorldPosition(); | 367 | LLVector3 resultingposition = GetWorldPosition(); |
@@ -232,7 +369,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
232 | LLQuaternion resultingrot = GetWorldRotation(); | 369 | LLQuaternion resultingrot = GetWorldRotation(); |
233 | PhysActor.Orientation = new Quaternion(resultingrot.W, resultingrot.X, resultingrot.Y, resultingrot.Z); | 370 | PhysActor.Orientation = new Quaternion(resultingrot.W, resultingrot.X, resultingrot.Y, resultingrot.Z); |
234 | } | 371 | } |
235 | 372 | ||
236 | // Tell the physics engines that this prim changed. | 373 | // Tell the physics engines that this prim changed. |
237 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 374 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); |
238 | } | 375 | } |
@@ -241,9 +378,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
241 | Console.WriteLine(e.Message); | 378 | Console.WriteLine(e.Message); |
242 | } | 379 | } |
243 | } | 380 | } |
381 | |||
244 | } | 382 | } |
245 | } | 383 | } |
246 | 384 | ||
385 | private byte[] m_TextureAnimation; | ||
386 | |||
387 | protected LLVector3 m_offsetPosition; | ||
388 | |||
247 | public LLVector3 OffsetPosition | 389 | public LLVector3 OffsetPosition |
248 | { | 390 | { |
249 | get { return m_offsetPosition; } | 391 | get { return m_offsetPosition; } |
@@ -251,19 +393,31 @@ namespace OpenSim.Region.Environment.Scenes | |||
251 | { | 393 | { |
252 | StoreUndoState(); | 394 | StoreUndoState(); |
253 | m_offsetPosition = value; | 395 | m_offsetPosition = value; |
254 | try | 396 | try |
255 | { | 397 | { |
256 | // Hack to get the child prim to update world positions in the physics engine | 398 | // Hack to get the child prim to update world positions in the physics engine |
257 | ParentGroup.ResetChildPrimPhysicsPositions(); | 399 | ParentGroup.ResetChildPrimPhysicsPositions(); |
258 | } | 400 | |
259 | catch (NullReferenceException) | 401 | } |
260 | { | 402 | catch (NullReferenceException) |
261 | // Ignore, and skip over. | 403 | { |
262 | } | 404 | // Ignore, and skip over. |
263 | //m_log.Info("[PART]: OFFSET:" + m_offsetPosition.ToString()); | 405 | } |
406 | //m_log.Info("[PART]: OFFSET:" + m_offsetPosition.ToString()); | ||
264 | } | 407 | } |
265 | } | 408 | } |
266 | 409 | ||
410 | public LLVector3 AbsolutePosition | ||
411 | { | ||
412 | get { | ||
413 | if (m_IsAttachment) | ||
414 | return GroupPosition; | ||
415 | |||
416 | return m_offsetPosition + m_groupPosition; } | ||
417 | } | ||
418 | |||
419 | protected LLQuaternion m_rotationOffset; | ||
420 | |||
267 | public LLQuaternion RotationOffset | 421 | public LLQuaternion RotationOffset |
268 | { | 422 | { |
269 | get | 423 | get |
@@ -312,9 +466,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
312 | Console.WriteLine(ex.Message); | 466 | Console.WriteLine(ex.Message); |
313 | } | 467 | } |
314 | } | 468 | } |
469 | |||
315 | } | 470 | } |
316 | } | 471 | } |
317 | 472 | ||
473 | protected LLVector3 m_velocity; | ||
474 | protected LLVector3 m_rotationalvelocity; | ||
475 | |||
318 | /// <summary></summary> | 476 | /// <summary></summary> |
319 | public LLVector3 Velocity | 477 | public LLVector3 Velocity |
320 | { | 478 | { |
@@ -335,8 +493,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
335 | 493 | ||
336 | return m_velocity; | 494 | return m_velocity; |
337 | } | 495 | } |
338 | set | 496 | set { |
339 | { | 497 | |
340 | m_velocity = value; | 498 | m_velocity = value; |
341 | if (PhysActor != null) | 499 | if (PhysActor != null) |
342 | { | 500 | { |
@@ -346,6 +504,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
346 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 504 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); |
347 | } | 505 | } |
348 | } | 506 | } |
507 | |||
349 | } | 508 | } |
350 | } | 509 | } |
351 | 510 | ||
@@ -360,7 +519,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
360 | { | 519 | { |
361 | if (PhysActor.IsPhysical) | 520 | if (PhysActor.IsPhysical) |
362 | { | 521 | { |
363 | m_rotationalvelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(), 0); | 522 | m_rotationalvelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(),0); |
364 | } | 523 | } |
365 | } | 524 | } |
366 | 525 | ||
@@ -370,6 +529,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
370 | } | 529 | } |
371 | 530 | ||
372 | 531 | ||
532 | protected LLVector3 m_angularVelocity; | ||
533 | |||
373 | /// <summary></summary> | 534 | /// <summary></summary> |
374 | public LLVector3 AngularVelocity | 535 | public LLVector3 AngularVelocity |
375 | { | 536 | { |
@@ -377,6 +538,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
377 | set { m_angularVelocity = value; } | 538 | set { m_angularVelocity = value; } |
378 | } | 539 | } |
379 | 540 | ||
541 | protected LLVector3 m_acceleration; | ||
542 | |||
380 | /// <summary></summary> | 543 | /// <summary></summary> |
381 | public LLVector3 Acceleration | 544 | public LLVector3 Acceleration |
382 | { | 545 | { |
@@ -384,6 +547,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
384 | set { m_acceleration = value; } | 547 | set { m_acceleration = value; } |
385 | } | 548 | } |
386 | 549 | ||
550 | private string m_description = String.Empty; | ||
551 | |||
552 | public string Description | ||
553 | { | ||
554 | get { return m_description; } | ||
555 | set { m_description = value; } | ||
556 | } | ||
557 | |||
558 | private Color m_color = Color.Black; | ||
559 | |||
387 | public Color Color | 560 | public Color Color |
388 | { | 561 | { |
389 | get { return m_color; } | 562 | get { return m_color; } |
@@ -391,7 +564,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
391 | { | 564 | { |
392 | m_color = value; | 565 | m_color = value; |
393 | TriggerScriptChangedEvent(Changed.COLOR); | 566 | TriggerScriptChangedEvent(Changed.COLOR); |
394 | 567 | ||
395 | /* ScheduleFullUpdate() need not be called b/c after | 568 | /* ScheduleFullUpdate() need not be called b/c after |
396 | * setting the color, the text will be set, so then | 569 | * setting the color, the text will be set, so then |
397 | * ScheduleFullUpdate() will be called. */ | 570 | * ScheduleFullUpdate() will be called. */ |
@@ -399,6 +572,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
399 | } | 572 | } |
400 | } | 573 | } |
401 | 574 | ||
575 | private string m_text = String.Empty; | ||
576 | |||
402 | public Vector3 SitTargetPosition | 577 | public Vector3 SitTargetPosition |
403 | { | 578 | { |
404 | get { return m_sitTargetPosition; } | 579 | get { return m_sitTargetPosition; } |
@@ -412,93 +587,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
412 | public string Text | 587 | public string Text |
413 | { | 588 | { |
414 | get { return m_text; } | 589 | get { return m_text; } |
415 | set { m_text = value; } | ||
416 | } | ||
417 | |||
418 | public int LinkNum | ||
419 | { | ||
420 | get { return m_linkNum; } | ||
421 | set | ||
422 | { | ||
423 | m_linkNum = value; | ||
424 | TriggerScriptChangedEvent(Changed.LINK); | ||
425 | } | ||
426 | } | ||
427 | |||
428 | public byte ClickAction | ||
429 | { | ||
430 | get { return m_clickAction; } | ||
431 | set { m_clickAction = value; } | ||
432 | } | ||
433 | |||
434 | public PrimitiveBaseShape Shape | ||
435 | { | ||
436 | get { return m_shape; } | ||
437 | set | ||
438 | { | ||
439 | m_shape = value; | ||
440 | TriggerScriptChangedEvent(Changed.SHAPE); | ||
441 | } | ||
442 | } | ||
443 | |||
444 | public LLVector3 Scale | ||
445 | { | ||
446 | get { return m_shape.Scale; } | ||
447 | set | 590 | set |
448 | { | 591 | { |
449 | StoreUndoState(); | 592 | m_text = value; |
450 | m_shape.Scale = value; | ||
451 | TriggerScriptChangedEvent(Changed.SCALE); | ||
452 | } | ||
453 | } | ||
454 | |||
455 | public bool Stopped | ||
456 | { | ||
457 | get | ||
458 | { | ||
459 | double threshold = 0.02; | ||
460 | return (Math.Abs(Velocity.X) < threshold && | ||
461 | Math.Abs(Velocity.Y) < threshold && | ||
462 | Math.Abs(Velocity.Z) < threshold && | ||
463 | Math.Abs(AngularVelocity.X) < threshold && | ||
464 | Math.Abs(AngularVelocity.Y) < threshold && | ||
465 | Math.Abs(AngularVelocity.Z) < threshold); | ||
466 | } | ||
467 | } | ||
468 | |||
469 | public LLUUID ObjectCreator | ||
470 | { | ||
471 | get { return CreatorID; } | ||
472 | } | ||
473 | |||
474 | public LLUUID UUID | ||
475 | { | ||
476 | get { return m_uuid; } | ||
477 | set { m_uuid = value; } | ||
478 | } | ||
479 | |||
480 | public virtual string Name | ||
481 | { | ||
482 | get { return m_name; } | ||
483 | set { m_name = value; } | ||
484 | } | ||
485 | |||
486 | public LLVector3 AbsolutePosition | ||
487 | { | ||
488 | get | ||
489 | { | ||
490 | if (m_IsAttachment) | ||
491 | return GroupPosition; | ||
492 | |||
493 | return m_offsetPosition + m_groupPosition; | ||
494 | } | 593 | } |
495 | } | 594 | } |
496 | 595 | ||
497 | public string Description | 596 | private string m_sitName = String.Empty; |
498 | { | ||
499 | get { return m_description; } | ||
500 | set { m_description = value; } | ||
501 | } | ||
502 | 597 | ||
503 | public string SitName | 598 | public string SitName |
504 | { | 599 | { |
@@ -506,113 +601,39 @@ namespace OpenSim.Region.Environment.Scenes | |||
506 | set { m_sitName = value; } | 601 | set { m_sitName = value; } |
507 | } | 602 | } |
508 | 603 | ||
604 | private string m_touchName = String.Empty; | ||
605 | |||
509 | public string TouchName | 606 | public string TouchName |
510 | { | 607 | { |
511 | get { return m_touchName; } | 608 | get { return m_touchName; } |
512 | set { m_touchName = value; } | 609 | set { m_touchName = value; } |
513 | } | 610 | } |
514 | 611 | ||
515 | public uint GetEffectiveObjectFlags() | 612 | private int m_linkNum = 0; |
516 | { | ||
517 | LLObject.ObjectFlags f = Flags; | ||
518 | if (m_parentGroup == null || m_parentGroup.RootPart == this) | ||
519 | f &= ~(LLObject.ObjectFlags.Touch | LLObject.ObjectFlags.Money); | ||
520 | |||
521 | return (uint) Flags | (uint) LocalFlags; | ||
522 | } | ||
523 | |||
524 | /// <summary> | ||
525 | /// Method for a prim to get it's world position from the group. | ||
526 | /// Remember, the Group Position simply gives the position of the group itself | ||
527 | /// </summary> | ||
528 | /// <returns>A Linked Child Prim objects position in world</returns> | ||
529 | public LLVector3 GetWorldPosition() | ||
530 | { | ||
531 | Quaternion parentRot = new Quaternion( | ||
532 | ParentGroup.RootPart.RotationOffset.W, | ||
533 | ParentGroup.RootPart.RotationOffset.X, | ||
534 | ParentGroup.RootPart.RotationOffset.Y, | ||
535 | ParentGroup.RootPart.RotationOffset.Z); | ||
536 | |||
537 | Vector3 axPos | ||
538 | = new Vector3( | ||
539 | OffsetPosition.X, | ||
540 | OffsetPosition.Y, | ||
541 | OffsetPosition.Z); | ||
542 | |||
543 | axPos = parentRot * axPos; | ||
544 | LLVector3 translationOffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); | ||
545 | return GroupPosition + translationOffsetPosition; | ||
546 | |||
547 | //return (new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z) + AbsolutePosition); | ||
548 | } | ||
549 | 613 | ||
550 | /// <summary> | 614 | public int LinkNum |
551 | /// Gets the rotation of this prim offset by the group rotation | ||
552 | /// </summary> | ||
553 | /// <returns></returns> | ||
554 | public LLQuaternion GetWorldRotation() | ||
555 | { | 615 | { |
556 | Quaternion newRot; | 616 | get { return m_linkNum; } |
557 | 617 | set | |
558 | if (LinkNum == 0) | 618 | { |
559 | { | 619 | m_linkNum = value; |
560 | newRot = new Quaternion(RotationOffset.W, RotationOffset.X, RotationOffset.Y, RotationOffset.Z); | 620 | TriggerScriptChangedEvent(Changed.LINK); |
561 | } | 621 | |
562 | else | ||
563 | { | ||
564 | Quaternion parentRot = new Quaternion( | ||
565 | ParentGroup.RootPart.RotationOffset.W, | ||
566 | ParentGroup.RootPart.RotationOffset.X, | ||
567 | ParentGroup.RootPart.RotationOffset.Y, | ||
568 | ParentGroup.RootPart.RotationOffset.Z); | ||
569 | |||
570 | Quaternion oldRot | ||
571 | = new Quaternion( | ||
572 | RotationOffset.W, | ||
573 | RotationOffset.X, | ||
574 | RotationOffset.Y, | ||
575 | RotationOffset.Z); | ||
576 | |||
577 | newRot = parentRot * oldRot; | ||
578 | } | 622 | } |
579 | return new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); | ||
580 | |||
581 | //return new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w); | ||
582 | } | 623 | } |
583 | 624 | ||
584 | public void StoreUndoState() | 625 | private byte m_clickAction = 0; |
626 | |||
627 | public byte ClickAction | ||
585 | { | 628 | { |
586 | if (!m_undoing) | 629 | get { return m_clickAction; } |
630 | set | ||
587 | { | 631 | { |
588 | if (m_parentGroup != null) | 632 | m_clickAction = value; |
589 | { | ||
590 | if (m_undo.Count > 0) | ||
591 | { | ||
592 | UndoState last = m_undo.Peek(); | ||
593 | if (last != null) | ||
594 | { | ||
595 | if (last.Compare(this)) | ||
596 | return; | ||
597 | } | ||
598 | } | ||
599 | |||
600 | |||
601 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
602 | { | ||
603 | UndoState nUndo = new UndoState(this); | ||
604 | |||
605 | m_undo.Push(nUndo); | ||
606 | } | ||
607 | } | ||
608 | } | 633 | } |
609 | } | 634 | } |
610 | 635 | ||
611 | public void ClearUndoState() | 636 | protected PrimitiveBaseShape m_shape; |
612 | { | ||
613 | m_undo.Clear(); | ||
614 | StoreUndoState(); | ||
615 | } | ||
616 | 637 | ||
617 | /// <summary> | 638 | /// <summary> |
618 | /// hook to the physics scene to apply impulse | 639 | /// hook to the physics scene to apply impulse |
@@ -624,17 +645,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
624 | public void ApplyImpulse(LLVector3 impulsei, bool localGlobalTF) | 645 | public void ApplyImpulse(LLVector3 impulsei, bool localGlobalTF) |
625 | { | 646 | { |
626 | PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); | 647 | PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); |
627 | 648 | ||
628 | if (localGlobalTF) | 649 | if (localGlobalTF) |
629 | { | 650 | { |
651 | |||
630 | LLQuaternion grot = GetWorldRotation(); | 652 | LLQuaternion grot = GetWorldRotation(); |
631 | Quaternion AXgrot = new Quaternion(grot.W, grot.X, grot.Y, grot.Z); | 653 | Quaternion AXgrot = new Quaternion(grot.W,grot.X,grot.Y,grot.Z); |
632 | Vector3 AXimpulsei = new Vector3(impulsei.X, impulsei.Y, impulsei.Z); | 654 | Vector3 AXimpulsei = new Vector3(impulsei.X, impulsei.Y, impulsei.Z); |
633 | Vector3 newimpulse = AXgrot * AXimpulsei; | 655 | Vector3 newimpulse = AXgrot * AXimpulsei; |
634 | impulse = new PhysicsVector(newimpulse.x, newimpulse.y, newimpulse.z); | 656 | impulse = new PhysicsVector(newimpulse.x, newimpulse.y, newimpulse.z); |
657 | |||
635 | } | 658 | } |
636 | else | 659 | else |
637 | { | 660 | { |
661 | |||
638 | if (m_parentGroup != null) | 662 | if (m_parentGroup != null) |
639 | { | 663 | { |
640 | m_parentGroup.applyImpulse(impulse); | 664 | m_parentGroup.applyImpulse(impulse); |
@@ -652,6 +676,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
652 | { | 676 | { |
653 | StopMoveToTarget(); | 677 | StopMoveToTarget(); |
654 | } | 678 | } |
679 | |||
655 | } | 680 | } |
656 | 681 | ||
657 | public void StopMoveToTarget() | 682 | public void StopMoveToTarget() |
@@ -664,48 +689,56 @@ namespace OpenSim.Region.Environment.Scenes | |||
664 | if (m_parentGroup != null) | 689 | if (m_parentGroup != null) |
665 | { | 690 | { |
666 | if (m_parentGroup.Scene != null) | 691 | if (m_parentGroup.Scene != null) |
667 | m_parentGroup.Scene.TriggerObjectChanged(LocalId, (uint) val); | 692 | m_parentGroup.Scene.TriggerObjectChanged(LocalId, (uint)val); |
668 | } | 693 | } |
669 | } | ||
670 | |||
671 | #endregion | ||
672 | |||
673 | #region Permissions | ||
674 | |||
675 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | ||
676 | public uint BaseMask = (uint) PermissionMask.All; | ||
677 | public uint EveryoneMask = (uint) PermissionMask.None; | ||
678 | 694 | ||
679 | public LLObject.ObjectFlags Flags = LLObject.ObjectFlags.None; | 695 | } |
680 | public uint GroupMask = (uint) PermissionMask.None; | ||
681 | public uint NextOwnerMask = (uint) PermissionMask.All; | ||
682 | public uint OwnerMask = (uint) PermissionMask.All; | ||
683 | 696 | ||
684 | public uint ObjectFlags | 697 | public PrimitiveBaseShape Shape |
685 | { | 698 | { |
686 | get { return (uint) Flags; } | 699 | get { return m_shape; } |
687 | set { Flags = (LLObject.ObjectFlags) value; } | 700 | set |
701 | { | ||
702 | |||
703 | m_shape = value; | ||
704 | TriggerScriptChangedEvent(Changed.SHAPE); | ||
705 | } | ||
688 | } | 706 | } |
689 | 707 | ||
690 | #endregion | 708 | public LLVector3 Scale |
691 | |||
692 | protected SceneObjectPart(SerializationInfo info, StreamingContext context) | ||
693 | { | 709 | { |
694 | //System.Console.WriteLine("SceneObjectPart Deserialize BGN"); | 710 | get { return m_shape.Scale; } |
695 | 711 | set | |
696 | if (info == null) | ||
697 | { | 712 | { |
698 | throw new ArgumentNullException("info"); | 713 | StoreUndoState(); |
714 | m_shape.Scale = value; | ||
715 | TriggerScriptChangedEvent(Changed.SCALE); | ||
699 | } | 716 | } |
717 | } | ||
700 | 718 | ||
701 | /* | 719 | public bool Stopped |
702 | m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>)); | 720 | { |
703 | m_ids = (List<LLUUID>)info.GetValue("m_ids", typeof(List<LLUUID>)); | 721 | get { |
704 | */ | 722 | double threshold = 0.02; |
723 | return (Math.Abs(Velocity.X) < threshold && | ||
724 | Math.Abs(Velocity.Y) < threshold && | ||
725 | Math.Abs(Velocity.Z) < threshold && | ||
726 | Math.Abs(AngularVelocity.X) < threshold && | ||
727 | Math.Abs(AngularVelocity.Y) < threshold && | ||
728 | Math.Abs(AngularVelocity.Z) < threshold); | ||
729 | } | ||
730 | } | ||
705 | 731 | ||
706 | //System.Console.WriteLine("SceneObjectPart Deserialize END"); | 732 | #endregion |
733 | |||
734 | public LLUUID ObjectOwner | ||
735 | { | ||
736 | get { return OwnerID; } | ||
707 | } | 737 | } |
708 | 738 | ||
739 | // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out. | ||
740 | protected SceneObjectGroup m_parentGroup; | ||
741 | |||
709 | public SceneObjectGroup ParentGroup | 742 | public SceneObjectGroup ParentGroup |
710 | { | 743 | { |
711 | get { return m_parentGroup; } | 744 | get { return m_parentGroup; } |
@@ -725,7 +758,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
725 | public SceneObjectPart() | 758 | public SceneObjectPart() |
726 | { | 759 | { |
727 | // It's not necessary to persist this | 760 | // It's not necessary to persist this |
728 | m_inventoryFileName = "inventory_" + LLUUID.Random() + ".tmp"; | 761 | m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; |
729 | m_TextureAnimation = new byte[0]; | 762 | m_TextureAnimation = new byte[0]; |
730 | } | 763 | } |
731 | 764 | ||
@@ -757,13 +790,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
757 | CreatorID = OwnerID; | 790 | CreatorID = OwnerID; |
758 | LastOwnerID = LLUUID.Zero; | 791 | LastOwnerID = LLUUID.Zero; |
759 | UUID = LLUUID.Random(); | 792 | UUID = LLUUID.Random(); |
760 | LocalId = (localID); | 793 | LocalId = (uint) (localID); |
761 | Shape = shape; | 794 | Shape = shape; |
762 | // Todo: Add More Object Parameter from above! | 795 | // Todo: Add More Object Parameter from above! |
763 | OwnershipCost = 0; | 796 | OwnershipCost = 0; |
764 | ObjectSaleType = 0; | 797 | ObjectSaleType = (byte) 0; |
765 | SalePrice = 0; | 798 | SalePrice = 0; |
766 | Category = 0; | 799 | Category = (uint) 0; |
767 | LastOwnerID = CreatorID; | 800 | LastOwnerID = CreatorID; |
768 | // End Todo: /// | 801 | // End Todo: /// |
769 | GroupPosition = groupPosition; | 802 | GroupPosition = groupPosition; |
@@ -774,20 +807,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
774 | AngularVelocity = new LLVector3(0, 0, 0); | 807 | AngularVelocity = new LLVector3(0, 0, 0); |
775 | Acceleration = new LLVector3(0, 0, 0); | 808 | Acceleration = new LLVector3(0, 0, 0); |
776 | m_TextureAnimation = new byte[0]; | 809 | m_TextureAnimation = new byte[0]; |
777 | m_inventoryFileName = "inventory_" + LLUUID.Random() + ".tmp"; | 810 | m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; |
778 | 811 | ||
779 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, | 812 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, |
780 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from | 813 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from |
781 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log | 814 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log |
782 | m_folderID = UUID; | 815 | m_folderID = UUID; |
783 | 816 | ||
784 | Flags = 0; | 817 | Flags = 0; |
785 | Flags |= LLObject.ObjectFlags.AllowInventoryDrop | | 818 | Flags |= LLObject.ObjectFlags.AllowInventoryDrop | |
786 | LLObject.ObjectFlags.CreateSelected; | 819 | LLObject.ObjectFlags.CreateSelected; |
787 | 820 | ||
788 | TrimPermissions(); | 821 | TrimPermissions(); |
789 | //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); | 822 | //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); |
790 | 823 | ||
791 | ScheduleFullUpdate(); | 824 | ScheduleFullUpdate(); |
792 | } | 825 | } |
793 | 826 | ||
@@ -813,149 +846,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
813 | CreatorID = creatorID; | 846 | CreatorID = creatorID; |
814 | LastOwnerID = lastOwnerID; | 847 | LastOwnerID = lastOwnerID; |
815 | UUID = LLUUID.Random(); | 848 | UUID = LLUUID.Random(); |
816 | LocalId = (localID); | 849 | LocalId = (uint) (localID); |
817 | Shape = shape; | 850 | Shape = shape; |
818 | OwnershipCost = 0; | 851 | OwnershipCost = 0; |
819 | ObjectSaleType = 0; | 852 | ObjectSaleType = (byte) 0; |
820 | SalePrice = 0; | 853 | SalePrice = 0; |
821 | Category = 0; | 854 | Category = (uint) 0; |
822 | LastOwnerID = CreatorID; | 855 | LastOwnerID = CreatorID; |
823 | OffsetPosition = position; | 856 | OffsetPosition = position; |
824 | RotationOffset = rotation; | 857 | RotationOffset = rotation; |
825 | ObjectFlags = flags; | 858 | ObjectFlags = flags; |
826 | 859 | ||
827 | // Since we don't store script state, this is only a 'temporary' objectflag now | 860 | // Since we don't store script state, this is only a 'temporary' objectflag now |
828 | // If the object is scripted, the script will get loaded and this will be set again | 861 | // If the object is scripted, the script will get loaded and this will be set again |
829 | ObjectFlags &= ~(uint) (LLObject.ObjectFlags.Scripted | LLObject.ObjectFlags.Touch); | 862 | ObjectFlags &= ~(uint)(LLObject.ObjectFlags.Scripted | LLObject.ObjectFlags.Touch); |
830 | 863 | ||
831 | TrimPermissions(); | 864 | TrimPermissions(); |
832 | // ApplyPhysics(); | 865 | // ApplyPhysics(); |
833 | 866 | ||
834 | ScheduleFullUpdate(); | 867 | ScheduleFullUpdate(); |
835 | } | 868 | } |
836 | 869 | ||
837 | #endregion | 870 | #endregion |
838 | 871 | ||
839 | #region IScriptHost Members | ||
840 | |||
841 | public LLUUID ObjectOwner | ||
842 | { | ||
843 | get { return OwnerID; } | ||
844 | } | ||
845 | |||
846 | public void SetText(string text, Vector3 color, double alpha) | ||
847 | { | ||
848 | Color = Color.FromArgb(0xff - (int) (alpha * 0xff), | ||
849 | (int) (color.x * 0xff), | ||
850 | (int) (color.y * 0xff), | ||
851 | (int) (color.z * 0xff)); | ||
852 | SetText(text); | ||
853 | } | ||
854 | |||
855 | #endregion | ||
856 | |||
857 | #region ISerializable Members | ||
858 | |||
859 | [SecurityPermission(SecurityAction.LinkDemand, | ||
860 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
861 | public virtual void GetObjectData( | ||
862 | SerializationInfo info, StreamingContext context) | ||
863 | { | ||
864 | if (info == null) | ||
865 | { | ||
866 | throw new ArgumentNullException("info"); | ||
867 | } | ||
868 | |||
869 | info.AddValue("m_inventoryFileName", m_inventoryFileName); | ||
870 | info.AddValue("m_folderID", m_folderID.UUID); | ||
871 | info.AddValue("PhysActor", PhysActor); | ||
872 | |||
873 | Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>(); | ||
874 | |||
875 | foreach (LLUUID id in TaskInventory.Keys) | ||
876 | { | ||
877 | TaskInventory_work.Add(id.UUID, TaskInventory[id]); | ||
878 | } | ||
879 | |||
880 | info.AddValue("TaskInventory", TaskInventory_work); | ||
881 | |||
882 | info.AddValue("LastOwnerID", LastOwnerID.UUID); | ||
883 | info.AddValue("OwnerID", OwnerID.UUID); | ||
884 | info.AddValue("GroupID", GroupID.UUID); | ||
885 | |||
886 | info.AddValue("OwnershipCost", OwnershipCost); | ||
887 | info.AddValue("ObjectSaleType", ObjectSaleType); | ||
888 | info.AddValue("SalePrice", SalePrice); | ||
889 | info.AddValue("Category", Category); | ||
890 | |||
891 | info.AddValue("CreationDate", CreationDate); | ||
892 | info.AddValue("ParentID", ParentID); | ||
893 | |||
894 | info.AddValue("OwnerMask", OwnerMask); | ||
895 | info.AddValue("NextOwnerMask", NextOwnerMask); | ||
896 | info.AddValue("GroupMask", GroupMask); | ||
897 | info.AddValue("EveryoneMask", EveryoneMask); | ||
898 | info.AddValue("BaseMask", BaseMask); | ||
899 | |||
900 | info.AddValue("m_particleSystem", m_particleSystem); | ||
901 | |||
902 | info.AddValue("TimeStampFull", TimeStampFull); | ||
903 | info.AddValue("TimeStampTerse", TimeStampTerse); | ||
904 | info.AddValue("TimeStampLastActivity", TimeStampLastActivity); | ||
905 | |||
906 | info.AddValue("m_updateFlag", m_updateFlag); | ||
907 | info.AddValue("CreatorID", CreatorID.UUID); | ||
908 | |||
909 | info.AddValue("m_inventorySerial", m_inventorySerial); | ||
910 | info.AddValue("m_uuid", m_uuid.UUID); | ||
911 | info.AddValue("m_localID", m_localId); | ||
912 | info.AddValue("m_name", m_name); | ||
913 | info.AddValue("m_flags", Flags); | ||
914 | info.AddValue("m_material", m_material); | ||
915 | info.AddValue("m_regionHandle", m_regionHandle); | ||
916 | |||
917 | info.AddValue("m_groupPosition.X", m_groupPosition.X); | ||
918 | info.AddValue("m_groupPosition.Y", m_groupPosition.Y); | ||
919 | info.AddValue("m_groupPosition.Z", m_groupPosition.Z); | ||
920 | |||
921 | info.AddValue("m_offsetPosition.X", m_offsetPosition.X); | ||
922 | info.AddValue("m_offsetPosition.Y", m_offsetPosition.Y); | ||
923 | info.AddValue("m_offsetPosition.Z", m_offsetPosition.Z); | ||
924 | |||
925 | info.AddValue("m_rotationOffset.W", m_rotationOffset.W); | ||
926 | info.AddValue("m_rotationOffset.X", m_rotationOffset.X); | ||
927 | info.AddValue("m_rotationOffset.Y", m_rotationOffset.Y); | ||
928 | info.AddValue("m_rotationOffset.Z", m_rotationOffset.Z); | ||
929 | |||
930 | info.AddValue("m_velocity.X", m_velocity.X); | ||
931 | info.AddValue("m_velocity.Y", m_velocity.Y); | ||
932 | info.AddValue("m_velocity.Z", m_velocity.Z); | ||
933 | |||
934 | info.AddValue("m_rotationalvelocity.X", m_rotationalvelocity.X); | ||
935 | info.AddValue("m_rotationalvelocity.Y", m_rotationalvelocity.Y); | ||
936 | info.AddValue("m_rotationalvelocity.Z", m_rotationalvelocity.Z); | ||
937 | |||
938 | info.AddValue("m_angularVelocity.X", m_angularVelocity.X); | ||
939 | info.AddValue("m_angularVelocity.Y", m_angularVelocity.Y); | ||
940 | info.AddValue("m_angularVelocity.Z", m_angularVelocity.Z); | ||
941 | |||
942 | info.AddValue("m_acceleration.X", m_acceleration.X); | ||
943 | info.AddValue("m_acceleration.Y", m_acceleration.Y); | ||
944 | info.AddValue("m_acceleration.Z", m_acceleration.Z); | ||
945 | |||
946 | info.AddValue("m_description", m_description); | ||
947 | info.AddValue("m_color", m_color); | ||
948 | info.AddValue("m_text", m_text); | ||
949 | info.AddValue("m_sitName", m_sitName); | ||
950 | info.AddValue("m_touchName", m_touchName); | ||
951 | info.AddValue("m_clickAction", m_clickAction); | ||
952 | info.AddValue("m_shape", m_shape); | ||
953 | info.AddValue("m_parentGroup", m_parentGroup); | ||
954 | info.AddValue("PayPrice", PayPrice); | ||
955 | } | ||
956 | |||
957 | #endregion | ||
958 | |||
959 | /// <summary> | 872 | /// <summary> |
960 | /// Restore this part from the serialized xml representation. | 873 | /// Restore this part from the serialized xml representation. |
961 | /// </summary> | 874 | /// </summary> |
@@ -968,9 +881,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
968 | 881 | ||
969 | return newobject; | 882 | return newobject; |
970 | } | 883 | } |
971 | 884 | ||
972 | public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim) | 885 | public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim) |
973 | { | 886 | { |
887 | |||
974 | bool isPhysical = (((rootObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0) && m_physicalPrim); | 888 | bool isPhysical = (((rootObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0) && m_physicalPrim); |
975 | bool isPhantom = ((rootObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0); | 889 | bool isPhantom = ((rootObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0); |
976 | 890 | ||
@@ -988,7 +902,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
988 | new PhysicsVector(Scale.X, Scale.Y, Scale.Z), | 902 | new PhysicsVector(Scale.X, Scale.Y, Scale.Z), |
989 | new Quaternion(RotationOffset.W, RotationOffset.X, | 903 | new Quaternion(RotationOffset.W, RotationOffset.X, |
990 | RotationOffset.Y, RotationOffset.Z), RigidBody); | 904 | RotationOffset.Y, RotationOffset.Z), RigidBody); |
991 | 905 | ||
992 | // Basic Physics returns null.. joy joy joy. | 906 | // Basic Physics returns null.. joy joy joy. |
993 | if (PhysActor != null) | 907 | if (PhysActor != null) |
994 | { | 908 | { |
@@ -1004,15 +918,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
1004 | OwnerMask = NextOwnerMask; | 918 | OwnerMask = NextOwnerMask; |
1005 | 919 | ||
1006 | TriggerScriptChangedEvent(Changed.OWNER); | 920 | TriggerScriptChangedEvent(Changed.OWNER); |
921 | |||
1007 | } | 922 | } |
1008 | 923 | ||
1009 | public void TrimPermissions() | 924 | public void TrimPermissions() |
1010 | { | 925 | { |
1011 | BaseMask &= (uint) PermissionMask.All; | 926 | |
1012 | OwnerMask &= (uint) PermissionMask.All; | 927 | BaseMask &= (uint)PermissionMask.All; |
1013 | GroupMask &= (uint) PermissionMask.All; | 928 | OwnerMask &= (uint)PermissionMask.All; |
1014 | EveryoneMask &= (uint) PermissionMask.All; | 929 | GroupMask &= (uint)PermissionMask.All; |
1015 | NextOwnerMask &= (uint) PermissionMask.All; | 930 | EveryoneMask &= (uint)PermissionMask.All; |
931 | NextOwnerMask &= (uint)PermissionMask.All; | ||
932 | |||
1016 | } | 933 | } |
1017 | 934 | ||
1018 | /// <summary> | 935 | /// <summary> |
@@ -1046,24 +963,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
1046 | Vector3 rOrigin = iray.Origin; | 963 | Vector3 rOrigin = iray.Origin; |
1047 | Vector3 rDirection = iray.Direction; | 964 | Vector3 rDirection = iray.Direction; |
1048 | 965 | ||
966 | |||
1049 | 967 | ||
1050 | //rDirection = rDirection.Normalize(); | 968 | //rDirection = rDirection.Normalize(); |
1051 | // Buidling the first part of the Quadratic equation | 969 | // Buidling the first part of the Quadratic equation |
1052 | Vector3 r2ndDirection = rDirection * rDirection; | 970 | Vector3 r2ndDirection = rDirection*rDirection; |
1053 | float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z; | 971 | float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z; |
1054 | 972 | ||
1055 | // Buidling the second part of the Quadratic equation | 973 | // Buidling the second part of the Quadratic equation |
1056 | Vector3 tmVal2 = rOrigin - vAbsolutePosition; | 974 | Vector3 tmVal2 = rOrigin - vAbsolutePosition; |
1057 | Vector3 r2Direction = rDirection * 2.0f; | 975 | Vector3 r2Direction = rDirection*2.0f; |
1058 | Vector3 tmVal3 = r2Direction * tmVal2; | 976 | Vector3 tmVal3 = r2Direction*tmVal2; |
1059 | 977 | ||
1060 | float itestPart2 = tmVal3.x + tmVal3.y + tmVal3.z; | 978 | float itestPart2 = tmVal3.x + tmVal3.y + tmVal3.z; |
1061 | 979 | ||
1062 | // Buidling the third part of the Quadratic equation | 980 | // Buidling the third part of the Quadratic equation |
1063 | Vector3 tmVal4 = rOrigin * rOrigin; | 981 | Vector3 tmVal4 = rOrigin*rOrigin; |
1064 | Vector3 tmVal5 = vAbsolutePosition * vAbsolutePosition; | 982 | Vector3 tmVal5 = vAbsolutePosition*vAbsolutePosition; |
1065 | 983 | ||
1066 | Vector3 tmVal6 = vAbsolutePosition * rOrigin; | 984 | Vector3 tmVal6 = vAbsolutePosition*rOrigin; |
1067 | 985 | ||
1068 | 986 | ||
1069 | // Set Radius to the largest dimention of the prim | 987 | // Set Radius to the largest dimention of the prim |
@@ -1085,21 +1003,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
1085 | //radius = radius; | 1003 | //radius = radius; |
1086 | 1004 | ||
1087 | float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z - | 1005 | float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z - |
1088 | (2.0f * (tmVal6.x + tmVal6.y + tmVal6.z + (radius * radius))); | 1006 | (2.0f*(tmVal6.x + tmVal6.y + tmVal6.z + (radius*radius))); |
1089 | 1007 | ||
1090 | // Yuk Quadradrics.. Solve first | 1008 | // Yuk Quadradrics.. Solve first |
1091 | float rootsqr = (itestPart2 * itestPart2) - (4.0f * itestPart1 * itestPart3); | 1009 | float rootsqr = (itestPart2*itestPart2) - (4.0f*itestPart1*itestPart3); |
1092 | if (rootsqr < 0.0f) | 1010 | if (rootsqr < 0.0f) |
1093 | { | 1011 | { |
1094 | // No intersection | 1012 | // No intersection |
1095 | return returnresult; | 1013 | return returnresult; |
1096 | } | 1014 | } |
1097 | float root = ((-itestPart2) - (float) Math.Sqrt(rootsqr)) / (itestPart1 * 2.0f); | 1015 | float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); |
1098 | 1016 | ||
1099 | if (root < 0.0f) | 1017 | if (root < 0.0f) |
1100 | { | 1018 | { |
1101 | // perform second quadratic root solution | 1019 | // perform second quadratic root solution |
1102 | root = ((-itestPart2) + (float) Math.Sqrt(rootsqr)) / (itestPart1 * 2.0f); | 1020 | root = ((-itestPart2) + (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); |
1103 | 1021 | ||
1104 | // is there any intersection? | 1022 | // is there any intersection? |
1105 | if (root < 0.0f) | 1023 | if (root < 0.0f) |
@@ -1112,8 +1030,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1112 | // We got an intersection. putting together an EntityIntersection object with the | 1030 | // We got an intersection. putting together an EntityIntersection object with the |
1113 | // intersection information | 1031 | // intersection information |
1114 | Vector3 ipoint = | 1032 | Vector3 ipoint = |
1115 | new Vector3(iray.Origin.x + (iray.Direction.x * root), iray.Origin.y + (iray.Direction.y * root), | 1033 | new Vector3(iray.Origin.x + (iray.Direction.x*root), iray.Origin.y + (iray.Direction.y*root), |
1116 | iray.Origin.z + (iray.Direction.z * root)); | 1034 | iray.Origin.z + (iray.Direction.z*root)); |
1117 | 1035 | ||
1118 | returnresult.HitTF = true; | 1036 | returnresult.HitTF = true; |
1119 | returnresult.ipoint = ipoint; | 1037 | returnresult.ipoint = ipoint; |
@@ -1174,7 +1092,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1174 | 1092 | ||
1175 | // Variables prefixed with AX are Axiom.Math copies of the LL variety. | 1093 | // Variables prefixed with AX are Axiom.Math copies of the LL variety. |
1176 | 1094 | ||
1177 | Quaternion AXrot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); | 1095 | Quaternion AXrot = new Quaternion(rot.W,rot.X,rot.Y,rot.Z); |
1178 | AXrot.Normalize(); | 1096 | AXrot.Normalize(); |
1179 | 1097 | ||
1180 | Vector3 AXpos = new Vector3(pos.X, pos.Y, pos.Z); | 1098 | Vector3 AXpos = new Vector3(pos.X, pos.Y, pos.Z); |
@@ -1183,33 +1101,31 @@ namespace OpenSim.Region.Environment.Scenes | |||
1183 | // it's different for each vertex because we've got to rotate it | 1101 | // it's different for each vertex because we've got to rotate it |
1184 | // to get the world position of the vertex to produce the Oriented Bounding Box | 1102 | // to get the world position of the vertex to produce the Oriented Bounding Box |
1185 | 1103 | ||
1186 | Vector3 tScale = new Vector3(); | 1104 | Vector3 tScale = new Vector3(); |
1187 | 1105 | ||
1188 | Vector3 AXscale = new Vector3(m_shape.Scale.X * 0.5f, m_shape.Scale.Y * 0.5f, m_shape.Scale.Z * 0.5f); | 1106 | Vector3 AXscale = new Vector3(m_shape.Scale.X * 0.5f, m_shape.Scale.Y * 0.5f, m_shape.Scale.Z * 0.5f); |
1189 | 1107 | ||
1190 | //Vector3 pScale = (AXscale) - (AXrot.Inverse() * (AXscale)); | 1108 | //Vector3 pScale = (AXscale) - (AXrot.Inverse() * (AXscale)); |
1191 | //Vector3 nScale = (AXscale * -1) - (AXrot.Inverse() * (AXscale * -1)); | 1109 | //Vector3 nScale = (AXscale * -1) - (AXrot.Inverse() * (AXscale * -1)); |
1192 | 1110 | ||
1193 | // rScale is the rotated offset to find a vertex based on the scale and the world rotation. | 1111 | // rScale is the rotated offset to find a vertex based on the scale and the world rotation. |
1194 | Vector3 rScale = new Vector3(); | 1112 | Vector3 rScale = new Vector3(); |
1195 | 1113 | ||
1196 | // Get Vertexes for Faces Stick them into ABCD for each Face | 1114 | // Get Vertexes for Faces Stick them into ABCD for each Face |
1197 | // Form: Face<vertex>[face] that corresponds to the below diagram | 1115 | // Form: Face<vertex>[face] that corresponds to the below diagram |
1198 | |||
1199 | #region ABCD Face Vertex Map Comment Diagram | 1116 | #region ABCD Face Vertex Map Comment Diagram |
1200 | |||
1201 | // A _________ B | 1117 | // A _________ B |
1202 | // | | | 1118 | // | | |
1203 | // | 4 top | | 1119 | // | 4 top | |
1204 | // |_________| | 1120 | // |_________| |
1205 | // C D | 1121 | // C D |
1206 | 1122 | ||
1207 | // A _________ B | 1123 | // A _________ B |
1208 | // | Back | | 1124 | // | Back | |
1209 | // | 3 | | 1125 | // | 3 | |
1210 | // |_________| | 1126 | // |_________| |
1211 | // C D | 1127 | // C D |
1212 | 1128 | ||
1213 | // A _________ B B _________ A | 1129 | // A _________ B B _________ A |
1214 | // | Left | | Right | | 1130 | // | Left | | Right | |
1215 | // | 0 | | 2 | | 1131 | // | 0 | | 2 | |
@@ -1227,15 +1143,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1227 | // | 5 bot | | 1143 | // | 5 bot | |
1228 | // |_________| | 1144 | // |_________| |
1229 | // A B | 1145 | // A B |
1230 | |||
1231 | #endregion | 1146 | #endregion |
1232 | 1147 | ||
1233 | #region Plane Decomposition of Oriented Bounding Box | 1148 | #region Plane Decomposition of Oriented Bounding Box |
1234 | |||
1235 | tScale = new Vector3(AXscale.x, -AXscale.y, AXscale.z); | 1149 | tScale = new Vector3(AXscale.x, -AXscale.y, AXscale.z); |
1236 | rScale = ((AXrot * tScale)); | 1150 | rScale = ((AXrot * tScale)); |
1237 | vertexes[0] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1151 | vertexes[0] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1238 | // vertexes[0].x = pos.X + vertexes[0].x; | 1152 | // vertexes[0].x = pos.X + vertexes[0].x; |
1239 | //vertexes[0].y = pos.Y + vertexes[0].y; | 1153 | //vertexes[0].y = pos.Y + vertexes[0].y; |
1240 | //vertexes[0].z = pos.Z + vertexes[0].z; | 1154 | //vertexes[0].z = pos.Z + vertexes[0].z; |
1241 | 1155 | ||
@@ -1247,8 +1161,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1247 | rScale = ((AXrot * tScale)); | 1161 | rScale = ((AXrot * tScale)); |
1248 | vertexes[1] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1162 | vertexes[1] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1249 | 1163 | ||
1250 | // vertexes[1].x = pos.X + vertexes[1].x; | 1164 | // vertexes[1].x = pos.X + vertexes[1].x; |
1251 | // vertexes[1].y = pos.Y + vertexes[1].y; | 1165 | // vertexes[1].y = pos.Y + vertexes[1].y; |
1252 | //vertexes[1].z = pos.Z + vertexes[1].z; | 1166 | //vertexes[1].z = pos.Z + vertexes[1].z; |
1253 | 1167 | ||
1254 | FaceB[0] = vertexes[1]; | 1168 | FaceB[0] = vertexes[1]; |
@@ -1273,8 +1187,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1273 | vertexes[3] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1187 | vertexes[3] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1274 | 1188 | ||
1275 | //vertexes[3].x = pos.X + vertexes[3].x; | 1189 | //vertexes[3].x = pos.X + vertexes[3].x; |
1276 | // vertexes[3].y = pos.Y + vertexes[3].y; | 1190 | // vertexes[3].y = pos.Y + vertexes[3].y; |
1277 | // vertexes[3].z = pos.Z + vertexes[3].z; | 1191 | // vertexes[3].z = pos.Z + vertexes[3].z; |
1278 | 1192 | ||
1279 | FaceD[0] = vertexes[3]; | 1193 | FaceD[0] = vertexes[3]; |
1280 | FaceC[1] = vertexes[3]; | 1194 | FaceC[1] = vertexes[3]; |
@@ -1284,9 +1198,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1284 | rScale = ((AXrot * tScale)); | 1198 | rScale = ((AXrot * tScale)); |
1285 | vertexes[4] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1199 | vertexes[4] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1286 | 1200 | ||
1287 | // vertexes[4].x = pos.X + vertexes[4].x; | 1201 | // vertexes[4].x = pos.X + vertexes[4].x; |
1288 | // vertexes[4].y = pos.Y + vertexes[4].y; | 1202 | // vertexes[4].y = pos.Y + vertexes[4].y; |
1289 | // vertexes[4].z = pos.Z + vertexes[4].z; | 1203 | // vertexes[4].z = pos.Z + vertexes[4].z; |
1290 | 1204 | ||
1291 | FaceB[1] = vertexes[4]; | 1205 | FaceB[1] = vertexes[4]; |
1292 | FaceA[2] = vertexes[4]; | 1206 | FaceA[2] = vertexes[4]; |
@@ -1296,9 +1210,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1296 | rScale = ((AXrot * tScale)); | 1210 | rScale = ((AXrot * tScale)); |
1297 | vertexes[5] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1211 | vertexes[5] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1298 | 1212 | ||
1299 | // vertexes[5].x = pos.X + vertexes[5].x; | 1213 | // vertexes[5].x = pos.X + vertexes[5].x; |
1300 | // vertexes[5].y = pos.Y + vertexes[5].y; | 1214 | // vertexes[5].y = pos.Y + vertexes[5].y; |
1301 | // vertexes[5].z = pos.Z + vertexes[5].z; | 1215 | // vertexes[5].z = pos.Z + vertexes[5].z; |
1302 | 1216 | ||
1303 | FaceD[1] = vertexes[5]; | 1217 | FaceD[1] = vertexes[5]; |
1304 | FaceC[2] = vertexes[5]; | 1218 | FaceC[2] = vertexes[5]; |
@@ -1308,9 +1222,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1308 | rScale = ((AXrot * tScale)); | 1222 | rScale = ((AXrot * tScale)); |
1309 | vertexes[6] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1223 | vertexes[6] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1310 | 1224 | ||
1311 | // vertexes[6].x = pos.X + vertexes[6].x; | 1225 | // vertexes[6].x = pos.X + vertexes[6].x; |
1312 | // vertexes[6].y = pos.Y + vertexes[6].y; | 1226 | // vertexes[6].y = pos.Y + vertexes[6].y; |
1313 | // vertexes[6].z = pos.Z + vertexes[6].z; | 1227 | // vertexes[6].z = pos.Z + vertexes[6].z; |
1314 | 1228 | ||
1315 | FaceB[2] = vertexes[6]; | 1229 | FaceB[2] = vertexes[6]; |
1316 | FaceA[3] = vertexes[6]; | 1230 | FaceA[3] = vertexes[6]; |
@@ -1320,36 +1234,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
1320 | rScale = ((AXrot * tScale)); | 1234 | rScale = ((AXrot * tScale)); |
1321 | vertexes[7] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1235 | vertexes[7] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1322 | 1236 | ||
1323 | // vertexes[7].x = pos.X + vertexes[7].x; | 1237 | // vertexes[7].x = pos.X + vertexes[7].x; |
1324 | // vertexes[7].y = pos.Y + vertexes[7].y; | 1238 | // vertexes[7].y = pos.Y + vertexes[7].y; |
1325 | // vertexes[7].z = pos.Z + vertexes[7].z; | 1239 | // vertexes[7].z = pos.Z + vertexes[7].z; |
1326 | 1240 | ||
1327 | FaceD[2] = vertexes[7]; | 1241 | FaceD[2] = vertexes[7]; |
1328 | FaceC[3] = vertexes[7]; | 1242 | FaceC[3] = vertexes[7]; |
1329 | FaceD[5] = vertexes[7]; | 1243 | FaceD[5] = vertexes[7]; |
1330 | |||
1331 | #endregion | 1244 | #endregion |
1332 | 1245 | ||
1333 | // Get our plane normals | 1246 | // Get our plane normals |
1334 | for (int i = 0; i < 6; i++) | 1247 | for (int i = 0; i < 6; i++) |
1335 | { | 1248 | { |
1336 | //m_log.Info("[FACECALCULATION]: FaceA[" + i + "]=" + FaceA[i] + " FaceB[" + i + "]=" + FaceB[i] + " FaceC[" + i + "]=" + FaceC[i] + " FaceD[" + i + "]=" + FaceD[i]); | 1249 | //m_log.Info("[FACECALCULATION]: FaceA[" + i + "]=" + FaceA[i] + " FaceB[" + i + "]=" + FaceB[i] + " FaceC[" + i + "]=" + FaceC[i] + " FaceD[" + i + "]=" + FaceD[i]); |
1337 | 1250 | ||
1338 | // Our Plane direction | 1251 | // Our Plane direction |
1339 | AmBa = FaceA[i] - FaceB[i]; | 1252 | AmBa = FaceA[i] - FaceB[i]; |
1340 | AmBb = FaceB[i] - FaceC[i]; | 1253 | AmBb = FaceB[i] - FaceC[i]; |
1341 | 1254 | ||
1342 | cross = AmBb.Cross(AmBa); | 1255 | cross = AmBb.Cross(AmBa); |
1343 | 1256 | ||
1344 | // normalize the cross product to get the normal. | 1257 | // normalize the cross product to get the normal. |
1345 | normals[i] = cross / cross.Length; | 1258 | normals[i] = cross / cross.Length; |
1346 | 1259 | ||
1347 | //m_log.Info("[NORMALS]: normals[ " + i + "]" + normals[i].ToString()); | 1260 | //m_log.Info("[NORMALS]: normals[ " + i + "]" + normals[i].ToString()); |
1348 | //distance[i] = (normals[i].x * AmBa.x + normals[i].y * AmBa.y + normals[i].z * AmBa.z) * -1; | 1261 | //distance[i] = (normals[i].x * AmBa.x + normals[i].y * AmBa.y + normals[i].z * AmBa.z) * -1; |
1349 | } | 1262 | } |
1350 | 1263 | ||
1351 | EntityIntersection returnresult = new EntityIntersection(); | 1264 | EntityIntersection returnresult = new EntityIntersection(); |
1352 | 1265 | ||
1353 | returnresult.distance = 1024; | 1266 | returnresult.distance = 1024; |
1354 | float c = 0; | 1267 | float c = 0; |
1355 | float a = 0; | 1268 | float a = 0; |
@@ -1357,59 +1270,57 @@ namespace OpenSim.Region.Environment.Scenes | |||
1357 | Vector3 q = new Vector3(); | 1270 | Vector3 q = new Vector3(); |
1358 | 1271 | ||
1359 | #region OBB Version 2 Experiment | 1272 | #region OBB Version 2 Experiment |
1360 | |||
1361 | //float fmin = 999999; | 1273 | //float fmin = 999999; |
1362 | //float fmax = -999999; | 1274 | //float fmax = -999999; |
1363 | //float s = 0; | 1275 | //float s = 0; |
1364 | 1276 | ||
1365 | //for (int i=0;i<6;i++) | 1277 | //for (int i=0;i<6;i++) |
1366 | //{ | 1278 | //{ |
1367 | //s = iray.Direction.Dot(normals[i]); | 1279 | //s = iray.Direction.Dot(normals[i]); |
1368 | //d = normals[i].Dot(FaceB[i]); | 1280 | //d = normals[i].Dot(FaceB[i]); |
1369 | 1281 | ||
1370 | //if (s == 0) | 1282 | //if (s == 0) |
1371 | //{ | 1283 | //{ |
1372 | //if (iray.Origin.Dot(normals[i]) > d) | 1284 | //if (iray.Origin.Dot(normals[i]) > d) |
1373 | //{ | 1285 | //{ |
1374 | //return returnresult; | 1286 | //return returnresult; |
1375 | //} | 1287 | //} |
1376 | // else | 1288 | // else |
1377 | //{ | 1289 | //{ |
1378 | //continue; | 1290 | //continue; |
1379 | //} | 1291 | //} |
1380 | //} | 1292 | //} |
1381 | //a = (d - iray.Origin.Dot(normals[i])) / s; | 1293 | //a = (d - iray.Origin.Dot(normals[i])) / s; |
1382 | //if ( iray.Direction.Dot(normals[i]) < 0) | 1294 | //if ( iray.Direction.Dot(normals[i]) < 0) |
1383 | //{ | 1295 | //{ |
1384 | //if (a > fmax) | 1296 | //if (a > fmax) |
1385 | //{ | 1297 | //{ |
1386 | //if (a > fmin) | 1298 | //if (a > fmin) |
1387 | //{ | 1299 | //{ |
1388 | //return returnresult; | 1300 | //return returnresult; |
1389 | //} | 1301 | //} |
1390 | //fmax = a; | 1302 | //fmax = a; |
1391 | //} | 1303 | //} |
1392 | 1304 | ||
1393 | //} | 1305 | //} |
1394 | //else | 1306 | //else |
1395 | //{ | 1307 | //{ |
1396 | //if (a < fmin) | 1308 | //if (a < fmin) |
1397 | //{ | 1309 | //{ |
1398 | //if (a < 0 || a < fmax) | 1310 | //if (a < 0 || a < fmax) |
1399 | //{ | 1311 | //{ |
1400 | //return returnresult; | 1312 | //return returnresult; |
1401 | //} | 1313 | //} |
1402 | //fmin = a; | 1314 | //fmin = a; |
1403 | //} | 1315 | //} |
1404 | //} | 1316 | //} |
1405 | //} | 1317 | //} |
1406 | //if (fmax > 0) | 1318 | //if (fmax > 0) |
1407 | // a= fmax; | 1319 | // a= fmax; |
1408 | //else | 1320 | //else |
1409 | // a=fmin; | 1321 | // a=fmin; |
1410 | 1322 | ||
1411 | //q = iray.Origin + a * iray.Direction; | 1323 | //q = iray.Origin + a * iray.Direction; |
1412 | |||
1413 | #endregion | 1324 | #endregion |
1414 | 1325 | ||
1415 | // Loop over faces (6 of them) | 1326 | // Loop over faces (6 of them) |
@@ -1430,6 +1341,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1430 | // If the normal is pointing outside the object | 1341 | // If the normal is pointing outside the object |
1431 | if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) | 1342 | if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) |
1432 | { | 1343 | { |
1344 | |||
1433 | if (faceCenters) | 1345 | if (faceCenters) |
1434 | { | 1346 | { |
1435 | q = AXpos + a * AAfacenormals[i]; //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; | 1347 | q = AXpos + a * AAfacenormals[i]; //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; |
@@ -1439,13 +1351,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1439 | q = iray.Origin + a * iray.Direction; | 1351 | q = iray.Origin + a * iray.Direction; |
1440 | } | 1352 | } |
1441 | 1353 | ||
1442 | float distance2 = (float) GetDistanceTo(q, AXpos); | 1354 | float distance2 = (float)GetDistanceTo(q, AXpos); |
1443 | // Is this the closest hit to the object's origin? | 1355 | // Is this the closest hit to the object's origin? |
1444 | if (faceCenters) | 1356 | if (faceCenters) |
1445 | { | 1357 | { |
1446 | distance2 = (float) GetDistanceTo(q, iray.Origin); | 1358 | distance2 = (float)GetDistanceTo(q, iray.Origin); |
1447 | } | 1359 | } |
1448 | 1360 | ||
1449 | 1361 | ||
1450 | if (distance2 < returnresult.distance) | 1362 | if (distance2 < returnresult.distance) |
1451 | { | 1363 | { |
@@ -1456,12 +1368,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1456 | //m_log.Info("[POINT]: " + q.ToString()); | 1368 | //m_log.Info("[POINT]: " + q.ToString()); |
1457 | returnresult.normal = normals[i]; | 1369 | returnresult.normal = normals[i]; |
1458 | returnresult.AAfaceNormal = AAfacenormals[i]; | 1370 | returnresult.AAfaceNormal = AAfacenormals[i]; |
1371 | |||
1459 | } | 1372 | } |
1460 | } | 1373 | } |
1374 | |||
1461 | } | 1375 | } |
1462 | return returnresult; | 1376 | return returnresult; |
1463 | } | 1377 | } |
1464 | 1378 | ||
1465 | // Use this for attachments! LocalID should be avatar's localid | 1379 | // Use this for attachments! LocalID should be avatar's localid |
1466 | public void SetParentLocalId(uint localID) | 1380 | public void SetParentLocalId(uint localID) |
1467 | { | 1381 | { |
@@ -1471,14 +1385,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1471 | public void SetAttachmentPoint(uint AttachmentPoint) | 1385 | public void SetAttachmentPoint(uint AttachmentPoint) |
1472 | { | 1386 | { |
1473 | m_attachmentPoint = AttachmentPoint; | 1387 | m_attachmentPoint = AttachmentPoint; |
1474 | 1388 | ||
1475 | // save the attachment point. | 1389 | // save the attachment point. |
1476 | //if (AttachmentPoint != 0) | 1390 | //if (AttachmentPoint != 0) |
1477 | //{ | 1391 | //{ |
1478 | m_shape.State = (byte) AttachmentPoint; | 1392 | m_shape.State = (byte)AttachmentPoint; |
1479 | //} | 1393 | //} |
1394 | |||
1480 | } | 1395 | } |
1481 | |||
1482 | /// <summary> | 1396 | /// <summary> |
1483 | /// | 1397 | /// |
1484 | /// </summary> | 1398 | /// </summary> |
@@ -1500,12 +1414,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1500 | PhysActor.Buoyancy = fvalue; | 1414 | PhysActor.Buoyancy = fvalue; |
1501 | } | 1415 | } |
1502 | } | 1416 | } |
1503 | 1417 | ||
1504 | public void SetAxisRotation(int axis, int rotate) | 1418 | public void SetAxisRotation(int axis, int rotate) |
1505 | { | 1419 | { |
1506 | if (m_parentGroup != null) | 1420 | if (m_parentGroup != null) |
1507 | { | 1421 | { |
1508 | m_parentGroup.SetAxisRotation(axis, rotate); | 1422 | m_parentGroup.SetAxisRotation(axis, rotate); |
1423 | |||
1509 | } | 1424 | } |
1510 | } | 1425 | } |
1511 | 1426 | ||
@@ -1527,9 +1442,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1527 | { | 1442 | { |
1528 | PhysActor.FloatOnWater = false; | 1443 | PhysActor.FloatOnWater = false; |
1529 | } | 1444 | } |
1445 | |||
1530 | } | 1446 | } |
1531 | } | 1447 | } |
1532 | 1448 | ||
1533 | 1449 | ||
1534 | public LLVector3 GetSitTargetPositionLL() | 1450 | public LLVector3 GetSitTargetPositionLL() |
1535 | { | 1451 | { |
@@ -1600,403 +1516,66 @@ namespace OpenSim.Region.Environment.Scenes | |||
1600 | return part; | 1516 | return part; |
1601 | } | 1517 | } |
1602 | 1518 | ||
1603 | /// <summary> | 1519 | #region Copying |
1604 | /// Reset LLUUIDs for this part. This involves generate this part's own LLUUID and | ||
1605 | /// generating new LLUUIDs for all the items in the inventory. | ||
1606 | /// </summary> | ||
1607 | /// <param name="linkNum">Link number for the part</param> | ||
1608 | public void ResetIDs(int linkNum) | ||
1609 | { | ||
1610 | UUID = LLUUID.Random(); | ||
1611 | LinkNum = linkNum; | ||
1612 | |||
1613 | ResetInventoryIDs(); | ||
1614 | } | ||
1615 | |||
1616 | public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF) | ||
1617 | { | ||
1618 | bool set = addRemTF == 1; | ||
1619 | |||
1620 | // Are we the owner? | ||
1621 | if (AgentID == OwnerID) | ||
1622 | { | ||
1623 | switch (field) | ||
1624 | { | ||
1625 | case 2: | ||
1626 | OwnerMask = ApplyMask(OwnerMask, set, mask); | ||
1627 | break; | ||
1628 | case 4: | ||
1629 | GroupMask = ApplyMask(GroupMask, set, mask); | ||
1630 | break; | ||
1631 | case 8: | ||
1632 | EveryoneMask = ApplyMask(EveryoneMask, set, mask); | ||
1633 | break; | ||
1634 | case 16: | ||
1635 | NextOwnerMask = ApplyMask(NextOwnerMask, set, mask); | ||
1636 | break; | ||
1637 | } | ||
1638 | SendFullUpdateToAllClients(); | ||
1639 | |||
1640 | SendObjectPropertiesToClient(AgentID); | ||
1641 | } | ||
1642 | } | ||
1643 | |||
1644 | private void SendObjectPropertiesToClient(LLUUID AgentID) | ||
1645 | { | ||
1646 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
1647 | for (int i = 0; i < avatars.Count; i++) | ||
1648 | { | ||
1649 | // Ugly reference :( | ||
1650 | if (avatars[i].UUID == AgentID) | ||
1651 | { | ||
1652 | m_parentGroup.GetProperties(avatars[i].ControllingClient); | ||
1653 | } | ||
1654 | } | ||
1655 | } | ||
1656 | |||
1657 | private uint ApplyMask(uint val, bool set, uint mask) | ||
1658 | { | ||
1659 | if (set) | ||
1660 | { | ||
1661 | return val |= mask; | ||
1662 | } | ||
1663 | else | ||
1664 | { | ||
1665 | return val &= ~mask; | ||
1666 | } | ||
1667 | } | ||
1668 | |||
1669 | public virtual void UpdateMovement() | ||
1670 | { | ||
1671 | } | ||
1672 | |||
1673 | public void PhysicsOutOfBounds(PhysicsVector pos) | ||
1674 | { | ||
1675 | m_log.Info("[PHYSICS]: Physical Object went out of bounds."); | ||
1676 | RemFlag(LLObject.ObjectFlags.Physics); | ||
1677 | DoPhysicsPropertyUpdate(false, true); | ||
1678 | //m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
1679 | } | ||
1680 | |||
1681 | public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) | ||
1682 | { | ||
1683 | } | ||
1684 | |||
1685 | |||
1686 | public void SetText(string text) | ||
1687 | { | ||
1688 | Text = text; | ||
1689 | ScheduleFullUpdate(); | ||
1690 | } | ||
1691 | |||
1692 | public int registerTargetWaypoint(LLVector3 target, float tolerance) | ||
1693 | { | ||
1694 | if (m_parentGroup != null) | ||
1695 | { | ||
1696 | return m_parentGroup.registerTargetWaypoint(target, tolerance); | ||
1697 | } | ||
1698 | return 0; | ||
1699 | } | ||
1700 | |||
1701 | public void unregisterTargetWaypoint(int handle) | ||
1702 | { | ||
1703 | if (m_parentGroup != null) | ||
1704 | { | ||
1705 | m_parentGroup.unregisterTargetWaypoint(handle); | ||
1706 | } | ||
1707 | } | ||
1708 | |||
1709 | |||
1710 | public void Undo() | ||
1711 | { | ||
1712 | if (m_undo.Count > 0) | ||
1713 | { | ||
1714 | UndoState goback = m_undo.Pop(); | ||
1715 | if (goback != null) | ||
1716 | goback.PlaybackState(this); | ||
1717 | } | ||
1718 | } | ||
1719 | |||
1720 | public void SetScriptEvents(LLUUID scriptid, int events) | ||
1721 | { | ||
1722 | scriptEvents oldparts; | ||
1723 | lock (m_scriptEvents) | ||
1724 | { | ||
1725 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
1726 | { | ||
1727 | oldparts = m_scriptEvents[scriptid]; | ||
1728 | |||
1729 | // remove values from aggregated script events | ||
1730 | m_scriptEvents[scriptid] = (scriptEvents) events; | ||
1731 | } | ||
1732 | else | ||
1733 | { | ||
1734 | m_scriptEvents.Add(scriptid, (scriptEvents) events); | ||
1735 | } | ||
1736 | } | ||
1737 | aggregateScriptEvents(); | ||
1738 | } | ||
1739 | |||
1740 | public void RemoveScriptEvents(LLUUID scriptid) | ||
1741 | { | ||
1742 | lock (m_scriptEvents) | ||
1743 | { | ||
1744 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
1745 | { | ||
1746 | scriptEvents oldparts = scriptEvents.None; | ||
1747 | oldparts = m_scriptEvents[scriptid]; | ||
1748 | |||
1749 | // remove values from aggregated script events | ||
1750 | m_aggregateScriptEvents &= ~oldparts; | ||
1751 | m_scriptEvents.Remove(scriptid); | ||
1752 | } | ||
1753 | } | ||
1754 | aggregateScriptEvents(); | ||
1755 | } | ||
1756 | |||
1757 | public void aggregateScriptEvents() | ||
1758 | { | ||
1759 | // Aggregate script events | ||
1760 | lock (m_scriptEvents) | ||
1761 | { | ||
1762 | foreach (scriptEvents s in m_scriptEvents.Values) | ||
1763 | { | ||
1764 | m_aggregateScriptEvents |= s; | ||
1765 | } | ||
1766 | } | ||
1767 | |||
1768 | uint objectflagupdate = 0; | ||
1769 | |||
1770 | if ( | ||
1771 | ((m_aggregateScriptEvents & scriptEvents.touch) != 0) || | ||
1772 | ((m_aggregateScriptEvents & scriptEvents.touch_end) != 0) || | ||
1773 | ((m_aggregateScriptEvents & scriptEvents.touch_start) != 0) | ||
1774 | ) | ||
1775 | { | ||
1776 | objectflagupdate |= (uint) LLObject.ObjectFlags.Touch; | ||
1777 | } | ||
1778 | |||
1779 | if ((m_aggregateScriptEvents & scriptEvents.money) != 0) | ||
1780 | { | ||
1781 | objectflagupdate |= (uint) LLObject.ObjectFlags.Money; | ||
1782 | } | ||
1783 | |||
1784 | if ( | ||
1785 | ((m_aggregateScriptEvents & scriptEvents.collision) != 0) || | ||
1786 | ((m_aggregateScriptEvents & scriptEvents.collision_end) != 0) || | ||
1787 | ((m_aggregateScriptEvents & scriptEvents.collision_start) != 0) | ||
1788 | ) | ||
1789 | { | ||
1790 | // subscribe to physics updates. | ||
1791 | } | ||
1792 | |||
1793 | LocalFlags = (LLObject.ObjectFlags) objectflagupdate; | ||
1794 | |||
1795 | if (m_parentGroup != null && m_parentGroup.RootPart == this) | ||
1796 | m_parentGroup.aggregateScriptEvents(); | ||
1797 | else | ||
1798 | ScheduleFullUpdate(); | ||
1799 | } | ||
1800 | |||
1801 | #region Events | ||
1802 | |||
1803 | public void PhysicsRequestingTerseUpdate() | ||
1804 | { | ||
1805 | if (PhysActor != null) | ||
1806 | { | ||
1807 | LLVector3 newpos = new LLVector3(PhysActor.Position.GetBytes(), 0); | ||
1808 | if (newpos.X > 257f || newpos.X < -1f || newpos.Y > 257f || newpos.Y < -1f) | ||
1809 | { | ||
1810 | m_parentGroup.AbsolutePosition = newpos; | ||
1811 | return; | ||
1812 | } | ||
1813 | } | ||
1814 | ScheduleTerseUpdate(); | ||
1815 | |||
1816 | //SendTerseUpdateToAllClients(); | ||
1817 | } | ||
1818 | |||
1819 | #endregion | ||
1820 | |||
1821 | #region Client Update Methods | ||
1822 | |||
1823 | /// <summary> | ||
1824 | /// Tell all scene presences that they should send updates for this part to their clients | ||
1825 | /// </summary> | ||
1826 | public void AddFullUpdateToAllAvatars() | ||
1827 | { | ||
1828 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
1829 | for (int i = 0; i < avatars.Count; i++) | ||
1830 | { | ||
1831 | avatars[i].QueuePartForUpdate(this); | ||
1832 | } | ||
1833 | } | ||
1834 | |||
1835 | public void SendFullUpdateToAllClientsExcept(LLUUID agentID) | ||
1836 | { | ||
1837 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
1838 | for (int i = 0; i < avatars.Count; i++) | ||
1839 | { | ||
1840 | // Ugly reference :( | ||
1841 | if (avatars[i].UUID != agentID) | ||
1842 | { | ||
1843 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, | ||
1844 | avatars[i].GenerateClientFlags(UUID)); | ||
1845 | } | ||
1846 | } | ||
1847 | } | ||
1848 | |||
1849 | |||
1850 | public void AddFullUpdateToAvatar(ScenePresence presence) | ||
1851 | { | ||
1852 | presence.QueuePartForUpdate(this); | ||
1853 | } | ||
1854 | |||
1855 | /// <summary> | ||
1856 | /// | ||
1857 | /// </summary> | ||
1858 | public void SendFullUpdateToAllClients() | ||
1859 | { | ||
1860 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
1861 | for (int i = 0; i < avatars.Count; i++) | ||
1862 | { | ||
1863 | // Ugly reference :( | ||
1864 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, | ||
1865 | avatars[i].GenerateClientFlags(UUID)); | ||
1866 | } | ||
1867 | } | ||
1868 | |||
1869 | /// <summary> | ||
1870 | /// | ||
1871 | /// </summary> | ||
1872 | /// <param name="remoteClient"></param> | ||
1873 | public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) | ||
1874 | { | ||
1875 | m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); | ||
1876 | } | ||
1877 | |||
1878 | /// <summary> | ||
1879 | /// Sends a full update to the client | ||
1880 | /// </summary> | ||
1881 | /// <param name="remoteClient"></param> | ||
1882 | /// <param name="clientFlags"></param> | ||
1883 | public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientflags) | ||
1884 | { | ||
1885 | LLVector3 lPos; | ||
1886 | lPos = OffsetPosition; | ||
1887 | SendFullUpdateToClient(remoteClient, lPos, clientflags); | ||
1888 | } | ||
1889 | 1520 | ||
1890 | /// <summary> | 1521 | /// <summary> |
1891 | /// Sends a full update to the client | 1522 | /// Duplicates this part. |
1892 | /// </summary> | 1523 | /// </summary> |
1893 | /// <param name="remoteClient"></param> | 1524 | /// <returns></returns> |
1894 | /// <param name="lPos"></param> | 1525 | public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID, int linkNum) |
1895 | /// <param name="clientFlags"></param> | ||
1896 | public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos, uint clientFlags) | ||
1897 | { | 1526 | { |
1898 | LLQuaternion lRot; | 1527 | SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone(); |
1899 | lRot = RotationOffset; | 1528 | dupe.m_shape = m_shape.Copy(); |
1900 | clientFlags &= ~(uint) LLObject.ObjectFlags.CreateSelected; | 1529 | dupe.m_regionHandle = m_regionHandle; |
1901 | 1530 | dupe.UUID = LLUUID.Random(); | |
1902 | if (remoteClient.AgentId == OwnerID) | 1531 | dupe.LocalId = localID; |
1903 | { | 1532 | dupe.OwnerID = AgentID; |
1904 | if ((uint) (Flags & LLObject.ObjectFlags.CreateSelected) != 0) | 1533 | dupe.GroupID = GroupID; |
1905 | { | 1534 | dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z); |
1906 | clientFlags |= (uint) LLObject.ObjectFlags.CreateSelected; | 1535 | dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); |
1907 | Flags &= ~LLObject.ObjectFlags.CreateSelected; | 1536 | dupe.RotationOffset = |
1908 | } | 1537 | new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); |
1909 | } | 1538 | dupe.Velocity = new LLVector3(0, 0, 0); |
1910 | 1539 | dupe.Acceleration = new LLVector3(0, 0, 0); | |
1540 | dupe.AngularVelocity = new LLVector3(0, 0, 0); | ||
1541 | dupe.ObjectFlags = ObjectFlags; | ||
1911 | 1542 | ||
1912 | byte[] color = new[] {m_color.R, m_color.G, m_color.B, m_color.A}; | 1543 | dupe.OwnershipCost = OwnershipCost; |
1913 | remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, m_shape, lPos, clientFlags, | 1544 | dupe.ObjectSaleType = ObjectSaleType; |
1914 | m_uuid, | 1545 | dupe.SalePrice = SalePrice; |
1915 | OwnerID, | 1546 | dupe.Category = Category; |
1916 | m_text, color, ParentID, m_particleSystem, lRot, m_clickAction, m_TextureAnimation, m_IsAttachment, | 1547 | |
1917 | m_attachmentPoint, fromAssetID); | 1548 | dupe.TaskInventory = (TaskInventoryDictionary)dupe.TaskInventory.Clone(); |
1918 | } | 1549 | |
1550 | dupe.ResetIDs(linkNum); | ||
1919 | 1551 | ||
1920 | /// Terse updates | 1552 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
1921 | public void AddTerseUpdateToAllAvatars() | 1553 | dupe.LastOwnerID = ObjectOwner; |
1922 | { | ||
1923 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
1924 | for (int i = 0; i < avatars.Count; i++) | ||
1925 | { | ||
1926 | avatars[i].QueuePartForUpdate(this); | ||
1927 | } | ||
1928 | } | ||
1929 | 1554 | ||
1930 | public void AddTerseUpdateToAvatar(ScenePresence presence) | 1555 | byte[] extraP = new byte[Shape.ExtraParams.Length]; |
1931 | { | 1556 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); |
1932 | presence.QueuePartForUpdate(this); | 1557 | dupe.Shape.ExtraParams = extraP; |
1933 | } | 1558 | bool UsePhysics = ((dupe.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); |
1559 | dupe.DoPhysicsPropertyUpdate(UsePhysics, true); | ||
1934 | 1560 | ||
1935 | /// <summary> | 1561 | return dupe; |
1936 | /// | ||
1937 | /// </summary> | ||
1938 | public void SendTerseUpdateToAllClients() | ||
1939 | { | ||
1940 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
1941 | for (int i = 0; i < avatars.Count; i++) | ||
1942 | { | ||
1943 | m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); | ||
1944 | } | ||
1945 | } | 1562 | } |
1946 | 1563 | ||
1564 | #endregion | ||
1565 | |||
1947 | /// <summary> | 1566 | /// <summary> |
1948 | /// Send a terse update to the client. | 1567 | /// Reset LLUUIDs for this part. This involves generate this part's own LLUUID and |
1568 | /// generating new LLUUIDs for all the items in the inventory. | ||
1949 | /// </summary> | 1569 | /// </summary> |
1950 | /// <param name="remoteClient"></param> | 1570 | /// <param name="linkNum">Link number for the part</param> |
1951 | public void SendTerseUpdate(IClientAPI remoteClient) | 1571 | public void ResetIDs(int linkNum) |
1952 | { | ||
1953 | m_parentGroup.SendPartTerseUpdate(remoteClient, this); | ||
1954 | } | ||
1955 | |||
1956 | public void SendTerseUpdateToClient(IClientAPI remoteClient) | ||
1957 | { | ||
1958 | LLVector3 lPos; | ||
1959 | lPos = OffsetPosition; | ||
1960 | LLQuaternion mRot = RotationOffset; | ||
1961 | if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | ||
1962 | { | ||
1963 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, lPos, mRot, Shape.State, | ||
1964 | fromAssetID); | ||
1965 | } | ||
1966 | else | ||
1967 | { | ||
1968 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, lPos, mRot, Velocity, | ||
1969 | RotationalVelocity); | ||
1970 | //System.Console.WriteLine("LID: " + LocalID + " RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); | ||
1971 | } | ||
1972 | } | ||
1973 | |||
1974 | public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) | ||
1975 | { | 1572 | { |
1976 | LLQuaternion mRot = RotationOffset; | 1573 | UUID = LLUUID.Random(); |
1977 | if (m_IsAttachment) | 1574 | LinkNum = linkNum; |
1978 | { | 1575 | |
1979 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, lPos, mRot, | 1576 | ResetInventoryIDs(); |
1980 | (byte) ((m_attachmentPoint % 16) * 16 + (m_attachmentPoint / 16)), fromAssetID); | ||
1981 | } | ||
1982 | else | ||
1983 | { | ||
1984 | if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | ||
1985 | { | ||
1986 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, lPos, mRot, | ||
1987 | Shape.State, fromAssetID); | ||
1988 | } | ||
1989 | else | ||
1990 | { | ||
1991 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, lPos, mRot, Velocity, | ||
1992 | RotationalVelocity); | ||
1993 | //System.Console.WriteLine("LID: " + LocalID + "RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); | ||
1994 | } | ||
1995 | } | ||
1996 | } | 1577 | } |
1997 | 1578 | ||
1998 | #endregion | ||
1999 | |||
2000 | #region Update Scheduling | 1579 | #region Update Scheduling |
2001 | 1580 | ||
2002 | /// <summary> | 1581 | /// <summary> |
@@ -2017,9 +1596,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
2017 | m_parentGroup.HasGroupChanged = true; | 1596 | m_parentGroup.HasGroupChanged = true; |
2018 | m_parentGroup.QueueForUpdateCheck(); | 1597 | m_parentGroup.QueueForUpdateCheck(); |
2019 | } | 1598 | } |
2020 | 1599 | ||
2021 | int timeNow = Util.UnixTimeSinceEpoch(); | 1600 | int timeNow = Util.UnixTimeSinceEpoch(); |
2022 | 1601 | ||
2023 | // If multiple updates are scheduled on the same second, we still need to perform all of them | 1602 | // If multiple updates are scheduled on the same second, we still need to perform all of them |
2024 | // So we'll force the issue by bumping up the timestamp so that later processing sees these need | 1603 | // So we'll force the issue by bumping up the timestamp so that later processing sees these need |
2025 | // to be performed. | 1604 | // to be performed. |
@@ -2029,11 +1608,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
2029 | } | 1608 | } |
2030 | else | 1609 | else |
2031 | { | 1610 | { |
2032 | TimeStampFull = (uint) timeNow; | 1611 | TimeStampFull = (uint)timeNow; |
2033 | } | 1612 | } |
2034 | 1613 | ||
2035 | m_updateFlag = 2; | 1614 | m_updateFlag = 2; |
2036 | 1615 | ||
2037 | // m_log.DebugFormat( | 1616 | // m_log.DebugFormat( |
2038 | // "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}", | 1617 | // "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}", |
2039 | // UUID, Name, TimeStampFull); | 1618 | // UUID, Name, TimeStampFull); |
@@ -2156,13 +1735,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
2156 | 1735 | ||
2157 | public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) | 1736 | public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) |
2158 | { | 1737 | { |
1738 | |||
1739 | |||
2159 | //m_log.Info("TSomething1:" + ((type & (ushort)ExtraParamType.Something1) == (ushort)ExtraParamType.Something1)); | 1740 | //m_log.Info("TSomething1:" + ((type & (ushort)ExtraParamType.Something1) == (ushort)ExtraParamType.Something1)); |
2160 | //m_log.Info("TSomething2:" + ((type & (ushort)ExtraParamType.Something2) == (ushort)ExtraParamType.Something2)); | 1741 | //m_log.Info("TSomething2:" + ((type & (ushort)ExtraParamType.Something2) == (ushort)ExtraParamType.Something2)); |
2161 | //m_log.Info("TSomething3:" + ((type & (ushort)ExtraParamType.Something3) == (ushort)ExtraParamType.Something3)); | 1742 | //m_log.Info("TSomething3:" + ((type & (ushort)ExtraParamType.Something3) == (ushort)ExtraParamType.Something3)); |
2162 | //m_log.Info("TSomething4:" + ((type & (ushort)ExtraParamType.Something4) == (ushort)ExtraParamType.Something4)); | 1743 | //m_log.Info("TSomething4:" + ((type & (ushort)ExtraParamType.Something4) == (ushort)ExtraParamType.Something4)); |
2163 | //m_log.Info("TSomething5:" + ((type & (ushort)ExtraParamType.Something5) == (ushort)ExtraParamType.Something5)); | 1744 | //m_log.Info("TSomething5:" + ((type & (ushort)ExtraParamType.Something5) == (ushort)ExtraParamType.Something5)); |
2164 | //m_log.Info("TSomething6:" + ((type & (ushort)ExtraParamType.Something6) == (ushort)ExtraParamType.Something6)); | 1745 | //m_log.Info("TSomething6:" + ((type & (ushort)ExtraParamType.Something6) == (ushort)ExtraParamType.Something6)); |
2165 | 1746 | ||
2166 | bool usePhysics = false; | 1747 | bool usePhysics = false; |
2167 | bool IsTemporary = false; | 1748 | bool IsTemporary = false; |
2168 | bool IsPhantom = false; | 1749 | bool IsPhantom = false; |
@@ -2170,7 +1751,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2170 | bool wasUsingPhysics = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); | 1751 | bool wasUsingPhysics = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); |
2171 | //bool IsLocked = false; | 1752 | //bool IsLocked = false; |
2172 | int i = 0; | 1753 | int i = 0; |
2173 | 1754 | ||
2174 | 1755 | ||
2175 | try | 1756 | try |
2176 | { | 1757 | { |
@@ -2254,7 +1835,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2254 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); | 1835 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); |
2255 | ScheduleFullUpdate(); | 1836 | ScheduleFullUpdate(); |
2256 | } | 1837 | } |
2257 | |||
2258 | public void ScriptSetPhysicsStatus(bool UsePhysics) | 1838 | public void ScriptSetPhysicsStatus(bool UsePhysics) |
2259 | { | 1839 | { |
2260 | if (m_parentGroup != null) | 1840 | if (m_parentGroup != null) |
@@ -2262,7 +1842,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2262 | m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); | 1842 | m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); |
2263 | } | 1843 | } |
2264 | } | 1844 | } |
2265 | |||
2266 | public void ScriptSetPhantomStatus(bool Phantom) | 1845 | public void ScriptSetPhantomStatus(bool Phantom) |
2267 | { | 1846 | { |
2268 | if (m_parentGroup != null) | 1847 | if (m_parentGroup != null) |
@@ -2270,7 +1849,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2270 | m_parentGroup.ScriptSetPhantomStatus(Phantom); | 1849 | m_parentGroup.ScriptSetPhantomStatus(Phantom); |
2271 | } | 1850 | } |
2272 | } | 1851 | } |
2273 | |||
2274 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) | 1852 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) |
2275 | { | 1853 | { |
2276 | if (PhysActor != null) | 1854 | if (PhysActor != null) |
@@ -2319,6 +1897,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2319 | PhysActor.link(ParentGroup.RootPart.PhysActor); | 1897 | PhysActor.link(ParentGroup.RootPart.PhysActor); |
2320 | } | 1898 | } |
2321 | } | 1899 | } |
1900 | |||
2322 | } | 1901 | } |
2323 | } | 1902 | } |
2324 | } | 1903 | } |
@@ -2332,13 +1911,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
2332 | int i = 0; | 1911 | int i = 0; |
2333 | uint length = (uint) data.Length; | 1912 | uint length = (uint) data.Length; |
2334 | m_shape.ExtraParams[i++] = 1; | 1913 | m_shape.ExtraParams[i++] = 1; |
2335 | m_shape.ExtraParams[i++] = (byte) (type % 256); | 1914 | m_shape.ExtraParams[i++] = (byte) (type%256); |
2336 | m_shape.ExtraParams[i++] = (byte) ((type >> 8) % 256); | 1915 | m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256); |
2337 | 1916 | ||
2338 | m_shape.ExtraParams[i++] = (byte) (length % 256); | 1917 | m_shape.ExtraParams[i++] = (byte) (length%256); |
2339 | m_shape.ExtraParams[i++] = (byte) ((length >> 8) % 256); | 1918 | m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256); |
2340 | m_shape.ExtraParams[i++] = (byte) ((length >> 16) % 256); | 1919 | m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256); |
2341 | m_shape.ExtraParams[i++] = (byte) ((length >> 24) % 256); | 1920 | m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256); |
2342 | Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length); | 1921 | Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length); |
2343 | 1922 | ||
2344 | ScheduleFullUpdate(); | 1923 | ScheduleFullUpdate(); |
@@ -2416,14 +1995,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
2416 | 1995 | ||
2417 | public byte ConvertScriptUintToByte(uint indata) | 1996 | public byte ConvertScriptUintToByte(uint indata) |
2418 | { | 1997 | { |
2419 | byte outdata = (byte) TextureAnimFlags.NONE; | 1998 | byte outdata = (byte)TextureAnimFlags.NONE; |
2420 | if ((indata & 1) != 0) outdata |= (byte) TextureAnimFlags.ANIM_ON; | 1999 | if ((indata & 1) != 0) outdata |= (byte)TextureAnimFlags.ANIM_ON; |
2421 | if ((indata & 2) != 0) outdata |= (byte) TextureAnimFlags.LOOP; | 2000 | if ((indata & 2) != 0) outdata |= (byte)TextureAnimFlags.LOOP; |
2422 | if ((indata & 4) != 0) outdata |= (byte) TextureAnimFlags.REVERSE; | 2001 | if ((indata & 4) != 0) outdata |= (byte)TextureAnimFlags.REVERSE; |
2423 | if ((indata & 8) != 0) outdata |= (byte) TextureAnimFlags.PING_PONG; | 2002 | if ((indata & 8) != 0) outdata |= (byte)TextureAnimFlags.PING_PONG; |
2424 | if ((indata & 16) != 0) outdata |= (byte) TextureAnimFlags.SMOOTH; | 2003 | if ((indata & 16) != 0) outdata |= (byte)TextureAnimFlags.SMOOTH; |
2425 | if ((indata & 32) != 0) outdata |= (byte) TextureAnimFlags.ROTATE; | 2004 | if ((indata & 32) != 0) outdata |= (byte)TextureAnimFlags.ROTATE; |
2426 | if ((indata & 64) != 0) outdata |= (byte) TextureAnimFlags.SCALE; | 2005 | if ((indata & 64) != 0) outdata |= (byte)TextureAnimFlags.SCALE; |
2427 | return outdata; | 2006 | return outdata; |
2428 | } | 2007 | } |
2429 | 2008 | ||
@@ -2435,17 +2014,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
2435 | // The flags don't like conversion from uint to byte, so we have to do | 2014 | // The flags don't like conversion from uint to byte, so we have to do |
2436 | // it the crappy way. See the above function :( | 2015 | // it the crappy way. See the above function :( |
2437 | 2016 | ||
2438 | data[pos] = ConvertScriptUintToByte(pTexAnim.Flags); | 2017 | data[pos] = ConvertScriptUintToByte(pTexAnim.Flags); pos++; |
2439 | pos++; | 2018 | data[pos] = (byte)pTexAnim.Face; pos++; |
2440 | data[pos] = (byte) pTexAnim.Face; | 2019 | data[pos] = (byte)pTexAnim.SizeX; pos++; |
2441 | pos++; | 2020 | data[pos] = (byte)pTexAnim.SizeY; pos++; |
2442 | data[pos] = (byte) pTexAnim.SizeX; | ||
2443 | pos++; | ||
2444 | data[pos] = (byte) pTexAnim.SizeY; | ||
2445 | pos++; | ||
2446 | 2021 | ||
2447 | Helpers.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); | 2022 | Helpers.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); |
2448 | Helpers.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); | 2023 | Helpers.FloatToBytes(pTexAnim.Length ).CopyTo(data, pos + 4); |
2449 | Helpers.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); | 2024 | Helpers.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); |
2450 | 2025 | ||
2451 | m_TextureAnimation = data; | 2026 | m_TextureAnimation = data; |
@@ -2496,7 +2071,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2496 | #endregion | 2071 | #endregion |
2497 | 2072 | ||
2498 | #region Sound | 2073 | #region Sound |
2499 | |||
2500 | public void PreloadSound(string sound) | 2074 | public void PreloadSound(string sound) |
2501 | { | 2075 | { |
2502 | LLUUID ownerID = OwnerID; | 2076 | LLUUID ownerID = OwnerID; |
@@ -2522,7 +2096,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2522 | foreach (ScenePresence p in avatarts) | 2096 | foreach (ScenePresence p in avatarts) |
2523 | { | 2097 | { |
2524 | // TODO: some filtering by distance of avatar | 2098 | // TODO: some filtering by distance of avatar |
2525 | 2099 | ||
2526 | p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); | 2100 | p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); |
2527 | } | 2101 | } |
2528 | } | 2102 | } |
@@ -2537,7 +2111,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2537 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2111 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
2538 | foreach (ScenePresence p in avatarts) | 2112 | foreach (ScenePresence p in avatarts) |
2539 | { | 2113 | { |
2540 | p.ControllingClient.SendAttachedSoundGainChange(UUID, (float) volume); | 2114 | p.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); |
2541 | } | 2115 | } |
2542 | } | 2116 | } |
2543 | 2117 | ||
@@ -2563,7 +2137,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2563 | SceneObjectPart op = this; | 2137 | SceneObjectPart op = this; |
2564 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) | 2138 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) |
2565 | { | 2139 | { |
2566 | if (item.Value.Name == sound && item.Value.Type == (int) AssetType.Sound) | 2140 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
2567 | { | 2141 | { |
2568 | soundID = item.Value.ItemID; | 2142 | soundID = item.Value.ItemID; |
2569 | break; | 2143 | break; |
@@ -2571,26 +2145,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
2571 | } | 2145 | } |
2572 | } | 2146 | } |
2573 | 2147 | ||
2574 | if (soundID == LLUUID.Zero) | 2148 | if(soundID == LLUUID.Zero) |
2575 | return; | 2149 | return; |
2576 | 2150 | ||
2577 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2151 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
2578 | foreach (ScenePresence p in avatarts) | 2152 | foreach (ScenePresence p in avatarts) |
2579 | { | 2153 | { |
2580 | double dis = Util.GetDistanceTo(p.AbsolutePosition, position); | 2154 | double dis=Util.GetDistanceTo(p.AbsolutePosition, position); |
2581 | if (dis > 100.0) // Max audio distance | 2155 | if(dis > 100.0) // Max audio distance |
2582 | continue; | 2156 | continue; |
2583 | 2157 | ||
2584 | // Scale by distance | 2158 | // Scale by distance |
2585 | volume *= ((100.0 - dis) / 100.0); | 2159 | volume*=((100.0-dis)/100.0); |
2586 | 2160 | ||
2587 | if (triggered) | 2161 | if (triggered) |
2588 | { | 2162 | { |
2589 | p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float) volume); | 2163 | p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume); |
2590 | } | 2164 | } |
2591 | else | 2165 | else |
2592 | { | 2166 | { |
2593 | p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float) volume, flags); | 2167 | p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)volume, flags); |
2594 | } | 2168 | } |
2595 | } | 2169 | } |
2596 | } | 2170 | } |
@@ -2607,57 +2181,513 @@ namespace OpenSim.Region.Environment.Scenes | |||
2607 | { | 2181 | { |
2608 | StoreUndoState(); | 2182 | StoreUndoState(); |
2609 | m_shape.Scale = scale; | 2183 | m_shape.Scale = scale; |
2610 | 2184 | ||
2611 | ScheduleFullUpdate(); | 2185 | ScheduleFullUpdate(); |
2612 | } | 2186 | } |
2613 | 2187 | ||
2614 | #endregion | 2188 | #endregion |
2615 | 2189 | ||
2616 | #region Copying | 2190 | public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF) |
2191 | { | ||
2192 | bool set = addRemTF == 1; | ||
2193 | |||
2194 | // Are we the owner? | ||
2195 | if (AgentID == OwnerID) | ||
2196 | { | ||
2197 | switch (field) | ||
2198 | { | ||
2199 | case 2: | ||
2200 | OwnerMask = ApplyMask(OwnerMask, set, mask); | ||
2201 | break; | ||
2202 | case 4: | ||
2203 | GroupMask = ApplyMask(GroupMask, set, mask); | ||
2204 | break; | ||
2205 | case 8: | ||
2206 | EveryoneMask = ApplyMask(EveryoneMask, set, mask); | ||
2207 | break; | ||
2208 | case 16: | ||
2209 | NextOwnerMask = ApplyMask(NextOwnerMask, set, mask); | ||
2210 | break; | ||
2211 | } | ||
2212 | SendFullUpdateToAllClients(); | ||
2213 | |||
2214 | SendObjectPropertiesToClient(AgentID); | ||
2215 | |||
2216 | } | ||
2217 | } | ||
2218 | |||
2219 | private void SendObjectPropertiesToClient(LLUUID AgentID) | ||
2220 | { | ||
2221 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
2222 | for (int i = 0; i < avatars.Count; i++) | ||
2223 | { | ||
2224 | // Ugly reference :( | ||
2225 | if (avatars[i].UUID == AgentID) | ||
2226 | { | ||
2227 | m_parentGroup.GetProperties(avatars[i].ControllingClient); | ||
2228 | } | ||
2229 | } | ||
2230 | } | ||
2231 | |||
2232 | private uint ApplyMask(uint val, bool set, uint mask) | ||
2233 | { | ||
2234 | if (set) | ||
2235 | { | ||
2236 | return val |= mask; | ||
2237 | } | ||
2238 | else | ||
2239 | { | ||
2240 | return val &= ~mask; | ||
2241 | } | ||
2242 | } | ||
2617 | 2243 | ||
2244 | #region Client Update Methods | ||
2245 | |||
2618 | /// <summary> | 2246 | /// <summary> |
2619 | /// Duplicates this part. | 2247 | /// Tell all scene presences that they should send updates for this part to their clients |
2620 | /// </summary> | 2248 | /// </summary> |
2621 | /// <returns></returns> | 2249 | public void AddFullUpdateToAllAvatars() |
2622 | public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID, int linkNum) | ||
2623 | { | 2250 | { |
2624 | SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone(); | 2251 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
2625 | dupe.m_shape = m_shape.Copy(); | 2252 | for (int i = 0; i < avatars.Count; i++) |
2626 | dupe.m_regionHandle = m_regionHandle; | 2253 | { |
2627 | dupe.UUID = LLUUID.Random(); | 2254 | avatars[i].QueuePartForUpdate(this); |
2628 | dupe.LocalId = localID; | 2255 | } |
2629 | dupe.OwnerID = AgentID; | 2256 | } |
2630 | dupe.GroupID = GroupID; | ||
2631 | dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z); | ||
2632 | dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); | ||
2633 | dupe.RotationOffset = | ||
2634 | new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); | ||
2635 | dupe.Velocity = new LLVector3(0, 0, 0); | ||
2636 | dupe.Acceleration = new LLVector3(0, 0, 0); | ||
2637 | dupe.AngularVelocity = new LLVector3(0, 0, 0); | ||
2638 | dupe.ObjectFlags = ObjectFlags; | ||
2639 | 2257 | ||
2640 | dupe.OwnershipCost = OwnershipCost; | 2258 | public void SendFullUpdateToAllClientsExcept(LLUUID agentID) |
2641 | dupe.ObjectSaleType = ObjectSaleType; | 2259 | { |
2642 | dupe.SalePrice = SalePrice; | 2260 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
2643 | dupe.Category = Category; | 2261 | for (int i = 0; i < avatars.Count; i++) |
2262 | { | ||
2263 | // Ugly reference :( | ||
2264 | if (avatars[i].UUID != agentID) | ||
2265 | { | ||
2266 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, | ||
2267 | avatars[i].GenerateClientFlags(UUID)); | ||
2268 | } | ||
2269 | } | ||
2270 | } | ||
2271 | |||
2644 | 2272 | ||
2645 | dupe.TaskInventory = (TaskInventoryDictionary) dupe.TaskInventory.Clone(); | 2273 | public void AddFullUpdateToAvatar(ScenePresence presence) |
2274 | { | ||
2275 | presence.QueuePartForUpdate(this); | ||
2276 | } | ||
2646 | 2277 | ||
2647 | dupe.ResetIDs(linkNum); | 2278 | /// <summary> |
2279 | /// | ||
2280 | /// </summary> | ||
2281 | public void SendFullUpdateToAllClients() | ||
2282 | { | ||
2283 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
2284 | for (int i = 0; i < avatars.Count; i++) | ||
2285 | { | ||
2286 | // Ugly reference :( | ||
2287 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, | ||
2288 | avatars[i].GenerateClientFlags(UUID)); | ||
2289 | } | ||
2290 | } | ||
2648 | 2291 | ||
2649 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 2292 | /// <summary> |
2650 | dupe.LastOwnerID = ObjectOwner; | 2293 | /// |
2294 | /// </summary> | ||
2295 | /// <param name="remoteClient"></param> | ||
2296 | public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) | ||
2297 | { | ||
2298 | m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); | ||
2299 | } | ||
2651 | 2300 | ||
2652 | byte[] extraP = new byte[Shape.ExtraParams.Length]; | 2301 | /// <summary> |
2653 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); | 2302 | /// Sends a full update to the client |
2654 | dupe.Shape.ExtraParams = extraP; | 2303 | /// </summary> |
2655 | bool UsePhysics = ((dupe.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); | 2304 | /// <param name="remoteClient"></param> |
2656 | dupe.DoPhysicsPropertyUpdate(UsePhysics, true); | 2305 | /// <param name="clientFlags"></param> |
2306 | public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientflags) | ||
2307 | { | ||
2308 | LLVector3 lPos; | ||
2309 | lPos = OffsetPosition; | ||
2310 | SendFullUpdateToClient(remoteClient, lPos, clientflags); | ||
2311 | } | ||
2312 | |||
2313 | /// <summary> | ||
2314 | /// Sends a full update to the client | ||
2315 | /// </summary> | ||
2316 | /// <param name="remoteClient"></param> | ||
2317 | /// <param name="lPos"></param> | ||
2318 | /// <param name="clientFlags"></param> | ||
2319 | public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos, uint clientFlags) | ||
2320 | { | ||
2321 | LLQuaternion lRot; | ||
2322 | lRot = RotationOffset; | ||
2323 | clientFlags &= ~(uint) LLObject.ObjectFlags.CreateSelected; | ||
2657 | 2324 | ||
2658 | return dupe; | 2325 | if (remoteClient.AgentId == OwnerID) |
2326 | { | ||
2327 | if ((uint) (Flags & LLObject.ObjectFlags.CreateSelected) != 0) | ||
2328 | { | ||
2329 | clientFlags |= (uint) LLObject.ObjectFlags.CreateSelected; | ||
2330 | Flags &= ~LLObject.ObjectFlags.CreateSelected; | ||
2331 | } | ||
2332 | } | ||
2333 | |||
2334 | |||
2335 | byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; | ||
2336 | remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, lPos, clientFlags, m_uuid, | ||
2337 | OwnerID, | ||
2338 | m_text, color, ParentID, m_particleSystem, lRot, m_clickAction, m_TextureAnimation, m_IsAttachment, m_attachmentPoint,fromAssetID); | ||
2339 | } | ||
2340 | |||
2341 | /// Terse updates | ||
2342 | public void AddTerseUpdateToAllAvatars() | ||
2343 | { | ||
2344 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
2345 | for (int i = 0; i < avatars.Count; i++) | ||
2346 | { | ||
2347 | avatars[i].QueuePartForUpdate(this); | ||
2348 | } | ||
2349 | } | ||
2350 | |||
2351 | public void AddTerseUpdateToAvatar(ScenePresence presence) | ||
2352 | { | ||
2353 | presence.QueuePartForUpdate(this); | ||
2354 | } | ||
2355 | |||
2356 | /// <summary> | ||
2357 | /// | ||
2358 | /// </summary> | ||
2359 | public void SendTerseUpdateToAllClients() | ||
2360 | { | ||
2361 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
2362 | for (int i = 0; i < avatars.Count; i++) | ||
2363 | { | ||
2364 | m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); | ||
2365 | } | ||
2366 | } | ||
2367 | |||
2368 | /// <summary> | ||
2369 | /// Send a terse update to the client. | ||
2370 | /// </summary> | ||
2371 | /// <param name="remoteClient"></param> | ||
2372 | public void SendTerseUpdate(IClientAPI remoteClient) | ||
2373 | { | ||
2374 | m_parentGroup.SendPartTerseUpdate(remoteClient, this); | ||
2375 | } | ||
2376 | |||
2377 | public void SendTerseUpdateToClient(IClientAPI remoteClient) | ||
2378 | { | ||
2379 | LLVector3 lPos; | ||
2380 | lPos = OffsetPosition; | ||
2381 | LLQuaternion mRot = RotationOffset; | ||
2382 | if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | ||
2383 | { | ||
2384 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Shape.State, fromAssetID); | ||
2385 | } | ||
2386 | else | ||
2387 | { | ||
2388 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, | ||
2389 | RotationalVelocity); | ||
2390 | //System.Console.WriteLine("LID: " + LocalID + " RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); | ||
2391 | } | ||
2392 | } | ||
2393 | |||
2394 | public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) | ||
2395 | { | ||
2396 | LLQuaternion mRot = RotationOffset; | ||
2397 | if (m_IsAttachment) | ||
2398 | { | ||
2399 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, (byte)((m_attachmentPoint % 16) * 16 + (m_attachmentPoint / 16)),fromAssetID); | ||
2400 | } | ||
2401 | else | ||
2402 | { | ||
2403 | if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) | ||
2404 | { | ||
2405 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Shape.State, fromAssetID); | ||
2406 | } | ||
2407 | else | ||
2408 | { | ||
2409 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, | ||
2410 | RotationalVelocity); | ||
2411 | //System.Console.WriteLine("LID: " + LocalID + "RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); | ||
2412 | } | ||
2413 | } | ||
2414 | } | ||
2415 | |||
2416 | #endregion | ||
2417 | |||
2418 | public virtual void UpdateMovement() | ||
2419 | { | ||
2420 | } | ||
2421 | |||
2422 | #region Events | ||
2423 | |||
2424 | public void PhysicsRequestingTerseUpdate() | ||
2425 | { | ||
2426 | if (PhysActor != null) | ||
2427 | { | ||
2428 | LLVector3 newpos = new LLVector3(PhysActor.Position.GetBytes(), 0); | ||
2429 | if (newpos.X > 257f || newpos.X < -1f || newpos.Y > 257f || newpos.Y < -1f) | ||
2430 | { | ||
2431 | m_parentGroup.AbsolutePosition = newpos; | ||
2432 | return; | ||
2433 | } | ||
2434 | |||
2435 | } | ||
2436 | ScheduleTerseUpdate(); | ||
2437 | |||
2438 | //SendTerseUpdateToAllClients(); | ||
2659 | } | 2439 | } |
2660 | 2440 | ||
2661 | #endregion | 2441 | #endregion |
2442 | |||
2443 | public void PhysicsOutOfBounds(PhysicsVector pos) | ||
2444 | { | ||
2445 | m_log.Info("[PHYSICS]: Physical Object went out of bounds."); | ||
2446 | RemFlag(LLObject.ObjectFlags.Physics); | ||
2447 | DoPhysicsPropertyUpdate(false, true); | ||
2448 | //m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
2449 | } | ||
2450 | |||
2451 | public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) | ||
2452 | { | ||
2453 | } | ||
2454 | |||
2455 | |||
2456 | public void SetText(string text) | ||
2457 | { | ||
2458 | Text = text; | ||
2459 | ScheduleFullUpdate(); | ||
2460 | } | ||
2461 | |||
2462 | public void SetText(string text, Vector3 color, double alpha) | ||
2463 | { | ||
2464 | Color = Color.FromArgb(0xff - (int) (alpha*0xff), | ||
2465 | (int) (color.x*0xff), | ||
2466 | (int) (color.y*0xff), | ||
2467 | (int) (color.z*0xff)); | ||
2468 | SetText( text ); | ||
2469 | } | ||
2470 | |||
2471 | public int registerTargetWaypoint(LLVector3 target, float tolerance) | ||
2472 | { | ||
2473 | if (m_parentGroup != null) | ||
2474 | { | ||
2475 | return m_parentGroup.registerTargetWaypoint(target, tolerance); | ||
2476 | } | ||
2477 | return 0; | ||
2478 | } | ||
2479 | public void unregisterTargetWaypoint(int handle) | ||
2480 | { | ||
2481 | if (m_parentGroup != null) | ||
2482 | { | ||
2483 | m_parentGroup.unregisterTargetWaypoint(handle); | ||
2484 | } | ||
2485 | } | ||
2486 | protected SceneObjectPart(SerializationInfo info, StreamingContext context) | ||
2487 | { | ||
2488 | //System.Console.WriteLine("SceneObjectPart Deserialize BGN"); | ||
2489 | |||
2490 | if (info == null) | ||
2491 | { | ||
2492 | throw new ArgumentNullException("info"); | ||
2493 | } | ||
2494 | |||
2495 | /* | ||
2496 | m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>)); | ||
2497 | m_ids = (List<LLUUID>)info.GetValue("m_ids", typeof(List<LLUUID>)); | ||
2498 | */ | ||
2499 | |||
2500 | //System.Console.WriteLine("SceneObjectPart Deserialize END"); | ||
2501 | } | ||
2502 | |||
2503 | [SecurityPermission(SecurityAction.LinkDemand, | ||
2504 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
2505 | public virtual void GetObjectData( | ||
2506 | SerializationInfo info, StreamingContext context) | ||
2507 | { | ||
2508 | if (info == null) | ||
2509 | { | ||
2510 | throw new ArgumentNullException("info"); | ||
2511 | } | ||
2512 | |||
2513 | info.AddValue("m_inventoryFileName", m_inventoryFileName); | ||
2514 | info.AddValue("m_folderID", m_folderID.UUID); | ||
2515 | info.AddValue("PhysActor", PhysActor); | ||
2516 | |||
2517 | Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>(); | ||
2518 | |||
2519 | foreach (LLUUID id in TaskInventory.Keys) | ||
2520 | { | ||
2521 | TaskInventory_work.Add(id.UUID, TaskInventory[id]); | ||
2522 | } | ||
2523 | |||
2524 | info.AddValue("TaskInventory", TaskInventory_work); | ||
2525 | |||
2526 | info.AddValue("LastOwnerID", LastOwnerID.UUID); | ||
2527 | info.AddValue("OwnerID", OwnerID.UUID); | ||
2528 | info.AddValue("GroupID", GroupID.UUID); | ||
2529 | |||
2530 | info.AddValue("OwnershipCost", OwnershipCost); | ||
2531 | info.AddValue("ObjectSaleType", ObjectSaleType); | ||
2532 | info.AddValue("SalePrice", SalePrice); | ||
2533 | info.AddValue("Category", Category); | ||
2534 | |||
2535 | info.AddValue("CreationDate", CreationDate); | ||
2536 | info.AddValue("ParentID", ParentID); | ||
2537 | |||
2538 | info.AddValue("OwnerMask", OwnerMask); | ||
2539 | info.AddValue("NextOwnerMask", NextOwnerMask); | ||
2540 | info.AddValue("GroupMask", GroupMask); | ||
2541 | info.AddValue("EveryoneMask", EveryoneMask); | ||
2542 | info.AddValue("BaseMask", BaseMask); | ||
2543 | |||
2544 | info.AddValue("m_particleSystem", m_particleSystem); | ||
2545 | |||
2546 | info.AddValue("TimeStampFull", TimeStampFull); | ||
2547 | info.AddValue("TimeStampTerse", TimeStampTerse); | ||
2548 | info.AddValue("TimeStampLastActivity", TimeStampLastActivity); | ||
2549 | |||
2550 | info.AddValue("m_updateFlag", m_updateFlag); | ||
2551 | info.AddValue("CreatorID", CreatorID.UUID); | ||
2552 | |||
2553 | info.AddValue("m_inventorySerial", m_inventorySerial); | ||
2554 | info.AddValue("m_uuid", m_uuid.UUID); | ||
2555 | info.AddValue("m_localID", m_localId); | ||
2556 | info.AddValue("m_name", m_name); | ||
2557 | info.AddValue("m_flags", Flags); | ||
2558 | info.AddValue("m_material", m_material); | ||
2559 | info.AddValue("m_regionHandle", m_regionHandle); | ||
2560 | |||
2561 | info.AddValue("m_groupPosition.X", m_groupPosition.X); | ||
2562 | info.AddValue("m_groupPosition.Y", m_groupPosition.Y); | ||
2563 | info.AddValue("m_groupPosition.Z", m_groupPosition.Z); | ||
2564 | |||
2565 | info.AddValue("m_offsetPosition.X", m_offsetPosition.X); | ||
2566 | info.AddValue("m_offsetPosition.Y", m_offsetPosition.Y); | ||
2567 | info.AddValue("m_offsetPosition.Z", m_offsetPosition.Z); | ||
2568 | |||
2569 | info.AddValue("m_rotationOffset.W", m_rotationOffset.W); | ||
2570 | info.AddValue("m_rotationOffset.X", m_rotationOffset.X); | ||
2571 | info.AddValue("m_rotationOffset.Y", m_rotationOffset.Y); | ||
2572 | info.AddValue("m_rotationOffset.Z", m_rotationOffset.Z); | ||
2573 | |||
2574 | info.AddValue("m_velocity.X", m_velocity.X); | ||
2575 | info.AddValue("m_velocity.Y", m_velocity.Y); | ||
2576 | info.AddValue("m_velocity.Z", m_velocity.Z); | ||
2577 | |||
2578 | info.AddValue("m_rotationalvelocity.X", m_rotationalvelocity.X); | ||
2579 | info.AddValue("m_rotationalvelocity.Y", m_rotationalvelocity.Y); | ||
2580 | info.AddValue("m_rotationalvelocity.Z", m_rotationalvelocity.Z); | ||
2581 | |||
2582 | info.AddValue("m_angularVelocity.X", m_angularVelocity.X); | ||
2583 | info.AddValue("m_angularVelocity.Y", m_angularVelocity.Y); | ||
2584 | info.AddValue("m_angularVelocity.Z", m_angularVelocity.Z); | ||
2585 | |||
2586 | info.AddValue("m_acceleration.X", m_acceleration.X); | ||
2587 | info.AddValue("m_acceleration.Y", m_acceleration.Y); | ||
2588 | info.AddValue("m_acceleration.Z", m_acceleration.Z); | ||
2589 | |||
2590 | info.AddValue("m_description", m_description); | ||
2591 | info.AddValue("m_color", m_color); | ||
2592 | info.AddValue("m_text", m_text); | ||
2593 | info.AddValue("m_sitName", m_sitName); | ||
2594 | info.AddValue("m_touchName", m_touchName); | ||
2595 | info.AddValue("m_clickAction", m_clickAction); | ||
2596 | info.AddValue("m_shape", m_shape); | ||
2597 | info.AddValue("m_parentGroup", m_parentGroup); | ||
2598 | info.AddValue("PayPrice", PayPrice); | ||
2599 | } | ||
2600 | |||
2601 | |||
2602 | public void Undo() | ||
2603 | { | ||
2604 | if (m_undo.Count > 0) | ||
2605 | { | ||
2606 | UndoState goback = m_undo.Pop(); | ||
2607 | if (goback != null) | ||
2608 | goback.PlaybackState(this); | ||
2609 | } | ||
2610 | } | ||
2611 | |||
2612 | public void SetScriptEvents(LLUUID scriptid, int events) | ||
2613 | { | ||
2614 | scriptEvents oldparts; | ||
2615 | lock (m_scriptEvents) | ||
2616 | { | ||
2617 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
2618 | { | ||
2619 | oldparts = m_scriptEvents[scriptid]; | ||
2620 | |||
2621 | // remove values from aggregated script events | ||
2622 | m_scriptEvents[scriptid] = (scriptEvents) events; | ||
2623 | } | ||
2624 | else | ||
2625 | { | ||
2626 | m_scriptEvents.Add(scriptid, (scriptEvents) events); | ||
2627 | } | ||
2628 | } | ||
2629 | aggregateScriptEvents(); | ||
2630 | } | ||
2631 | |||
2632 | public void RemoveScriptEvents(LLUUID scriptid) | ||
2633 | { | ||
2634 | lock (m_scriptEvents) | ||
2635 | { | ||
2636 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
2637 | { | ||
2638 | scriptEvents oldparts = scriptEvents.None; | ||
2639 | oldparts = (scriptEvents) m_scriptEvents[scriptid]; | ||
2640 | |||
2641 | // remove values from aggregated script events | ||
2642 | m_aggregateScriptEvents &= ~oldparts; | ||
2643 | m_scriptEvents.Remove(scriptid); | ||
2644 | } | ||
2645 | } | ||
2646 | aggregateScriptEvents(); | ||
2647 | } | ||
2648 | |||
2649 | public void aggregateScriptEvents() | ||
2650 | { | ||
2651 | // Aggregate script events | ||
2652 | lock (m_scriptEvents) | ||
2653 | { | ||
2654 | foreach (scriptEvents s in m_scriptEvents.Values) | ||
2655 | { | ||
2656 | m_aggregateScriptEvents |= s; | ||
2657 | } | ||
2658 | } | ||
2659 | |||
2660 | uint objectflagupdate = 0; | ||
2661 | |||
2662 | if ( | ||
2663 | ((m_aggregateScriptEvents & scriptEvents.touch) != 0) || | ||
2664 | ((m_aggregateScriptEvents & scriptEvents.touch_end) != 0) || | ||
2665 | ((m_aggregateScriptEvents & scriptEvents.touch_start) != 0) | ||
2666 | ) | ||
2667 | { | ||
2668 | objectflagupdate |= (uint) LLObject.ObjectFlags.Touch; | ||
2669 | } | ||
2670 | |||
2671 | if ((m_aggregateScriptEvents & scriptEvents.money) != 0) | ||
2672 | { | ||
2673 | objectflagupdate |= (uint) LLObject.ObjectFlags.Money; | ||
2674 | } | ||
2675 | |||
2676 | if ( | ||
2677 | ((m_aggregateScriptEvents & scriptEvents.collision) != 0) || | ||
2678 | ((m_aggregateScriptEvents & scriptEvents.collision_end) != 0) || | ||
2679 | ((m_aggregateScriptEvents & scriptEvents.collision_start) != 0) | ||
2680 | ) | ||
2681 | { | ||
2682 | // subscribe to physics updates. | ||
2683 | } | ||
2684 | |||
2685 | LocalFlags=(LLObject.ObjectFlags)objectflagupdate; | ||
2686 | |||
2687 | if(m_parentGroup != null && m_parentGroup.RootPart == this) | ||
2688 | m_parentGroup.aggregateScriptEvents(); | ||
2689 | else | ||
2690 | ScheduleFullUpdate(); | ||
2691 | } | ||
2662 | } | 2692 | } |
2663 | } \ No newline at end of file | 2693 | } |