aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISoundModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/ITerrainModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWorldComm.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs172
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs182
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs347
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs92
-rw-r--r--OpenSim/Region/Framework/Scenes/UndoState.cs79
15 files changed, 761 insertions, 210 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
index c289cdb..8954513 100644
--- a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
+++ b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
65 /// The UUID of the texture updater, not the texture UUID. If you need the texture UUID then you will need 65 /// The UUID of the texture updater, not the texture UUID. If you need the texture UUID then you will need
66 /// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture 66 /// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture
67 /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID 67 /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID
68 /// </returns> 68 /// </returns>
69 UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams, 69 UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
70 int updateTimer, bool SetBlending, byte AlphaValue); 70 int updateTimer, bool SetBlending, byte AlphaValue);
71 71
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index fa9bf19..f58904f 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -150,7 +150,7 @@ namespace OpenSim.Region.Framework.Interfaces
150 /// <returns> 150 /// <returns>
151 /// A list of inventory items with that name. 151 /// A list of inventory items with that name.
152 /// If no inventory item has that name then an empty list is returned. 152 /// If no inventory item has that name then an empty list is returned.
153 /// </returns> 153 /// </returns>
154 IList<TaskInventoryItem> GetInventoryItems(string name); 154 IList<TaskInventoryItem> GetInventoryItems(string name);
155 155
156 /// <summary> 156 /// <summary>
diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
index 379fabd..6117a80 100644
--- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
@@ -32,9 +32,9 @@ namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public interface ISoundModule 33 public interface ISoundModule
34 { 34 {
35 void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags); 35 void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius);
36 36
37 void TriggerSound( 37 void TriggerSound(
38 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle); 38 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius);
39 } 39 }
40} \ No newline at end of file 40} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
index 7caac55..5947afb 100644
--- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
@@ -62,5 +62,7 @@ namespace OpenSim.Region.Framework.Interfaces
62 void SaveToStream(string filename, Stream stream); 62 void SaveToStream(string filename, Stream stream);
63 63
64 void InstallPlugin(string name, ITerrainEffect plug); 64 void InstallPlugin(string name, ITerrainEffect plug);
65
66 void UndoTerrain(ITerrainChannel channel);
65 } 67 }
66} 68}
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
index 948b9dc..8da99a0 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Region.Framework.Interfaces
62 /// <param name="name">name to filter on</param> 62 /// <param name="name">name to filter on</param>
63 /// <param name="id">key to filter on (user given, could be totally faked)</param> 63 /// <param name="id">key to filter on (user given, could be totally faked)</param>
64 /// <param name="msg">msg to filter on</param> 64 /// <param name="msg">msg to filter on</param>
65 /// <returns>number of the scripts handle</returns> 65 /// <returns>number of the scripts handle</returns>
66 int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg); 66 int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg);
67 67
68 /// <summary> 68 /// <summary>
@@ -77,19 +77,19 @@ namespace OpenSim.Region.Framework.Interfaces
77 /// <param name="channel">channel to sent on</param> 77 /// <param name="channel">channel to sent on</param>
78 /// <param name="name">name of sender (object or avatar)</param> 78 /// <param name="name">name of sender (object or avatar)</param>
79 /// <param name="id">key of sender (object or avatar)</param> 79 /// <param name="id">key of sender (object or avatar)</param>
80 /// <param name="msg">msg to sent</param> 80 /// <param name="msg">msg to sent</param>
81 void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); 81 void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg);
82 82
83 /// <summary> 83 /// <summary>
84 /// Are there any listen events ready to be dispatched? 84 /// Are there any listen events ready to be dispatched?
85 /// </summary> 85 /// </summary>
86 /// <returns>boolean indication</returns> 86 /// <returns>boolean indication</returns>
87 bool HasMessages(); 87 bool HasMessages();
88 88
89 /// <summary> 89 /// <summary>
90 /// Pop the first availlable listen event from the queue 90 /// Pop the first availlable listen event from the queue
91 /// </summary> 91 /// </summary>
92 /// <returns>ListenerInfo with filter filled in</returns> 92 /// <returns>ListenerInfo with filter filled in</returns>
93 IWorldCommListenerInfo GetNextMessage(); 93 IWorldCommListenerInfo GetNextMessage();
94 94
95 void ListenControl(UUID itemID, int handle, int active); 95 void ListenControl(UUID itemID, int handle, int active);
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index e98f0e7..be0e985 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -419,15 +419,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation
419 { 419 {
420 if (m_scenePresence.IsChildAgent) 420 if (m_scenePresence.IsChildAgent)
421 return; 421 return;
422
423 UUID[] animIDs;
424 int[] sequenceNums;
425 UUID[] objectIDs;
426 422
427 m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); 423 m_scenePresence.Scene.ForEachScenePresence(
428 424 delegate(ScenePresence SP)
429 m_scenePresence.ControllingClient.SendAnimations( 425 {
430 animIDs, sequenceNums, m_scenePresence.ControllingClient.AgentId, objectIDs); 426 SP.Animator.SendAnimPack();
427 });
431 } 428 }
432 429
433 /// <summary> 430 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 22909bc..7fb1cd8 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -213,7 +213,7 @@ namespace OpenSim.Region.Framework.Scenes
213 /// Triggered when an object or attachment enters a scene 213 /// Triggered when an object or attachment enters a scene
214 /// </summary> 214 /// </summary>
215 public event OnIncomingSceneObjectDelegate OnIncomingSceneObject; 215 public event OnIncomingSceneObjectDelegate OnIncomingSceneObject;
216 public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so); 216 public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
217 217
218 public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); 218 public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
219 219
@@ -417,7 +417,7 @@ namespace OpenSim.Region.Framework.Scenes
417 } 417 }
418 } 418 }
419 } 419 }
420 } 420 }
421 421
422 public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) 422 public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
423 { 423 {
@@ -437,7 +437,7 @@ namespace OpenSim.Region.Framework.Scenes
437 e.Message, e.StackTrace); 437 e.Message, e.StackTrace);
438 } 438 }
439 } 439 }
440 } 440 }
441 } 441 }
442 442
443 public void TriggerOnScriptChangedEvent(uint localID, uint change) 443 public void TriggerOnScriptChangedEvent(uint localID, uint change)
@@ -458,7 +458,7 @@ namespace OpenSim.Region.Framework.Scenes
458 e.Message, e.StackTrace); 458 e.Message, e.StackTrace);
459 } 459 }
460 } 460 }
461 } 461 }
462 } 462 }
463 463
464 public void TriggerOnClientMovement(ScenePresence avatar) 464 public void TriggerOnClientMovement(ScenePresence avatar)
@@ -479,7 +479,7 @@ namespace OpenSim.Region.Framework.Scenes
479 e.Message, e.StackTrace); 479 e.Message, e.StackTrace);
480 } 480 }
481 } 481 }
482 } 482 }
483 } 483 }
484 484
485 public void TriggerPermissionError(UUID user, string reason) 485 public void TriggerPermissionError(UUID user, string reason)
@@ -500,7 +500,7 @@ namespace OpenSim.Region.Framework.Scenes
500 e.Message, e.StackTrace); 500 e.Message, e.StackTrace);
501 } 501 }
502 } 502 }
503 } 503 }
504 } 504 }
505 505
506 public void TriggerOnPluginConsole(string[] args) 506 public void TriggerOnPluginConsole(string[] args)
@@ -521,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes
521 e.Message, e.StackTrace); 521 e.Message, e.StackTrace);
522 } 522 }
523 } 523 }
524 } 524 }
525 } 525 }
526 526
527 public void TriggerOnFrame() 527 public void TriggerOnFrame()
@@ -542,11 +542,11 @@ namespace OpenSim.Region.Framework.Scenes
542 e.Message, e.StackTrace); 542 e.Message, e.StackTrace);
543 } 543 }
544 } 544 }
545 } 545 }
546 } 546 }
547 547
548 public void TriggerOnNewClient(IClientAPI client) 548 public void TriggerOnNewClient(IClientAPI client)
549 { 549 {
550 OnNewClientDelegate handlerNewClient = OnNewClient; 550 OnNewClientDelegate handlerNewClient = OnNewClient;
551 if (handlerNewClient != null) 551 if (handlerNewClient != null)
552 { 552 {
@@ -563,10 +563,10 @@ namespace OpenSim.Region.Framework.Scenes
563 e.Message, e.StackTrace); 563 e.Message, e.StackTrace);
564 } 564 }
565 } 565 }
566 } 566 }
567 567
568 if (client is IClientCore) 568 if (client is IClientCore)
569 { 569 {
570 OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect; 570 OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect;
571 if (handlerClientConnect != null) 571 if (handlerClientConnect != null)
572 { 572 {
@@ -583,7 +583,7 @@ namespace OpenSim.Region.Framework.Scenes
583 e.Message, e.StackTrace); 583 e.Message, e.StackTrace);
584 } 584 }
585 } 585 }
586 } 586 }
587 } 587 }
588 } 588 }
589 589
@@ -605,11 +605,11 @@ namespace OpenSim.Region.Framework.Scenes
605 e.Message, e.StackTrace); 605 e.Message, e.StackTrace);
606 } 606 }
607 } 607 }
608 } 608 }
609 } 609 }
610 610
611 public void TriggerOnRemovePresence(UUID agentId) 611 public void TriggerOnRemovePresence(UUID agentId)
612 { 612 {
613 OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence; 613 OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence;
614 if (handlerRemovePresence != null) 614 if (handlerRemovePresence != null)
615 { 615 {
@@ -626,11 +626,11 @@ namespace OpenSim.Region.Framework.Scenes
626 e.Message, e.StackTrace); 626 e.Message, e.StackTrace);
627 } 627 }
628 } 628 }
629 } 629 }
630 } 630 }
631 631
632 public void TriggerOnBackup(IRegionDataStore dstore) 632 public void TriggerOnBackup(IRegionDataStore dstore)
633 { 633 {
634 OnBackupDelegate handlerOnAttach = OnBackup; 634 OnBackupDelegate handlerOnAttach = OnBackup;
635 if (handlerOnAttach != null) 635 if (handlerOnAttach != null)
636 { 636 {
@@ -647,7 +647,7 @@ namespace OpenSim.Region.Framework.Scenes
647 e.Message, e.StackTrace); 647 e.Message, e.StackTrace);
648 } 648 }
649 } 649 }
650 } 650 }
651 } 651 }
652 652
653 public void TriggerParcelPrimCountUpdate() 653 public void TriggerParcelPrimCountUpdate()
@@ -668,7 +668,7 @@ namespace OpenSim.Region.Framework.Scenes
668 e.Message, e.StackTrace); 668 e.Message, e.StackTrace);
669 } 669 }
670 } 670 }
671 } 671 }
672 } 672 }
673 673
674 public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args) 674 public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args)
@@ -689,7 +689,7 @@ namespace OpenSim.Region.Framework.Scenes
689 e.Message, e.StackTrace); 689 e.Message, e.StackTrace);
690 } 690 }
691 } 691 }
692 } 692 }
693 } 693 }
694 694
695 public void TriggerTerrainTick() 695 public void TriggerTerrainTick()
@@ -710,7 +710,7 @@ namespace OpenSim.Region.Framework.Scenes
710 e.Message, e.StackTrace); 710 e.Message, e.StackTrace);
711 } 711 }
712 } 712 }
713 } 713 }
714 } 714 }
715 715
716 public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) 716 public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
@@ -731,7 +731,7 @@ namespace OpenSim.Region.Framework.Scenes
731 e.Message, e.StackTrace); 731 e.Message, e.StackTrace);
732 } 732 }
733 } 733 }
734 } 734 }
735 } 735 }
736 736
737 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) 737 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
@@ -752,11 +752,11 @@ namespace OpenSim.Region.Framework.Scenes
752 e.Message, e.StackTrace); 752 e.Message, e.StackTrace);
753 } 753 }
754 } 754 }
755 } 755 }
756 } 756 }
757 757
758 public void TriggerShutdown() 758 public void TriggerShutdown()
759 { 759 {
760 OnShutdownDelegate handlerShutdown = OnShutdown; 760 OnShutdownDelegate handlerShutdown = OnShutdown;
761 if (handlerShutdown != null) 761 if (handlerShutdown != null)
762 { 762 {
@@ -773,11 +773,11 @@ namespace OpenSim.Region.Framework.Scenes
773 e.Message, e.StackTrace); 773 e.Message, e.StackTrace);
774 } 774 }
775 } 775 }
776 } 776 }
777 } 777 }
778 778
779 public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) 779 public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
780 { 780 {
781 ObjectGrabDelegate handlerObjectGrab = OnObjectGrab; 781 ObjectGrabDelegate handlerObjectGrab = OnObjectGrab;
782 if (handlerObjectGrab != null) 782 if (handlerObjectGrab != null)
783 { 783 {
@@ -794,11 +794,11 @@ namespace OpenSim.Region.Framework.Scenes
794 e.Message, e.StackTrace); 794 e.Message, e.StackTrace);
795 } 795 }
796 } 796 }
797 } 797 }
798 } 798 }
799 799
800 public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) 800 public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
801 { 801 {
802 ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing; 802 ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing;
803 if (handlerObjectGrabbing != null) 803 if (handlerObjectGrabbing != null)
804 { 804 {
@@ -815,11 +815,11 @@ namespace OpenSim.Region.Framework.Scenes
815 e.Message, e.StackTrace); 815 e.Message, e.StackTrace);
816 } 816 }
817 } 817 }
818 } 818 }
819 } 819 }
820 820
821 public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) 821 public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
822 { 822 {
823 ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab; 823 ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab;
824 if (handlerObjectDeGrab != null) 824 if (handlerObjectDeGrab != null)
825 { 825 {
@@ -836,11 +836,11 @@ namespace OpenSim.Region.Framework.Scenes
836 e.Message, e.StackTrace); 836 e.Message, e.StackTrace);
837 } 837 }
838 } 838 }
839 } 839 }
840 } 840 }
841 841
842 public void TriggerScriptReset(uint localID, UUID itemID) 842 public void TriggerScriptReset(uint localID, UUID itemID)
843 { 843 {
844 ScriptResetDelegate handlerScriptReset = OnScriptReset; 844 ScriptResetDelegate handlerScriptReset = OnScriptReset;
845 if (handlerScriptReset != null) 845 if (handlerScriptReset != null)
846 { 846 {
@@ -857,11 +857,11 @@ namespace OpenSim.Region.Framework.Scenes
857 e.Message, e.StackTrace); 857 e.Message, e.StackTrace);
858 } 858 }
859 } 859 }
860 } 860 }
861 } 861 }
862 862
863 public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) 863 public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
864 { 864 {
865 NewRezScript handlerRezScript = OnRezScript; 865 NewRezScript handlerRezScript = OnRezScript;
866 if (handlerRezScript != null) 866 if (handlerRezScript != null)
867 { 867 {
@@ -878,7 +878,7 @@ namespace OpenSim.Region.Framework.Scenes
878 e.Message, e.StackTrace); 878 e.Message, e.StackTrace);
879 } 879 }
880 } 880 }
881 } 881 }
882 } 882 }
883 883
884 public void TriggerStartScript(uint localID, UUID itemID) 884 public void TriggerStartScript(uint localID, UUID itemID)
@@ -899,7 +899,7 @@ namespace OpenSim.Region.Framework.Scenes
899 e.Message, e.StackTrace); 899 e.Message, e.StackTrace);
900 } 900 }
901 } 901 }
902 } 902 }
903 } 903 }
904 904
905 public void TriggerStopScript(uint localID, UUID itemID) 905 public void TriggerStopScript(uint localID, UUID itemID)
@@ -920,11 +920,11 @@ namespace OpenSim.Region.Framework.Scenes
920 e.Message, e.StackTrace); 920 e.Message, e.StackTrace);
921 } 921 }
922 } 922 }
923 } 923 }
924 } 924 }
925 925
926 public void TriggerRemoveScript(uint localID, UUID itemID) 926 public void TriggerRemoveScript(uint localID, UUID itemID)
927 { 927 {
928 RemoveScript handlerRemoveScript = OnRemoveScript; 928 RemoveScript handlerRemoveScript = OnRemoveScript;
929 if (handlerRemoveScript != null) 929 if (handlerRemoveScript != null)
930 { 930 {
@@ -941,7 +941,7 @@ namespace OpenSim.Region.Framework.Scenes
941 e.Message, e.StackTrace); 941 e.Message, e.StackTrace);
942 } 942 }
943 } 943 }
944 } 944 }
945 } 945 }
946 946
947 public bool TriggerGroupMove(UUID groupID, Vector3 delta) 947 public bool TriggerGroupMove(UUID groupID, Vector3 delta)
@@ -1040,7 +1040,7 @@ namespace OpenSim.Region.Framework.Scenes
1040 e.Message, e.StackTrace); 1040 e.Message, e.StackTrace);
1041 } 1041 }
1042 } 1042 }
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 public void TriggerLandObjectAdded(ILandObject newParcel) 1046 public void TriggerLandObjectAdded(ILandObject newParcel)
@@ -1061,7 +1061,7 @@ namespace OpenSim.Region.Framework.Scenes
1061 e.Message, e.StackTrace); 1061 e.Message, e.StackTrace);
1062 } 1062 }
1063 } 1063 }
1064 } 1064 }
1065 } 1065 }
1066 1066
1067 public void TriggerLandObjectRemoved(UUID globalID) 1067 public void TriggerLandObjectRemoved(UUID globalID)
@@ -1082,7 +1082,7 @@ namespace OpenSim.Region.Framework.Scenes
1082 e.Message, e.StackTrace); 1082 e.Message, e.StackTrace);
1083 } 1083 }
1084 } 1084 }
1085 } 1085 }
1086 } 1086 }
1087 1087
1088 public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel) 1088 public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
@@ -1108,7 +1108,7 @@ namespace OpenSim.Region.Framework.Scenes
1108 e.Message, e.StackTrace); 1108 e.Message, e.StackTrace);
1109 } 1109 }
1110 } 1110 }
1111 } 1111 }
1112 } 1112 }
1113 1113
1114 public void TriggerIncomingInstantMessage(GridInstantMessage message) 1114 public void TriggerIncomingInstantMessage(GridInstantMessage message)
@@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes
1129 e.Message, e.StackTrace); 1129 e.Message, e.StackTrace);
1130 } 1130 }
1131 } 1131 }
1132 } 1132 }
1133 } 1133 }
1134 1134
1135 public void TriggerUnhandledInstantMessage(GridInstantMessage message) 1135 public void TriggerUnhandledInstantMessage(GridInstantMessage message)
@@ -1150,7 +1150,7 @@ namespace OpenSim.Region.Framework.Scenes
1150 e.Message, e.StackTrace); 1150 e.Message, e.StackTrace);
1151 } 1151 }
1152 } 1152 }
1153 } 1153 }
1154 } 1154 }
1155 1155
1156 public void TriggerClientClosed(UUID ClientID, Scene scene) 1156 public void TriggerClientClosed(UUID ClientID, Scene scene)
@@ -1171,7 +1171,7 @@ namespace OpenSim.Region.Framework.Scenes
1171 e.Message, e.StackTrace); 1171 e.Message, e.StackTrace);
1172 } 1172 }
1173 } 1173 }
1174 } 1174 }
1175 } 1175 }
1176 1176
1177 public void TriggerOnMakeChildAgent(ScenePresence presence) 1177 public void TriggerOnMakeChildAgent(ScenePresence presence)
@@ -1192,7 +1192,7 @@ namespace OpenSim.Region.Framework.Scenes
1192 e.Message, e.StackTrace); 1192 e.Message, e.StackTrace);
1193 } 1193 }
1194 } 1194 }
1195 } 1195 }
1196 } 1196 }
1197 1197
1198 public void TriggerOnSendNewWindlightProfileTargeted(RegionMeta7WindlightData wl, UUID user) 1198 public void TriggerOnSendNewWindlightProfileTargeted(RegionMeta7WindlightData wl, UUID user)
@@ -1231,7 +1231,7 @@ namespace OpenSim.Region.Framework.Scenes
1231 e.Message, e.StackTrace); 1231 e.Message, e.StackTrace);
1232 } 1232 }
1233 } 1233 }
1234 } 1234 }
1235 } 1235 }
1236 1236
1237 public void TriggerOnIncomingSceneObject(SceneObjectGroup so) 1237 public void TriggerOnIncomingSceneObject(SceneObjectGroup so)
@@ -1251,12 +1251,12 @@ namespace OpenSim.Region.Framework.Scenes
1251 "[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}", 1251 "[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}",
1252 e.Message, e.StackTrace); 1252 e.Message, e.StackTrace);
1253 } 1253 }
1254 } 1254 }
1255 } 1255 }
1256 } 1256 }
1257 1257
1258 public void TriggerOnRegisterCaps(UUID agentID, Caps caps) 1258 public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
1259 { 1259 {
1260 RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps; 1260 RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps;
1261 if (handlerRegisterCaps != null) 1261 if (handlerRegisterCaps != null)
1262 { 1262 {
@@ -1273,7 +1273,7 @@ namespace OpenSim.Region.Framework.Scenes
1273 e.Message, e.StackTrace); 1273 e.Message, e.StackTrace);
1274 } 1274 }
1275 } 1275 }
1276 } 1276 }
1277 } 1277 }
1278 1278
1279 public void TriggerOnDeregisterCaps(UUID agentID, Caps caps) 1279 public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
@@ -1294,7 +1294,7 @@ namespace OpenSim.Region.Framework.Scenes
1294 e.Message, e.StackTrace); 1294 e.Message, e.StackTrace);
1295 } 1295 }
1296 } 1296 }
1297 } 1297 }
1298 } 1298 }
1299 1299
1300 public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel) 1300 public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel)
@@ -1315,7 +1315,7 @@ namespace OpenSim.Region.Framework.Scenes
1315 e.Message, e.StackTrace); 1315 e.Message, e.StackTrace);
1316 } 1316 }
1317 } 1317 }
1318 } 1318 }
1319 } 1319 }
1320 1320
1321 public void TriggerLandBuy(Object sender, LandBuyArgs args) 1321 public void TriggerLandBuy(Object sender, LandBuyArgs args)
@@ -1336,7 +1336,7 @@ namespace OpenSim.Region.Framework.Scenes
1336 e.Message, e.StackTrace); 1336 e.Message, e.StackTrace);
1337 } 1337 }
1338 } 1338 }
1339 } 1339 }
1340 } 1340 }
1341 1341
1342 public void TriggerValidateLandBuy(Object sender, LandBuyArgs args) 1342 public void TriggerValidateLandBuy(Object sender, LandBuyArgs args)
@@ -1357,11 +1357,11 @@ namespace OpenSim.Region.Framework.Scenes
1357 e.Message, e.StackTrace); 1357 e.Message, e.StackTrace);
1358 } 1358 }
1359 } 1359 }
1360 } 1360 }
1361 } 1361 }
1362 1362
1363 public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos) 1363 public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos)
1364 { 1364 {
1365 ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent; 1365 ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
1366 if (handlerScriptAtTargetEvent != null) 1366 if (handlerScriptAtTargetEvent != null)
1367 { 1367 {
@@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes
1378 e.Message, e.StackTrace); 1378 e.Message, e.StackTrace);
1379 } 1379 }
1380 } 1380 }
1381 } 1381 }
1382 } 1382 }
1383 1383
1384 public void TriggerNotAtTargetEvent(uint localID) 1384 public void TriggerNotAtTargetEvent(uint localID)
@@ -1399,11 +1399,11 @@ namespace OpenSim.Region.Framework.Scenes
1399 e.Message, e.StackTrace); 1399 e.Message, e.StackTrace);
1400 } 1400 }
1401 } 1401 }
1402 } 1402 }
1403 } 1403 }
1404 1404
1405 public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) 1405 public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot)
1406 { 1406 {
1407 ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; 1407 ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent;
1408 if (handlerScriptAtRotTargetEvent != null) 1408 if (handlerScriptAtRotTargetEvent != null)
1409 { 1409 {
@@ -1420,7 +1420,7 @@ namespace OpenSim.Region.Framework.Scenes
1420 e.Message, e.StackTrace); 1420 e.Message, e.StackTrace);
1421 } 1421 }
1422 } 1422 }
1423 } 1423 }
1424 } 1424 }
1425 1425
1426 public void TriggerNotAtRotTargetEvent(uint localID) 1426 public void TriggerNotAtRotTargetEvent(uint localID)
@@ -1441,7 +1441,7 @@ namespace OpenSim.Region.Framework.Scenes
1441 e.Message, e.StackTrace); 1441 e.Message, e.StackTrace);
1442 } 1442 }
1443 } 1443 }
1444 } 1444 }
1445 } 1445 }
1446 1446
1447 public void TriggerRequestChangeWaterHeight(float height) 1447 public void TriggerRequestChangeWaterHeight(float height)
@@ -1462,7 +1462,7 @@ namespace OpenSim.Region.Framework.Scenes
1462 e.Message, e.StackTrace); 1462 e.Message, e.StackTrace);
1463 } 1463 }
1464 } 1464 }
1465 } 1465 }
1466 } 1466 }
1467 1467
1468 public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar) 1468 public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar)
@@ -1483,7 +1483,7 @@ namespace OpenSim.Region.Framework.Scenes
1483 e.Message, e.StackTrace); 1483 e.Message, e.StackTrace);
1484 } 1484 }
1485 } 1485 }
1486 } 1486 }
1487 } 1487 }
1488 1488
1489 public void TriggerSignificantClientMovement(IClientAPI client) 1489 public void TriggerSignificantClientMovement(IClientAPI client)
@@ -1504,7 +1504,7 @@ namespace OpenSim.Region.Framework.Scenes
1504 e.Message, e.StackTrace); 1504 e.Message, e.StackTrace);
1505 } 1505 }
1506 } 1506 }
1507 } 1507 }
1508 } 1508 }
1509 1509
1510 public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat) 1510 public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
@@ -1525,7 +1525,7 @@ namespace OpenSim.Region.Framework.Scenes
1525 e.Message, e.StackTrace); 1525 e.Message, e.StackTrace);
1526 } 1526 }
1527 } 1527 }
1528 } 1528 }
1529 } 1529 }
1530 1530
1531 public void TriggerOnChatFromClient(Object sender, OSChatMessage chat) 1531 public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
@@ -1546,7 +1546,7 @@ namespace OpenSim.Region.Framework.Scenes
1546 e.Message, e.StackTrace); 1546 e.Message, e.StackTrace);
1547 } 1547 }
1548 } 1548 }
1549 } 1549 }
1550 } 1550 }
1551 1551
1552 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) 1552 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
@@ -1567,7 +1567,7 @@ namespace OpenSim.Region.Framework.Scenes
1567 e.Message, e.StackTrace); 1567 e.Message, e.StackTrace);
1568 } 1568 }
1569 } 1569 }
1570 } 1570 }
1571 } 1571 }
1572 1572
1573 internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed) 1573 internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed)
@@ -1588,7 +1588,7 @@ namespace OpenSim.Region.Framework.Scenes
1588 e.Message, e.StackTrace); 1588 e.Message, e.StackTrace);
1589 } 1589 }
1590 } 1590 }
1591 } 1591 }
1592 } 1592 }
1593 1593
1594 public void TriggerNoticeNoLandDataFromStorage() 1594 public void TriggerNoticeNoLandDataFromStorage()
@@ -1609,7 +1609,7 @@ namespace OpenSim.Region.Framework.Scenes
1609 e.Message, e.StackTrace); 1609 e.Message, e.StackTrace);
1610 } 1610 }
1611 } 1611 }
1612 } 1612 }
1613 } 1613 }
1614 1614
1615 public void TriggerIncomingLandDataFromStorage(List<LandData> landData) 1615 public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
@@ -1630,7 +1630,7 @@ namespace OpenSim.Region.Framework.Scenes
1630 e.Message, e.StackTrace); 1630 e.Message, e.StackTrace);
1631 } 1631 }
1632 } 1632 }
1633 } 1633 }
1634 } 1634 }
1635 1635
1636 public void TriggerSetAllowForcefulBan(bool allow) 1636 public void TriggerSetAllowForcefulBan(bool allow)
@@ -1651,7 +1651,7 @@ namespace OpenSim.Region.Framework.Scenes
1651 e.Message, e.StackTrace); 1651 e.Message, e.StackTrace);
1652 } 1652 }
1653 } 1653 }
1654 } 1654 }
1655 } 1655 }
1656 1656
1657 public void TriggerRequestParcelPrimCountUpdate() 1657 public void TriggerRequestParcelPrimCountUpdate()
@@ -1672,7 +1672,7 @@ namespace OpenSim.Region.Framework.Scenes
1672 e.Message, e.StackTrace); 1672 e.Message, e.StackTrace);
1673 } 1673 }
1674 } 1674 }
1675 } 1675 }
1676 } 1676 }
1677 1677
1678 public void TriggerParcelPrimCountTainted() 1678 public void TriggerParcelPrimCountTainted()
@@ -1693,7 +1693,7 @@ namespace OpenSim.Region.Framework.Scenes
1693 e.Message, e.StackTrace); 1693 e.Message, e.StackTrace);
1694 } 1694 }
1695 } 1695 }
1696 } 1696 }
1697 } 1697 }
1698 1698
1699 // this lets us keep track of nasty script events like timer, etc. 1699 // this lets us keep track of nasty script events like timer, etc.
@@ -1732,7 +1732,7 @@ namespace OpenSim.Region.Framework.Scenes
1732 e.Message, e.StackTrace); 1732 e.Message, e.StackTrace);
1733 } 1733 }
1734 } 1734 }
1735 } 1735 }
1736 } 1736 }
1737 1737
1738 public float GetCurrentTimeAsSunLindenHour() 1738 public float GetCurrentTimeAsSunLindenHour()
@@ -1759,7 +1759,7 @@ namespace OpenSim.Region.Framework.Scenes
1759 } 1759 }
1760 1760
1761 public void TriggerOarFileLoaded(Guid requestId, string message) 1761 public void TriggerOarFileLoaded(Guid requestId, string message)
1762 { 1762 {
1763 OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded; 1763 OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded;
1764 if (handlerOarFileLoaded != null) 1764 if (handlerOarFileLoaded != null)
1765 { 1765 {
@@ -1776,7 +1776,7 @@ namespace OpenSim.Region.Framework.Scenes
1776 e.Message, e.StackTrace); 1776 e.Message, e.StackTrace);
1777 } 1777 }
1778 } 1778 }
1779 } 1779 }
1780 } 1780 }
1781 1781
1782 public void TriggerOarFileSaved(Guid requestId, string message) 1782 public void TriggerOarFileSaved(Guid requestId, string message)
@@ -1797,7 +1797,7 @@ namespace OpenSim.Region.Framework.Scenes
1797 e.Message, e.StackTrace); 1797 e.Message, e.StackTrace);
1798 } 1798 }
1799 } 1799 }
1800 } 1800 }
1801 } 1801 }
1802 1802
1803 public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message) 1803 public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
@@ -1818,7 +1818,7 @@ namespace OpenSim.Region.Framework.Scenes
1818 e.Message, e.StackTrace); 1818 e.Message, e.StackTrace);
1819 } 1819 }
1820 } 1820 }
1821 } 1821 }
1822 } 1822 }
1823 1823
1824 public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders) 1824 public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders)
@@ -1839,7 +1839,7 @@ namespace OpenSim.Region.Framework.Scenes
1839 e.Message, e.StackTrace); 1839 e.Message, e.StackTrace);
1840 } 1840 }
1841 } 1841 }
1842 } 1842 }
1843 } 1843 }
1844 1844
1845 public void TriggerScriptColliding(uint localId, ColliderArgs colliders) 1845 public void TriggerScriptColliding(uint localId, ColliderArgs colliders)
@@ -1860,7 +1860,7 @@ namespace OpenSim.Region.Framework.Scenes
1860 e.Message, e.StackTrace); 1860 e.Message, e.StackTrace);
1861 } 1861 }
1862 } 1862 }
1863 } 1863 }
1864 } 1864 }
1865 1865
1866 public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders) 1866 public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
@@ -1881,7 +1881,7 @@ namespace OpenSim.Region.Framework.Scenes
1881 e.Message, e.StackTrace); 1881 e.Message, e.StackTrace);
1882 } 1882 }
1883 } 1883 }
1884 } 1884 }
1885 } 1885 }
1886 1886
1887 public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders) 1887 public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders)
@@ -1902,7 +1902,7 @@ namespace OpenSim.Region.Framework.Scenes
1902 e.Message, e.StackTrace); 1902 e.Message, e.StackTrace);
1903 } 1903 }
1904 } 1904 }
1905 } 1905 }
1906 } 1906 }
1907 1907
1908 public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders) 1908 public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders)
@@ -1923,7 +1923,7 @@ namespace OpenSim.Region.Framework.Scenes
1923 e.Message, e.StackTrace); 1923 e.Message, e.StackTrace);
1924 } 1924 }
1925 } 1925 }
1926 } 1926 }
1927 } 1927 }
1928 1928
1929 public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders) 1929 public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
@@ -1944,11 +1944,11 @@ namespace OpenSim.Region.Framework.Scenes
1944 e.Message, e.StackTrace); 1944 e.Message, e.StackTrace);
1945 } 1945 }
1946 } 1946 }
1947 } 1947 }
1948 } 1948 }
1949 1949
1950 public void TriggerSetRootAgentScene(UUID agentID, Scene scene) 1950 public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
1951 { 1951 {
1952 OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene; 1952 OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene;
1953 if (handlerSetRootAgentScene != null) 1953 if (handlerSetRootAgentScene != null)
1954 { 1954 {
@@ -1965,7 +1965,7 @@ namespace OpenSim.Region.Framework.Scenes
1965 e.Message, e.StackTrace); 1965 e.Message, e.StackTrace);
1966 } 1966 }
1967 } 1967 }
1968 } 1968 }
1969 } 1969 }
1970 1970
1971 public void TriggerOnRegionUp(GridRegion otherRegion) 1971 public void TriggerOnRegionUp(GridRegion otherRegion)
@@ -1986,7 +1986,7 @@ namespace OpenSim.Region.Framework.Scenes
1986 e.Message, e.StackTrace); 1986 e.Message, e.StackTrace);
1987 } 1987 }
1988 } 1988 }
1989 } 1989 }
1990 } 1990 }
1991 } 1991 }
1992} 1992}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4d357fd..ab0d397 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2003,6 +2003,23 @@ namespace OpenSim.Region.Framework.Scenes
2003 return; 2003 return;
2004 } 2004 }
2005 2005
2006 if (grp.RootPart.RETURN_AT_EDGE)
2007 {
2008 // We remove the object here
2009 try
2010 {
2011 List<SceneObjectGroup> objects = new List<SceneObjectGroup>();
2012 objects.Add(grp);
2013 SceneObjectGroup[] objectsArray = objects.ToArray();
2014 returnObjects(objectsArray, UUID.Zero);
2015 }
2016 catch (Exception)
2017 {
2018 m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border.");
2019 }
2020 return;
2021 }
2022
2006 int thisx = (int)RegionInfo.RegionLocX; 2023 int thisx = (int)RegionInfo.RegionLocX;
2007 int thisy = (int)RegionInfo.RegionLocY; 2024 int thisy = (int)RegionInfo.RegionLocY;
2008 Vector3 EastCross = new Vector3(0.1f,0,0); 2025 Vector3 EastCross = new Vector3(0.1f,0,0);
@@ -2071,19 +2088,25 @@ namespace OpenSim.Region.Framework.Scenes
2071 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); 2088 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2072 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) 2089 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2073 2090
2074 if (crossedBordery.BorderLine.Z > 0) 2091 try
2075 { 2092 {
2076 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); 2093 if (crossedBordery.BorderLine.Z > 0)
2077 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); 2094 {
2078 } 2095 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2079 else 2096 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2080 pos.Y = ((pos.Y + Constants.RegionSize)); 2097 }
2098 else
2099 pos.Y = ((pos.Y + Constants.RegionSize));
2081 2100
2082 newRegionHandle 2101 newRegionHandle
2083 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), 2102 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
2084 (uint)((thisy + changeY) * Constants.RegionSize)); 2103 (uint)((thisy + changeY) * Constants.RegionSize));
2085 // x - 1 2104 // x - 1
2086 // y + 1 2105 // y + 1
2106 }
2107 catch (Exception ex)
2108 {
2109 }
2087 } 2110 }
2088 else 2111 else
2089 { 2112 {
@@ -2545,7 +2568,7 @@ namespace OpenSim.Region.Framework.Scenes
2545 AttachObject( 2568 AttachObject(
2546 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); 2569 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
2547 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2570 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2548 grp.SendGroupFullUpdate(); 2571 grp.SendGroupFullUpdate();
2549 } 2572 }
2550 else 2573 else
2551 { 2574 {
@@ -2711,6 +2734,7 @@ namespace OpenSim.Region.Framework.Scenes
2711 client.OnGrabUpdate += ProcessObjectGrabUpdate; 2734 client.OnGrabUpdate += ProcessObjectGrabUpdate;
2712 client.OnDeGrabObject += ProcessObjectDeGrab; 2735 client.OnDeGrabObject += ProcessObjectDeGrab;
2713 client.OnUndo += m_sceneGraph.HandleUndo; 2736 client.OnUndo += m_sceneGraph.HandleUndo;
2737 client.OnRedo += m_sceneGraph.HandleRedo;
2714 client.OnObjectDescription += m_sceneGraph.PrimDescription; 2738 client.OnObjectDescription += m_sceneGraph.PrimDescription;
2715 client.OnObjectDrop += m_sceneGraph.DropObject; 2739 client.OnObjectDrop += m_sceneGraph.DropObject;
2716 client.OnObjectSaleInfo += ObjectSaleInfo; 2740 client.OnObjectSaleInfo += ObjectSaleInfo;
@@ -2865,6 +2889,7 @@ namespace OpenSim.Region.Framework.Scenes
2865 client.OnGrabObject -= ProcessObjectGrab; 2889 client.OnGrabObject -= ProcessObjectGrab;
2866 client.OnDeGrabObject -= ProcessObjectDeGrab; 2890 client.OnDeGrabObject -= ProcessObjectDeGrab;
2867 client.OnUndo -= m_sceneGraph.HandleUndo; 2891 client.OnUndo -= m_sceneGraph.HandleUndo;
2892 client.OnRedo -= m_sceneGraph.HandleRedo;
2868 client.OnObjectDescription -= m_sceneGraph.PrimDescription; 2893 client.OnObjectDescription -= m_sceneGraph.PrimDescription;
2869 client.OnObjectDrop -= m_sceneGraph.DropObject; 2894 client.OnObjectDrop -= m_sceneGraph.DropObject;
2870 client.OnObjectSaleInfo -= ObjectSaleInfo; 2895 client.OnObjectSaleInfo -= ObjectSaleInfo;
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 1547f9a..5e798c0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -262,7 +262,7 @@ namespace OpenSim.Region.Framework.Scenes
262 /// Returns a new unallocated local ID 262 /// Returns a new unallocated local ID
263 /// </summary> 263 /// </summary>
264 /// <returns>A brand new local ID</returns> 264 /// <returns>A brand new local ID</returns>
265 protected internal uint AllocateLocalId() 265 public uint AllocateLocalId()
266 { 266 {
267 uint myID; 267 uint myID;
268 268
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 2c66719..e28d29f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -476,6 +476,15 @@ namespace OpenSim.Region.Framework.Scenes
476 part.Undo(); 476 part.Undo();
477 } 477 }
478 } 478 }
479 protected internal void HandleRedo(IClientAPI remoteClient, UUID primId)
480 {
481 if (primId != UUID.Zero)
482 {
483 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId);
484 if (part != null)
485 part.Redo();
486 }
487 }
479 488
480 protected internal void HandleObjectGroupUpdate( 489 protected internal void HandleObjectGroupUpdate(
481 IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage) 490 IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage)
@@ -669,7 +678,7 @@ namespace OpenSim.Region.Framework.Scenes
669 // it get cleaned up 678 // it get cleaned up
670 // 679 //
671 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); 680 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
672 group.HasGroupChanged = false; 681 group.HasGroupChanged = false;
673 } 682 }
674 else 683 else
675 { 684 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4676a30..f35a7c5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -369,14 +369,23 @@ namespace OpenSim.Region.Framework.Scenes
369 } 369 }
370 370
371 lockPartsForRead(true); 371 lockPartsForRead(true);
372
373 if (RootPart.GetStatusSandbox())
372 { 374 {
373 foreach (SceneObjectPart part in m_parts.Values) 375 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
374 { 376 {
375 377 RootPart.ScriptSetPhysicsStatus(false);
376 part.GroupPosition = val; 378 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
377 379 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
380 return;
378 } 381 }
379 } 382 }
383
384 foreach (SceneObjectPart part in m_parts.Values)
385 {
386 part.GroupPosition = val;
387 }
388
380 lockPartsForRead(false); 389 lockPartsForRead(false);
381 390
382 //if (m_rootPart.PhysActor != null) 391 //if (m_rootPart.PhysActor != null)
@@ -470,6 +479,34 @@ namespace OpenSim.Region.Framework.Scenes
470 } 479 }
471 } 480 }
472 481
482 private SceneObjectPart m_PlaySoundMasterPrim = null;
483 public SceneObjectPart PlaySoundMasterPrim
484 {
485 get { return m_PlaySoundMasterPrim; }
486 set { m_PlaySoundMasterPrim = value; }
487 }
488
489 private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>();
490 public List<SceneObjectPart> PlaySoundSlavePrims
491 {
492 get { return m_LoopSoundSlavePrims; }
493 set { m_LoopSoundSlavePrims = value; }
494 }
495
496 private SceneObjectPart m_LoopSoundMasterPrim = null;
497 public SceneObjectPart LoopSoundMasterPrim
498 {
499 get { return m_LoopSoundMasterPrim; }
500 set { m_LoopSoundMasterPrim = value; }
501 }
502
503 private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>();
504 public List<SceneObjectPart> LoopSoundSlavePrims
505 {
506 get { return m_LoopSoundSlavePrims; }
507 set { m_LoopSoundSlavePrims = value; }
508 }
509
473 // The UUID for the Region this Object is in. 510 // The UUID for the Region this Object is in.
474 public UUID RegionUUID 511 public UUID RegionUUID
475 { 512 {
@@ -584,7 +621,7 @@ namespace OpenSim.Region.Framework.Scenes
584 621
585 if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0) 622 if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0)
586 m_rootPart.ParentID = 0; 623 m_rootPart.ParentID = 0;
587 if (m_rootPart.LocalId==0) 624 if (m_rootPart.LocalId == 0)
588 m_rootPart.LocalId = m_scene.AllocateLocalId(); 625 m_rootPart.LocalId = m_scene.AllocateLocalId();
589 626
590 // No need to lock here since the object isn't yet in a scene 627 // No need to lock here since the object isn't yet in a scene
@@ -1586,6 +1623,9 @@ namespace OpenSim.Region.Framework.Scenes
1586 /// <param name="part"></param> 1623 /// <param name="part"></param>
1587 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) 1624 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags)
1588 { 1625 {
1626// m_log.DebugFormat(
1627// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
1628
1589 if (m_rootPart.UUID == part.UUID) 1629 if (m_rootPart.UUID == part.UUID)
1590 { 1630 {
1591 if (IsAttachment) 1631 if (IsAttachment)
@@ -2084,7 +2124,9 @@ namespace OpenSim.Region.Framework.Scenes
2084 2124
2085 foreach (SceneObjectPart part in m_parts.Values) 2125 foreach (SceneObjectPart part in m_parts.Values)
2086 { 2126 {
2087 2127 if (!IsSelected)
2128 part.UpdateLookAt();
2129
2088 part.SendScheduledUpdates(); 2130 part.SendScheduledUpdates();
2089 2131
2090 } 2132 }
@@ -2434,7 +2476,6 @@ namespace OpenSim.Region.Framework.Scenes
2434 2476
2435 AttachToBackup(); 2477 AttachToBackup();
2436 2478
2437
2438 // Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the 2479 // Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the
2439 // position of linkset prims. IF YOU CHANGE THIS, YOU MUST TEST colliding with just linked and 2480 // position of linkset prims. IF YOU CHANGE THIS, YOU MUST TEST colliding with just linked and
2440 // unmoved prims! 2481 // unmoved prims!
@@ -2449,9 +2490,10 @@ namespace OpenSim.Region.Framework.Scenes
2449 /// an independent SceneObjectGroup. 2490 /// an independent SceneObjectGroup.
2450 /// </summary> 2491 /// </summary>
2451 /// <param name="partID"></param> 2492 /// <param name="partID"></param>
2452 public void DelinkFromGroup(uint partID) 2493 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
2494 public SceneObjectGroup DelinkFromGroup(uint partID)
2453 { 2495 {
2454 DelinkFromGroup(partID, true); 2496 return DelinkFromGroup(partID, true);
2455 } 2497 }
2456 2498
2457 /// <summary> 2499 /// <summary>
@@ -2460,28 +2502,39 @@ namespace OpenSim.Region.Framework.Scenes
2460 /// </summary> 2502 /// </summary>
2461 /// <param name="partID"></param> 2503 /// <param name="partID"></param>
2462 /// <param name="sendEvents"></param> 2504 /// <param name="sendEvents"></param>
2463 public void DelinkFromGroup(uint partID, bool sendEvents) 2505 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
2506 public SceneObjectGroup DelinkFromGroup(uint partID, bool sendEvents)
2464 { 2507 {
2465 SceneObjectPart linkPart = GetChildPart(partID); 2508 SceneObjectPart linkPart = GetChildPart(partID);
2466 2509
2467 if (linkPart != null) 2510 if (linkPart != null)
2468 { 2511 {
2469 DelinkFromGroup(linkPart, sendEvents); 2512 return DelinkFromGroup(linkPart, sendEvents);
2470 } 2513 }
2471 else 2514 else
2472 { 2515 {
2473 m_log.InfoFormat("[SCENE OBJECT GROUP]: " + 2516 m_log.WarnFormat("[SCENE OBJECT GROUP]: " +
2474 "DelinkFromGroup(): Child prim {0} not found in object {1}, {2}", 2517 "DelinkFromGroup(): Child prim {0} not found in object {1}, {2}",
2475 partID, LocalId, UUID); 2518 partID, LocalId, UUID);
2519
2520 return null;
2476 } 2521 }
2477 } 2522 }
2478 2523
2479 public void DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents) 2524 /// <summary>
2525 /// Delink the given prim from this group. The delinked prim is established as
2526 /// an independent SceneObjectGroup.
2527 /// </summary>
2528 /// <param name="partID"></param>
2529 /// <param name="sendEvents"></param>
2530 /// <returns>The object group of the newly delinked prim.</returns>
2531 public SceneObjectGroup DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents)
2480 { 2532 {
2481 linkPart.ClearUndoState();
2482// m_log.DebugFormat( 2533// m_log.DebugFormat(
2483// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", 2534// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
2484// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); 2535// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
2536
2537 linkPart.ClearUndoState();
2485 2538
2486 Quaternion worldRot = linkPart.GetWorldRotation(); 2539 Quaternion worldRot = linkPart.GetWorldRotation();
2487 2540
@@ -2536,6 +2589,8 @@ namespace OpenSim.Region.Framework.Scenes
2536 2589
2537 //HasGroupChanged = true; 2590 //HasGroupChanged = true;
2538 //ScheduleGroupForFullUpdate(); 2591 //ScheduleGroupForFullUpdate();
2592
2593 return objectGroup;
2539 } 2594 }
2540 2595
2541 /// <summary> 2596 /// <summary>
@@ -2574,7 +2629,6 @@ namespace OpenSim.Region.Framework.Scenes
2574 2629
2575 part.LinkNum = linkNum; 2630 part.LinkNum = linkNum;
2576 2631
2577
2578 part.OffsetPosition = part.GroupPosition - AbsolutePosition; 2632 part.OffsetPosition = part.GroupPosition - AbsolutePosition;
2579 2633
2580 Quaternion rootRotation = m_rootPart.RotationOffset; 2634 Quaternion rootRotation = m_rootPart.RotationOffset;
@@ -2604,11 +2658,14 @@ namespace OpenSim.Region.Framework.Scenes
2604 { 2658 {
2605 if (m_rootPart.PhysActor.IsPhysical) 2659 if (m_rootPart.PhysActor.IsPhysical)
2606 { 2660 {
2607 Vector3 llmoveforce = pos - AbsolutePosition; 2661 if (!m_rootPart.BlockGrab)
2608 Vector3 grabforce = llmoveforce; 2662 {
2609 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; 2663 Vector3 llmoveforce = pos - AbsolutePosition;
2610 m_rootPart.PhysActor.AddForce(grabforce,true); 2664 Vector3 grabforce = llmoveforce;
2611 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2665 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
2666 m_rootPart.PhysActor.AddForce(grabforce, true);
2667 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
2668 }
2612 } 2669 }
2613 else 2670 else
2614 { 2671 {
@@ -2966,6 +3023,7 @@ namespace OpenSim.Region.Framework.Scenes
2966 SceneObjectPart part = GetChildPart(localID); 3023 SceneObjectPart part = GetChildPart(localID);
2967 if (part != null) 3024 if (part != null)
2968 { 3025 {
3026 part.IgnoreUndoUpdate = true;
2969 if (scale.X > m_scene.m_maxNonphys) 3027 if (scale.X > m_scene.m_maxNonphys)
2970 scale.X = m_scene.m_maxNonphys; 3028 scale.X = m_scene.m_maxNonphys;
2971 if (scale.Y > m_scene.m_maxNonphys) 3029 if (scale.Y > m_scene.m_maxNonphys)
@@ -2992,6 +3050,7 @@ namespace OpenSim.Region.Framework.Scenes
2992 { 3050 {
2993 if (obPart.UUID != m_rootPart.UUID) 3051 if (obPart.UUID != m_rootPart.UUID)
2994 { 3052 {
3053 obPart.IgnoreUndoUpdate = true;
2995 Vector3 oldSize = new Vector3(obPart.Scale); 3054 Vector3 oldSize = new Vector3(obPart.Scale);
2996 3055
2997 float f = 1.0f; 3056 float f = 1.0f;
@@ -3050,6 +3109,8 @@ namespace OpenSim.Region.Framework.Scenes
3050 y *= a; 3109 y *= a;
3051 z *= a; 3110 z *= a;
3052 } 3111 }
3112 obPart.IgnoreUndoUpdate = false;
3113 obPart.StoreUndoState();
3053 } 3114 }
3054 } 3115 }
3055 } 3116 }
@@ -3066,6 +3127,7 @@ namespace OpenSim.Region.Framework.Scenes
3066 { 3127 {
3067 foreach (SceneObjectPart obPart in m_parts.Values) 3128 foreach (SceneObjectPart obPart in m_parts.Values)
3068 { 3129 {
3130 obPart.IgnoreUndoUpdate = true;
3069 if (obPart.UUID != m_rootPart.UUID) 3131 if (obPart.UUID != m_rootPart.UUID)
3070 { 3132 {
3071 Vector3 currentpos = new Vector3(obPart.OffsetPosition); 3133 Vector3 currentpos = new Vector3(obPart.OffsetPosition);
@@ -3079,6 +3141,8 @@ namespace OpenSim.Region.Framework.Scenes
3079 obPart.Resize(newSize); 3141 obPart.Resize(newSize);
3080 obPart.UpdateOffSet(currentpos); 3142 obPart.UpdateOffSet(currentpos);
3081 } 3143 }
3144 obPart.IgnoreUndoUpdate = false;
3145 obPart.StoreUndoState();
3082 } 3146 }
3083 } 3147 }
3084 lockPartsForRead(false); 3148 lockPartsForRead(false);
@@ -3089,6 +3153,8 @@ namespace OpenSim.Region.Framework.Scenes
3089 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); 3153 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
3090 } 3154 }
3091 3155
3156 part.IgnoreUndoUpdate = false;
3157 part.StoreUndoState();
3092 HasGroupChanged = true; 3158 HasGroupChanged = true;
3093 ScheduleGroupForTerseUpdate(); 3159 ScheduleGroupForTerseUpdate();
3094 } 3160 }
@@ -3104,13 +3170,26 @@ namespace OpenSim.Region.Framework.Scenes
3104 /// <param name="pos"></param> 3170 /// <param name="pos"></param>
3105 public void UpdateGroupPosition(Vector3 pos) 3171 public void UpdateGroupPosition(Vector3 pos)
3106 { 3172 {
3173 foreach (SceneObjectPart part in Children.Values)
3174 {
3175 part.StoreUndoState();
3176 }
3107 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 3177 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
3108 { 3178 {
3109 if (IsAttachment) 3179 if (IsAttachment)
3110 { 3180 {
3111 m_rootPart.AttachedPos = pos; 3181 m_rootPart.AttachedPos = pos;
3112 } 3182 }
3113 3183 if (RootPart.GetStatusSandbox())
3184 {
3185 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
3186 {
3187 RootPart.ScriptSetPhysicsStatus(false);
3188 pos = AbsolutePosition;
3189 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
3190 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
3191 }
3192 }
3114 AbsolutePosition = pos; 3193 AbsolutePosition = pos;
3115 3194
3116 HasGroupChanged = true; 3195 HasGroupChanged = true;
@@ -3129,7 +3208,10 @@ namespace OpenSim.Region.Framework.Scenes
3129 public void UpdateSinglePosition(Vector3 pos, uint localID) 3208 public void UpdateSinglePosition(Vector3 pos, uint localID)
3130 { 3209 {
3131 SceneObjectPart part = GetChildPart(localID); 3210 SceneObjectPart part = GetChildPart(localID);
3132 3211 foreach (SceneObjectPart parts in Children.Values)
3212 {
3213 parts.StoreUndoState();
3214 }
3133 if (part != null) 3215 if (part != null)
3134 { 3216 {
3135 if (part.UUID == m_rootPart.UUID) 3217 if (part.UUID == m_rootPart.UUID)
@@ -3151,6 +3233,10 @@ namespace OpenSim.Region.Framework.Scenes
3151 /// <param name="pos"></param> 3233 /// <param name="pos"></param>
3152 private void UpdateRootPosition(Vector3 pos) 3234 private void UpdateRootPosition(Vector3 pos)
3153 { 3235 {
3236 foreach (SceneObjectPart part in Children.Values)
3237 {
3238 part.StoreUndoState();
3239 }
3154 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 3240 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
3155 Vector3 oldPos = 3241 Vector3 oldPos =
3156 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, 3242 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
@@ -3195,6 +3281,10 @@ namespace OpenSim.Region.Framework.Scenes
3195 /// <param name="rot"></param> 3281 /// <param name="rot"></param>
3196 public void UpdateGroupRotationR(Quaternion rot) 3282 public void UpdateGroupRotationR(Quaternion rot)
3197 { 3283 {
3284 foreach (SceneObjectPart parts in Children.Values)
3285 {
3286 parts.StoreUndoState();
3287 }
3198 m_rootPart.UpdateRotation(rot); 3288 m_rootPart.UpdateRotation(rot);
3199 3289
3200 PhysicsActor actor = m_rootPart.PhysActor; 3290 PhysicsActor actor = m_rootPart.PhysActor;
@@ -3215,6 +3305,10 @@ namespace OpenSim.Region.Framework.Scenes
3215 /// <param name="rot"></param> 3305 /// <param name="rot"></param>
3216 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) 3306 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
3217 { 3307 {
3308 foreach (SceneObjectPart parts in Children.Values)
3309 {
3310 parts.StoreUndoState();
3311 }
3218 m_rootPart.UpdateRotation(rot); 3312 m_rootPart.UpdateRotation(rot);
3219 3313
3220 PhysicsActor actor = m_rootPart.PhysActor; 3314 PhysicsActor actor = m_rootPart.PhysActor;
@@ -3238,6 +3332,10 @@ namespace OpenSim.Region.Framework.Scenes
3238 public void UpdateSingleRotation(Quaternion rot, uint localID) 3332 public void UpdateSingleRotation(Quaternion rot, uint localID)
3239 { 3333 {
3240 SceneObjectPart part = GetChildPart(localID); 3334 SceneObjectPart part = GetChildPart(localID);
3335 foreach (SceneObjectPart parts in Children.Values)
3336 {
3337 parts.StoreUndoState();
3338 }
3241 if (part != null) 3339 if (part != null)
3242 { 3340 {
3243 if (part.UUID == m_rootPart.UUID) 3341 if (part.UUID == m_rootPart.UUID)
@@ -3268,8 +3366,11 @@ namespace OpenSim.Region.Framework.Scenes
3268 } 3366 }
3269 else 3367 else
3270 { 3368 {
3369 part.IgnoreUndoUpdate = true;
3271 part.UpdateRotation(rot); 3370 part.UpdateRotation(rot);
3272 part.OffsetPosition = pos; 3371 part.OffsetPosition = pos;
3372 part.IgnoreUndoUpdate = false;
3373 part.StoreUndoState();
3273 } 3374 }
3274 } 3375 }
3275 } 3376 }
@@ -3283,6 +3384,7 @@ namespace OpenSim.Region.Framework.Scenes
3283 Quaternion axRot = rot; 3384 Quaternion axRot = rot;
3284 Quaternion oldParentRot = m_rootPart.RotationOffset; 3385 Quaternion oldParentRot = m_rootPart.RotationOffset;
3285 3386
3387 m_rootPart.StoreUndoState();
3286 m_rootPart.UpdateRotation(rot); 3388 m_rootPart.UpdateRotation(rot);
3287 if (m_rootPart.PhysActor != null) 3389 if (m_rootPart.PhysActor != null)
3288 { 3390 {
@@ -3291,23 +3393,33 @@ namespace OpenSim.Region.Framework.Scenes
3291 } 3393 }
3292 3394
3293 lockPartsForRead(true); 3395 lockPartsForRead(true);
3396
3397 foreach (SceneObjectPart prim in m_parts.Values)
3294 { 3398 {
3295 foreach (SceneObjectPart prim in m_parts.Values) 3399 if (prim.UUID != m_rootPart.UUID)
3296 { 3400 {
3297 if (prim.UUID != m_rootPart.UUID) 3401 prim.IgnoreUndoUpdate = true;
3298 { 3402 Vector3 axPos = prim.OffsetPosition;
3299 Vector3 axPos = prim.OffsetPosition; 3403 axPos *= oldParentRot;
3300 axPos *= oldParentRot; 3404 axPos *= Quaternion.Inverse(axRot);
3301 axPos *= Quaternion.Inverse(axRot); 3405 prim.OffsetPosition = axPos;
3302 prim.OffsetPosition = axPos; 3406 Quaternion primsRot = prim.RotationOffset;
3303 Quaternion primsRot = prim.RotationOffset; 3407 Quaternion newRot = primsRot * oldParentRot;
3304 Quaternion newRot = primsRot * oldParentRot; 3408 newRot *= Quaternion.Inverse(axRot);
3305 newRot *= Quaternion.Inverse(axRot); 3409 prim.RotationOffset = newRot;
3306 prim.RotationOffset = newRot; 3410 prim.ScheduleTerseUpdate();
3307 prim.ScheduleTerseUpdate(); 3411 }
3308 } 3412 }
3413
3414 foreach (SceneObjectPart childpart in Children.Values)
3415 {
3416 if (childpart != m_rootPart)
3417 {
3418 childpart.IgnoreUndoUpdate = false;
3419 childpart.StoreUndoState();
3309 } 3420 }
3310 } 3421 }
3422
3311 lockPartsForRead(false); 3423 lockPartsForRead(false);
3312 3424
3313 m_rootPart.ScheduleTerseUpdate(); 3425 m_rootPart.ScheduleTerseUpdate();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0d19589..e7f9f31 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -133,6 +133,18 @@ namespace OpenSim.Region.Framework.Scenes
133 [XmlIgnore] 133 [XmlIgnore]
134 public bool DIE_AT_EDGE; 134 public bool DIE_AT_EDGE;
135 135
136 [XmlIgnore]
137 public bool RETURN_AT_EDGE;
138
139 [XmlIgnore]
140 public bool BlockGrab;
141
142 [XmlIgnore]
143 public bool StatusSandbox;
144
145 [XmlIgnore]
146 public Vector3 StatusSandboxPos;
147
136 // TODO: This needs to be persisted in next XML version update! 148 // TODO: This needs to be persisted in next XML version update!
137 [XmlIgnore] 149 [XmlIgnore]
138 public int[] PayPrice = {-2,-2,-2,-2,-2}; 150 public int[] PayPrice = {-2,-2,-2,-2,-2};
@@ -219,6 +231,15 @@ namespace OpenSim.Region.Framework.Scenes
219 [XmlIgnore] 231 [XmlIgnore]
220 public Quaternion SpinOldOrientation = Quaternion.Identity; 232 public Quaternion SpinOldOrientation = Quaternion.Identity;
221 233
234 [XmlIgnore]
235 public Quaternion m_APIDTarget = Quaternion.Identity;
236
237 [XmlIgnore]
238 public float m_APIDDamp = 0;
239
240 [XmlIgnore]
241 public float m_APIDStrength = 0;
242
222 /// <summary> 243 /// <summary>
223 /// This part's inventory 244 /// This part's inventory
224 /// </summary> 245 /// </summary>
@@ -233,6 +254,9 @@ namespace OpenSim.Region.Framework.Scenes
233 public bool Undoing; 254 public bool Undoing;
234 255
235 [XmlIgnore] 256 [XmlIgnore]
257 public bool IgnoreUndoUpdate = false;
258
259 [XmlIgnore]
236 private PrimFlags LocalFlags; 260 private PrimFlags LocalFlags;
237 [XmlIgnore] 261 [XmlIgnore]
238 private float m_damage = -1.0f; 262 private float m_damage = -1.0f;
@@ -254,6 +278,7 @@ namespace OpenSim.Region.Framework.Scenes
254 private string m_text = String.Empty; 278 private string m_text = String.Empty;
255 private string m_touchName = String.Empty; 279 private string m_touchName = String.Empty;
256 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); 280 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
281 private readonly UndoStack<UndoState> m_redo = new UndoStack<UndoState>(5);
257 private UUID _creatorID; 282 private UUID _creatorID;
258 283
259 private bool m_passTouches; 284 private bool m_passTouches;
@@ -506,6 +531,27 @@ namespace OpenSim.Region.Framework.Scenes
506 } 531 }
507 } 532 }
508 533
534 [XmlIgnore]
535 public Quaternion APIDTarget
536 {
537 get { return m_APIDTarget; }
538 set { m_APIDTarget = value; }
539 }
540
541 [XmlIgnore]
542 public float APIDDamp
543 {
544 get { return m_APIDDamp; }
545 set { m_APIDDamp = value; }
546 }
547
548 [XmlIgnore]
549 public float APIDStrength
550 {
551 get { return m_APIDStrength; }
552 set { m_APIDStrength = value; }
553 }
554
509 public ulong RegionHandle 555 public ulong RegionHandle
510 { 556 {
511 get { return m_regionHandle; } 557 get { return m_regionHandle; }
@@ -517,6 +563,33 @@ namespace OpenSim.Region.Framework.Scenes
517 get { return m_scriptAccessPin; } 563 get { return m_scriptAccessPin; }
518 set { m_scriptAccessPin = (int)value; } 564 set { m_scriptAccessPin = (int)value; }
519 } 565 }
566 private SceneObjectPart m_PlaySoundMasterPrim = null;
567 public SceneObjectPart PlaySoundMasterPrim
568 {
569 get { return m_PlaySoundMasterPrim; }
570 set { m_PlaySoundMasterPrim = value; }
571 }
572
573 private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>();
574 public List<SceneObjectPart> PlaySoundSlavePrims
575 {
576 get { return m_LoopSoundSlavePrims; }
577 set { m_LoopSoundSlavePrims = value; }
578 }
579
580 private SceneObjectPart m_LoopSoundMasterPrim = null;
581 public SceneObjectPart LoopSoundMasterPrim
582 {
583 get { return m_LoopSoundMasterPrim; }
584 set { m_LoopSoundMasterPrim = value; }
585 }
586
587 private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>();
588 public List<SceneObjectPart> LoopSoundSlavePrims
589 {
590 get { return m_LoopSoundSlavePrims; }
591 set { m_LoopSoundSlavePrims = value; }
592 }
520 593
521 public Byte[] TextureAnimation 594 public Byte[] TextureAnimation
522 { 595 {
@@ -576,8 +649,6 @@ namespace OpenSim.Region.Framework.Scenes
576 } 649 }
577 set 650 set
578 { 651 {
579 StoreUndoState();
580
581 m_groupPosition = value; 652 m_groupPosition = value;
582 PhysicsActor actor = PhysActor; 653 PhysicsActor actor = PhysActor;
583 if (actor != null) 654 if (actor != null)
@@ -1403,6 +1474,10 @@ namespace OpenSim.Region.Framework.Scenes
1403 { 1474 {
1404 m_undo.Clear(); 1475 m_undo.Clear();
1405 } 1476 }
1477 lock (m_redo)
1478 {
1479 m_redo.Clear();
1480 }
1406 StoreUndoState(); 1481 StoreUndoState();
1407 } 1482 }
1408 1483
@@ -1713,6 +1788,66 @@ namespace OpenSim.Region.Framework.Scenes
1713 return m_parentGroup.RootPart.DIE_AT_EDGE; 1788 return m_parentGroup.RootPart.DIE_AT_EDGE;
1714 } 1789 }
1715 1790
1791 public bool GetReturnAtEdge()
1792 {
1793 if (m_parentGroup == null)
1794 return false;
1795 if (m_parentGroup.IsDeleted)
1796 return false;
1797
1798 return m_parentGroup.RootPart.RETURN_AT_EDGE;
1799 }
1800
1801 public void SetReturnAtEdge(bool p)
1802 {
1803 if (m_parentGroup == null)
1804 return;
1805 if (m_parentGroup.IsDeleted)
1806 return;
1807
1808 m_parentGroup.RootPart.RETURN_AT_EDGE = p;
1809 }
1810
1811 public bool GetBlockGrab()
1812 {
1813 if (m_parentGroup == null)
1814 return false;
1815 if (m_parentGroup.IsDeleted)
1816 return false;
1817
1818 return m_parentGroup.RootPart.BlockGrab;
1819 }
1820
1821 public void SetBlockGrab(bool p)
1822 {
1823 if (m_parentGroup == null)
1824 return;
1825 if (m_parentGroup.IsDeleted)
1826 return;
1827
1828 m_parentGroup.RootPart.BlockGrab = p;
1829 }
1830
1831 public void SetStatusSandbox(bool p)
1832 {
1833 if (m_parentGroup == null)
1834 return;
1835 if (m_parentGroup.IsDeleted)
1836 return;
1837 StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition;
1838 m_parentGroup.RootPart.StatusSandbox = p;
1839 }
1840
1841 public bool GetStatusSandbox()
1842 {
1843 if (m_parentGroup == null)
1844 return false;
1845 if (m_parentGroup.IsDeleted)
1846 return false;
1847
1848 return m_parentGroup.RootPart.StatusSandbox;
1849 }
1850
1716 public int GetAxisRotation(int axis) 1851 public int GetAxisRotation(int axis)
1717 { 1852 {
1718 //Cannot use ScriptBaseClass constants as no referance to it currently. 1853 //Cannot use ScriptBaseClass constants as no referance to it currently.
@@ -1924,7 +2059,7 @@ namespace OpenSim.Region.Framework.Scenes
1924 // play the sound. 2059 // play the sound.
1925 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) 2060 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
1926 { 2061 {
1927 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0); 2062 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false);
1928 } 2063 }
1929 2064
1930 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) 2065 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
@@ -2499,9 +2634,8 @@ namespace OpenSim.Region.Framework.Scenes
2499 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2634 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
2500 foreach (ScenePresence p in avatarts) 2635 foreach (ScenePresence p in avatarts)
2501 { 2636 {
2502 // TODO: some filtering by distance of avatar 2637 if (!(Util.GetDistanceTo(p.AbsolutePosition, AbsolutePosition) >= 100))
2503 2638 p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2504 p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2505 } 2639 }
2506 } 2640 }
2507 2641
@@ -2562,7 +2696,38 @@ namespace OpenSim.Region.Framework.Scenes
2562 2696
2563 public void RotLookAt(Quaternion target, float strength, float damping) 2697 public void RotLookAt(Quaternion target, float strength, float damping)
2564 { 2698 {
2565 m_parentGroup.rotLookAt(target, strength, damping); 2699 rotLookAt(target, strength, damping);
2700 }
2701
2702 public void rotLookAt(Quaternion target, float strength, float damping)
2703 {
2704 if (IsAttachment)
2705 {
2706 /*
2707 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2708 if (avatar != null)
2709 {
2710 Rotate the Av?
2711 } */
2712 }
2713 else
2714 {
2715 APIDDamp = damping;
2716 APIDStrength = strength;
2717 APIDTarget = target;
2718 }
2719 }
2720
2721 public void startLookAt(Quaternion rot, float damp, float strength)
2722 {
2723 APIDDamp = damp;
2724 APIDStrength = strength;
2725 APIDTarget = rot;
2726 }
2727
2728 public void stopLookAt()
2729 {
2730 APIDTarget = Quaternion.Identity;
2566 } 2731 }
2567 2732
2568 /// <summary> 2733 /// <summary>
@@ -2824,7 +2989,7 @@ namespace OpenSim.Region.Framework.Scenes
2824 /// <param name="volume"></param> 2989 /// <param name="volume"></param>
2825 /// <param name="triggered"></param> 2990 /// <param name="triggered"></param>
2826 /// <param name="flags"></param> 2991 /// <param name="flags"></param>
2827 public void SendSound(string sound, double volume, bool triggered, byte flags) 2992 public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster)
2828 { 2993 {
2829 if (volume > 1) 2994 if (volume > 1)
2830 volume = 1; 2995 volume = 1;
@@ -2859,10 +3024,51 @@ namespace OpenSim.Region.Framework.Scenes
2859 ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>(); 3024 ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>();
2860 if (soundModule != null) 3025 if (soundModule != null)
2861 { 3026 {
2862 if (triggered) 3027 if (useMaster)
2863 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle); 3028 {
3029 if (isMaster)
3030 {
3031 if (triggered)
3032 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3033 else
3034 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3035 ParentGroup.PlaySoundMasterPrim = this;
3036 ownerID = this._ownerID;
3037 objectID = this.UUID;
3038 parentID = this.GetRootPartUUID();
3039 position = this.AbsolutePosition; // region local
3040 regionHandle = this.ParentGroup.Scene.RegionInfo.RegionHandle;
3041 if (triggered)
3042 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3043 else
3044 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3045 foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims)
3046 {
3047 ownerID = prim._ownerID;
3048 objectID = prim.UUID;
3049 parentID = prim.GetRootPartUUID();
3050 position = prim.AbsolutePosition; // region local
3051 regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle;
3052 if (triggered)
3053 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3054 else
3055 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3056 }
3057 ParentGroup.PlaySoundSlavePrims.Clear();
3058 ParentGroup.PlaySoundMasterPrim = null;
3059 }
3060 else
3061 {
3062 ParentGroup.PlaySoundSlavePrims.Add(this);
3063 }
3064 }
2864 else 3065 else
2865 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags); 3066 {
3067 if (triggered)
3068 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3069 else
3070 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3071 }
2866 } 3072 }
2867 } 3073 }
2868 3074
@@ -3181,6 +3387,14 @@ namespace OpenSim.Region.Framework.Scenes
3181 hasProfileCut = hasDimple; // is it the same thing? 3387 hasProfileCut = hasDimple; // is it the same thing?
3182 } 3388 }
3183 3389
3390 public void SetVehicleFlags(int param, bool remove)
3391 {
3392 if (PhysActor != null)
3393 {
3394 PhysActor.VehicleFlags(param, remove);
3395 }
3396 }
3397
3184 public void SetGroup(UUID groupID, IClientAPI client) 3398 public void SetGroup(UUID groupID, IClientAPI client)
3185 { 3399 {
3186 _groupID = groupID; 3400 _groupID = groupID;
@@ -3285,27 +3499,30 @@ namespace OpenSim.Region.Framework.Scenes
3285 { 3499 {
3286 if (!Undoing) 3500 if (!Undoing)
3287 { 3501 {
3288 if (m_parentGroup != null) 3502 if (!IgnoreUndoUpdate)
3289 { 3503 {
3290 lock (m_undo) 3504 if (m_parentGroup != null)
3291 { 3505 {
3292 if (m_undo.Count > 0) 3506 lock (m_undo)
3293 { 3507 {
3294 UndoState last = m_undo.Peek(); 3508 if (m_undo.Count > 0)
3295 if (last != null)
3296 { 3509 {
3297 if (last.Compare(this)) 3510 UndoState last = m_undo.Peek();
3298 return; 3511 if (last != null)
3512 {
3513 if (last.Compare(this))
3514 return;
3515 }
3299 } 3516 }
3300 }
3301 3517
3302 if (m_parentGroup.GetSceneMaxUndo() > 0) 3518 if (m_parentGroup.GetSceneMaxUndo() > 0)
3303 { 3519 {
3304 UndoState nUndo = new UndoState(this); 3520 UndoState nUndo = new UndoState(this);
3305 3521
3306 m_undo.Push(nUndo); 3522 m_undo.Push(nUndo);
3307 } 3523 }
3308 3524
3525 }
3309 } 3526 }
3310 } 3527 }
3311 } 3528 }
@@ -3776,14 +3993,39 @@ namespace OpenSim.Region.Framework.Scenes
3776 lock (m_undo) 3993 lock (m_undo)
3777 { 3994 {
3778 if (m_undo.Count > 0) 3995 if (m_undo.Count > 0)
3996 {
3997 UndoState nUndo = null;
3998 if (m_parentGroup.GetSceneMaxUndo() > 0)
3779 { 3999 {
3780 UndoState goback = m_undo.Pop(); 4000 nUndo = new UndoState(this);
3781 if (goback != null) 4001 }
3782 goback.PlaybackState(this); 4002 UndoState goback = m_undo.Pop();
4003 if (goback != null)
4004 {
4005 goback.PlaybackState(this);
4006 if (nUndo != null)
4007 m_redo.Push(nUndo);
4008 }
3783 } 4009 }
3784 } 4010 }
3785 } 4011 }
3786 4012
4013 public void Redo()
4014 {
4015 lock (m_redo)
4016 {
4017 if (m_parentGroup.GetSceneMaxUndo() > 0)
4018 {
4019 UndoState nUndo = new UndoState(this);
4020
4021 m_undo.Push(nUndo);
4022 }
4023 UndoState gofwd = m_redo.Pop();
4024 if (gofwd != null)
4025 gofwd.PlayfwdState(this);
4026 }
4027 }
4028
3787 public void UpdateExtraParam(ushort type, bool inUse, byte[] data) 4029 public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
3788 { 4030 {
3789 m_shape.ReadInUpdateExtraParam(type, inUse, data); 4031 m_shape.ReadInUpdateExtraParam(type, inUse, data);
@@ -3827,6 +4069,18 @@ namespace OpenSim.Region.Framework.Scenes
3827 (pos.Z != OffsetPosition.Z)) 4069 (pos.Z != OffsetPosition.Z))
3828 { 4070 {
3829 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 4071 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
4072
4073 if (ParentGroup.RootPart.GetStatusSandbox())
4074 {
4075 if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10)
4076 {
4077 ParentGroup.RootPart.ScriptSetPhysicsStatus(false);
4078 newPos = OffsetPosition;
4079 ParentGroup.Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
4080 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, ParentGroup.RootPart.AbsolutePosition, Name, UUID, false);
4081 }
4082 }
4083
3830 OffsetPosition = newPos; 4084 OffsetPosition = newPos;
3831 ScheduleTerseUpdate(); 4085 ScheduleTerseUpdate();
3832 } 4086 }
@@ -4119,7 +4373,6 @@ namespace OpenSim.Region.Framework.Scenes
4119 (rot.Z != RotationOffset.Z) || 4373 (rot.Z != RotationOffset.Z) ||
4120 (rot.W != RotationOffset.W)) 4374 (rot.W != RotationOffset.W))
4121 { 4375 {
4122 //StoreUndoState();
4123 RotationOffset = rot; 4376 RotationOffset = rot;
4124 ParentGroup.HasGroupChanged = true; 4377 ParentGroup.HasGroupChanged = true;
4125 ScheduleTerseUpdate(); 4378 ScheduleTerseUpdate();
@@ -4303,7 +4556,7 @@ namespace OpenSim.Region.Framework.Scenes
4303 else 4556 else
4304 { 4557 {
4305// m_log.DebugFormat( 4558// m_log.DebugFormat(
4306// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); 4559// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
4307 ScheduleFullUpdate(); 4560 ScheduleFullUpdate();
4308 } 4561 }
4309 } 4562 }
@@ -4421,5 +4674,41 @@ namespace OpenSim.Region.Framework.Scenes
4421 4674
4422 Inventory.ApplyNextOwnerPermissions(); 4675 Inventory.ApplyNextOwnerPermissions();
4423 } 4676 }
4677 public void UpdateLookAt()
4678 {
4679 try
4680 {
4681 if (APIDTarget != Quaternion.Identity)
4682 {
4683 if (Single.IsNaN(APIDTarget.W) == true)
4684 {
4685 APIDTarget = Quaternion.Identity;
4686 return;
4687 }
4688 Quaternion rot = RotationOffset;
4689 Quaternion dir = (rot - APIDTarget);
4690 float speed = ((APIDStrength / APIDDamp) * (float)(Math.PI / 180.0f));
4691 if (dir.Z > speed)
4692 {
4693 rot.Z -= speed;
4694 }
4695 if (dir.Z < -speed)
4696 {
4697 rot.Z += speed;
4698 }
4699 rot.Normalize();
4700 UpdateRotation(rot);
4701 }
4702 }
4703 catch (Exception ex)
4704 {
4705 m_log.Error("[Physics] " + ex);
4706 }
4707 }
4708
4709 public Color4 GetTextColor()
4710 {
4711 return new Color4((byte)Color.R, (byte)Color.G, (byte)Color.B, (byte)(0xFF - Color.A));
4712 }
4424 } 4713 }
4425} 4714}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3317dd3..5d00917 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -318,8 +318,6 @@ namespace OpenSim.Region.Framework.Scenes
318 } 318 }
319 } 319 }
320 320
321 static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
322
323 private void RestoreSavedScriptState(UUID oldID, UUID newID) 321 private void RestoreSavedScriptState(UUID oldID, UUID newID)
324 { 322 {
325 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 323 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
@@ -585,7 +583,7 @@ namespace OpenSim.Region.Framework.Scenes
585 m_items.TryGetValue(itemId, out item); 583 m_items.TryGetValue(itemId, out item);
586 m_items.LockItemsForRead(false); 584 m_items.LockItemsForRead(false);
587 return item; 585 return item;
588 } 586 }
589 587
590 /// <summary> 588 /// <summary>
591 /// Get inventory items by name. 589 /// Get inventory items by name.
@@ -594,7 +592,7 @@ namespace OpenSim.Region.Framework.Scenes
594 /// <returns> 592 /// <returns>
595 /// A list of inventory items with that name. 593 /// A list of inventory items with that name.
596 /// If no inventory item has that name then an empty list is returned. 594 /// If no inventory item has that name then an empty list is returned.
597 /// </returns> 595 /// </returns>
598 public IList<TaskInventoryItem> GetInventoryItems(string name) 596 public IList<TaskInventoryItem> GetInventoryItems(string name)
599 { 597 {
600 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(); 598 IList<TaskInventoryItem> items = new List<TaskInventoryItem>();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6a2ab02..123d6f3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -167,6 +167,8 @@ namespace OpenSim.Region.Framework.Scenes
167 167
168 private Quaternion m_bodyRot= Quaternion.Identity; 168 private Quaternion m_bodyRot= Quaternion.Identity;
169 169
170 private Quaternion m_bodyRotPrevious = Quaternion.Identity;
171
170 private const int LAND_VELOCITYMAG_MAX = 12; 172 private const int LAND_VELOCITYMAG_MAX = 12;
171 173
172 public bool IsRestrictedToRegion; 174 public bool IsRestrictedToRegion;
@@ -233,7 +235,7 @@ namespace OpenSim.Region.Framework.Scenes
233 // Agent's Draw distance. 235 // Agent's Draw distance.
234 protected float m_DrawDistance; 236 protected float m_DrawDistance;
235 237
236 protected AvatarAppearance m_appearance; 238 protected AvatarAppearance m_appearance;
237 239
238 // neighbouring regions we have enabled a child agent in 240 // neighbouring regions we have enabled a child agent in
239 // holds the seed cap for the child agent in that region 241 // holds the seed cap for the child agent in that region
@@ -518,6 +520,12 @@ namespace OpenSim.Region.Framework.Scenes
518 set { m_bodyRot = value; } 520 set { m_bodyRot = value; }
519 } 521 }
520 522
523 public Quaternion PreviousRotation
524 {
525 get { return m_bodyRotPrevious; }
526 set { m_bodyRotPrevious = value; }
527 }
528
521 /// <summary> 529 /// <summary>
522 /// If this is true, agent doesn't have a representation in this scene. 530 /// If this is true, agent doesn't have a representation in this scene.
523 /// this is an agent 'looking into' this scene from a nearby scene(region) 531 /// this is an agent 'looking into' this scene from a nearby scene(region)
@@ -650,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes
650 #region Constructor(s) 658 #region Constructor(s)
651 659
652 public ScenePresence() 660 public ScenePresence()
653 { 661 {
654 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 662 m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
655 CreateSceneViewer(); 663 CreateSceneViewer();
656 m_animator = new ScenePresenceAnimator(this); 664 m_animator = new ScenePresenceAnimator(this);
@@ -868,6 +876,31 @@ namespace OpenSim.Region.Framework.Scenes
868 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0) 876 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
869 { 877 {
870 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); 878 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
879
880 if (pos.X < 0)
881 {
882 emergencyPos.X = (int)Constants.RegionSize + pos.X;
883 if (!(pos.Y < 0))
884 emergencyPos.Y = pos.Y;
885 if (!(pos.Z < 0))
886 emergencyPos.X = pos.X;
887 }
888 if (pos.Y < 0)
889 {
890 emergencyPos.Y = (int)Constants.RegionSize + pos.Y;
891 if (!(pos.X < 0))
892 emergencyPos.X = pos.X;
893 if (!(pos.Z < 0))
894 emergencyPos.Z = pos.Z;
895 }
896 if (pos.Z < 0)
897 {
898 if (!(pos.X < 0))
899 emergencyPos.X = pos.X;
900 if (!(pos.Y < 0))
901 emergencyPos.Y = pos.Y;
902 //Leave as 128
903 }
871 904
872 m_log.WarnFormat( 905 m_log.WarnFormat(
873 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 906 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
@@ -2900,36 +2933,75 @@ namespace OpenSim.Region.Framework.Scenes
2900 { 2933 {
2901 // Checks if where it's headed exists a region 2934 // Checks if where it's headed exists a region
2902 2935
2936 bool needsTransit = false;
2903 if (m_scene.TestBorderCross(pos2, Cardinals.W)) 2937 if (m_scene.TestBorderCross(pos2, Cardinals.W))
2904 { 2938 {
2905 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2939 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2940 {
2941 needsTransit = true;
2906 neighbor = HaveNeighbor(Cardinals.SW, ref fix); 2942 neighbor = HaveNeighbor(Cardinals.SW, ref fix);
2943 }
2907 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2944 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2945 {
2946 needsTransit = true;
2908 neighbor = HaveNeighbor(Cardinals.NW, ref fix); 2947 neighbor = HaveNeighbor(Cardinals.NW, ref fix);
2948 }
2909 else 2949 else
2950 {
2951 needsTransit = true;
2910 neighbor = HaveNeighbor(Cardinals.W, ref fix); 2952 neighbor = HaveNeighbor(Cardinals.W, ref fix);
2953 }
2911 } 2954 }
2912 else if (m_scene.TestBorderCross(pos2, Cardinals.E)) 2955 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
2913 { 2956 {
2914 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2957 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2958 {
2959 needsTransit = true;
2915 neighbor = HaveNeighbor(Cardinals.SE, ref fix); 2960 neighbor = HaveNeighbor(Cardinals.SE, ref fix);
2961 }
2916 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2962 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2963 {
2964 needsTransit = true;
2917 neighbor = HaveNeighbor(Cardinals.NE, ref fix); 2965 neighbor = HaveNeighbor(Cardinals.NE, ref fix);
2966 }
2918 else 2967 else
2968 {
2969 needsTransit = true;
2919 neighbor = HaveNeighbor(Cardinals.E, ref fix); 2970 neighbor = HaveNeighbor(Cardinals.E, ref fix);
2971 }
2920 } 2972 }
2921 else if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2973 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
2974 {
2975 needsTransit = true;
2922 neighbor = HaveNeighbor(Cardinals.S, ref fix); 2976 neighbor = HaveNeighbor(Cardinals.S, ref fix);
2977 }
2923 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2978 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2979 {
2980 needsTransit = true;
2924 neighbor = HaveNeighbor(Cardinals.N, ref fix); 2981 neighbor = HaveNeighbor(Cardinals.N, ref fix);
2982 }
2983
2925 2984
2926
2927 // Makes sure avatar does not end up outside region 2985 // Makes sure avatar does not end up outside region
2928 if (neighbor < 0) 2986 if (neighbor <= 0)
2929 AbsolutePosition = new Vector3( 2987 {
2930 AbsolutePosition.X + 3*fix[0], 2988 if (!needsTransit)
2931 AbsolutePosition.Y + 3*fix[1], 2989 {
2932 AbsolutePosition.Z); 2990 if (m_requestedSitTargetUUID == UUID.Zero)
2991 {
2992 Vector3 pos = AbsolutePosition;
2993 if (AbsolutePosition.X < 0)
2994 pos.X += Velocity.X;
2995 else if (AbsolutePosition.X > Constants.RegionSize)
2996 pos.X -= Velocity.X;
2997 if (AbsolutePosition.Y < 0)
2998 pos.Y += Velocity.Y;
2999 else if (AbsolutePosition.Y > Constants.RegionSize)
3000 pos.Y -= Velocity.Y;
3001 AbsolutePosition = pos;
3002 }
3003 }
3004 }
2933 else if (neighbor > 0) 3005 else if (neighbor > 0)
2934 CrossToNewRegion(); 3006 CrossToNewRegion();
2935 } 3007 }
@@ -3400,7 +3472,7 @@ namespace OpenSim.Region.Framework.Scenes
3400 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3472 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3401 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3473 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3402 m_physicsActor.SubscribeEvents(500); 3474 m_physicsActor.SubscribeEvents(500);
3403 m_physicsActor.LocalID = LocalId; 3475 m_physicsActor.LocalID = LocalId;
3404 } 3476 }
3405 3477
3406 private void OutOfBoundsCall(Vector3 pos) 3478 private void OutOfBoundsCall(Vector3 pos)
@@ -3503,7 +3575,7 @@ namespace OpenSim.Region.Framework.Scenes
3503 } 3575 }
3504 if (m_health <= 0) 3576 if (m_health <= 0)
3505 m_scene.EventManager.TriggerAvatarKill(killerObj, this); 3577 m_scene.EventManager.TriggerAvatarKill(killerObj, this);
3506 } 3578 }
3507 } 3579 }
3508 3580
3509 public void setHealthWithUpdate(float health) 3581 public void setHealthWithUpdate(float health)
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs
index 713ff69..55e407e 100644
--- a/OpenSim/Region/Framework/Scenes/UndoState.cs
+++ b/OpenSim/Region/Framework/Scenes/UndoState.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Region.Framework.Interfaces;
29 30
30namespace OpenSim.Region.Framework.Scenes 31namespace OpenSim.Region.Framework.Scenes
31{ 32{
@@ -35,29 +36,21 @@ namespace OpenSim.Region.Framework.Scenes
35 public Vector3 Scale = Vector3.Zero; 36 public Vector3 Scale = Vector3.Zero;
36 public Quaternion Rotation = Quaternion.Identity; 37 public Quaternion Rotation = Quaternion.Identity;
37 38
38 public UndoState(Vector3 pos, Quaternion rot, Vector3 scale)
39 {
40 Position = pos;
41 Rotation = rot;
42 Scale = scale;
43 }
44
45 public UndoState(SceneObjectPart part) 39 public UndoState(SceneObjectPart part)
46 { 40 {
47 if (part != null) 41 if (part != null)
48 { 42 {
49 if (part.ParentID == 0) 43 if (part.ParentID == 0)
50 { 44 {
51 Position = part.AbsolutePosition; 45 Position = part.ParentGroup.AbsolutePosition;
52 Rotation = part.RotationOffset; 46 Rotation = part.RotationOffset;
53 47 Scale = part.Shape.Scale;
54 } 48 }
55 else 49 else
56 { 50 {
57 Position = part.OffsetPosition; 51 Position = part.OffsetPosition;
58 Rotation = part.RotationOffset; 52 Rotation = part.RotationOffset;
59 Scale = part.Shape.Scale; 53 Scale = part.Shape.Scale;
60
61 } 54 }
62 } 55 }
63 } 56 }
@@ -68,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
68 { 61 {
69 if (part.ParentID == 0) 62 if (part.ParentID == 0)
70 { 63 {
71 if (Position == part.AbsolutePosition && Rotation == part.RotationOffset) 64 if (Position == part.ParentGroup.AbsolutePosition && Rotation == part.ParentGroup.Rotation)
72 return true; 65 return true;
73 else 66 else
74 return false; 67 return false;
@@ -93,24 +86,78 @@ namespace OpenSim.Region.Framework.Scenes
93 86
94 if (part.ParentID == 0) 87 if (part.ParentID == 0)
95 { 88 {
96 part.ParentGroup.AbsolutePosition = Position; 89 if (Position != Vector3.Zero)
97 part.UpdateRotation(Rotation); 90 part.ParentGroup.AbsolutePosition = Position;
91 part.RotationOffset = Rotation;
92 if (Scale != Vector3.Zero)
93 part.Resize(Scale);
98 part.ParentGroup.ScheduleGroupForTerseUpdate(); 94 part.ParentGroup.ScheduleGroupForTerseUpdate();
99 } 95 }
100 else 96 else
101 { 97 {
102 part.OffsetPosition = Position; 98 if (Position != Vector3.Zero)
99 part.OffsetPosition = Position;
103 part.UpdateRotation(Rotation); 100 part.UpdateRotation(Rotation);
104 part.Resize(Scale); 101 if (Scale != Vector3.Zero)
102 part.Resize(Scale); part.ScheduleTerseUpdate();
103 }
104 part.Undoing = false;
105
106 }
107 }
108 public void PlayfwdState(SceneObjectPart part)
109 {
110 if (part != null)
111 {
112 part.Undoing = true;
113
114 if (part.ParentID == 0)
115 {
116 if (Position != Vector3.Zero)
117 part.ParentGroup.AbsolutePosition = Position;
118 if (Rotation != Quaternion.Identity)
119 part.UpdateRotation(Rotation);
120 if (Scale != Vector3.Zero)
121 part.Resize(Scale);
122 part.ParentGroup.ScheduleGroupForTerseUpdate();
123 }
124 else
125 {
126 if (Position != Vector3.Zero)
127 part.OffsetPosition = Position;
128 if (Rotation != Quaternion.Identity)
129 part.UpdateRotation(Rotation);
130 if (Scale != Vector3.Zero)
131 part.Resize(Scale);
105 part.ScheduleTerseUpdate(); 132 part.ScheduleTerseUpdate();
106 } 133 }
107 part.Undoing = false; 134 part.Undoing = false;
108 135
109 } 136 }
110 } 137 }
138 }
139 public class LandUndoState
140 {
141 public ITerrainModule m_terrainModule;
142 public ITerrainChannel m_terrainChannel;
143
144 public LandUndoState(ITerrainModule terrainModule, ITerrainChannel terrainChannel)
145 {
146 m_terrainModule = terrainModule;
147 m_terrainChannel = terrainChannel;
148 }
149
150 public bool Compare(ITerrainChannel terrainChannel)
151 {
152 if (m_terrainChannel != terrainChannel)
153 return false;
154 else
155 return false;
156 }
111 157
112 public UndoState() 158 public void PlaybackState()
113 { 159 {
160 m_terrainModule.UndoTerrain(m_terrainChannel);
114 } 161 }
115 } 162 }
116} 163}