diff options
author | Jeff Ames | 2009-07-28 09:40:07 +0000 |
---|---|---|
committer | Jeff Ames | 2009-07-28 09:40:07 +0000 |
commit | a1786d4c39d01be27224d690408cf1f797facd7c (patch) | |
tree | 716b17388b062b8032f635097c0f514c20bd9d9b /OpenSim/Region/ScriptEngine/Shared | |
parent | Than you, otakup0pe, for a patch to correct llSetPos & friends' behavior (diff) | |
download | opensim-SC_OLD-a1786d4c39d01be27224d690408cf1f797facd7c.zip opensim-SC_OLD-a1786d4c39d01be27224d690408cf1f797facd7c.tar.gz opensim-SC_OLD-a1786d4c39d01be27224d690408cf1f797facd7c.tar.bz2 opensim-SC_OLD-a1786d4c39d01be27224d690408cf1f797facd7c.tar.xz |
Formatting cleanup.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 403 |
1 files changed, 198 insertions, 205 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c7c416c..acab734 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -305,14 +305,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
305 | } | 305 | } |
306 | } | 306 | } |
307 | } | 307 | } |
308 | 308 | ||
309 | return UUID.Zero; | 309 | return UUID.Zero; |
310 | } | 310 | } |
311 | 311 | ||
312 | protected UUID InventoryKey(string name) | 312 | protected UUID InventoryKey(string name) |
313 | { | 313 | { |
314 | m_host.AddScriptLPS(1); | 314 | m_host.AddScriptLPS(1); |
315 | 315 | ||
316 | lock (m_host.TaskInventory) | 316 | lock (m_host.TaskInventory) |
317 | { | 317 | { |
318 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 318 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) |
@@ -323,7 +323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
323 | } | 323 | } |
324 | } | 324 | } |
325 | } | 325 | } |
326 | 326 | ||
327 | return UUID.Zero; | 327 | return UUID.Zero; |
328 | } | 328 | } |
329 | 329 | ||
@@ -1580,7 +1580,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1580 | /// Set a light point on a part | 1580 | /// Set a light point on a part |
1581 | /// </summary> | 1581 | /// </summary> |
1582 | /// FIXME: Much of this code should probably be in SceneObjectGroup | 1582 | /// FIXME: Much of this code should probably be in SceneObjectGroup |
1583 | /// | 1583 | /// |
1584 | /// <param name="part"></param> | 1584 | /// <param name="part"></param> |
1585 | /// <param name="light"></param> | 1585 | /// <param name="light"></param> |
1586 | /// <param name="color"></param> | 1586 | /// <param name="color"></param> |
@@ -1633,7 +1633,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1633 | rgb.y += texcolor.G; | 1633 | rgb.y += texcolor.G; |
1634 | rgb.z += texcolor.B; | 1634 | rgb.z += texcolor.B; |
1635 | } | 1635 | } |
1636 | 1636 | ||
1637 | rgb.x /= (float)GetNumberOfSides(part); | 1637 | rgb.x /= (float)GetNumberOfSides(part); |
1638 | rgb.y /= (float)GetNumberOfSides(part); | 1638 | rgb.y /= (float)GetNumberOfSides(part); |
1639 | rgb.z /= (float)GetNumberOfSides(part); | 1639 | rgb.z /= (float)GetNumberOfSides(part); |
@@ -1849,16 +1849,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1849 | 1849 | ||
1850 | ScriptSleep(200); | 1850 | ScriptSleep(200); |
1851 | } | 1851 | } |
1852 | // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) | 1852 | |
1853 | // note linked setpos is capped "differently" | 1853 | // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) |
1854 | private LSL_Vector SetPosAdjust(LSL_Vector start, LSL_Vector end) | 1854 | // note linked setpos is capped "differently" |
1855 | { | 1855 | private LSL_Vector SetPosAdjust(LSL_Vector start, LSL_Vector end) |
1856 | if ( llVecDist(start, end) > 10.0f * m_ScriptDistanceFactor ) { | 1856 | { |
1857 | return start + m_ScriptDistanceFactor * 10.0f * llVecNorm(end - start); | 1857 | if (llVecDist(start, end) > 10.0f * m_ScriptDistanceFactor) |
1858 | } else { | 1858 | return start + m_ScriptDistanceFactor * 10.0f * llVecNorm(end - start); |
1859 | return end; | 1859 | else |
1860 | } | 1860 | return end; |
1861 | } | 1861 | } |
1862 | |||
1862 | protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) | 1863 | protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) |
1863 | { | 1864 | { |
1864 | // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) | 1865 | // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) |
@@ -1867,32 +1868,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1867 | float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y); | 1868 | float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y); |
1868 | bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true); | 1869 | bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true); |
1869 | 1870 | ||
1870 | |||
1871 | if (part.ParentGroup == null) | 1871 | if (part.ParentGroup == null) |
1872 | { | 1872 | { |
1873 | if ((targetPos.z < ground) && disable_underground_movement) | 1873 | if ((targetPos.z < ground) && disable_underground_movement) |
1874 | targetPos.z = ground; | 1874 | targetPos.z = ground; |
1875 | LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); | 1875 | LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); |
1876 | part.UpdateOffSet(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z)); } | 1876 | part.UpdateOffSet(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z)); |
1877 | } | ||
1877 | else if (part.ParentGroup.RootPart == part) | 1878 | else if (part.ParentGroup.RootPart == part) |
1878 | { | 1879 | { |
1879 | if ((targetPos.z < ground) && disable_underground_movement) | 1880 | if ((targetPos.z < ground) && disable_underground_movement) |
1880 | targetPos.z = ground; | 1881 | targetPos.z = ground; |
1881 | SceneObjectGroup parent = part.ParentGroup; | 1882 | SceneObjectGroup parent = part.ParentGroup; |
1882 | LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); | 1883 | LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); |
1883 | parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z)); | 1884 | parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z)); |
1884 | } | 1885 | } |
1885 | else | 1886 | else |
1886 | { | 1887 | { |
1887 | //it's late... i think this is right ? | 1888 | //it's late... i think this is right ? |
1888 | if ( llVecDist(new LSL_Vector(0,0,0), targetPos) <= 10.0f ) | 1889 | if (llVecDist(new LSL_Vector(0,0,0), targetPos) <= 10.0f) |
1889 | { | 1890 | { |
1890 | part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z); | 1891 | part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z); |
1891 | SceneObjectGroup parent = part.ParentGroup; | 1892 | SceneObjectGroup parent = part.ParentGroup; |
1892 | parent.HasGroupChanged = true; | 1893 | parent.HasGroupChanged = true; |
1893 | parent.ScheduleGroupForTerseUpdate(); | 1894 | parent.ScheduleGroupForTerseUpdate(); |
1894 | } | 1895 | } |
1895 | } | 1896 | } |
1896 | } | 1897 | } |
1897 | 1898 | ||
1898 | public LSL_Vector llGetPos() | 1899 | public LSL_Vector llGetPos() |
@@ -1908,14 +1909,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1908 | if (m_host.ParentID != 0) | 1909 | if (m_host.ParentID != 0) |
1909 | { | 1910 | { |
1910 | return new LSL_Vector(m_host.OffsetPosition.X, | 1911 | return new LSL_Vector(m_host.OffsetPosition.X, |
1911 | m_host.OffsetPosition.Y, | 1912 | m_host.OffsetPosition.Y, |
1912 | m_host.OffsetPosition.Z); | 1913 | m_host.OffsetPosition.Z); |
1913 | } | 1914 | } |
1914 | else | 1915 | else |
1915 | { | 1916 | { |
1916 | return new LSL_Vector(m_host.AbsolutePosition.X, | 1917 | return new LSL_Vector(m_host.AbsolutePosition.X, |
1917 | m_host.AbsolutePosition.Y, | 1918 | m_host.AbsolutePosition.Y, |
1918 | m_host.AbsolutePosition.Z); | 1919 | m_host.AbsolutePosition.Z); |
1919 | } | 1920 | } |
1920 | } | 1921 | } |
1921 | 1922 | ||
@@ -2072,7 +2073,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2072 | { | 2073 | { |
2073 | m_host.AddScriptLPS(1); | 2074 | m_host.AddScriptLPS(1); |
2074 | m_host.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0); | 2075 | m_host.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0); |
2075 | |||
2076 | } | 2076 | } |
2077 | 2077 | ||
2078 | public void llSetTorque(LSL_Vector torque, int local) | 2078 | public void llSetTorque(LSL_Vector torque, int local) |
@@ -2481,12 +2481,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2481 | m_host.AddScriptLPS(1); | 2481 | m_host.AddScriptLPS(1); |
2482 | 2482 | ||
2483 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; | 2483 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; |
2484 | 2484 | ||
2485 | lock (m_host.TaskInventory) | 2485 | lock (m_host.TaskInventory) |
2486 | { | 2486 | { |
2487 | item = m_host.TaskInventory[invItemID]; | 2487 | item = m_host.TaskInventory[invItemID]; |
2488 | } | 2488 | } |
2489 | 2489 | ||
2490 | if (item.PermsGranter == UUID.Zero) | 2490 | if (item.PermsGranter == UUID.Zero) |
2491 | return 0; | 2491 | return 0; |
2492 | 2492 | ||
@@ -2512,9 +2512,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2512 | return 0; | 2512 | return 0; |
2513 | } | 2513 | } |
2514 | 2514 | ||
2515 | bool result | 2515 | bool result = money.ObjectGiveMoney( |
2516 | = money.ObjectGiveMoney( | 2516 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); |
2517 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); | ||
2518 | 2517 | ||
2519 | if (result) | 2518 | if (result) |
2520 | return 1; | 2519 | return 1; |
@@ -2560,7 +2559,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2560 | 2559 | ||
2561 | if (dist > m_ScriptDistanceFactor * 10.0f) | 2560 | if (dist > m_ScriptDistanceFactor * 10.0f) |
2562 | return; | 2561 | return; |
2563 | 2562 | ||
2564 | TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); | 2563 | TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); |
2565 | 2564 | ||
2566 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory) | 2565 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory) |
@@ -2610,7 +2609,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2610 | return; | 2609 | return; |
2611 | } | 2610 | } |
2612 | } | 2611 | } |
2613 | 2612 | ||
2614 | llSay(0, "Could not find object " + inventory); | 2613 | llSay(0, "Could not find object " + inventory); |
2615 | } | 2614 | } |
2616 | 2615 | ||
@@ -2622,29 +2621,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2622 | public void llLookAt(LSL_Vector target, double strength, double damping) | 2621 | public void llLookAt(LSL_Vector target, double strength, double damping) |
2623 | { | 2622 | { |
2624 | // partial implementation, rotates objects correctly but does not apply strength or damping attributes | 2623 | // partial implementation, rotates objects correctly but does not apply strength or damping attributes |
2625 | 2624 | ||
2626 | m_host.AddScriptLPS(1); | 2625 | m_host.AddScriptLPS(1); |
2627 | // Determine where we are looking from | 2626 | // Determine where we are looking from |
2628 | LSL_Vector from = llGetPos(); | 2627 | LSL_Vector from = llGetPos(); |
2629 | 2628 | ||
2630 | // Work out the normalised vector from the source to the target | 2629 | // Work out the normalised vector from the source to the target |
2631 | LSL_Vector delta = llVecNorm(target - from); | 2630 | LSL_Vector delta = llVecNorm(target - from); |
2632 | LSL_Vector angle = new LSL_Vector(0,0,0); | 2631 | LSL_Vector angle = new LSL_Vector(0,0,0); |
2633 | 2632 | ||
2634 | // Calculate the yaw | 2633 | // Calculate the yaw |
2635 | // subtracting PI_BY_TWO is required to compensate for the odd SL co-ordinate system | 2634 | // subtracting PI_BY_TWO is required to compensate for the odd SL co-ordinate system |
2636 | angle.x = llAtan2(delta.z, delta.y) - ScriptBaseClass.PI_BY_TWO; | 2635 | angle.x = llAtan2(delta.z, delta.y) - ScriptBaseClass.PI_BY_TWO; |
2637 | 2636 | ||
2638 | // Calculate pitch | 2637 | // Calculate pitch |
2639 | angle.y = llAtan2(delta.x, llSqrt((delta.y * delta.y) + (delta.z * delta.z))); | 2638 | angle.y = llAtan2(delta.x, llSqrt((delta.y * delta.y) + (delta.z * delta.z))); |
2640 | 2639 | ||
2641 | // we need to convert from a vector describing | 2640 | // we need to convert from a vector describing |
2642 | // the angles of rotation in radians into rotation value | 2641 | // the angles of rotation in radians into rotation value |
2643 | 2642 | ||
2644 | LSL_Types.Quaternion rot = llEuler2Rot(angle); | 2643 | LSL_Types.Quaternion rot = llEuler2Rot(angle); |
2645 | 2644 | ||
2646 | // Orient the object to the angle calculated | 2645 | // Orient the object to the angle calculated |
2647 | llSetRot(rot); | 2646 | llSetRot(rot); |
2648 | } | 2647 | } |
2649 | 2648 | ||
2650 | public void llStopLookAt() | 2649 | public void llStopLookAt() |
@@ -2683,7 +2682,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2683 | public void llTakeControls(int controls, int accept, int pass_on) | 2682 | public void llTakeControls(int controls, int accept, int pass_on) |
2684 | { | 2683 | { |
2685 | TaskInventoryItem item; | 2684 | TaskInventoryItem item; |
2686 | 2685 | ||
2687 | lock (m_host.TaskInventory) | 2686 | lock (m_host.TaskInventory) |
2688 | { | 2687 | { |
2689 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 2688 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) |
@@ -2691,7 +2690,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2691 | else | 2690 | else |
2692 | item = m_host.TaskInventory[InventorySelf()]; | 2691 | item = m_host.TaskInventory[InventorySelf()]; |
2693 | } | 2692 | } |
2694 | 2693 | ||
2695 | if (item.PermsGranter != UUID.Zero) | 2694 | if (item.PermsGranter != UUID.Zero) |
2696 | { | 2695 | { |
2697 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | 2696 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); |
@@ -2709,9 +2708,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2709 | } | 2708 | } |
2710 | 2709 | ||
2711 | public void llReleaseControls() | 2710 | public void llReleaseControls() |
2712 | { | 2711 | { |
2713 | TaskInventoryItem item; | 2712 | TaskInventoryItem item; |
2714 | 2713 | ||
2715 | lock (m_host.TaskInventory) | 2714 | lock (m_host.TaskInventory) |
2716 | { | 2715 | { |
2717 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 2716 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) |
@@ -2719,7 +2718,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2719 | else | 2718 | else |
2720 | item = m_host.TaskInventory[InventorySelf()]; | 2719 | item = m_host.TaskInventory[InventorySelf()]; |
2721 | } | 2720 | } |
2722 | 2721 | ||
2723 | m_host.AddScriptLPS(1); | 2722 | m_host.AddScriptLPS(1); |
2724 | 2723 | ||
2725 | if (item.PermsGranter != UUID.Zero) | 2724 | if (item.PermsGranter != UUID.Zero) |
@@ -2762,7 +2761,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2762 | else | 2761 | else |
2763 | item = m_host.TaskInventory[InventorySelf()]; | 2762 | item = m_host.TaskInventory[InventorySelf()]; |
2764 | } | 2763 | } |
2765 | 2764 | ||
2766 | if (item.PermsGranter != m_host.OwnerID) | 2765 | if (item.PermsGranter != m_host.OwnerID) |
2767 | return; | 2766 | return; |
2768 | 2767 | ||
@@ -2794,7 +2793,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2794 | else | 2793 | else |
2795 | item = m_host.TaskInventory[InventorySelf()]; | 2794 | item = m_host.TaskInventory[InventorySelf()]; |
2796 | } | 2795 | } |
2797 | 2796 | ||
2798 | if (item.PermsGranter != m_host.OwnerID) | 2797 | if (item.PermsGranter != m_host.OwnerID) |
2799 | return; | 2798 | return; |
2800 | 2799 | ||
@@ -2934,7 +2933,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2934 | m_host.AddScriptLPS(1); | 2933 | m_host.AddScriptLPS(1); |
2935 | if (m_host.ParentGroup != null) | 2934 | if (m_host.ParentGroup != null) |
2936 | { | 2935 | { |
2937 | if (!m_host.ParentGroup.IsDeleted) | 2936 | if (!m_host.ParentGroup.IsDeleted) |
2938 | { | 2937 | { |
2939 | m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy); | 2938 | m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy); |
2940 | } | 2939 | } |
@@ -3022,7 +3021,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3022 | return; | 3021 | return; |
3023 | 3022 | ||
3024 | TaskInventoryItem item; | 3023 | TaskInventoryItem item; |
3025 | 3024 | ||
3026 | lock (m_host.TaskInventory) | 3025 | lock (m_host.TaskInventory) |
3027 | { | 3026 | { |
3028 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 3027 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) |
@@ -3030,7 +3029,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3030 | else | 3029 | else |
3031 | item = m_host.TaskInventory[InventorySelf()]; | 3030 | item = m_host.TaskInventory[InventorySelf()]; |
3032 | } | 3031 | } |
3033 | 3032 | ||
3034 | if (item.PermsGranter == UUID.Zero) | 3033 | if (item.PermsGranter == UUID.Zero) |
3035 | return; | 3034 | return; |
3036 | 3035 | ||
@@ -3057,16 +3056,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3057 | UUID invItemID=InventorySelf(); | 3056 | UUID invItemID=InventorySelf(); |
3058 | if (invItemID == UUID.Zero) | 3057 | if (invItemID == UUID.Zero) |
3059 | return; | 3058 | return; |
3060 | 3059 | ||
3061 | TaskInventoryItem item; | 3060 | TaskInventoryItem item; |
3062 | 3061 | ||
3063 | lock (m_host.TaskInventory) | 3062 | lock (m_host.TaskInventory) |
3064 | { | 3063 | { |
3065 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 3064 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) |
3066 | return; | 3065 | return; |
3067 | else | 3066 | else |
3068 | item = m_host.TaskInventory[InventorySelf()]; | 3067 | item = m_host.TaskInventory[InventorySelf()]; |
3069 | } | 3068 | } |
3070 | 3069 | ||
3071 | if (item.PermsGranter == UUID.Zero) | 3070 | if (item.PermsGranter == UUID.Zero) |
3072 | return; | 3071 | return; |
@@ -3137,13 +3136,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3137 | 3136 | ||
3138 | if (invItemID == UUID.Zero) | 3137 | if (invItemID == UUID.Zero) |
3139 | return; // Not in a prim? How?? | 3138 | return; // Not in a prim? How?? |
3140 | 3139 | ||
3141 | TaskInventoryItem item; | 3140 | TaskInventoryItem item; |
3142 | 3141 | ||
3143 | lock (m_host.TaskInventory) | 3142 | lock (m_host.TaskInventory) |
3144 | { | 3143 | { |
3145 | item = m_host.TaskInventory[invItemID]; | 3144 | item = m_host.TaskInventory[invItemID]; |
3146 | } | 3145 | } |
3147 | 3146 | ||
3148 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions | 3147 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions |
3149 | { | 3148 | { |
@@ -3229,14 +3228,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3229 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3228 | m_host.TaskInventory[invItemID].PermsGranter = agentID; |
3230 | m_host.TaskInventory[invItemID].PermsMask = 0; | 3229 | m_host.TaskInventory[invItemID].PermsMask = 0; |
3231 | } | 3230 | } |
3232 | 3231 | ||
3233 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; | 3232 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; |
3234 | m_waitingForScriptAnswer=true; | 3233 | m_waitingForScriptAnswer=true; |
3235 | } | 3234 | } |
3236 | 3235 | ||
3237 | presence.ControllingClient.SendScriptQuestion( | 3236 | presence.ControllingClient.SendScriptQuestion( |
3238 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm); | 3237 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm); |
3239 | 3238 | ||
3240 | return; | 3239 | return; |
3241 | } | 3240 | } |
3242 | 3241 | ||
@@ -3262,7 +3261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3262 | 3261 | ||
3263 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) | 3262 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) |
3264 | llReleaseControls(); | 3263 | llReleaseControls(); |
3265 | 3264 | ||
3266 | lock (m_host.TaskInventory) | 3265 | lock (m_host.TaskInventory) |
3267 | { | 3266 | { |
3268 | m_host.TaskInventory[invItemID].PermsMask = answer; | 3267 | m_host.TaskInventory[invItemID].PermsMask = answer; |
@@ -3303,7 +3302,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3303 | if (item.Type == 10 && item.ItemID == m_itemID) | 3302 | if (item.Type == 10 && item.ItemID == m_itemID) |
3304 | { | 3303 | { |
3305 | int perms = item.PermsMask; | 3304 | int perms = item.PermsMask; |
3306 | if (m_automaticLinkPermission) | 3305 | if (m_automaticLinkPermission) |
3307 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | 3306 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
3308 | return perms; | 3307 | return perms; |
3309 | } | 3308 | } |
@@ -3339,15 +3338,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3339 | { | 3338 | { |
3340 | m_host.AddScriptLPS(1); | 3339 | m_host.AddScriptLPS(1); |
3341 | UUID invItemID = InventorySelf(); | 3340 | UUID invItemID = InventorySelf(); |
3342 | 3341 | ||
3343 | TaskInventoryItem item; | 3342 | TaskInventoryItem item; |
3344 | lock (m_host.TaskInventory) | 3343 | lock (m_host.TaskInventory) |
3345 | { | 3344 | { |
3346 | item = m_host.TaskInventory[invItemID]; | 3345 | item = m_host.TaskInventory[invItemID]; |
3347 | } | 3346 | } |
3348 | 3347 | ||
3349 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3348 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
3350 | && !m_automaticLinkPermission) | 3349 | && !m_automaticLinkPermission) |
3351 | { | 3350 | { |
3352 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); | 3351 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); |
3353 | return; | 3352 | return; |
@@ -3357,13 +3356,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3357 | ScenePresence sp = World.GetScenePresence(item.PermsGranter); | 3356 | ScenePresence sp = World.GetScenePresence(item.PermsGranter); |
3358 | if (sp != null) | 3357 | if (sp != null) |
3359 | client = sp.ControllingClient; | 3358 | client = sp.ControllingClient; |
3360 | 3359 | ||
3361 | SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)target); | 3360 | SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)target); |
3362 | 3361 | ||
3363 | if (targetPart.ParentGroup.RootPart.AttachmentPoint != 0) | 3362 | if (targetPart.ParentGroup.RootPart.AttachmentPoint != 0) |
3364 | return; // Fail silently if attached | 3363 | return; // Fail silently if attached |
3365 | SceneObjectGroup parentPrim = null, childPrim = null; | 3364 | SceneObjectGroup parentPrim = null, childPrim = null; |
3366 | 3365 | ||
3367 | if (targetPart != null) | 3366 | if (targetPart != null) |
3368 | { | 3367 | { |
3369 | if (parent != 0) { | 3368 | if (parent != 0) { |
@@ -3381,12 +3380,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3381 | // if (uf != (Byte)0) | 3380 | // if (uf != (Byte)0) |
3382 | // parent.RootPart.UpdateFlag = uf; | 3381 | // parent.RootPart.UpdateFlag = uf; |
3383 | } | 3382 | } |
3384 | 3383 | ||
3385 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | 3384 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); |
3386 | parentPrim.RootPart.AddFlag(PrimFlags.CreateSelected); | 3385 | parentPrim.RootPart.AddFlag(PrimFlags.CreateSelected); |
3387 | parentPrim.HasGroupChanged = true; | 3386 | parentPrim.HasGroupChanged = true; |
3388 | parentPrim.ScheduleGroupForFullUpdate(); | 3387 | parentPrim.ScheduleGroupForFullUpdate(); |
3389 | 3388 | ||
3390 | if (client != null) | 3389 | if (client != null) |
3391 | parentPrim.GetProperties(client); | 3390 | parentPrim.GetProperties(client); |
3392 | 3391 | ||
@@ -3397,7 +3396,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3397 | { | 3396 | { |
3398 | m_host.AddScriptLPS(1); | 3397 | m_host.AddScriptLPS(1); |
3399 | UUID invItemID = InventorySelf(); | 3398 | UUID invItemID = InventorySelf(); |
3400 | 3399 | ||
3401 | lock (m_host.TaskInventory) | 3400 | lock (m_host.TaskInventory) |
3402 | { | 3401 | { |
3403 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3402 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
@@ -3407,16 +3406,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3407 | return; | 3406 | return; |
3408 | } | 3407 | } |
3409 | } | 3408 | } |
3410 | 3409 | ||
3411 | if (linknum < ScriptBaseClass.LINK_THIS) | 3410 | if (linknum < ScriptBaseClass.LINK_THIS) |
3412 | return; | 3411 | return; |
3413 | 3412 | ||
3414 | SceneObjectGroup parentPrim = m_host.ParentGroup; | 3413 | SceneObjectGroup parentPrim = m_host.ParentGroup; |
3415 | 3414 | ||
3416 | if (parentPrim.RootPart.AttachmentPoint != 0) | 3415 | if (parentPrim.RootPart.AttachmentPoint != 0) |
3417 | return; // Fail silently if attached | 3416 | return; // Fail silently if attached |
3418 | SceneObjectPart childPrim = null; | 3417 | SceneObjectPart childPrim = null; |
3419 | 3418 | ||
3420 | switch (linknum) | 3419 | switch (linknum) |
3421 | { | 3420 | { |
3422 | case ScriptBaseClass.LINK_ROOT: | 3421 | case ScriptBaseClass.LINK_ROOT: |
@@ -3440,7 +3439,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3440 | childPrim = null; | 3439 | childPrim = null; |
3441 | break; | 3440 | break; |
3442 | } | 3441 | } |
3443 | 3442 | ||
3444 | if (linknum == ScriptBaseClass.LINK_ROOT) | 3443 | if (linknum == ScriptBaseClass.LINK_ROOT) |
3445 | { | 3444 | { |
3446 | // Restructuring Multiple Prims. | 3445 | // Restructuring Multiple Prims. |
@@ -3451,8 +3450,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3451 | parentPrim.DelinkFromGroup(part.LocalId, true); | 3450 | parentPrim.DelinkFromGroup(part.LocalId, true); |
3452 | } | 3451 | } |
3453 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | 3452 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); |
3454 | 3453 | ||
3455 | if (parts.Count > 0) | 3454 | if (parts.Count > 0) |
3456 | { | 3455 | { |
3457 | SceneObjectPart newRoot = parts[0]; | 3456 | SceneObjectPart newRoot = parts[0]; |
3458 | parts.Remove(newRoot); | 3457 | parts.Remove(newRoot); |
@@ -3467,7 +3466,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3467 | { | 3466 | { |
3468 | if (childPrim == null) | 3467 | if (childPrim == null) |
3469 | return; | 3468 | return; |
3470 | 3469 | ||
3471 | parentPrim.DelinkFromGroup(childPrim.LocalId, true); | 3470 | parentPrim.DelinkFromGroup(childPrim.LocalId, true); |
3472 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | 3471 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); |
3473 | } | 3472 | } |
@@ -3479,10 +3478,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3479 | SceneObjectGroup parentPrim = m_host.ParentGroup; | 3478 | SceneObjectGroup parentPrim = m_host.ParentGroup; |
3480 | if (parentPrim.RootPart.AttachmentPoint != 0) | 3479 | if (parentPrim.RootPart.AttachmentPoint != 0) |
3481 | return; // Fail silently if attached | 3480 | return; // Fail silently if attached |
3482 | 3481 | ||
3483 | List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); | 3482 | List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); |
3484 | parts.Remove(parentPrim.RootPart); | 3483 | parts.Remove(parentPrim.RootPart); |
3485 | 3484 | ||
3486 | foreach (SceneObjectPart part in parts) | 3485 | foreach (SceneObjectPart part in parts) |
3487 | { | 3486 | { |
3488 | parentPrim.DelinkFromGroup(part.LocalId, true); | 3487 | parentPrim.DelinkFromGroup(part.LocalId, true); |
@@ -3509,29 +3508,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3509 | /// time a blank name is returned is if the target prim has a blank | 3508 | /// time a blank name is returned is if the target prim has a blank |
3510 | /// name. If no prim with the given link number can be found then | 3509 | /// name. If no prim with the given link number can be found then |
3511 | /// usually NULL_KEY is returned but there are exceptions. | 3510 | /// usually NULL_KEY is returned but there are exceptions. |
3512 | /// | 3511 | /// |
3513 | /// In a single unlinked prim, A call with 0 returns the name, all | 3512 | /// In a single unlinked prim, A call with 0 returns the name, all |
3514 | /// other values for link number return NULL_KEY | 3513 | /// other values for link number return NULL_KEY |
3515 | /// | 3514 | /// |
3516 | /// In link sets it is more complicated. | 3515 | /// In link sets it is more complicated. |
3517 | /// | 3516 | /// |
3518 | /// If the script is in the root prim:- | 3517 | /// If the script is in the root prim:- |
3519 | /// A zero link number returns NULL_KEY. | 3518 | /// A zero link number returns NULL_KEY. |
3520 | /// Positive link numbers return the name of the prim, or NULL_KEY | 3519 | /// Positive link numbers return the name of the prim, or NULL_KEY |
3521 | /// if a prim does not exist at that position. | 3520 | /// if a prim does not exist at that position. |
3522 | /// Negative link numbers return the name of the first child prim. | 3521 | /// Negative link numbers return the name of the first child prim. |
3523 | /// | 3522 | /// |
3524 | /// If the script is in a child prim:- | 3523 | /// If the script is in a child prim:- |
3525 | /// Link numbers 0 or 1 return the name of the root prim. | 3524 | /// Link numbers 0 or 1 return the name of the root prim. |
3526 | /// Positive link numbers return the name of the prim or NULL_KEY | 3525 | /// Positive link numbers return the name of the prim or NULL_KEY |
3527 | /// if a prim does not exist at that position. | 3526 | /// if a prim does not exist at that position. |
3528 | /// Negative numbers return the name of the root prim. | 3527 | /// Negative numbers return the name of the root prim. |
3529 | /// | 3528 | /// |
3530 | /// References | 3529 | /// References |
3531 | /// http://lslwiki.net/lslwiki/wakka.php?wakka=llGetLinkName | 3530 | /// http://lslwiki.net/lslwiki/wakka.php?wakka=llGetLinkName |
3532 | /// Mentions NULL_KEY being returned | 3531 | /// Mentions NULL_KEY being returned |
3533 | /// http://wiki.secondlife.com/wiki/LlGetLinkName | 3532 | /// http://wiki.secondlife.com/wiki/LlGetLinkName |
3534 | /// Mentions using the LINK_* constants, some of which are negative | 3533 | /// Mentions using the LINK_* constants, some of which are negative |
3535 | /// </summary> | 3534 | /// </summary> |
3536 | public LSL_String llGetLinkName(int linknum) | 3535 | public LSL_String llGetLinkName(int linknum) |
3537 | { | 3536 | { |
@@ -3540,7 +3539,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3540 | // simplest case, this prims link number | 3539 | // simplest case, this prims link number |
3541 | if (m_host.LinkNum == linknum) | 3540 | if (m_host.LinkNum == linknum) |
3542 | return m_host.Name; | 3541 | return m_host.Name; |
3543 | 3542 | ||
3544 | // Single prim | 3543 | // Single prim |
3545 | if (m_host.LinkNum == 0) | 3544 | if (m_host.LinkNum == 0) |
3546 | { | 3545 | { |
@@ -3575,7 +3574,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3575 | { | 3574 | { |
3576 | m_host.AddScriptLPS(1); | 3575 | m_host.AddScriptLPS(1); |
3577 | int count = 0; | 3576 | int count = 0; |
3578 | 3577 | ||
3579 | lock (m_host.TaskInventory) | 3578 | lock (m_host.TaskInventory) |
3580 | { | 3579 | { |
3581 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 3580 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) |
@@ -3586,7 +3585,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3586 | } | 3585 | } |
3587 | } | 3586 | } |
3588 | } | 3587 | } |
3589 | 3588 | ||
3590 | return count; | 3589 | return count; |
3591 | } | 3590 | } |
3592 | 3591 | ||
@@ -3605,7 +3604,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3605 | } | 3604 | } |
3606 | } | 3605 | } |
3607 | } | 3606 | } |
3608 | 3607 | ||
3609 | if (keys.Count == 0) | 3608 | if (keys.Count == 0) |
3610 | { | 3609 | { |
3611 | return String.Empty; | 3610 | return String.Empty; |
@@ -3702,7 +3701,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3702 | public void llRemoveInventory(string name) | 3701 | public void llRemoveInventory(string name) |
3703 | { | 3702 | { |
3704 | m_host.AddScriptLPS(1); | 3703 | m_host.AddScriptLPS(1); |
3705 | 3704 | ||
3706 | lock (m_host.TaskInventory) | 3705 | lock (m_host.TaskInventory) |
3707 | { | 3706 | { |
3708 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 3707 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) |
@@ -3738,9 +3737,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3738 | public void llPassTouches(int pass) | 3737 | public void llPassTouches(int pass) |
3739 | { | 3738 | { |
3740 | m_host.AddScriptLPS(1); | 3739 | m_host.AddScriptLPS(1); |
3741 | if (pass != 0) | 3740 | if (pass != 0) |
3742 | m_host.PassTouches = true; | 3741 | m_host.PassTouches = true; |
3743 | else | 3742 | else |
3744 | m_host.PassTouches = false; | 3743 | m_host.PassTouches = false; |
3745 | } | 3744 | } |
3746 | 3745 | ||
@@ -3806,7 +3805,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3806 | m_host.AddScriptLPS(1); | 3805 | m_host.AddScriptLPS(1); |
3807 | 3806 | ||
3808 | TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); | 3807 | TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); |
3809 | 3808 | ||
3810 | foreach (TaskInventoryItem item in itemDictionary.Values) | 3809 | foreach (TaskInventoryItem item in itemDictionary.Values) |
3811 | { | 3810 | { |
3812 | if (item.Type == 3 && item.Name == name) | 3811 | if (item.Type == 3 && item.Name == name) |
@@ -3858,9 +3857,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3858 | ScenePresence presence = World.GetScenePresence(agentId); | 3857 | ScenePresence presence = World.GetScenePresence(agentId); |
3859 | if (presence != null) | 3858 | if (presence != null) |
3860 | { | 3859 | { |
3861 | // agent must be over the owners land | 3860 | // agent must be over the owners land |
3862 | if (m_host.OwnerID | 3861 | if (m_host.OwnerID == World.LandChannel.GetLandObject( |
3863 | == World.LandChannel.GetLandObject( | ||
3864 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) | 3862 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) |
3865 | { | 3863 | { |
3866 | presence.ControllingClient.SendTeleportLocationStart(); | 3864 | presence.ControllingClient.SendTeleportLocationStart(); |
@@ -3952,7 +3950,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3952 | foreach (SceneObjectPart part in parts) | 3950 | foreach (SceneObjectPart part in parts) |
3953 | { | 3951 | { |
3954 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); | 3952 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); |
3955 | 3953 | ||
3956 | foreach (TaskInventoryItem item in itemsDictionary.Values) | 3954 | foreach (TaskInventoryItem item in itemsDictionary.Values) |
3957 | { | 3955 | { |
3958 | if (item.Type == ScriptBaseClass.INVENTORY_SCRIPT) | 3956 | if (item.Type == ScriptBaseClass.INVENTORY_SCRIPT) |
@@ -3983,14 +3981,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3983 | 3981 | ||
3984 | bool pusheeIsAvatar = false; | 3982 | bool pusheeIsAvatar = false; |
3985 | UUID targetID = UUID.Zero; | 3983 | UUID targetID = UUID.Zero; |
3986 | 3984 | ||
3987 | if (!UUID.TryParse(target,out targetID)) | 3985 | if (!UUID.TryParse(target,out targetID)) |
3988 | return; | 3986 | return; |
3989 | 3987 | ||
3990 | ScenePresence pusheeav = null; | 3988 | ScenePresence pusheeav = null; |
3991 | Vector3 PusheePos = Vector3.Zero; | 3989 | Vector3 PusheePos = Vector3.Zero; |
3992 | SceneObjectPart pusheeob = null; | 3990 | SceneObjectPart pusheeob = null; |
3993 | |||
3994 | 3991 | ||
3995 | ScenePresence avatar = World.GetScenePresence(targetID); | 3992 | ScenePresence avatar = World.GetScenePresence(targetID); |
3996 | if (avatar != null) | 3993 | if (avatar != null) |
@@ -4417,13 +4414,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4417 | double angle = Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2; | 4414 | double angle = Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2; |
4418 | if (angle < 0) angle = -angle; | 4415 | if (angle < 0) angle = -angle; |
4419 | if (angle > Math.PI) return (Math.PI * 2 - angle); | 4416 | if (angle > Math.PI) return (Math.PI * 2 - angle); |
4420 | return angle; | 4417 | return angle; |
4421 | } | 4418 | } |
4422 | 4419 | ||
4423 | public LSL_String llGetInventoryKey(string name) | 4420 | public LSL_String llGetInventoryKey(string name) |
4424 | { | 4421 | { |
4425 | m_host.AddScriptLPS(1); | 4422 | m_host.AddScriptLPS(1); |
4426 | 4423 | ||
4427 | lock (m_host.TaskInventory) | 4424 | lock (m_host.TaskInventory) |
4428 | { | 4425 | { |
4429 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 4426 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) |
@@ -4439,9 +4436,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4439 | return UUID.Zero.ToString(); | 4436 | return UUID.Zero.ToString(); |
4440 | } | 4437 | } |
4441 | } | 4438 | } |
4439 | } | ||
4442 | } | 4440 | } |
4443 | } | 4441 | |
4444 | |||
4445 | return UUID.Zero.ToString(); | 4442 | return UUID.Zero.ToString(); |
4446 | } | 4443 | } |
4447 | 4444 | ||
@@ -5144,7 +5141,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5144 | // edge will be used to pass the Region Coordinates offset | 5141 | // edge will be used to pass the Region Coordinates offset |
5145 | // we want to check for a neighboring sim | 5142 | // we want to check for a neighboring sim |
5146 | LSL_Vector edge = new LSL_Vector(0, 0, 0); | 5143 | LSL_Vector edge = new LSL_Vector(0, 0, 0); |
5147 | 5144 | ||
5148 | if (dir.x == 0) | 5145 | if (dir.x == 0) |
5149 | { | 5146 | { |
5150 | if (dir.y == 0) | 5147 | if (dir.y == 0) |
@@ -5164,7 +5161,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5164 | LSL_Float mag; | 5161 | LSL_Float mag; |
5165 | if (dir.x > 0) | 5162 | if (dir.x > 0) |
5166 | { | 5163 | { |
5167 | mag = (Constants.RegionSize - pos.x) / dir.x; | 5164 | mag = (Constants.RegionSize - pos.x) / dir.x; |
5168 | } | 5165 | } |
5169 | else | 5166 | else |
5170 | { | 5167 | { |
@@ -5187,18 +5184,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5187 | edge.x = dir.x / Math.Abs(dir.x); | 5184 | edge.x = dir.x / Math.Abs(dir.x); |
5188 | } | 5185 | } |
5189 | } | 5186 | } |
5190 | 5187 | ||
5191 | List<SimpleRegionInfo> neighbors = World.CommsManager.GridService.RequestNeighbours(World.RegionInfo.RegionLocX, World.RegionInfo.RegionLocY); | 5188 | List<SimpleRegionInfo> neighbors = World.CommsManager.GridService.RequestNeighbours(World.RegionInfo.RegionLocX, World.RegionInfo.RegionLocY); |
5192 | 5189 | ||
5193 | uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x; | 5190 | uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x; |
5194 | uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y; | 5191 | uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y; |
5195 | 5192 | ||
5196 | foreach (SimpleRegionInfo sri in neighbors) | 5193 | foreach (SimpleRegionInfo sri in neighbors) |
5197 | { | 5194 | { |
5198 | if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY) | 5195 | if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY) |
5199 | return 0; | 5196 | return 0; |
5200 | } | 5197 | } |
5201 | 5198 | ||
5202 | return 1; | 5199 | return 1; |
5203 | } | 5200 | } |
5204 | 5201 | ||
@@ -5270,7 +5267,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5270 | flags |= ScriptBaseClass.AGENT_CROUCHING; | 5267 | flags |= ScriptBaseClass.AGENT_CROUCHING; |
5271 | } | 5268 | } |
5272 | 5269 | ||
5273 | if (agentMovementAnimation == "WALK" || agentMovementAnimation == "CROUCHWALK") | 5270 | if (agentMovementAnimation == "WALK" || agentMovementAnimation == "CROUCHWALK") |
5274 | { | 5271 | { |
5275 | flags |= ScriptBaseClass.AGENT_WALKING; | 5272 | flags |= ScriptBaseClass.AGENT_WALKING; |
5276 | } | 5273 | } |
@@ -5282,8 +5279,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5282 | // note: this may need some tweaking when walking downhill. you "fall down" for a brief instant | 5279 | // note: this may need some tweaking when walking downhill. you "fall down" for a brief instant |
5283 | // and don't collide when walking downhill, which instantly registers as in-air, briefly. should | 5280 | // and don't collide when walking downhill, which instantly registers as in-air, briefly. should |
5284 | // there be some minimum non-collision threshold time before claiming the avatar is in-air? | 5281 | // there be some minimum non-collision threshold time before claiming the avatar is in-air? |
5285 | if ((flags & ScriptBaseClass.AGENT_WALKING) == 0 && | 5282 | if ((flags & ScriptBaseClass.AGENT_WALKING) == 0 && |
5286 | agent.PhysicsActor != null && | 5283 | agent.PhysicsActor != null && |
5287 | !agent.PhysicsActor.IsColliding) | 5284 | !agent.PhysicsActor.IsColliding) |
5288 | { | 5285 | { |
5289 | flags |= ScriptBaseClass.AGENT_IN_AIR; | 5286 | flags |= ScriptBaseClass.AGENT_IN_AIR; |
@@ -5397,8 +5394,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5397 | if (presence != null) | 5394 | if (presence != null) |
5398 | { | 5395 | { |
5399 | // agent must be over the owners land | 5396 | // agent must be over the owners land |
5400 | if (m_host.OwnerID | 5397 | if (m_host.OwnerID == World.LandChannel.GetLandObject( |
5401 | == World.LandChannel.GetLandObject( | ||
5402 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) | 5398 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) |
5403 | World.TeleportClientHome(agentId, presence.ControllingClient); | 5399 | World.TeleportClientHome(agentId, presence.ControllingClient); |
5404 | } | 5400 | } |
@@ -5484,12 +5480,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5484 | UUID key = new UUID(); | 5480 | UUID key = new UUID(); |
5485 | if (UUID.TryParse(id, out key)) | 5481 | if (UUID.TryParse(id, out key)) |
5486 | { | 5482 | { |
5487 | ScenePresence presence = World.GetScenePresence(key); | 5483 | ScenePresence presence = World.GetScenePresence(key); |
5488 | if (presence != null) // object is an avatar | 5484 | if (presence != null) // object is an avatar |
5489 | { | 5485 | { |
5490 | if (m_host.OwnerID | 5486 | if (m_host.OwnerID |
5491 | == World.LandChannel.GetLandObject( | 5487 | == World.LandChannel.GetLandObject( |
5492 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) | 5488 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) |
5493 | return 1; | 5489 | return 1; |
5494 | } | 5490 | } |
5495 | else // object is not an avatar | 5491 | else // object is not an avatar |
@@ -5498,23 +5494,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5498 | if (obj != null) | 5494 | if (obj != null) |
5499 | if (m_host.OwnerID | 5495 | if (m_host.OwnerID |
5500 | == World.LandChannel.GetLandObject( | 5496 | == World.LandChannel.GetLandObject( |
5501 | obj.AbsolutePosition.X, obj.AbsolutePosition.Y).landData.OwnerID) | 5497 | obj.AbsolutePosition.X, obj.AbsolutePosition.Y).landData.OwnerID) |
5502 | return 1; | 5498 | return 1; |
5503 | } | 5499 | } |
5504 | } | 5500 | } |
5505 | 5501 | ||
5506 | return 0; | 5502 | return 0; |
5507 | } | 5503 | } |
5508 | 5504 | ||
5509 | public LSL_String llGetLandOwnerAt(LSL_Vector pos) | 5505 | public LSL_String llGetLandOwnerAt(LSL_Vector pos) |
5510 | { | 5506 | { |
5511 | m_host.AddScriptLPS(1); | 5507 | m_host.AddScriptLPS(1); |
5512 | return World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).landData.OwnerID.ToString(); | 5508 | return World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).landData.OwnerID.ToString(); |
5513 | } | 5509 | } |
5514 | 5510 | ||
5515 | /// <summary> | 5511 | /// <summary> |
5516 | /// According to http://lslwiki.net/lslwiki/wakka.php?wakka=llGetAgentSize | 5512 | /// According to http://lslwiki.net/lslwiki/wakka.php?wakka=llGetAgentSize |
5517 | /// only the height of avatars vary and that says:- | 5513 | /// only the height of avatars vary and that says: |
5518 | /// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively). | 5514 | /// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively). |
5519 | /// </summary> | 5515 | /// </summary> |
5520 | public LSL_Vector llGetAgentSize(string id) | 5516 | public LSL_Vector llGetAgentSize(string id) |
@@ -5936,7 +5932,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5936 | return inv.Key; | 5932 | return inv.Key; |
5937 | } | 5933 | } |
5938 | } | 5934 | } |
5939 | 5935 | ||
5940 | return UUID.Zero; | 5936 | return UUID.Zero; |
5941 | } | 5937 | } |
5942 | 5938 | ||
@@ -6028,7 +6024,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6028 | { | 6024 | { |
6029 | if (!m_host.ParentGroup.IsDeleted) | 6025 | if (!m_host.ParentGroup.IsDeleted) |
6030 | { | 6026 | { |
6031 | m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, | 6027 | m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, |
6032 | new PhysicsVector((float)vec.x, (float)vec.y, (float)vec.z)); | 6028 | new PhysicsVector((float)vec.x, (float)vec.y, (float)vec.z)); |
6033 | } | 6029 | } |
6034 | } | 6030 | } |
@@ -6156,10 +6152,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6156 | public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel) | 6152 | public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel) |
6157 | { | 6153 | { |
6158 | IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); | 6154 | IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); |
6159 | 6155 | ||
6160 | if (dm == null) | 6156 | if (dm == null) |
6161 | return; | 6157 | return; |
6162 | 6158 | ||
6163 | m_host.AddScriptLPS(1); | 6159 | m_host.AddScriptLPS(1); |
6164 | UUID av = new UUID(); | 6160 | UUID av = new UUID(); |
6165 | if (!UUID.TryParse(avatar,out av)) | 6161 | if (!UUID.TryParse(avatar,out av)) |
@@ -6187,11 +6183,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6187 | } | 6183 | } |
6188 | buts[i] = buttons.Data[i].ToString(); | 6184 | buts[i] = buttons.Data[i].ToString(); |
6189 | } | 6185 | } |
6190 | 6186 | ||
6191 | dm.SendDialogToUser( | 6187 | dm.SendDialogToUser( |
6192 | av, m_host.Name, m_host.UUID, m_host.OwnerID, | 6188 | av, m_host.Name, m_host.UUID, m_host.OwnerID, |
6193 | message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); | 6189 | message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); |
6194 | 6190 | ||
6195 | ConditionalScriptSleep(1000); | 6191 | ConditionalScriptSleep(1000); |
6196 | } | 6192 | } |
6197 | 6193 | ||
@@ -7079,14 +7075,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7079 | public void llSetParcelMusicURL(string url) | 7075 | public void llSetParcelMusicURL(string url) |
7080 | { | 7076 | { |
7081 | m_host.AddScriptLPS(1); | 7077 | m_host.AddScriptLPS(1); |
7082 | 7078 | ||
7083 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 7079 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
7084 | 7080 | ||
7085 | if (land.landData.OwnerID != m_host.ObjectOwner) | 7081 | if (land.landData.OwnerID != m_host.ObjectOwner) |
7086 | return; | 7082 | return; |
7087 | 7083 | ||
7088 | land.SetMusicUrl(url); | 7084 | land.SetMusicUrl(url); |
7089 | 7085 | ||
7090 | ConditionalScriptSleep(2000); | 7086 | ConditionalScriptSleep(2000); |
7091 | } | 7087 | } |
7092 | 7088 | ||
@@ -7234,7 +7230,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7234 | result.Add(upper); | 7230 | result.Add(upper); |
7235 | return result; | 7231 | return result; |
7236 | } | 7232 | } |
7237 | 7233 | ||
7238 | // Not found so return empty values | 7234 | // Not found so return empty values |
7239 | result.Add(new LSL_Vector()); | 7235 | result.Add(new LSL_Vector()); |
7240 | result.Add(new LSL_Vector()); | 7236 | result.Add(new LSL_Vector()); |
@@ -7358,10 +7354,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7358 | // vector tapera | 7354 | // vector tapera |
7359 | res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); | 7355 | res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); |
7360 | 7356 | ||
7361 | // float revolutions, | 7357 | // float revolutions |
7362 | res.Add(new LSL_Float(Shape.PathRevolutions / 50.0)); // needs fixing :( | 7358 | res.Add(new LSL_Float(Shape.PathRevolutions / 50.0)); // needs fixing :( |
7363 | 7359 | ||
7364 | // float radiusoffset, | 7360 | // float radiusoffset |
7365 | res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); | 7361 | res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); |
7366 | 7362 | ||
7367 | // float skew | 7363 | // float skew |
@@ -8036,7 +8032,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8036 | public LSL_Integer llGetInventoryPermMask(string item, int mask) | 8032 | public LSL_Integer llGetInventoryPermMask(string item, int mask) |
8037 | { | 8033 | { |
8038 | m_host.AddScriptLPS(1); | 8034 | m_host.AddScriptLPS(1); |
8039 | 8035 | ||
8040 | lock (m_host.TaskInventory) | 8036 | lock (m_host.TaskInventory) |
8041 | { | 8037 | { |
8042 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 8038 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) |
@@ -8059,7 +8055,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8059 | } | 8055 | } |
8060 | } | 8056 | } |
8061 | } | 8057 | } |
8062 | 8058 | ||
8063 | return -1; | 8059 | return -1; |
8064 | } | 8060 | } |
8065 | 8061 | ||
@@ -8072,7 +8068,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8072 | public LSL_String llGetInventoryCreator(string item) | 8068 | public LSL_String llGetInventoryCreator(string item) |
8073 | { | 8069 | { |
8074 | m_host.AddScriptLPS(1); | 8070 | m_host.AddScriptLPS(1); |
8075 | 8071 | ||
8076 | lock (m_host.TaskInventory) | 8072 | lock (m_host.TaskInventory) |
8077 | { | 8073 | { |
8078 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 8074 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) |
@@ -8083,9 +8079,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8083 | } | 8079 | } |
8084 | } | 8080 | } |
8085 | } | 8081 | } |
8086 | 8082 | ||
8087 | llSay(0, "No item name '" + item + "'"); | 8083 | llSay(0, "No item name '" + item + "'"); |
8088 | 8084 | ||
8089 | return String.Empty; | 8085 | return String.Empty; |
8090 | } | 8086 | } |
8091 | 8087 | ||
@@ -8093,7 +8089,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8093 | { | 8089 | { |
8094 | m_host.AddScriptLPS(1); | 8090 | m_host.AddScriptLPS(1); |
8095 | 8091 | ||
8096 | World.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0, | 8092 | World.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0, |
8097 | m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); | 8093 | m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); |
8098 | // IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 8094 | // IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
8099 | // wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg); | 8095 | // wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg); |
@@ -8309,7 +8305,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8309 | public void llLoadURL(string avatar_id, string message, string url) | 8305 | public void llLoadURL(string avatar_id, string message, string url) |
8310 | { | 8306 | { |
8311 | m_host.AddScriptLPS(1); | 8307 | m_host.AddScriptLPS(1); |
8312 | 8308 | ||
8313 | IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); | 8309 | IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); |
8314 | if (null != dm) | 8310 | if (null != dm) |
8315 | dm.SendUrlToUser( | 8311 | dm.SendUrlToUser( |
@@ -8322,7 +8318,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8322 | { | 8318 | { |
8323 | // TODO: Not implemented yet (missing in libomv?): | 8319 | // TODO: Not implemented yet (missing in libomv?): |
8324 | // PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) | 8320 | // PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) |
8325 | 8321 | ||
8326 | m_host.AddScriptLPS(1); | 8322 | m_host.AddScriptLPS(1); |
8327 | 8323 | ||
8328 | // according to the docs, this command only works if script owner and land owner are the same | 8324 | // according to the docs, this command only works if script owner and land owner are the same |
@@ -8330,23 +8326,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8330 | ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 8326 | ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
8331 | if (!World.Permissions.CanEditParcel(m_host.ObjectOwner, landObject)) return; | 8327 | if (!World.Permissions.CanEditParcel(m_host.ObjectOwner, landObject)) return; |
8332 | 8328 | ||
8333 | bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? | 8329 | bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? |
8334 | byte loop = 0; | 8330 | byte loop = 0; |
8335 | 8331 | ||
8336 | LandData landData = landObject.landData; | 8332 | LandData landData = landObject.landData; |
8337 | string url = landData.MediaURL; | 8333 | string url = landData.MediaURL; |
8338 | string texture = landData.MediaID.ToString(); | 8334 | string texture = landData.MediaID.ToString(); |
8339 | bool autoAlign = landData.MediaAutoScale != 0; | 8335 | bool autoAlign = landData.MediaAutoScale != 0; |
8340 | string mediaType = ""; // TODO these have to be added as soon as LandData supports it | 8336 | string mediaType = ""; // TODO these have to be added as soon as LandData supports it |
8341 | string description = ""; | 8337 | string description = ""; |
8342 | int width = 0; | 8338 | int width = 0; |
8343 | int height = 0; | 8339 | int height = 0; |
8344 | 8340 | ||
8345 | ParcelMediaCommandEnum? commandToSend = null; | 8341 | ParcelMediaCommandEnum? commandToSend = null; |
8346 | float time = 0.0f; // default is from start | 8342 | float time = 0.0f; // default is from start |
8347 | 8343 | ||
8348 | ScenePresence presence = null; | 8344 | ScenePresence presence = null; |
8349 | 8345 | ||
8350 | for (int i = 0; i < commandList.Data.Length; i++) | 8346 | for (int i = 0; i < commandList.Data.Length; i++) |
8351 | { | 8347 | { |
8352 | ParcelMediaCommandEnum command = (ParcelMediaCommandEnum)commandList.Data[i]; | 8348 | ParcelMediaCommandEnum command = (ParcelMediaCommandEnum)commandList.Data[i]; |
@@ -8386,7 +8382,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8386 | case ParcelMediaCommandEnum.Unload: | 8382 | case ParcelMediaCommandEnum.Unload: |
8387 | commandToSend = command; | 8383 | commandToSend = command; |
8388 | break; | 8384 | break; |
8389 | 8385 | ||
8390 | case ParcelMediaCommandEnum.Url: | 8386 | case ParcelMediaCommandEnum.Url: |
8391 | if ((i + 1) < commandList.Length) | 8387 | if ((i + 1) < commandList.Length) |
8392 | { | 8388 | { |
@@ -8491,7 +8487,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8491 | 8487 | ||
8492 | // if we didn't get a presence, we send to all and change the url | 8488 | // if we didn't get a presence, we send to all and change the url |
8493 | // if we did get a presence, we only send to the agent specified, and *don't change the land settings*! | 8489 | // if we did get a presence, we only send to the agent specified, and *don't change the land settings*! |
8494 | 8490 | ||
8495 | // did something important change or do we only start/stop/pause? | 8491 | // did something important change or do we only start/stop/pause? |
8496 | if (update) | 8492 | if (update) |
8497 | { | 8493 | { |
@@ -8500,7 +8496,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8500 | // we send to all | 8496 | // we send to all |
8501 | landData.MediaID = new UUID(texture); | 8497 | landData.MediaID = new UUID(texture); |
8502 | landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; | 8498 | landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; |
8503 | 8499 | ||
8504 | // do that one last, it will cause a ParcelPropertiesUpdate | 8500 | // do that one last, it will cause a ParcelPropertiesUpdate |
8505 | landObject.SetMediaUrl(url); | 8501 | landObject.SetMediaUrl(url); |
8506 | 8502 | ||
@@ -8514,7 +8510,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8514 | mediaType, | 8510 | mediaType, |
8515 | description, | 8511 | description, |
8516 | width, height, | 8512 | width, height, |
8517 | loop); | 8513 | loop); |
8518 | } | 8514 | } |
8519 | } | 8515 | } |
8520 | else if (!presence.IsChildAgent) | 8516 | else if (!presence.IsChildAgent) |
@@ -8526,7 +8522,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8526 | mediaType, | 8522 | mediaType, |
8527 | description, | 8523 | description, |
8528 | width, height, | 8524 | width, height, |
8529 | loop); | 8525 | loop); |
8530 | } | 8526 | } |
8531 | } | 8527 | } |
8532 | 8528 | ||
@@ -8605,7 +8601,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8605 | public LSL_Integer llGetInventoryType(string name) | 8601 | public LSL_Integer llGetInventoryType(string name) |
8606 | { | 8602 | { |
8607 | m_host.AddScriptLPS(1); | 8603 | m_host.AddScriptLPS(1); |
8608 | 8604 | ||
8609 | lock (m_host.TaskInventory) | 8605 | lock (m_host.TaskInventory) |
8610 | { | 8606 | { |
8611 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 8607 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) |
@@ -8616,7 +8612,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8616 | } | 8612 | } |
8617 | } | 8613 | } |
8618 | } | 8614 | } |
8619 | 8615 | ||
8620 | return -1; | 8616 | return -1; |
8621 | } | 8617 | } |
8622 | 8618 | ||
@@ -8642,7 +8638,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8642 | { | 8638 | { |
8643 | m_host.AddScriptLPS(1); | 8639 | m_host.AddScriptLPS(1); |
8644 | UUID invItemID = InventorySelf(); | 8640 | UUID invItemID = InventorySelf(); |
8645 | 8641 | ||
8646 | if (invItemID == UUID.Zero) | 8642 | if (invItemID == UUID.Zero) |
8647 | return new LSL_Vector(); | 8643 | return new LSL_Vector(); |
8648 | 8644 | ||
@@ -8650,14 +8646,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8650 | { | 8646 | { |
8651 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | 8647 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) |
8652 | return new LSL_Vector(); | 8648 | return new LSL_Vector(); |
8653 | 8649 | ||
8654 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 8650 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
8655 | { | 8651 | { |
8656 | ShoutError("No permissions to track the camera"); | 8652 | ShoutError("No permissions to track the camera"); |
8657 | return new LSL_Vector(); | 8653 | return new LSL_Vector(); |
8658 | } | 8654 | } |
8659 | } | 8655 | } |
8660 | 8656 | ||
8661 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 8657 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
8662 | if (presence != null) | 8658 | if (presence != null) |
8663 | { | 8659 | { |
@@ -8678,20 +8674,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8678 | { | 8674 | { |
8679 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | 8675 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) |
8680 | return new LSL_Rotation(); | 8676 | return new LSL_Rotation(); |
8681 | 8677 | ||
8682 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 8678 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
8683 | { | 8679 | { |
8684 | ShoutError("No permissions to track the camera"); | 8680 | ShoutError("No permissions to track the camera"); |
8685 | return new LSL_Rotation(); | 8681 | return new LSL_Rotation(); |
8686 | } | 8682 | } |
8687 | } | 8683 | } |
8688 | 8684 | ||
8689 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 8685 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
8690 | if (presence != null) | 8686 | if (presence != null) |
8691 | { | 8687 | { |
8692 | return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W); | 8688 | return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W); |
8693 | } | 8689 | } |
8694 | 8690 | ||
8695 | return new LSL_Rotation(); | 8691 | return new LSL_Rotation(); |
8696 | } | 8692 | } |
8697 | 8693 | ||
@@ -8838,7 +8834,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8838 | { | 8834 | { |
8839 | // we need the permission first, to know which avatar we want to set the camera for | 8835 | // we need the permission first, to know which avatar we want to set the camera for |
8840 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | 8836 | agentID = m_host.TaskInventory[invItemID].PermsGranter; |
8841 | 8837 | ||
8842 | if (agentID == UUID.Zero) return; | 8838 | if (agentID == UUID.Zero) return; |
8843 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | 8839 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; |
8844 | } | 8840 | } |
@@ -9012,9 +9008,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9012 | IConfigSource config = m_ScriptEngine.ConfigSource; | 9008 | IConfigSource config = m_ScriptEngine.ConfigSource; |
9013 | if (config.Configs["Network"] != null) | 9009 | if (config.Configs["Network"] != null) |
9014 | { | 9010 | { |
9015 | shard | 9011 | shard = config.Configs["Network"].GetString( |
9016 | = config.Configs["Network"].GetString( | 9012 | "user_server_url", "http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort.ToString()); |
9017 | "user_server_url", "http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort.ToString()); | ||
9018 | shard = config.Configs["Network"].GetString("shard", shard); | 9013 | shard = config.Configs["Network"].GetString("shard", shard); |
9019 | } | 9014 | } |
9020 | 9015 | ||
@@ -9039,7 +9034,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9039 | for (int i = 1; i < gnums.Length; i++) { | 9034 | for (int i = 1; i < gnums.Length; i++) { |
9040 | System.Text.RegularExpressions.Group g = m.Groups[gnums[i]]; | 9035 | System.Text.RegularExpressions.Group g = m.Groups[gnums[i]]; |
9041 | CaptureCollection cc = g.Captures; | 9036 | CaptureCollection cc = g.Captures; |
9042 | } | 9037 | } |
9043 | if (m.Groups.Count == 5) { | 9038 | if (m.Groups.Count == 5) { |
9044 | httpHeaders["Authorization"] = String.Format("Basic {0}", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(m.Groups[2].ToString() + ":" + m.Groups[3].ToString()))); | 9039 | httpHeaders["Authorization"] = String.Format("Basic {0}", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(m.Groups[2].ToString() + ":" + m.Groups[3].ToString()))); |
9045 | url = m.Groups[1].ToString() + m.Groups[4].ToString(); | 9040 | url = m.Groups[1].ToString() + m.Groups[4].ToString(); |
@@ -9064,7 +9059,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9064 | m_host.AddScriptLPS(1); | 9059 | m_host.AddScriptLPS(1); |
9065 | NotImplemented("llHTTPResponse"); | 9060 | NotImplemented("llHTTPResponse"); |
9066 | } | 9061 | } |
9067 | 9062 | ||
9068 | public void llResetLandBanList() | 9063 | public void llResetLandBanList() |
9069 | { | 9064 | { |
9070 | m_host.AddScriptLPS(1); | 9065 | m_host.AddScriptLPS(1); |
@@ -9360,7 +9355,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9360 | return item.ItemID; | 9355 | return item.ItemID; |
9361 | } | 9356 | } |
9362 | } | 9357 | } |
9363 | 9358 | ||
9364 | return UUID.Zero; | 9359 | return UUID.Zero; |
9365 | } | 9360 | } |
9366 | 9361 | ||
@@ -9388,21 +9383,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9388 | public delegate void AssetRequestCallback(UUID assetID, AssetBase asset); | 9383 | public delegate void AssetRequestCallback(UUID assetID, AssetBase asset); |
9389 | protected void WithNotecard(UUID assetID, AssetRequestCallback cb) | 9384 | protected void WithNotecard(UUID assetID, AssetRequestCallback cb) |
9390 | { | 9385 | { |
9391 | World.AssetService.Get(assetID.ToString(), this, | 9386 | World.AssetService.Get(assetID.ToString(), this, |
9392 | delegate(string i, object sender, AssetBase a) | 9387 | delegate(string i, object sender, AssetBase a) |
9393 | { | 9388 | { |
9394 | UUID uuid = UUID.Zero; | 9389 | UUID uuid = UUID.Zero; |
9395 | UUID.TryParse(i, out uuid); | 9390 | UUID.TryParse(i, out uuid); |
9396 | cb(uuid, a); | 9391 | cb(uuid, a); |
9397 | }); | 9392 | }); |
9398 | } | 9393 | } |
9399 | 9394 | ||
9400 | public LSL_String llGetNumberOfNotecardLines(string name) | 9395 | public LSL_String llGetNumberOfNotecardLines(string name) |
9401 | { | 9396 | { |
9402 | m_host.AddScriptLPS(1); | 9397 | m_host.AddScriptLPS(1); |
9403 | 9398 | ||
9404 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); | 9399 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); |
9405 | 9400 | ||
9406 | UUID assetID = UUID.Zero; | 9401 | UUID assetID = UUID.Zero; |
9407 | 9402 | ||
9408 | if (!UUID.TryParse(name, out assetID)) | 9403 | if (!UUID.TryParse(name, out assetID)) |
@@ -9436,7 +9431,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9436 | ConditionalScriptSleep(100); | 9431 | ConditionalScriptSleep(100); |
9437 | return tid.ToString(); | 9432 | return tid.ToString(); |
9438 | } | 9433 | } |
9439 | 9434 | ||
9440 | WithNotecard(assetID, delegate (UUID id, AssetBase a) | 9435 | WithNotecard(assetID, delegate (UUID id, AssetBase a) |
9441 | { | 9436 | { |
9442 | if (a == null || a.Type != 7) | 9437 | if (a == null || a.Type != 7) |
@@ -9460,11 +9455,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9460 | } | 9455 | } |
9461 | 9456 | ||
9462 | public LSL_String llGetNotecardLine(string name, int line) | 9457 | public LSL_String llGetNotecardLine(string name, int line) |
9463 | { | 9458 | { |
9464 | m_host.AddScriptLPS(1); | 9459 | m_host.AddScriptLPS(1); |
9465 | 9460 | ||
9466 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); | 9461 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); |
9467 | 9462 | ||
9468 | UUID assetID = UUID.Zero; | 9463 | UUID assetID = UUID.Zero; |
9469 | 9464 | ||
9470 | if (!UUID.TryParse(name, out assetID)) | 9465 | if (!UUID.TryParse(name, out assetID)) |
@@ -9489,7 +9484,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9489 | 9484 | ||
9490 | // was: UUID tid = tid = AsyncCommands. | 9485 | // was: UUID tid = tid = AsyncCommands. |
9491 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString()); | 9486 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString()); |
9492 | 9487 | ||
9493 | if (NotecardCache.IsCached(assetID)) | 9488 | if (NotecardCache.IsCached(assetID)) |
9494 | { | 9489 | { |
9495 | AsyncCommands. | 9490 | AsyncCommands. |
@@ -9498,7 +9493,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9498 | ConditionalScriptSleep(100); | 9493 | ConditionalScriptSleep(100); |
9499 | return tid.ToString(); | 9494 | return tid.ToString(); |
9500 | } | 9495 | } |
9501 | 9496 | ||
9502 | WithNotecard(assetID, delegate (UUID id, AssetBase a) | 9497 | WithNotecard(assetID, delegate (UUID id, AssetBase a) |
9503 | { | 9498 | { |
9504 | if (a == null || a.Type != 7) | 9499 | if (a == null || a.Type != 7) |
@@ -9512,15 +9507,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9512 | string data = enc.GetString(a.Data); | 9507 | string data = enc.GetString(a.Data); |
9513 | //m_log.Debug(data); | 9508 | //m_log.Debug(data); |
9514 | NotecardCache.Cache(id, data); | 9509 | NotecardCache.Cache(id, data); |
9515 | AsyncCommands. | 9510 | AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(), |
9516 | DataserverPlugin.DataserverReply(id.ToString(), | 9511 | NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); |
9517 | NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); | ||
9518 | }); | 9512 | }); |
9519 | 9513 | ||
9520 | ConditionalScriptSleep(100); | 9514 | ConditionalScriptSleep(100); |
9521 | return tid.ToString(); | 9515 | return tid.ToString(); |
9522 | } | 9516 | } |
9523 | |||
9524 | } | 9517 | } |
9525 | 9518 | ||
9526 | public class NotecardCache | 9519 | public class NotecardCache |
@@ -9532,7 +9525,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9532 | } | 9525 | } |
9533 | 9526 | ||
9534 | protected static Dictionary<UUID, Notecard> m_Notecards = | 9527 | protected static Dictionary<UUID, Notecard> m_Notecards = |
9535 | new Dictionary<UUID, Notecard>(); | 9528 | new Dictionary<UUID, Notecard>(); |
9536 | 9529 | ||
9537 | public static void Cache(UUID assetID, string text) | 9530 | public static void Cache(UUID assetID, string text) |
9538 | { | 9531 | { |