diff options
author | Kitto Flora | 2010-03-12 13:48:31 -0500 |
---|---|---|
committer | Kitto Flora | 2010-03-12 13:48:31 -0500 |
commit | 7bd48d383d3383c1e633f76f76a5291f4224d48a (patch) | |
tree | 18997a5b1a123091af18a1a7984d7dd7873930ac /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |
parent | Dynamics Integration Part 1 (diff) | |
parent | Small consistency change (diff) | |
download | opensim-SC_OLD-7bd48d383d3383c1e633f76f76a5291f4224d48a.zip opensim-SC_OLD-7bd48d383d3383c1e633f76f76a5291f4224d48a.tar.gz opensim-SC_OLD-7bd48d383d3383c1e633f76f76a5291f4224d48a.tar.bz2 opensim-SC_OLD-7bd48d383d3383c1e633f76f76a5291f4224d48a.tar.xz |
Resolved merge
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 363 |
1 files changed, 318 insertions, 45 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 1353518..31ea502 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) |
@@ -1412,6 +1483,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1412 | { | 1483 | { |
1413 | m_undo.Clear(); | 1484 | m_undo.Clear(); |
1414 | } | 1485 | } |
1486 | lock (m_redo) | ||
1487 | { | ||
1488 | m_redo.Clear(); | ||
1489 | } | ||
1415 | StoreUndoState(); | 1490 | StoreUndoState(); |
1416 | } | 1491 | } |
1417 | 1492 | ||
@@ -1722,6 +1797,66 @@ namespace OpenSim.Region.Framework.Scenes | |||
1722 | return m_parentGroup.RootPart.DIE_AT_EDGE; | 1797 | return m_parentGroup.RootPart.DIE_AT_EDGE; |
1723 | } | 1798 | } |
1724 | 1799 | ||
1800 | public bool GetReturnAtEdge() | ||
1801 | { | ||
1802 | if (m_parentGroup == null) | ||
1803 | return false; | ||
1804 | if (m_parentGroup.IsDeleted) | ||
1805 | return false; | ||
1806 | |||
1807 | return m_parentGroup.RootPart.RETURN_AT_EDGE; | ||
1808 | } | ||
1809 | |||
1810 | public void SetReturnAtEdge(bool p) | ||
1811 | { | ||
1812 | if (m_parentGroup == null) | ||
1813 | return; | ||
1814 | if (m_parentGroup.IsDeleted) | ||
1815 | return; | ||
1816 | |||
1817 | m_parentGroup.RootPart.RETURN_AT_EDGE = p; | ||
1818 | } | ||
1819 | |||
1820 | public bool GetBlockGrab() | ||
1821 | { | ||
1822 | if (m_parentGroup == null) | ||
1823 | return false; | ||
1824 | if (m_parentGroup.IsDeleted) | ||
1825 | return false; | ||
1826 | |||
1827 | return m_parentGroup.RootPart.BlockGrab; | ||
1828 | } | ||
1829 | |||
1830 | public void SetBlockGrab(bool p) | ||
1831 | { | ||
1832 | if (m_parentGroup == null) | ||
1833 | return; | ||
1834 | if (m_parentGroup.IsDeleted) | ||
1835 | return; | ||
1836 | |||
1837 | m_parentGroup.RootPart.BlockGrab = p; | ||
1838 | } | ||
1839 | |||
1840 | public void SetStatusSandbox(bool p) | ||
1841 | { | ||
1842 | if (m_parentGroup == null) | ||
1843 | return; | ||
1844 | if (m_parentGroup.IsDeleted) | ||
1845 | return; | ||
1846 | StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition; | ||
1847 | m_parentGroup.RootPart.StatusSandbox = p; | ||
1848 | } | ||
1849 | |||
1850 | public bool GetStatusSandbox() | ||
1851 | { | ||
1852 | if (m_parentGroup == null) | ||
1853 | return false; | ||
1854 | if (m_parentGroup.IsDeleted) | ||
1855 | return false; | ||
1856 | |||
1857 | return m_parentGroup.RootPart.StatusSandbox; | ||
1858 | } | ||
1859 | |||
1725 | public int GetAxisRotation(int axis) | 1860 | public int GetAxisRotation(int axis) |
1726 | { | 1861 | { |
1727 | //Cannot use ScriptBaseClass constants as no referance to it currently. | 1862 | //Cannot use ScriptBaseClass constants as no referance to it currently. |
@@ -1933,7 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1933 | // play the sound. | 2068 | // play the sound. |
1934 | if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) | 2069 | if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) |
1935 | { | 2070 | { |
1936 | SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0); | 2071 | SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); |
1937 | } | 2072 | } |
1938 | 2073 | ||
1939 | if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) | 2074 | if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) |
@@ -2508,9 +2643,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2508 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2643 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
2509 | foreach (ScenePresence p in avatarts) | 2644 | foreach (ScenePresence p in avatarts) |
2510 | { | 2645 | { |
2511 | // TODO: some filtering by distance of avatar | 2646 | if (!(Util.GetDistanceTo(p.AbsolutePosition, AbsolutePosition) >= 100)) |
2512 | 2647 | p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); | |
2513 | p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); | ||
2514 | } | 2648 | } |
2515 | } | 2649 | } |
2516 | 2650 | ||
@@ -2571,7 +2705,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
2571 | 2705 | ||
2572 | public void RotLookAt(Quaternion target, float strength, float damping) | 2706 | public void RotLookAt(Quaternion target, float strength, float damping) |
2573 | { | 2707 | { |
2574 | m_parentGroup.rotLookAt(target, strength, damping); | 2708 | rotLookAt(target, strength, damping); |
2709 | } | ||
2710 | |||
2711 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2712 | { | ||
2713 | if (IsAttachment) | ||
2714 | { | ||
2715 | /* | ||
2716 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2717 | if (avatar != null) | ||
2718 | { | ||
2719 | Rotate the Av? | ||
2720 | } */ | ||
2721 | } | ||
2722 | else | ||
2723 | { | ||
2724 | APIDDamp = damping; | ||
2725 | APIDStrength = strength; | ||
2726 | APIDTarget = target; | ||
2727 | } | ||
2728 | } | ||
2729 | |||
2730 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2731 | { | ||
2732 | APIDDamp = damp; | ||
2733 | APIDStrength = strength; | ||
2734 | APIDTarget = rot; | ||
2735 | } | ||
2736 | |||
2737 | public void stopLookAt() | ||
2738 | { | ||
2739 | APIDTarget = Quaternion.Identity; | ||
2575 | } | 2740 | } |
2576 | 2741 | ||
2577 | /// <summary> | 2742 | /// <summary> |
@@ -2833,7 +2998,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2833 | /// <param name="volume"></param> | 2998 | /// <param name="volume"></param> |
2834 | /// <param name="triggered"></param> | 2999 | /// <param name="triggered"></param> |
2835 | /// <param name="flags"></param> | 3000 | /// <param name="flags"></param> |
2836 | public void SendSound(string sound, double volume, bool triggered, byte flags) | 3001 | public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster) |
2837 | { | 3002 | { |
2838 | if (volume > 1) | 3003 | if (volume > 1) |
2839 | volume = 1; | 3004 | volume = 1; |
@@ -2868,10 +3033,51 @@ namespace OpenSim.Region.Framework.Scenes | |||
2868 | ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>(); | 3033 | ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>(); |
2869 | if (soundModule != null) | 3034 | if (soundModule != null) |
2870 | { | 3035 | { |
2871 | if (triggered) | 3036 | if (useMaster) |
2872 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle); | 3037 | { |
3038 | if (isMaster) | ||
3039 | { | ||
3040 | if (triggered) | ||
3041 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3042 | else | ||
3043 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3044 | ParentGroup.PlaySoundMasterPrim = this; | ||
3045 | ownerID = this._ownerID; | ||
3046 | objectID = this.UUID; | ||
3047 | parentID = this.GetRootPartUUID(); | ||
3048 | position = this.AbsolutePosition; // region local | ||
3049 | regionHandle = this.ParentGroup.Scene.RegionInfo.RegionHandle; | ||
3050 | if (triggered) | ||
3051 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3052 | else | ||
3053 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3054 | foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) | ||
3055 | { | ||
3056 | ownerID = prim._ownerID; | ||
3057 | objectID = prim.UUID; | ||
3058 | parentID = prim.GetRootPartUUID(); | ||
3059 | position = prim.AbsolutePosition; // region local | ||
3060 | regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle; | ||
3061 | if (triggered) | ||
3062 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3063 | else | ||
3064 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3065 | } | ||
3066 | ParentGroup.PlaySoundSlavePrims.Clear(); | ||
3067 | ParentGroup.PlaySoundMasterPrim = null; | ||
3068 | } | ||
3069 | else | ||
3070 | { | ||
3071 | ParentGroup.PlaySoundSlavePrims.Add(this); | ||
3072 | } | ||
3073 | } | ||
2873 | else | 3074 | else |
2874 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags); | 3075 | { |
3076 | if (triggered) | ||
3077 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3078 | else | ||
3079 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3080 | } | ||
2875 | } | 3081 | } |
2876 | } | 3082 | } |
2877 | 3083 | ||
@@ -3001,22 +3207,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3001 | PhysActor.VehicleRotationParam(param, rotation); | 3207 | PhysActor.VehicleRotationParam(param, rotation); |
3002 | } | 3208 | } |
3003 | } | 3209 | } |
3004 | |||
3005 | public void SetVehicleFlags(int flags) | ||
3006 | { | ||
3007 | if (PhysActor != null) | ||
3008 | { | ||
3009 | PhysActor.VehicleFlagsSet(flags); | ||
3010 | } | ||
3011 | } | ||
3012 | |||
3013 | public void RemoveVehicleFlags(int flags) | ||
3014 | { | ||
3015 | if (PhysActor != null) | ||
3016 | { | ||
3017 | PhysActor.VehicleFlagsRemove(flags); | ||
3018 | } | ||
3019 | } | ||
3020 | 3210 | ||
3021 | /// <summary> | 3211 | /// <summary> |
3022 | /// Set the color of prim faces | 3212 | /// Set the color of prim faces |
@@ -3190,6 +3380,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3190 | hasProfileCut = hasDimple; // is it the same thing? | 3380 | hasProfileCut = hasDimple; // is it the same thing? |
3191 | } | 3381 | } |
3192 | 3382 | ||
3383 | public void SetVehicleFlags(int param, bool remove) | ||
3384 | { | ||
3385 | if (PhysActor != null) | ||
3386 | { | ||
3387 | PhysActor.VehicleFlags(param, remove); | ||
3388 | } | ||
3389 | } | ||
3390 | |||
3193 | public void SetGroup(UUID groupID, IClientAPI client) | 3391 | public void SetGroup(UUID groupID, IClientAPI client) |
3194 | { | 3392 | { |
3195 | _groupID = groupID; | 3393 | _groupID = groupID; |
@@ -3294,27 +3492,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
3294 | { | 3492 | { |
3295 | if (!Undoing) | 3493 | if (!Undoing) |
3296 | { | 3494 | { |
3297 | if (m_parentGroup != null) | 3495 | if (!IgnoreUndoUpdate) |
3298 | { | 3496 | { |
3299 | lock (m_undo) | 3497 | if (m_parentGroup != null) |
3300 | { | 3498 | { |
3301 | if (m_undo.Count > 0) | 3499 | lock (m_undo) |
3302 | { | 3500 | { |
3303 | UndoState last = m_undo.Peek(); | 3501 | if (m_undo.Count > 0) |
3304 | if (last != null) | ||
3305 | { | 3502 | { |
3306 | if (last.Compare(this)) | 3503 | UndoState last = m_undo.Peek(); |
3307 | return; | 3504 | if (last != null) |
3505 | { | ||
3506 | if (last.Compare(this)) | ||
3507 | return; | ||
3508 | } | ||
3308 | } | 3509 | } |
3309 | } | ||
3310 | 3510 | ||
3311 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3511 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3312 | { | 3512 | { |
3313 | UndoState nUndo = new UndoState(this); | 3513 | UndoState nUndo = new UndoState(this); |
3314 | 3514 | ||
3315 | m_undo.Push(nUndo); | 3515 | m_undo.Push(nUndo); |
3316 | } | 3516 | } |
3317 | 3517 | ||
3518 | } | ||
3318 | } | 3519 | } |
3319 | } | 3520 | } |
3320 | } | 3521 | } |
@@ -3785,14 +3986,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
3785 | lock (m_undo) | 3986 | lock (m_undo) |
3786 | { | 3987 | { |
3787 | if (m_undo.Count > 0) | 3988 | if (m_undo.Count > 0) |
3989 | { | ||
3990 | UndoState nUndo = null; | ||
3991 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
3788 | { | 3992 | { |
3789 | UndoState goback = m_undo.Pop(); | 3993 | nUndo = new UndoState(this); |
3790 | if (goback != null) | 3994 | } |
3791 | goback.PlaybackState(this); | 3995 | UndoState goback = m_undo.Pop(); |
3996 | if (goback != null) | ||
3997 | { | ||
3998 | goback.PlaybackState(this); | ||
3999 | if (nUndo != null) | ||
4000 | m_redo.Push(nUndo); | ||
4001 | } | ||
3792 | } | 4002 | } |
3793 | } | 4003 | } |
3794 | } | 4004 | } |
3795 | 4005 | ||
4006 | public void Redo() | ||
4007 | { | ||
4008 | lock (m_redo) | ||
4009 | { | ||
4010 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
4011 | { | ||
4012 | UndoState nUndo = new UndoState(this); | ||
4013 | |||
4014 | m_undo.Push(nUndo); | ||
4015 | } | ||
4016 | UndoState gofwd = m_redo.Pop(); | ||
4017 | if (gofwd != null) | ||
4018 | gofwd.PlayfwdState(this); | ||
4019 | } | ||
4020 | } | ||
4021 | |||
3796 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) | 4022 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) |
3797 | { | 4023 | { |
3798 | m_shape.ReadInUpdateExtraParam(type, inUse, data); | 4024 | m_shape.ReadInUpdateExtraParam(type, inUse, data); |
@@ -3836,6 +4062,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3836 | (pos.Z != OffsetPosition.Z)) | 4062 | (pos.Z != OffsetPosition.Z)) |
3837 | { | 4063 | { |
3838 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); | 4064 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); |
4065 | |||
4066 | if (ParentGroup.RootPart.GetStatusSandbox()) | ||
4067 | { | ||
4068 | if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10) | ||
4069 | { | ||
4070 | ParentGroup.RootPart.ScriptSetPhysicsStatus(false); | ||
4071 | newPos = OffsetPosition; | ||
4072 | ParentGroup.Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), | ||
4073 | ChatTypeEnum.DebugChannel, 0x7FFFFFFF, ParentGroup.RootPart.AbsolutePosition, Name, UUID, false); | ||
4074 | } | ||
4075 | } | ||
4076 | |||
3839 | OffsetPosition = newPos; | 4077 | OffsetPosition = newPos; |
3840 | ScheduleTerseUpdate(); | 4078 | ScheduleTerseUpdate(); |
3841 | } | 4079 | } |
@@ -4128,7 +4366,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4128 | (rot.Z != RotationOffset.Z) || | 4366 | (rot.Z != RotationOffset.Z) || |
4129 | (rot.W != RotationOffset.W)) | 4367 | (rot.W != RotationOffset.W)) |
4130 | { | 4368 | { |
4131 | //StoreUndoState(); | ||
4132 | RotationOffset = rot; | 4369 | RotationOffset = rot; |
4133 | ParentGroup.HasGroupChanged = true; | 4370 | ParentGroup.HasGroupChanged = true; |
4134 | ScheduleTerseUpdate(); | 4371 | ScheduleTerseUpdate(); |
@@ -4312,7 +4549,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4312 | else | 4549 | else |
4313 | { | 4550 | { |
4314 | // m_log.DebugFormat( | 4551 | // m_log.DebugFormat( |
4315 | // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); | 4552 | // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); |
4316 | ScheduleFullUpdate(); | 4553 | ScheduleFullUpdate(); |
4317 | } | 4554 | } |
4318 | } | 4555 | } |
@@ -4430,5 +4667,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
4430 | 4667 | ||
4431 | Inventory.ApplyNextOwnerPermissions(); | 4668 | Inventory.ApplyNextOwnerPermissions(); |
4432 | } | 4669 | } |
4670 | public void UpdateLookAt() | ||
4671 | { | ||
4672 | try | ||
4673 | { | ||
4674 | if (APIDTarget != Quaternion.Identity) | ||
4675 | { | ||
4676 | if (Single.IsNaN(APIDTarget.W) == true) | ||
4677 | { | ||
4678 | APIDTarget = Quaternion.Identity; | ||
4679 | return; | ||
4680 | } | ||
4681 | Quaternion rot = RotationOffset; | ||
4682 | Quaternion dir = (rot - APIDTarget); | ||
4683 | float speed = ((APIDStrength / APIDDamp) * (float)(Math.PI / 180.0f)); | ||
4684 | if (dir.Z > speed) | ||
4685 | { | ||
4686 | rot.Z -= speed; | ||
4687 | } | ||
4688 | if (dir.Z < -speed) | ||
4689 | { | ||
4690 | rot.Z += speed; | ||
4691 | } | ||
4692 | rot.Normalize(); | ||
4693 | UpdateRotation(rot); | ||
4694 | } | ||
4695 | } | ||
4696 | catch (Exception ex) | ||
4697 | { | ||
4698 | m_log.Error("[Physics] " + ex); | ||
4699 | } | ||
4700 | } | ||
4701 | |||
4702 | public Color4 GetTextColor() | ||
4703 | { | ||
4704 | return new Color4((byte)Color.R, (byte)Color.G, (byte)Color.B, (byte)(0xFF - Color.A)); | ||
4705 | } | ||
4433 | } | 4706 | } |
4434 | } | 4707 | } |