aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs414
1 files changed, 209 insertions, 205 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index f226150..90a975c 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -28,6 +28,7 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Drawing;
31using System.Xml; 32using System.Xml;
32using System.Xml.Serialization; 33using System.Xml.Serialization;
33using Axiom.Math; 34using Axiom.Math;
@@ -38,23 +39,26 @@ using OpenSim.Framework.Console;
38using OpenSim.Region.Environment.Interfaces; 39using OpenSim.Region.Environment.Interfaces;
39using OpenSim.Region.Environment.Scenes.Scripting; 40using OpenSim.Region.Environment.Scenes.Scripting;
40using OpenSim.Region.Physics.Manager; 41using OpenSim.Region.Physics.Manager;
41using System.Drawing;
42 42
43namespace OpenSim.Region.Environment.Scenes 43namespace OpenSim.Region.Environment.Scenes
44{ 44{
45 public class SceneObjectPart : IScriptHost 45 public class SceneObjectPart : IScriptHost
46 { 46 {
47 private const LLObject.ObjectFlags OBJFULL_MASK_GENERAL = LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectTransfer; 47 private const LLObject.ObjectFlags OBJFULL_MASK_GENERAL =
48 private const LLObject.ObjectFlags OBJFULL_MASK_OWNER = LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectOwnerModify | LLObject.ObjectFlags.ObjectTransfer | LLObject.ObjectFlags.ObjectYouOwner; 48 LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectTransfer;
49
50 private const LLObject.ObjectFlags OBJFULL_MASK_OWNER =
51 LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectOwnerModify |
52 LLObject.ObjectFlags.ObjectTransfer | LLObject.ObjectFlags.ObjectYouOwner;
53
49 private const uint OBJNEXT_OWNER = 2147483647; 54 private const uint OBJNEXT_OWNER = 2147483647;
50 55
51 private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647; 56 private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647;
52 private const uint FULL_MASK_PERMISSIONS_OWNER = 2147483647; 57 private const uint FULL_MASK_PERMISSIONS_OWNER = 2147483647;
53 private string m_inventoryFileName = ""; 58 private string m_inventoryFileName = "";
54 private LLUUID m_folderID = LLUUID.Zero; 59 private LLUUID m_folderID = LLUUID.Zero;
55 60
56 [XmlIgnore] 61 [XmlIgnore] public PhysicsActor PhysActor = null;
57 public PhysicsActor PhysActor = null;
58 62
59 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); 63 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
60 public LLUUID LastOwnerID; 64 public LLUUID LastOwnerID;
@@ -72,25 +76,20 @@ namespace OpenSim.Region.Environment.Scenes
72 private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1); 76 private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1);
73 private LLUUID m_SitTargetAvatar = LLUUID.Zero; 77 private LLUUID m_SitTargetAvatar = LLUUID.Zero;
74 78
75
76
77 79
78 // Main grid has default permissions as follows 80 // Main grid has default permissions as follows
79 // 81 //
80 public uint OwnerMask = FULL_MASK_PERMISSIONS_OWNER; 82 public uint OwnerMask = FULL_MASK_PERMISSIONS_OWNER;
81 public uint NextOwnerMask = OBJNEXT_OWNER; 83 public uint NextOwnerMask = OBJNEXT_OWNER;
82 public uint GroupMask = (uint) LLObject.ObjectFlags.None; 84 public uint GroupMask = (uint) LLObject.ObjectFlags.None;
83 public uint EveryoneMask = (uint) LLObject.ObjectFlags.None; 85 public uint EveryoneMask = (uint) LLObject.ObjectFlags.None;
84 public uint BaseMask = FULL_MASK_PERMISSIONS_OWNER; 86 public uint BaseMask = FULL_MASK_PERMISSIONS_OWNER;
85 87
86 protected byte[] m_particleSystem = new byte[0]; 88 protected byte[] m_particleSystem = new byte[0];
87 89
88 [XmlIgnore] 90 [XmlIgnore] public uint TimeStampFull = 0;
89 public uint TimeStampFull = 0; 91 [XmlIgnore] public uint TimeStampTerse = 0;
90 [XmlIgnore] 92 [XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn
91 public uint TimeStampTerse = 0;
92 [XmlIgnore]
93 public uint TimeStampLastActivity = 0; // Will be used for AutoReturn
94 93
95 /// <summary> 94 /// <summary>
96 /// Only used internally to schedule client updates 95 /// Only used internally to schedule client updates
@@ -145,16 +144,16 @@ namespace OpenSim.Region.Environment.Scenes
145 144
146 public uint ObjectFlags 145 public uint ObjectFlags
147 { 146 {
148 get { return (uint)m_flags; } 147 get { return (uint) m_flags; }
149 set { m_flags = (LLObject.ObjectFlags)value; } 148 set { m_flags = (LLObject.ObjectFlags) value; }
150 } 149 }
151 150
152 protected LLObject.MaterialType m_material = 0; 151 protected LLObject.MaterialType m_material = 0;
153 152
154 public byte Material 153 public byte Material
155 { 154 {
156 get { return (byte)m_material; } 155 get { return (byte) m_material; }
157 set { m_material = (LLObject.MaterialType)value; } 156 set { m_material = (LLObject.MaterialType) value; }
158 } 157 }
159 158
160 protected ulong m_regionHandle; 159 protected ulong m_regionHandle;
@@ -168,7 +167,6 @@ namespace OpenSim.Region.Environment.Scenes
168 //unkown if this will be kept, added as a way of removing the group position from the group class 167 //unkown if this will be kept, added as a way of removing the group position from the group class
169 protected LLVector3 m_groupPosition; 168 protected LLVector3 m_groupPosition;
170 169
171
172 170
173 public LLVector3 GroupPosition 171 public LLVector3 GroupPosition
174 { 172 {
@@ -225,7 +223,7 @@ namespace OpenSim.Region.Environment.Scenes
225 if (PhysActor != null) 223 if (PhysActor != null)
226 { 224 {
227 if (PhysActor.Orientation.x != 0 || PhysActor.Orientation.y != 0 225 if (PhysActor.Orientation.x != 0 || PhysActor.Orientation.y != 0
228 || PhysActor.Orientation.z != 0 || PhysActor.Orientation.w != 0) 226 || PhysActor.Orientation.z != 0 || PhysActor.Orientation.w != 0)
229 { 227 {
230 m_rotationOffset.X = PhysActor.Orientation.x; 228 m_rotationOffset.X = PhysActor.Orientation.x;
231 m_rotationOffset.Y = PhysActor.Orientation.y; 229 m_rotationOffset.Y = PhysActor.Orientation.y;
@@ -281,6 +279,7 @@ namespace OpenSim.Region.Environment.Scenes
281 } 279 }
282 set { m_velocity = value; } 280 set { m_velocity = value; }
283 } 281 }
282
284 public LLVector3 RotationalVelocity 283 public LLVector3 RotationalVelocity
285 { 284 {
286 get 285 get
@@ -351,6 +350,7 @@ namespace OpenSim.Region.Environment.Scenes
351 { 350 {
352 get { return m_sitTargetPosition; } 351 get { return m_sitTargetPosition; }
353 } 352 }
353
354 public Quaternion SitTargetOrientation 354 public Quaternion SitTargetOrientation
355 { 355 {
356 get { return m_sitTargetOrientation; } 356 get { return m_sitTargetOrientation; }
@@ -383,6 +383,7 @@ namespace OpenSim.Region.Environment.Scenes
383 } 383 }
384 384
385 private int m_linkNum = 0; 385 private int m_linkNum = 0;
386
386 public int LinkNum 387 public int LinkNum
387 { 388 {
388 get { return m_linkNum; } 389 get { return m_linkNum; }
@@ -390,13 +391,14 @@ namespace OpenSim.Region.Environment.Scenes
390 } 391 }
391 392
392 private byte m_clickAction = 0; 393 private byte m_clickAction = 0;
394
393 public byte ClickAction 395 public byte ClickAction
394 { 396 {
395 get { return m_clickAction; } 397 get { return m_clickAction; }
396 set 398 set
397 { 399 {
398 m_clickAction = value; 400 m_clickAction = value;
399 this.ScheduleFullUpdate(); 401 ScheduleFullUpdate();
400 } 402 }
401 } 403 }
402 404
@@ -423,6 +425,7 @@ namespace OpenSim.Region.Environment.Scenes
423 425
424 // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out. 426 // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out.
425 protected SceneObjectGroup m_parentGroup; 427 protected SceneObjectGroup m_parentGroup;
428
426 public SceneObjectGroup ParentGroup 429 public SceneObjectGroup ParentGroup
427 { 430 {
428 get { return m_parentGroup; } 431 get { return m_parentGroup; }
@@ -434,7 +437,6 @@ namespace OpenSim.Region.Environment.Scenes
434 set { m_updateFlag = value; } 437 set { m_updateFlag = value; }
435 } 438 }
436 439
437
438 #region Constructors 440 #region Constructors
439 441
440 /// <summary> 442 /// <summary>
@@ -469,18 +471,18 @@ namespace OpenSim.Region.Environment.Scenes
469 m_regionHandle = regionHandle; 471 m_regionHandle = regionHandle;
470 m_parentGroup = parent; 472 m_parentGroup = parent;
471 473
472 CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 474 CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
473 OwnerID = ownerID; 475 OwnerID = ownerID;
474 CreatorID = OwnerID; 476 CreatorID = OwnerID;
475 LastOwnerID = LLUUID.Zero; 477 LastOwnerID = LLUUID.Zero;
476 UUID = LLUUID.Random(); 478 UUID = LLUUID.Random();
477 LocalID = (uint)(localID); 479 LocalID = (uint) (localID);
478 Shape = shape; 480 Shape = shape;
479 // Todo: Add More Object Parameter from above! 481 // Todo: Add More Object Parameter from above!
480 OwnershipCost = 0; 482 OwnershipCost = 0;
481 ObjectSaleType = (byte)0; 483 ObjectSaleType = (byte) 0;
482 SalePrice = 0; 484 SalePrice = 0;
483 Category = (uint)0; 485 Category = (uint) 0;
484 LastOwnerID = CreatorID; 486 LastOwnerID = CreatorID;
485 // End Todo: /// 487 // End Todo: ///
486 GroupPosition = groupPosition; 488 GroupPosition = groupPosition;
@@ -495,9 +497,9 @@ namespace OpenSim.Region.Environment.Scenes
495 m_folderID = LLUUID.Random(); 497 m_folderID = LLUUID.Random();
496 498
497 m_flags = 0; 499 m_flags = 0;
498 m_flags |= LLObject.ObjectFlags.Touch | 500 m_flags |= LLObject.ObjectFlags.Touch |
499 LLObject.ObjectFlags.AllowInventoryDrop | 501 LLObject.ObjectFlags.AllowInventoryDrop |
500 LLObject.ObjectFlags.CreateSelected; 502 LLObject.ObjectFlags.CreateSelected;
501 503
502 ApplySanePermissions(); 504 ApplySanePermissions();
503 505
@@ -520,18 +522,18 @@ namespace OpenSim.Region.Environment.Scenes
520 { 522 {
521 m_regionHandle = regionHandle; 523 m_regionHandle = regionHandle;
522 m_parentGroup = parent; 524 m_parentGroup = parent;
523 TimeStampTerse = (uint)Util.UnixTimeSinceEpoch(); 525 TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
524 CreationDate = creationDate; 526 CreationDate = creationDate;
525 OwnerID = ownerID; 527 OwnerID = ownerID;
526 CreatorID = creatorID; 528 CreatorID = creatorID;
527 LastOwnerID = lastOwnerID; 529 LastOwnerID = lastOwnerID;
528 UUID = LLUUID.Random(); 530 UUID = LLUUID.Random();
529 LocalID = (uint)(localID); 531 LocalID = (uint) (localID);
530 Shape = shape; 532 Shape = shape;
531 OwnershipCost = 0; 533 OwnershipCost = 0;
532 ObjectSaleType = (byte)0; 534 ObjectSaleType = (byte) 0;
533 SalePrice = 0; 535 SalePrice = 0;
534 Category = (uint)0; 536 Category = (uint) 0;
535 LastOwnerID = CreatorID; 537 LastOwnerID = CreatorID;
536 OffsetPosition = position; 538 OffsetPosition = position;
537 RotationOffset = rotation; 539 RotationOffset = rotation;
@@ -552,18 +554,18 @@ namespace OpenSim.Region.Environment.Scenes
552 /// <returns></returns> 554 /// <returns></returns>
553 public static SceneObjectPart FromXml(XmlReader xmlReader) 555 public static SceneObjectPart FromXml(XmlReader xmlReader)
554 { 556 {
555 XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); 557 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
556 SceneObjectPart newobject = (SceneObjectPart)serializer.Deserialize(xmlReader); 558 SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader);
557 return newobject; 559 return newobject;
558 } 560 }
559 561
560 public void ApplyPhysics() 562 public void ApplyPhysics()
561 { 563 {
562 bool isPhysical = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 564 bool isPhysical = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
563 bool isPhantom = ((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0); 565 bool isPhantom = ((ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0);
564 566
565 bool usePhysics = isPhysical && !isPhantom; 567 bool usePhysics = isPhysical && !isPhantom;
566 568
567 if (usePhysics) 569 if (usePhysics)
568 { 570 {
569 PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape( 571 PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape(
@@ -576,101 +578,102 @@ namespace OpenSim.Region.Environment.Scenes
576 RotationOffset.Y, RotationOffset.Z), usePhysics); 578 RotationOffset.Y, RotationOffset.Z), usePhysics);
577 } 579 }
578 580
579 DoPhysicsPropertyUpdate(usePhysics, true); 581 DoPhysicsPropertyUpdate(usePhysics, true);
580 } 582 }
583
581 public void ApplyNextOwnerPermissions() 584 public void ApplyNextOwnerPermissions()
582 { 585 {
583 BaseMask = NextOwnerMask; 586 BaseMask = NextOwnerMask;
584 OwnerMask = NextOwnerMask; 587 OwnerMask = NextOwnerMask;
585 } 588 }
589
586 public void ApplySanePermissions() 590 public void ApplySanePermissions()
587 { 591 {
588 // These are some flags that The OwnerMask should never have 592 // These are some flags that The OwnerMask should never have
589 OwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; 593 OwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectGroupOwned;
590 OwnerMask &= ~(uint)LLObject.ObjectFlags.Physics; 594 OwnerMask &= ~(uint) LLObject.ObjectFlags.Physics;
591 OwnerMask &= ~(uint)LLObject.ObjectFlags.Phantom; 595 OwnerMask &= ~(uint) LLObject.ObjectFlags.Phantom;
592 OwnerMask &= ~(uint)LLObject.ObjectFlags.Scripted; 596 OwnerMask &= ~(uint) LLObject.ObjectFlags.Scripted;
593 OwnerMask &= ~(uint)LLObject.ObjectFlags.Touch; 597 OwnerMask &= ~(uint) LLObject.ObjectFlags.Touch;
594 OwnerMask &= ~(uint)LLObject.ObjectFlags.Temporary; 598 OwnerMask &= ~(uint) LLObject.ObjectFlags.Temporary;
595 OwnerMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; 599 OwnerMask &= ~(uint) LLObject.ObjectFlags.TemporaryOnRez;
596 OwnerMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; 600 OwnerMask &= ~(uint) LLObject.ObjectFlags.ZlibCompressed;
597 OwnerMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; 601 OwnerMask &= ~(uint) LLObject.ObjectFlags.AllowInventoryDrop;
598 OwnerMask &= ~(uint)LLObject.ObjectFlags.AnimSource; 602 OwnerMask &= ~(uint) LLObject.ObjectFlags.AnimSource;
599 OwnerMask &= ~(uint)LLObject.ObjectFlags.Money; 603 OwnerMask &= ~(uint) LLObject.ObjectFlags.Money;
600 OwnerMask &= ~(uint)LLObject.ObjectFlags.CastShadows; 604 OwnerMask &= ~(uint) LLObject.ObjectFlags.CastShadows;
601 OwnerMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; 605 OwnerMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty;
602 OwnerMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; 606 OwnerMask &= ~(uint) LLObject.ObjectFlags.CreateSelected;
603 607
604 608
605 // These are some flags that the next owner mask should never have 609 // These are some flags that the next owner mask should never have
606 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; 610 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectYouOwner;
607 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; 611 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectTransfer;
608 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify; 612 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectOwnerModify;
609 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; 613 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectGroupOwned;
610 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Physics; 614 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Physics;
611 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Phantom; 615 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Phantom;
612 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Scripted; 616 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Scripted;
613 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Touch; 617 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Touch;
614 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Temporary; 618 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Temporary;
615 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; 619 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.TemporaryOnRez;
616 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; 620 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ZlibCompressed;
617 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; 621 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.AllowInventoryDrop;
618 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.AnimSource; 622 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.AnimSource;
619 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Money; 623 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Money;
620 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.CastShadows; 624 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.CastShadows;
621 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; 625 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty;
622 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; 626 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.CreateSelected;
623 627
624 628
625 // These are some flags that the GroupMask should never have 629 // These are some flags that the GroupMask should never have
626 GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; 630 GroupMask &= ~(uint) LLObject.ObjectFlags.ObjectYouOwner;
627 GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; 631 GroupMask &= ~(uint) LLObject.ObjectFlags.ObjectTransfer;
628 GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify; 632 GroupMask &= ~(uint) LLObject.ObjectFlags.ObjectOwnerModify;
629 GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; 633 GroupMask &= ~(uint) LLObject.ObjectFlags.ObjectGroupOwned;
630 GroupMask &= ~(uint)LLObject.ObjectFlags.Physics; 634 GroupMask &= ~(uint) LLObject.ObjectFlags.Physics;
631 GroupMask &= ~(uint)LLObject.ObjectFlags.Phantom; 635 GroupMask &= ~(uint) LLObject.ObjectFlags.Phantom;
632 GroupMask &= ~(uint)LLObject.ObjectFlags.Scripted; 636 GroupMask &= ~(uint) LLObject.ObjectFlags.Scripted;
633 GroupMask &= ~(uint)LLObject.ObjectFlags.Touch; 637 GroupMask &= ~(uint) LLObject.ObjectFlags.Touch;
634 GroupMask &= ~(uint)LLObject.ObjectFlags.Temporary; 638 GroupMask &= ~(uint) LLObject.ObjectFlags.Temporary;
635 GroupMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; 639 GroupMask &= ~(uint) LLObject.ObjectFlags.TemporaryOnRez;
636 GroupMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; 640 GroupMask &= ~(uint) LLObject.ObjectFlags.ZlibCompressed;
637 GroupMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; 641 GroupMask &= ~(uint) LLObject.ObjectFlags.AllowInventoryDrop;
638 GroupMask &= ~(uint)LLObject.ObjectFlags.AnimSource; 642 GroupMask &= ~(uint) LLObject.ObjectFlags.AnimSource;
639 GroupMask &= ~(uint)LLObject.ObjectFlags.Money; 643 GroupMask &= ~(uint) LLObject.ObjectFlags.Money;
640 GroupMask &= ~(uint)LLObject.ObjectFlags.CastShadows; 644 GroupMask &= ~(uint) LLObject.ObjectFlags.CastShadows;
641 GroupMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; 645 GroupMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty;
642 GroupMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; 646 GroupMask &= ~(uint) LLObject.ObjectFlags.CreateSelected;
643 647
644 648
645 // These are some flags that EveryoneMask should never have 649 // These are some flags that EveryoneMask should never have
646 EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; 650 EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectYouOwner;
647 EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; 651 EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectTransfer;
648 EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify; 652 EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectOwnerModify;
649 EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; 653 EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectGroupOwned;
650 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Physics; 654 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Physics;
651 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Phantom; 655 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Phantom;
652 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Scripted; 656 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Scripted;
653 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Touch; 657 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Touch;
654 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Temporary; 658 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Temporary;
655 EveryoneMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; 659 EveryoneMask &= ~(uint) LLObject.ObjectFlags.TemporaryOnRez;
656 EveryoneMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; 660 EveryoneMask &= ~(uint) LLObject.ObjectFlags.ZlibCompressed;
657 EveryoneMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; 661 EveryoneMask &= ~(uint) LLObject.ObjectFlags.AllowInventoryDrop;
658 EveryoneMask &= ~(uint)LLObject.ObjectFlags.AnimSource; 662 EveryoneMask &= ~(uint) LLObject.ObjectFlags.AnimSource;
659 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Money; 663 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Money;
660 EveryoneMask &= ~(uint)LLObject.ObjectFlags.CastShadows; 664 EveryoneMask &= ~(uint) LLObject.ObjectFlags.CastShadows;
661 EveryoneMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; 665 EveryoneMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty;
662 EveryoneMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; 666 EveryoneMask &= ~(uint) LLObject.ObjectFlags.CreateSelected;
663
664 667
665 // These are some flags that ObjectFlags (m_flags) should never have
666 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner;
667 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer;
668 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify;
669 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer;
670 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectCopy;
671 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify;
672 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectMove;
673 668
669 // These are some flags that ObjectFlags (m_flags) should never have
670 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectYouOwner;
671 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectTransfer;
672 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectOwnerModify;
673 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectYouOfficer;
674 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectCopy;
675 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectModify;
676 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectMove;
674 } 677 }
675 678
676 /// <summary> 679 /// <summary>
@@ -679,13 +682,12 @@ namespace OpenSim.Region.Environment.Scenes
679 /// <param name="xmlWriter"></param> 682 /// <param name="xmlWriter"></param>
680 public void ToXml(XmlWriter xmlWriter) 683 public void ToXml(XmlWriter xmlWriter)
681 { 684 {
682 XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); 685 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
683 serializer.Serialize(xmlWriter, this); 686 serializer.Serialize(xmlWriter, this);
684 } 687 }
685 688
686 public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) 689 public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot)
687 { 690 {
688
689 // In this case we're using a sphere with a radius of the largest dimention of the prim 691 // In this case we're using a sphere with a radius of the largest dimention of the prim
690 // TODO: Change to take shape into account 692 // TODO: Change to take shape into account
691 693
@@ -693,35 +695,34 @@ namespace OpenSim.Region.Environment.Scenes
693 EntityIntersection returnresult = new EntityIntersection(); 695 EntityIntersection returnresult = new EntityIntersection();
694 Vector3 vAbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 696 Vector3 vAbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
695 Vector3 vScale = new Vector3(Scale.X, Scale.Y, Scale.Z); 697 Vector3 vScale = new Vector3(Scale.X, Scale.Y, Scale.Z);
696 Quaternion qRotation = new Quaternion(RotationOffset.W, RotationOffset.X, RotationOffset.Y, RotationOffset.Z); 698 Quaternion qRotation =
697 699 new Quaternion(RotationOffset.W, RotationOffset.X, RotationOffset.Y, RotationOffset.Z);
698 700
699 701
700 Quaternion worldRotation = (qRotation * parentrot); 702 Quaternion worldRotation = (qRotation*parentrot);
701 Matrix3 worldRotM = worldRotation.ToRotationMatrix(); 703 Matrix3 worldRotM = worldRotation.ToRotationMatrix();
702 704
703 705
704
705 Vector3 rOrigin = iray.Origin; 706 Vector3 rOrigin = iray.Origin;
706 Vector3 rDirection = iray.Direction; 707 Vector3 rDirection = iray.Direction;
707 708
708 709
709 // Buidling the first part of the Quadratic equation 710 // Buidling the first part of the Quadratic equation
710 Vector3 r2ndDirection = rDirection * rDirection; 711 Vector3 r2ndDirection = rDirection*rDirection;
711 float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z; 712 float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z;
712 713
713 // Buidling the second part of the Quadratic equation 714 // Buidling the second part of the Quadratic equation
714 Vector3 tmVal2 = rOrigin - vAbsolutePosition; 715 Vector3 tmVal2 = rOrigin - vAbsolutePosition;
715 Vector3 r2Direction = rDirection * 2.0f; 716 Vector3 r2Direction = rDirection*2.0f;
716 Vector3 tmVal3 = r2Direction * tmVal2; 717 Vector3 tmVal3 = r2Direction*tmVal2;
717 718
718 float itestPart2 = tmVal3.x + tmVal3.y + tmVal3.z; 719 float itestPart2 = tmVal3.x + tmVal3.y + tmVal3.z;
719 720
720 // Buidling the third part of the Quadratic equation 721 // Buidling the third part of the Quadratic equation
721 Vector3 tmVal4 = rOrigin * rOrigin; 722 Vector3 tmVal4 = rOrigin*rOrigin;
722 Vector3 tmVal5 = vAbsolutePosition * vAbsolutePosition; 723 Vector3 tmVal5 = vAbsolutePosition*vAbsolutePosition;
723 724
724 Vector3 tmVal6 = vAbsolutePosition * rOrigin; 725 Vector3 tmVal6 = vAbsolutePosition*rOrigin;
725 726
726 727
727 // Set Radius to the largest dimention of the prim 728 // Set Radius to the largest dimention of the prim
@@ -735,21 +736,22 @@ namespace OpenSim.Region.Environment.Scenes
735 736
736 //radius = radius; 737 //radius = radius;
737 738
738 float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z - (2.0f * (tmVal6.x + tmVal6.y + tmVal6.z + (radius * radius))); 739 float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z -
740 (2.0f*(tmVal6.x + tmVal6.y + tmVal6.z + (radius*radius)));
739 741
740 // Yuk Quadradrics.. Solve first 742 // Yuk Quadradrics.. Solve first
741 float rootsqr = (itestPart2 * itestPart2) - (4.0f * itestPart1 * itestPart3); 743 float rootsqr = (itestPart2*itestPart2) - (4.0f*itestPart1*itestPart3);
742 if (rootsqr < 0.0f) 744 if (rootsqr < 0.0f)
743 { 745 {
744 // No intersection 746 // No intersection
745 return returnresult; 747 return returnresult;
746 } 748 }
747 float root = ((-itestPart2) - (float)Math.Sqrt((double)rootsqr)) / (itestPart1 * 2.0f); 749 float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f);
748 750
749 if (root < 0.0f) 751 if (root < 0.0f)
750 { 752 {
751 // perform second quadratic root solution 753 // perform second quadratic root solution
752 root = ((-itestPart2) + (float)Math.Sqrt((double)rootsqr)) / (itestPart1 * 2.0f); 754 root = ((-itestPart2) + (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f);
753 755
754 // is there any intersection? 756 // is there any intersection?
755 if (root < 0.0f) 757 if (root < 0.0f)
@@ -761,7 +763,9 @@ namespace OpenSim.Region.Environment.Scenes
761 763
762 // We got an intersection. putting together an EntityIntersection object with the 764 // We got an intersection. putting together an EntityIntersection object with the
763 // intersection information 765 // intersection information
764 Vector3 ipoint = new Vector3(iray.Origin.x + (iray.Direction.x * root), iray.Origin.y + (iray.Direction.y * root), iray.Origin.z + (iray.Direction.z * root)); 766 Vector3 ipoint =
767 new Vector3(iray.Origin.x + (iray.Direction.x*root), iray.Origin.y + (iray.Direction.y*root),
768 iray.Origin.z + (iray.Direction.z*root));
765 769
766 returnresult.HitTF = true; 770 returnresult.HitTF = true;
767 returnresult.ipoint = ipoint; 771 returnresult.ipoint = ipoint;
@@ -775,7 +779,7 @@ namespace OpenSim.Region.Environment.Scenes
775 779
776 LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z); 780 LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z);
777 LLVector3 distanceConvert2 = new LLVector3(ipoint.x, ipoint.y, ipoint.z); 781 LLVector3 distanceConvert2 = new LLVector3(ipoint.x, ipoint.y, ipoint.z);
778 float distance = (float)Util.GetDistanceTo(distanceConvert1, distanceConvert2); 782 float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2);
779 783
780 returnresult.distance = distance; 784 returnresult.distance = distance;
781 785
@@ -783,7 +787,6 @@ namespace OpenSim.Region.Environment.Scenes
783 } 787 }
784 788
785 789
786
787 /// <summary> 790 /// <summary>
788 /// 791 ///
789 /// </summary> 792 /// </summary>
@@ -797,6 +800,7 @@ namespace OpenSim.Region.Environment.Scenes
797 m_sitTargetPosition = offset; 800 m_sitTargetPosition = offset;
798 m_sitTargetOrientation = orientation; 801 m_sitTargetOrientation = orientation;
799 } 802 }
803
800 public LLVector3 GetSitTargetPositionLL() 804 public LLVector3 GetSitTargetPositionLL()
801 { 805 {
802 return new LLVector3(m_sitTargetPosition.x, m_sitTargetPosition.y, m_sitTargetPosition.z); 806 return new LLVector3(m_sitTargetPosition.x, m_sitTargetPosition.y, m_sitTargetPosition.z);
@@ -804,13 +808,17 @@ namespace OpenSim.Region.Environment.Scenes
804 808
805 public LLQuaternion GetSitTargetOrientationLL() 809 public LLQuaternion GetSitTargetOrientationLL()
806 { 810 {
807 return new LLQuaternion( m_sitTargetOrientation.x, m_sitTargetOrientation.y, m_sitTargetOrientation.z,m_sitTargetOrientation.w); 811 return
812 new LLQuaternion(m_sitTargetOrientation.x, m_sitTargetOrientation.y, m_sitTargetOrientation.z,
813 m_sitTargetOrientation.w);
808 } 814 }
809 815
810 // Utility function so the databases don't have to reference axiom.math 816 // Utility function so the databases don't have to reference axiom.math
811 public void SetSitTargetLL(LLVector3 offset, LLQuaternion orientation) 817 public void SetSitTargetLL(LLVector3 offset, LLQuaternion orientation)
812 { 818 {
813 if (!(offset.X == 0 && offset.Y == 0 && offset.Z == 0 && (orientation.W == 0 || orientation.W == 1) && orientation.X == 0 && orientation.Y == 0 && orientation.Z == 0)) 819 if (
820 !(offset.X == 0 && offset.Y == 0 && offset.Z == 0 && (orientation.W == 0 || orientation.W == 1) &&
821 orientation.X == 0 && orientation.Y == 0 && orientation.Z == 0))
814 { 822 {
815 m_sitTargetPosition = new Vector3(offset.X, offset.Y, offset.Z); 823 m_sitTargetPosition = new Vector3(offset.X, offset.Y, offset.Z);
816 m_sitTargetOrientation = new Quaternion(orientation.W, orientation.X, orientation.Y, orientation.Z); 824 m_sitTargetOrientation = new Quaternion(orientation.W, orientation.X, orientation.Y, orientation.Z);
@@ -869,7 +877,7 @@ namespace OpenSim.Region.Environment.Scenes
869 /// <returns></returns> 877 /// <returns></returns>
870 public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID) 878 public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID)
871 { 879 {
872 SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone(); 880 SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone();
873 dupe.m_shape = m_shape.Copy(); 881 dupe.m_shape = m_shape.Copy();
874 dupe.m_regionHandle = m_regionHandle; 882 dupe.m_regionHandle = m_regionHandle;
875 dupe.UUID = LLUUID.Random(); 883 dupe.UUID = LLUUID.Random();
@@ -896,7 +904,7 @@ namespace OpenSim.Region.Environment.Scenes
896 byte[] extraP = new byte[Shape.ExtraParams.Length]; 904 byte[] extraP = new byte[Shape.ExtraParams.Length];
897 Array.Copy(Shape.ExtraParams, extraP, extraP.Length); 905 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
898 dupe.Shape.ExtraParams = extraP; 906 dupe.Shape.ExtraParams = extraP;
899 bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 907 bool UsePhysics = ((dupe.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
900 dupe.DoPhysicsPropertyUpdate(UsePhysics, true); 908 dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
901 909
902 return dupe; 910 return dupe;
@@ -923,7 +931,7 @@ namespace OpenSim.Region.Environment.Scenes
923 { 931 {
924 m_parentGroup.HasChanged = true; 932 m_parentGroup.HasChanged = true;
925 } 933 }
926 TimeStampFull = (uint)Util.UnixTimeSinceEpoch(); 934 TimeStampFull = (uint) Util.UnixTimeSinceEpoch();
927 m_updateFlag = 2; 935 m_updateFlag = 2;
928 } 936 }
929 937
@@ -931,11 +939,10 @@ namespace OpenSim.Region.Environment.Scenes
931 { 939 {
932 LLObject.ObjectFlags prevflag = m_flags; 940 LLObject.ObjectFlags prevflag = m_flags;
933 //uint objflags = m_flags; 941 //uint objflags = m_flags;
934 if ((ObjectFlags & (uint)flag) == 0) 942 if ((ObjectFlags & (uint) flag) == 0)
935 { 943 {
936 //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString()); 944 //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString());
937 m_flags |= flag; 945 m_flags |= flag;
938
939 } 946 }
940 //uint currflag = (uint)m_flags; 947 //uint currflag = (uint)m_flags;
941 //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); 948 //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString());
@@ -945,11 +952,10 @@ namespace OpenSim.Region.Environment.Scenes
945 public void RemFlag(LLObject.ObjectFlags flag) 952 public void RemFlag(LLObject.ObjectFlags flag)
946 { 953 {
947 LLObject.ObjectFlags prevflag = m_flags; 954 LLObject.ObjectFlags prevflag = m_flags;
948 if ((ObjectFlags & (uint)flag) != 0) 955 if ((ObjectFlags & (uint) flag) != 0)
949 { 956 {
950 //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString()); 957 //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString());
951 m_flags &= ~flag; 958 m_flags &= ~flag;
952
953 } 959 }
954 //System.Console.WriteLine("prev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); 960 //System.Console.WriteLine("prev: " + prevflag.ToString() + " curr: " + m_flags.ToString());
955 //ScheduleFullUpdate(); 961 //ScheduleFullUpdate();
@@ -966,7 +972,7 @@ namespace OpenSim.Region.Environment.Scenes
966 { 972 {
967 m_parentGroup.HasChanged = true; 973 m_parentGroup.HasChanged = true;
968 } 974 }
969 TimeStampTerse = (uint)Util.UnixTimeSinceEpoch(); 975 TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
970 m_updateFlag = 1; 976 m_updateFlag = 1;
971 } 977 }
972 } 978 }
@@ -1074,7 +1080,7 @@ namespace OpenSim.Region.Environment.Scenes
1074 { 1080 {
1075 if (m_inventorySerial > 0) 1081 if (m_inventorySerial > 0)
1076 { 1082 {
1077 client.SendTaskInventory(m_uuid, (short)m_inventorySerial, 1083 client.SendTaskInventory(m_uuid, (short) m_inventorySerial,
1078 Helpers.StringToField(m_inventoryFileName)); 1084 Helpers.StringToField(m_inventoryFileName));
1079 return true; 1085 return true;
1080 } 1086 }
@@ -1134,7 +1140,7 @@ namespace OpenSim.Region.Environment.Scenes
1134 bool IsTemporary = false; 1140 bool IsTemporary = false;
1135 bool IsPhantom = false; 1141 bool IsPhantom = false;
1136 bool castsShadows = false; 1142 bool castsShadows = false;
1137 bool wasUsingPhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 1143 bool wasUsingPhysics = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
1138 //bool IsLocked = false; 1144 //bool IsLocked = false;
1139 int i = 0; 1145 int i = 0;
1140 1146
@@ -1162,7 +1168,6 @@ namespace OpenSim.Region.Environment.Scenes
1162 { 1168 {
1163 DoPhysicsPropertyUpdate(usePhysics, false); 1169 DoPhysicsPropertyUpdate(usePhysics, false);
1164 } 1170 }
1165
1166 } 1171 }
1167 else 1172 else
1168 { 1173 {
@@ -1174,9 +1179,6 @@ namespace OpenSim.Region.Environment.Scenes
1174 } 1179 }
1175 1180
1176 1181
1177
1178
1179
1180 if (IsPhantom) 1182 if (IsPhantom)
1181 { 1183 {
1182 AddFlag(LLObject.ObjectFlags.Phantom); 1184 AddFlag(LLObject.ObjectFlags.Phantom);
@@ -1220,19 +1222,18 @@ namespace OpenSim.Region.Environment.Scenes
1220 // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); 1222 // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
1221 ScheduleFullUpdate(); 1223 ScheduleFullUpdate();
1222 } 1224 }
1225
1223 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) 1226 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
1224 { 1227 {
1225
1226 if (PhysActor != null) 1228 if (PhysActor != null)
1227 { 1229 {
1228 if (UsePhysics != PhysActor.IsPhysical || isNew) 1230 if (UsePhysics != PhysActor.IsPhysical || isNew)
1229 { 1231 {
1230
1231 if (PhysActor.IsPhysical) 1232 if (PhysActor.IsPhysical)
1232 { 1233 {
1233 if (!isNew) 1234 if (!isNew)
1234 this.ParentGroup.m_scene.RemovePhysicalPrim(1); 1235 ParentGroup.m_scene.RemovePhysicalPrim(1);
1235 1236
1236 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; 1237 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
1237 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; 1238 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds;
1238 } 1239 }
@@ -1244,7 +1245,7 @@ namespace OpenSim.Region.Environment.Scenes
1244 //PhysActor = null; 1245 //PhysActor = null;
1245 1246
1246 1247
1247 if ((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 1248 if ((ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
1248 { 1249 {
1249 //PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape( 1250 //PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape(
1250 //Name, 1251 //Name,
@@ -1256,8 +1257,8 @@ namespace OpenSim.Region.Environment.Scenes
1256 //RotationOffset.Y, RotationOffset.Z), UsePhysics); 1257 //RotationOffset.Y, RotationOffset.Z), UsePhysics);
1257 if (UsePhysics) 1258 if (UsePhysics)
1258 { 1259 {
1259 this.ParentGroup.m_scene.AddPhysicalPrim(1); 1260 ParentGroup.m_scene.AddPhysicalPrim(1);
1260 1261
1261 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 1262 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
1262 PhysActor.OnOutOfBounds += PhysicsOutOfBounds; 1263 PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
1263 } 1264 }
@@ -1271,15 +1272,15 @@ namespace OpenSim.Region.Environment.Scenes
1271 { 1272 {
1272 m_shape.ExtraParams = new byte[data.Length + 7]; 1273 m_shape.ExtraParams = new byte[data.Length + 7];
1273 int i = 0; 1274 int i = 0;
1274 uint length = (uint)data.Length; 1275 uint length = (uint) data.Length;
1275 m_shape.ExtraParams[i++] = 1; 1276 m_shape.ExtraParams[i++] = 1;
1276 m_shape.ExtraParams[i++] = (byte)(type % 256); 1277 m_shape.ExtraParams[i++] = (byte) (type%256);
1277 m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256); 1278 m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256);
1278 1279
1279 m_shape.ExtraParams[i++] = (byte)(length % 256); 1280 m_shape.ExtraParams[i++] = (byte) (length%256);
1280 m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256); 1281 m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256);
1281 m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256); 1282 m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256);
1282 m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256); 1283 m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256);
1283 Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length); 1284 Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length);
1284 1285
1285 ScheduleFullUpdate(); 1286 ScheduleFullUpdate();
@@ -1305,7 +1306,7 @@ namespace OpenSim.Region.Environment.Scenes
1305 { 1306 {
1306 if (PhysActor != null) 1307 if (PhysActor != null)
1307 { 1308 {
1308 return new LLVector3(PhysActor.CenterOfMass.X,PhysActor.CenterOfMass.Y,PhysActor.CenterOfMass.Z); 1309 return new LLVector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z);
1309 } 1310 }
1310 else 1311 else
1311 { 1312 {
@@ -1323,7 +1324,7 @@ namespace OpenSim.Region.Environment.Scenes
1323 /// <param name="textureEntry"></param> 1324 /// <param name="textureEntry"></param>
1324 public void UpdateTextureEntry(byte[] textureEntry) 1325 public void UpdateTextureEntry(byte[] textureEntry)
1325 { 1326 {
1326 m_shape.Textures = new LLObject.TextureEntry( textureEntry, 0, textureEntry.Length ); 1327 m_shape.Textures = new LLObject.TextureEntry(textureEntry, 0, textureEntry.Length);
1327 ScheduleFullUpdate(); 1328 ScheduleFullUpdate();
1328 } 1329 }
1329 1330
@@ -1337,20 +1338,20 @@ namespace OpenSim.Region.Environment.Scenes
1337 { 1338 {
1338 if (tex.FaceTextures[i] != null) 1339 if (tex.FaceTextures[i] != null)
1339 { 1340 {
1340 tmpcolor = tex.GetFace((uint)i).RGBA; 1341 tmpcolor = tex.GetFace((uint) i).RGBA;
1341 tmpcolor.A = tmpcolor.A * 255; 1342 tmpcolor.A = tmpcolor.A*255;
1342 tmpcolor.R = tmpcolor.R * 255; 1343 tmpcolor.R = tmpcolor.R*255;
1343 tmpcolor.G = tmpcolor.G * 255; 1344 tmpcolor.G = tmpcolor.G*255;
1344 tmpcolor.B = tmpcolor.B * 255; 1345 tmpcolor.B = tmpcolor.B*255;
1345 tex.FaceTextures[i].RGBA = tmpcolor; 1346 tex.FaceTextures[i].RGBA = tmpcolor;
1346 } 1347 }
1347 } 1348 }
1348 tmpcolor = tex.DefaultTexture.RGBA; 1349 tmpcolor = tex.DefaultTexture.RGBA;
1349 tmpcolor.A = tmpcolor.A * 255; 1350 tmpcolor.A = tmpcolor.A*255;
1350 tmpcolor.R = tmpcolor.R * 255; 1351 tmpcolor.R = tmpcolor.R*255;
1351 tmpcolor.G = tmpcolor.G * 255; 1352 tmpcolor.G = tmpcolor.G*255;
1352 tmpcolor.B = tmpcolor.B * 255; 1353 tmpcolor.B = tmpcolor.B*255;
1353 tex.DefaultTexture.RGBA = tmpcolor; 1354 tex.DefaultTexture.RGBA = tmpcolor;
1354 UpdateTextureEntry(tex.ToBytes()); 1355 UpdateTextureEntry(tex.ToBytes());
1355 } 1356 }
1356 1357
@@ -1416,34 +1417,33 @@ namespace OpenSim.Region.Environment.Scenes
1416 // Are we the owner? 1417 // Are we the owner?
1417 if (AgentID == OwnerID) 1418 if (AgentID == OwnerID)
1418 { 1419 {
1419 MainLog.Instance.Verbose("PERMISSIONS", "field: " + field.ToString() + ", mask: " + mask.ToString() + " addRemTF: " + addRemTF.ToString()); 1420 MainLog.Instance.Verbose("PERMISSIONS",
1420 1421 "field: " + field.ToString() + ", mask: " + mask.ToString() + " addRemTF: " +
1422 addRemTF.ToString());
1423
1421 //Field 8 = EveryoneMask 1424 //Field 8 = EveryoneMask
1422 if (field == (byte)8) 1425 if (field == (byte) 8)
1423 { 1426 {
1424 MainLog.Instance.Verbose("PERMISSIONS", "Left over: " + (OwnerMask - EveryoneMask)); 1427 MainLog.Instance.Verbose("PERMISSIONS", "Left over: " + (OwnerMask - EveryoneMask));
1425 if (addRemTF == (byte)0) 1428 if (addRemTF == (byte) 0)
1426 { 1429 {
1427 //EveryoneMask = (uint)0; 1430 //EveryoneMask = (uint)0;
1428 EveryoneMask &= ~mask; 1431 EveryoneMask &= ~mask;
1429 //EveryoneMask &= ~(uint)57344; 1432 //EveryoneMask &= ~(uint)57344;
1430
1431
1432 } 1433 }
1433 else 1434 else
1434 { 1435 {
1435 //EveryoneMask = (uint)0; 1436 //EveryoneMask = (uint)0;
1436 EveryoneMask |= mask; 1437 EveryoneMask |= mask;
1437 //EveryoneMask |= (uint)57344; 1438 //EveryoneMask |= (uint)57344;
1438
1439 } 1439 }
1440 //ScheduleFullUpdate(); 1440 //ScheduleFullUpdate();
1441 SendFullUpdateToAllClients(); 1441 SendFullUpdateToAllClients();
1442 } 1442 }
1443 //Field 16 = NextownerMask 1443 //Field 16 = NextownerMask
1444 if (field == (byte)16) 1444 if (field == (byte) 16)
1445 { 1445 {
1446 if (addRemTF == (byte)0) 1446 if (addRemTF == (byte) 0)
1447 { 1447 {
1448 NextOwnerMask &= ~mask; 1448 NextOwnerMask &= ~mask;
1449 } 1449 }
@@ -1453,7 +1453,6 @@ namespace OpenSim.Region.Environment.Scenes
1453 } 1453 }
1454 SendFullUpdateToAllClients(); 1454 SendFullUpdateToAllClients();
1455 } 1455 }
1456
1457 } 1456 }
1458 } 1457 }
1459 1458
@@ -1482,7 +1481,8 @@ namespace OpenSim.Region.Environment.Scenes
1482 for (int i = 0; i < avatars.Count; i++) 1481 for (int i = 0; i < avatars.Count; i++)
1483 { 1482 {
1484 // Ugly reference :( 1483 // Ugly reference :(
1485 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, avatars[i].GenerateClientFlags(this.UUID)); 1484 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
1485 avatars[i].GenerateClientFlags(UUID));
1486 } 1486 }
1487 } 1487 }
1488 1488
@@ -1515,19 +1515,19 @@ namespace OpenSim.Region.Environment.Scenes
1515 { 1515 {
1516 LLQuaternion lRot; 1516 LLQuaternion lRot;
1517 lRot = RotationOffset; 1517 lRot = RotationOffset;
1518 clientFlags &= ~(uint)LLObject.ObjectFlags.CreateSelected; 1518 clientFlags &= ~(uint) LLObject.ObjectFlags.CreateSelected;
1519 1519
1520 if (remoteClient.AgentId == OwnerID) 1520 if (remoteClient.AgentId == OwnerID)
1521 { 1521 {
1522 if ((uint)(m_flags & LLObject.ObjectFlags.CreateSelected) != 0) 1522 if ((uint) (m_flags & LLObject.ObjectFlags.CreateSelected) != 0)
1523 { 1523 {
1524 clientFlags |= (uint)LLObject.ObjectFlags.CreateSelected; 1524 clientFlags |= (uint) LLObject.ObjectFlags.CreateSelected;
1525 m_flags &= ~LLObject.ObjectFlags.CreateSelected; 1525 m_flags &= ~LLObject.ObjectFlags.CreateSelected;
1526 } 1526 }
1527 } 1527 }
1528 1528
1529 1529
1530 byte[] color = new byte[] { m_color.R, m_color.G, m_color.B, m_color.A }; 1530 byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A};
1531 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid, 1531 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid,
1532 OwnerID, 1532 OwnerID,
1533 m_text, color, ParentID, m_particleSystem, lRot, m_clickAction); 1533 m_text, color, ParentID, m_particleSystem, lRot, m_clickAction);
@@ -1574,26 +1574,28 @@ namespace OpenSim.Region.Environment.Scenes
1574 LLVector3 lPos; 1574 LLVector3 lPos;
1575 lPos = OffsetPosition; 1575 lPos = OffsetPosition;
1576 LLQuaternion mRot = RotationOffset; 1576 LLQuaternion mRot = RotationOffset;
1577 if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) 1577 if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0)
1578 { 1578 {
1579 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); 1579 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
1580 } 1580 }
1581 else 1581 else
1582 { 1582 {
1583 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, RotationalVelocity); 1583 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity,
1584 RotationalVelocity);
1584 } 1585 }
1585 } 1586 }
1586 1587
1587 public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) 1588 public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos)
1588 { 1589 {
1589 LLQuaternion mRot = RotationOffset; 1590 LLQuaternion mRot = RotationOffset;
1590 if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) 1591 if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0)
1591 { 1592 {
1592 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); 1593 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
1593 } 1594 }
1594 else 1595 else
1595 { 1596 {
1596 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, RotationalVelocity); 1597 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity,
1598 RotationalVelocity);
1597 //System.Console.WriteLine("RVel:" + RotationalVelocity); 1599 //System.Console.WriteLine("RVel:" + RotationalVelocity);
1598 } 1600 }
1599 } 1601 }
@@ -1603,13 +1605,16 @@ namespace OpenSim.Region.Environment.Scenes
1603 public virtual void UpdateMovement() 1605 public virtual void UpdateMovement()
1604 { 1606 {
1605 } 1607 }
1608
1606 #region Events 1609 #region Events
1610
1607 public void PhysicsRequestingTerseUpdate() 1611 public void PhysicsRequestingTerseUpdate()
1608 { 1612 {
1609 ScheduleTerseUpdate(); 1613 ScheduleTerseUpdate();
1610 1614
1611 //SendTerseUpdateToAllClients(); 1615 //SendTerseUpdateToAllClients();
1612 } 1616 }
1617
1613 #endregion 1618 #endregion
1614 1619
1615 public void PhysicsOutOfBounds(PhysicsVector pos) 1620 public void PhysicsOutOfBounds(PhysicsVector pos)
@@ -1626,10 +1631,10 @@ namespace OpenSim.Region.Environment.Scenes
1626 1631
1627 public void SetText(string text, Vector3 color, double alpha) 1632 public void SetText(string text, Vector3 color, double alpha)
1628 { 1633 {
1629 Color = Color.FromArgb(0xff - (int)(alpha * 0xff), 1634 Color = Color.FromArgb(0xff - (int) (alpha*0xff),
1630 (int)(color.x * 0xff), 1635 (int) (color.x*0xff),
1631 (int)(color.y * 0xff), 1636 (int) (color.y*0xff),
1632 (int)(color.z * 0xff)); 1637 (int) (color.z*0xff));
1633 Text = text; 1638 Text = text;
1634 } 1639 }
1635 1640
@@ -1725,7 +1730,6 @@ namespace OpenSim.Region.Environment.Scenes
1725 public TaskInventoryItem() 1730 public TaskInventoryItem()
1726 { 1731 {
1727 } 1732 }
1728
1729 } 1733 }
1730 } 1734 }
1731} 1735} \ No newline at end of file