diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 719a5dd..402e5f7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -853,6 +853,91 @@ namespace OpenSim.Region.Framework.Scenes | |||
853 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); | 853 | m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); |
854 | } | 854 | } |
855 | */ | 855 | */ |
856 | public void ObjectTeleport(UUID sourceID, Vector3 targetPosition, Quaternion rotation, bool stop) | ||
857 | { | ||
858 | if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null) | ||
859 | return; | ||
860 | |||
861 | inTransit = true; | ||
862 | |||
863 | PhysicsActor pa = RootPart.PhysActor; | ||
864 | if(pa == null || RootPart.KeyframeMotion != null /*|| m_sittingAvatars.Count == 0*/) | ||
865 | { | ||
866 | inTransit = false; | ||
867 | return; | ||
868 | } | ||
869 | |||
870 | if(Scene.PositionIsInCurrentRegion(targetPosition)) | ||
871 | { | ||
872 | if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 1.0)) | ||
873 | { | ||
874 | inTransit = false; | ||
875 | return; | ||
876 | } | ||
877 | |||
878 | Vector3 curPos = AbsolutePosition; | ||
879 | ILandObject curLand = Scene.LandChannel.GetLandObject(curPos.X, curPos.Y); | ||
880 | float posX = targetPosition.X; | ||
881 | float posY = targetPosition.Y; | ||
882 | ILandObject land = Scene.LandChannel.GetLandObject(posX, posY); | ||
883 | if(land != null && land != curLand) | ||
884 | { | ||
885 | if(!Scene.Permissions.CanObjectEnterWithScripts(this, land)) | ||
886 | { | ||
887 | inTransit = false; | ||
888 | return; | ||
889 | } | ||
890 | |||
891 | UUID agentID; | ||
892 | foreach (ScenePresence av in m_sittingAvatars) | ||
893 | { | ||
894 | agentID = av.UUID; | ||
895 | if(land.IsRestrictedFromLand(agentID) || land.IsBannedFromLand(agentID)) | ||
896 | { | ||
897 | inTransit = false; | ||
898 | return; | ||
899 | } | ||
900 | } | ||
901 | } | ||
902 | |||
903 | if(stop) | ||
904 | RootPart.Stop(); | ||
905 | else | ||
906 | { | ||
907 | rotation.Normalize(); | ||
908 | if(Math.Abs(rotation.W) < 0.999) | ||
909 | { | ||
910 | Quaternion rot = RootPart.RotationOffset; | ||
911 | Vector3 vel = RootPart.Velocity; | ||
912 | Vector3 avel = RootPart.AngularVelocity; | ||
913 | Vector3 acc = RootPart.Acceleration; | ||
914 | |||
915 | rot *= rotation; | ||
916 | vel *= rotation; | ||
917 | avel *= rotation; | ||
918 | acc *= rotation; | ||
919 | |||
920 | RootPart.RotationOffset = rot; | ||
921 | RootPart.Velocity = vel; | ||
922 | RootPart.AngularVelocity = avel; | ||
923 | RootPart.Acceleration = acc; | ||
924 | } | ||
925 | } | ||
926 | |||
927 | Vector3 s = RootPart.Scale * RootPart.RotationOffset; | ||
928 | float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f; | ||
929 | if(targetPosition.Z < h) | ||
930 | targetPosition.Z = h; | ||
931 | |||
932 | inTransit = false; | ||
933 | AbsolutePosition = targetPosition; | ||
934 | RootPart.ScheduleTerseUpdate(); | ||
935 | return; | ||
936 | } | ||
937 | |||
938 | inTransit = false; | ||
939 | } | ||
940 | |||
856 | public override Vector3 Velocity | 941 | public override Vector3 Velocity |
857 | { | 942 | { |
858 | get { return RootPart.Velocity; } | 943 | get { return RootPart.Velocity; } |