diff options
Diffstat (limited to 'OpenSim')
3 files changed, 52 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3db5dd2..b5abdb5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1803,6 +1803,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1803 | return 0; | 1803 | return 0; |
1804 | } | 1804 | } |
1805 | 1805 | ||
1806 | public LSL_Integer llScaleByFactor(double scaling_factor) | ||
1807 | { | ||
1808 | m_host.AddScriptLPS(1); | ||
1809 | SceneObjectGroup group = m_host.ParentGroup; | ||
1810 | |||
1811 | if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical) | ||
1812 | return ScriptBaseClass.FALSE; | ||
1813 | |||
1814 | if (group.RootPart.KeyframeMotion != null) | ||
1815 | return ScriptBaseClass.FALSE; | ||
1816 | |||
1817 | List<SceneObjectPart> prims = GetLinkParts(ScriptBaseClass.LINK_SET); | ||
1818 | if (prims.Count > 0) | ||
1819 | { | ||
1820 | foreach (SceneObjectPart prim in prims) | ||
1821 | { | ||
1822 | LSL_Vector size = new LSL_Vector(prim.Scale.X, prim.Scale.Y, prim.Scale.Z); | ||
1823 | LSL_Vector new_size = new LSL_Vector(scaling_factor * size); | ||
1824 | |||
1825 | new_size.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.x)); | ||
1826 | new_size.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.y)); | ||
1827 | new_size.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.z)); | ||
1828 | |||
1829 | if (new_size.x != scaling_factor * size.x || new_size.y != scaling_factor * size.y || new_size.z != scaling_factor * size.z) | ||
1830 | return ScriptBaseClass.FALSE; | ||
1831 | |||
1832 | LSL_Vector position = new LSL_Vector(GetPartLocalPos(prim)); | ||
1833 | |||
1834 | if (!prim.IsRoot) | ||
1835 | { | ||
1836 | position = GetSetPosTarget(prim, scaling_factor * position, position, true); | ||
1837 | prim.OffsetPosition = position; | ||
1838 | prim.ScheduleTerseUpdate(); | ||
1839 | } | ||
1840 | |||
1841 | SetScale(prim, new_size); | ||
1842 | } | ||
1843 | |||
1844 | return ScriptBaseClass.TRUE; | ||
1845 | } | ||
1846 | else | ||
1847 | { | ||
1848 | return ScriptBaseClass.FALSE; | ||
1849 | } | ||
1850 | } | ||
1851 | |||
1806 | public void llSetScale(LSL_Vector scale) | 1852 | public void llSetScale(LSL_Vector scale) |
1807 | { | 1853 | { |
1808 | m_host.AddScriptLPS(1); | 1854 | m_host.AddScriptLPS(1); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 3d1482d..ea0b6f9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -326,6 +326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
326 | LSL_Integer llRound(double f); | 326 | LSL_Integer llRound(double f); |
327 | LSL_Integer llSameGroup(string agent); | 327 | LSL_Integer llSameGroup(string agent); |
328 | void llSay(int channelID, string text); | 328 | void llSay(int channelID, string text); |
329 | LSL_Integer llScaleByFactor(double scaling_factor); | ||
329 | void llScaleTexture(double u, double v, int face); | 330 | void llScaleTexture(double u, double v, int face); |
330 | LSL_Integer llScriptDanger(LSL_Vector pos); | 331 | LSL_Integer llScriptDanger(LSL_Vector pos); |
331 | void llScriptProfiler(LSL_Integer flag); | 332 | void llScriptProfiler(LSL_Integer flag); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 2769712..6aaf930 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -1465,6 +1465,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1465 | m_LSL_Functions.llSay(channelID, text); | 1465 | m_LSL_Functions.llSay(channelID, text); |
1466 | } | 1466 | } |
1467 | 1467 | ||
1468 | public LSL_Integer llScaleByFactor(double scaling_factor) | ||
1469 | { | ||
1470 | return m_LSL_Functions.llScaleByFactor(scaling_factor); | ||
1471 | } | ||
1472 | |||
1468 | public void llScaleTexture(double u, double v, int face) | 1473 | public void llScaleTexture(double u, double v, int face) |
1469 | { | 1474 | { |
1470 | m_LSL_Functions.llScaleTexture(u, v, face); | 1475 | m_LSL_Functions.llScaleTexture(u, v, face); |