aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorMelanie Thielker2009-07-27 23:13:31 +0000
committerMelanie Thielker2009-07-27 23:13:31 +0000
commitaec16c2a0a9283d28361eb21b16495421a77b46a (patch)
tree57bd030262f6fa4d838e8b1d8554859ffe44ba9b /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentPreserve the creator of items copied in inventory. (diff)
downloadopensim-SC-aec16c2a0a9283d28361eb21b16495421a77b46a.zip
opensim-SC-aec16c2a0a9283d28361eb21b16495421a77b46a.tar.gz
opensim-SC-aec16c2a0a9283d28361eb21b16495421a77b46a.tar.bz2
opensim-SC-aec16c2a0a9283d28361eb21b16495421a77b46a.tar.xz
Than you, otakup0pe, for a patch to correct llSetPos & friends' behavior
for child prims. Fixes Mantis #3931
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs38
1 files changed, 24 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 2c3002a..c7c416c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1849,15 +1849,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1849 1849
1850 ScriptSleep(200); 1850 ScriptSleep(200);
1851 } 1851 }
1852 1852 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
1853 // note linked setpos is capped "differently"
1854 private LSL_Vector SetPosAdjust(LSL_Vector start, LSL_Vector end)
1855 {
1856 if ( llVecDist(start, end) > 10.0f * m_ScriptDistanceFactor ) {
1857 return start + m_ScriptDistanceFactor * 10.0f * llVecNorm(end - start);
1858 } else {
1859 return end;
1860 }
1861 }
1853 protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) 1862 protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
1854 { 1863 {
1855 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) 1864 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
1856 LSL_Vector currentPos = llGetLocalPos(); 1865 LSL_Vector currentPos = llGetLocalPos();
1857 if (llVecDist(currentPos, targetPos) > 10.0f * m_ScriptDistanceFactor)
1858 {
1859 targetPos = currentPos + m_ScriptDistanceFactor * 10.0f * llVecNorm(targetPos - currentPos);
1860 }
1861 1866
1862 float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y); 1867 float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y);
1863 bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true); 1868 bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);
@@ -1867,22 +1872,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1867 { 1872 {
1868 if ((targetPos.z < ground) && disable_underground_movement) 1873 if ((targetPos.z < ground) && disable_underground_movement)
1869 targetPos.z = ground; 1874 targetPos.z = ground;
1870 part.UpdateOffSet(new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z)); 1875 LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
1871 } 1876 part.UpdateOffSet(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z)); }
1872 else if (part.ParentGroup.RootPart == part) 1877 else if (part.ParentGroup.RootPart == part)
1873 { 1878 {
1874 if ((targetPos.z < ground) && disable_underground_movement) 1879 if ((targetPos.z < ground) && disable_underground_movement)
1875 targetPos.z = ground; 1880 targetPos.z = ground;
1876 SceneObjectGroup parent = part.ParentGroup; 1881 SceneObjectGroup parent = part.ParentGroup;
1877 parent.UpdateGroupPosition(new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z)); 1882 LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
1883 parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z));
1878 } 1884 }
1879 else 1885 else
1880 { 1886 {
1881 part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z); 1887 //it's late... i think this is right ?
1882 SceneObjectGroup parent = part.ParentGroup; 1888 if ( llVecDist(new LSL_Vector(0,0,0), targetPos) <= 10.0f )
1883 parent.HasGroupChanged = true; 1889 {
1884 parent.ScheduleGroupForTerseUpdate(); 1890 part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z);
1885 } 1891 SceneObjectGroup parent = part.ParentGroup;
1892 parent.HasGroupChanged = true;
1893 parent.ScheduleGroupForTerseUpdate();
1894 }
1895 }
1886 } 1896 }
1887 1897
1888 public LSL_Vector llGetPos() 1898 public LSL_Vector llGetPos()