aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2019-05-01 01:35:45 +0100
committerUbitUmarov2019-05-01 01:36:10 +0100
commit11c945a5651d8e55c6948df9a026ff3d85566b51 (patch)
tree2d44f7bbf0740d55b7b62743ad0efd292f46e06a /OpenSim/Region
parentmissing files... (diff)
downloadopensim-SC-11c945a5651d8e55c6948df9a026ff3d85566b51.zip
opensim-SC-11c945a5651d8e55c6948df9a026ff3d85566b51.tar.gz
opensim-SC-11c945a5651d8e55c6948df9a026ff3d85566b51.tar.bz2
opensim-SC-11c945a5651d8e55c6948df9a026ff3d85566b51.tar.xz
add osLocalTeleportAgent(key agent, vector position, vector velocity, vector lookat, LSL_Integer flags). Velocity only works with ubOde but still not good. flags = bit field: 1 use velocity, 2 use lookat, 4 rotate avatar look in current velocity direction (ignored if 2 ie flag = 7 is same as 3). This bypasses most the unnecessary logic of osTeleportAgent, having usage same permissions. It may do region crossings(?). Experimental stage, feedbakc expected ;)
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs49
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs17
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
6 files changed, 62 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2fa92b3..073d11f 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4795,6 +4795,20 @@ Label_GroupsDone:
4795 return true; 4795 return true;
4796 } 4796 }
4797 4797
4798
4799 /// <summary>
4800 /// Tries to teleport agent within region.
4801 /// </summary>
4802 /// <param name="remoteClient"></param>
4803 /// <param name="position"></param>
4804 /// <param name="lookAt"></param>
4805 /// <param name="teleportFlags"></param>
4806 public void RequestLocalTeleport(ScenePresence sp, Vector3 position, Vector3 vel,
4807 Vector3 lookat, int flags)
4808 {
4809 sp.LocalTeleport(position, vel, lookat, flags);
4810 }
4811
4798 /// <summary> 4812 /// <summary>
4799 /// Tries to teleport agent to another region. 4813 /// Tries to teleport agent to another region.
4800 /// </summary> 4814 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b341d48..56e822a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1688,10 +1688,6 @@ namespace OpenSim.Region.Framework.Scenes
1688// } 1688// }
1689 } 1689 }
1690 1690
1691 /// <summary>
1692 /// Do not call this directly. Call Scene.RequestTeleportLocation() instead.
1693 /// </summary>
1694 /// <param name="pos"></param>
1695 public void Teleport(Vector3 pos) 1691 public void Teleport(Vector3 pos)
1696 { 1692 {
1697 TeleportWithMomentum(pos, Vector3.Zero); 1693 TeleportWithMomentum(pos, Vector3.Zero);
@@ -1736,36 +1732,37 @@ namespace OpenSim.Region.Framework.Scenes
1736 SendTerseUpdateToAllClients(); 1732 SendTerseUpdateToAllClients();
1737 } 1733 }
1738 1734
1739 public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) 1735 public void LocalTeleport(Vector3 newpos, Vector3 newvel, Vector3 newlookat, int flags)
1740 { 1736 {
1741 if(!CheckLocalTPLandingPoint(ref newpos)) 1737 if(!CheckLocalTPLandingPoint(ref newpos))
1742 return; 1738 return;
1743 1739
1744 AbsolutePosition = newpos; 1740 AbsolutePosition = newpos;
1745 1741
1746 if (newvel.HasValue) 1742 if ((flags & 1) != 0)
1747 { 1743 {
1748 if ((Vector3)newvel == Vector3.Zero) 1744 if (PhysicsActor != null)
1749 { 1745 PhysicsActor.SetMomentum(newvel);
1750 if (PhysicsActor != null) 1746 m_velocity = newvel;
1751 PhysicsActor.SetMomentum(Vector3.Zero); 1747 }
1752 m_velocity = Vector3.Zero;
1753 }
1754 else
1755 {
1756 if (PhysicsActor != null)
1757 PhysicsActor.SetMomentum((Vector3)newvel);
1758 m_velocity = (Vector3)newvel;
1759 1748
1760 if (rotateToVelXY) 1749 if ((flags & 2) != 0)
1761 { 1750 {
1762 Vector3 lookAt = (Vector3)newvel; 1751 newlookat.Z = 0;
1763 lookAt.Z = 0; 1752 newlookat.Normalize();
1764 lookAt.Normalize(); 1753 if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001)
1765 ControllingClient.SendLocalTeleport(newpos, lookAt, (uint)TeleportFlags.ViaLocation); 1754 ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation);
1766 return; 1755 }
1767 } 1756 else if((flags & 4) != 0)
1768 } 1757 {
1758 if((flags & 1) != 0)
1759 newlookat = newvel;
1760 else
1761 newlookat = m_velocity;
1762 newlookat.Z = 0;
1763 newlookat.Normalize();
1764 if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001)
1765 ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation);
1769 } 1766 }
1770 SendTerseUpdateToAllClients(); 1767 SendTerseUpdateToAllClients();
1771 } 1768 }
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
index 267fc5b..cec8b74 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
@@ -1976,8 +1976,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1976 1976
1977 private void changeTargetVelocity(Vector3 newVel) 1977 private void changeTargetVelocity(Vector3 newVel)
1978 { 1978 {
1979 m_pidControllerActive = true; 1979 //m_pidControllerActive = true;
1980 m_freemove = false; 1980 //m_freemove = false;
1981 _target_velocity = newVel; 1981 _target_velocity = newVel;
1982 if (Body != IntPtr.Zero) 1982 if (Body != IntPtr.Zero)
1983 SafeNativeMethods.BodyEnable(Body); 1983 SafeNativeMethods.BodyEnable(Body);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index c1c1eaf..a0f784e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -924,6 +924,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
924 } 924 }
925 925
926 // Teleport functions 926 // Teleport functions
927 public void osLocalTeleportAgent(LSL_Key agent, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Vector3 lookat, LSL_Integer flags)
928 {
929 UUID agentId;
930 if (!UUID.TryParse(agent, out agentId))
931 return;
932
933 ScenePresence presence = World.GetScenePresence(agentId);
934 if (presence == null || presence.IsDeleted || presence.IsInTransit)
935 return;
936
937 Vector3 pos = presence.AbsolutePosition;
938 if (!checkAllowAgentTPbyLandOwner(agentId, pos))
939 return;
940
941 World.RequestLocalTeleport(presence, position, velocity, lookat, flags);
942 }
943
927 public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 944 public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
928 { 945 {
929 // High because there is no security check. High griefer potential 946 // High because there is no security check. High griefer potential
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index ce6aaf8..194df36 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -150,6 +150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
150 string osGetAgentIP(string agent); 150 string osGetAgentIP(string agent);
151 151
152 // Teleport commands 152 // Teleport commands
153 void osLocalTeleportAgent(LSL_Key agent, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Vector3 lookat, LSL_Integer flags);
153 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); 154 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
154 void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); 155 void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
155 void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); 156 void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index fd5142f..88ea9d5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -247,6 +247,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
247 247
248 // Teleport Functions 248 // Teleport Functions
249 249
250 public void osLocalTeleportAgent(LSL_Key agent, vector position, vector velocity, vector lookat, LSL_Integer flags)
251 {
252 m_OSSL_Functions.osLocalTeleportAgent(agent, position, velocity, lookat, flags);
253 }
254
250 public void osTeleportAgent(string agent, string regionName, vector position, vector lookat) 255 public void osTeleportAgent(string agent, string regionName, vector position, vector lookat)
251 { 256 {
252 m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat); 257 m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat);