diff options
author | Melanie Thielker | 2010-08-08 02:04:37 +0200 |
---|---|---|
committer | Melanie Thielker | 2010-08-08 02:04:37 +0200 |
commit | d2b3d45d7606ff863181c4c0a129f6289451abbc (patch) | |
tree | 6b04601ce7c6de1f98c4813dd7359b2458aab4c4 | |
parent | In my crusade against facelights, I am striking the killing blow. Add a (diff) | |
parent | Increase sit distance to 256 meters, but leave the initial autopilot process ... (diff) | |
download | opensim-SC_OLD-d2b3d45d7606ff863181c4c0a129f6289451abbc.zip opensim-SC_OLD-d2b3d45d7606ff863181c4c0a129f6289451abbc.tar.gz opensim-SC_OLD-d2b3d45d7606ff863181c4c0a129f6289451abbc.tar.bz2 opensim-SC_OLD-d2b3d45d7606ff863181c4c0a129f6289451abbc.tar.xz |
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 199 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | 1014 |
4 files changed, 636 insertions, 617 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a828127..0d15cb4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -317,8 +317,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
317 | private bool m_scriptListens_notAtTarget = false; | 317 | private bool m_scriptListens_notAtTarget = false; |
318 | 318 | ||
319 | private bool m_scriptListens_atRotTarget = false; | 319 | private bool m_scriptListens_atRotTarget = false; |
320 | private bool m_scriptListens_notAtRotTarget = false; | 320 | private bool m_scriptListens_notAtRotTarget = false; |
321 | 321 | public bool m_dupeInProgress = false; | |
322 | internal Dictionary<UUID, string> m_savedScriptState = null; | 322 | internal Dictionary<UUID, string> m_savedScriptState = null; |
323 | 323 | ||
324 | #region Properties | 324 | #region Properties |
@@ -475,16 +475,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
475 | { | 475 | { |
476 | part.IgnoreUndoUpdate = false; | 476 | part.IgnoreUndoUpdate = false; |
477 | part.StoreUndoState(UndoType.STATE_GROUP_POSITION); | 477 | part.StoreUndoState(UndoType.STATE_GROUP_POSITION); |
478 | part.GroupPosition = val; | 478 | part.GroupPosition = val; |
479 | part.TriggerScriptChangedEvent(Changed.POSITION); | 479 | if (!m_dupeInProgress) |
480 | } | 480 | { |
481 | 481 | part.TriggerScriptChangedEvent(Changed.POSITION); | |
482 | foreach (ScenePresence av in m_linkedAvatars) | 482 | } |
483 | { | 483 | } |
484 | Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition; | 484 | if (!m_dupeInProgress) |
485 | av.AbsolutePosition += offset; | 485 | { |
486 | av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition | 486 | foreach (ScenePresence av in m_linkedAvatars) |
487 | av.SendFullUpdateToAllClients(); | 487 | { |
488 | Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition; | ||
489 | av.AbsolutePosition += offset; | ||
490 | av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition | ||
491 | av.SendFullUpdateToAllClients(); | ||
492 | } | ||
488 | } | 493 | } |
489 | 494 | ||
490 | //if (m_rootPart.PhysActor != null) | 495 | //if (m_rootPart.PhysActor != null) |
@@ -1800,88 +1805,96 @@ namespace OpenSim.Region.Framework.Scenes | |||
1800 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> | 1805 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> |
1801 | /// <returns></returns> | 1806 | /// <returns></returns> |
1802 | public SceneObjectGroup Copy(bool userExposed) | 1807 | public SceneObjectGroup Copy(bool userExposed) |
1803 | { | 1808 | { |
1804 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); | 1809 | SceneObjectGroup dupe; |
1805 | dupe.m_isBackedUp = false; | 1810 | try |
1806 | dupe.m_parts = new Dictionary<UUID, SceneObjectPart>(); | 1811 | { |
1807 | 1812 | m_dupeInProgress = true; | |
1808 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of | 1813 | dupe = (SceneObjectGroup)MemberwiseClone(); |
1809 | // attachments do not bordercross while they're being duplicated. This is hacktastic! | 1814 | dupe.m_isBackedUp = false; |
1810 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! | 1815 | dupe.m_parts = new Dictionary<UUID, SceneObjectPart>(); |
1811 | // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state | 1816 | |
1812 | // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, | 1817 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of |
1813 | // then restore it's attachment state | 1818 | // attachments do not bordercross while they're being duplicated. This is hacktastic! |
1814 | 1819 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! | |
1815 | // This is only necessary when userExposed is false! | 1820 | // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state |
1816 | 1821 | // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, | |
1817 | bool previousAttachmentStatus = dupe.RootPart.IsAttachment; | 1822 | // then restore it's attachment state |
1818 | 1823 | ||
1819 | if (!userExposed) | 1824 | // This is only necessary when userExposed is false! |
1820 | dupe.RootPart.IsAttachment = true; | 1825 | |
1821 | 1826 | bool previousAttachmentStatus = dupe.RootPart.IsAttachment; | |
1822 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); | 1827 | |
1823 | 1828 | if (!userExposed) | |
1824 | if (!userExposed) | 1829 | dupe.RootPart.IsAttachment = true; |
1825 | { | 1830 | |
1826 | dupe.RootPart.IsAttachment = previousAttachmentStatus; | 1831 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
1827 | } | 1832 | |
1828 | 1833 | if (!userExposed) | |
1829 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); | 1834 | { |
1830 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; | 1835 | dupe.RootPart.IsAttachment = previousAttachmentStatus; |
1831 | 1836 | } | |
1832 | if (userExposed) | 1837 | |
1833 | dupe.m_rootPart.TrimPermissions(); | 1838 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); |
1834 | 1839 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; | |
1835 | /// may need to create a new Physics actor. | 1840 | |
1836 | if (dupe.RootPart.PhysActor != null && userExposed) | 1841 | if (userExposed) |
1837 | { | 1842 | dupe.m_rootPart.TrimPermissions(); |
1838 | PrimitiveBaseShape pbs = dupe.RootPart.Shape; | 1843 | |
1839 | 1844 | /// may need to create a new Physics actor. | |
1840 | dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( | 1845 | if (dupe.RootPart.PhysActor != null && userExposed) |
1841 | dupe.RootPart.Name, | 1846 | { |
1842 | pbs, | 1847 | PrimitiveBaseShape pbs = dupe.RootPart.Shape; |
1843 | dupe.RootPart.AbsolutePosition, | 1848 | |
1844 | dupe.RootPart.Scale, | 1849 | dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( |
1845 | dupe.RootPart.RotationOffset, | 1850 | dupe.RootPart.Name, |
1846 | dupe.RootPart.PhysActor.IsPhysical); | 1851 | pbs, |
1847 | 1852 | dupe.RootPart.AbsolutePosition, | |
1848 | dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; | 1853 | dupe.RootPart.Scale, |
1849 | dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); | 1854 | dupe.RootPart.RotationOffset, |
1855 | dupe.RootPart.PhysActor.IsPhysical); | ||
1856 | |||
1857 | dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; | ||
1858 | dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); | ||
1859 | } | ||
1860 | |||
1861 | List<SceneObjectPart> partList; | ||
1862 | |||
1863 | lockPartsForRead(true); | ||
1864 | |||
1865 | partList = new List<SceneObjectPart>(m_parts.Values); | ||
1866 | |||
1867 | lockPartsForRead(false); | ||
1868 | |||
1869 | partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) | ||
1870 | { | ||
1871 | return p1.LinkNum.CompareTo(p2.LinkNum); | ||
1872 | } | ||
1873 | ); | ||
1874 | |||
1875 | foreach (SceneObjectPart part in partList) | ||
1876 | { | ||
1877 | if (part.UUID != m_rootPart.UUID) | ||
1878 | { | ||
1879 | SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); | ||
1880 | |||
1881 | newPart.LinkNum = part.LinkNum; | ||
1882 | } | ||
1883 | } | ||
1884 | |||
1885 | if (userExposed) | ||
1886 | { | ||
1887 | dupe.UpdateParentIDs(); | ||
1888 | dupe.HasGroupChanged = true; | ||
1889 | dupe.AttachToBackup(); | ||
1890 | |||
1891 | ScheduleGroupForFullUpdate(); | ||
1892 | } | ||
1893 | } | ||
1894 | finally | ||
1895 | { | ||
1896 | m_dupeInProgress = false; | ||
1850 | } | 1897 | } |
1851 | |||
1852 | List<SceneObjectPart> partList; | ||
1853 | |||
1854 | lockPartsForRead(true); | ||
1855 | |||
1856 | partList = new List<SceneObjectPart>(m_parts.Values); | ||
1857 | |||
1858 | lockPartsForRead(false); | ||
1859 | |||
1860 | partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) | ||
1861 | { | ||
1862 | return p1.LinkNum.CompareTo(p2.LinkNum); | ||
1863 | } | ||
1864 | ); | ||
1865 | |||
1866 | foreach (SceneObjectPart part in partList) | ||
1867 | { | ||
1868 | if (part.UUID != m_rootPart.UUID) | ||
1869 | { | ||
1870 | SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); | ||
1871 | |||
1872 | newPart.LinkNum = part.LinkNum; | ||
1873 | } | ||
1874 | } | ||
1875 | |||
1876 | if (userExposed) | ||
1877 | { | ||
1878 | dupe.UpdateParentIDs(); | ||
1879 | dupe.HasGroupChanged = true; | ||
1880 | dupe.AttachToBackup(); | ||
1881 | |||
1882 | ScheduleGroupForFullUpdate(); | ||
1883 | } | ||
1884 | |||
1885 | return dupe; | 1898 | return dupe; |
1886 | } | 1899 | } |
1887 | 1900 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b0ce450..77581af 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -718,17 +718,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
718 | 718 | ||
719 | // Tell the physics engines that this prim changed. | 719 | // Tell the physics engines that this prim changed. |
720 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 720 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
721 | } | 721 | } |
722 | 722 | ||
723 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | 723 | if (!m_parentGroup.m_dupeInProgress) |
724 | foreach (ScenePresence av in avs) | 724 | { |
725 | { | 725 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); |
726 | if (av.LinkedPrim == m_uuid) | 726 | foreach (ScenePresence av in avs) |
727 | { | 727 | { |
728 | Vector3 offset = (m_offsetPosition - oldpos); | 728 | if (av.LinkedPrim == m_uuid) |
729 | av.OffsetPosition += offset; | 729 | { |
730 | av.SendFullUpdateToAllClients(); | 730 | Vector3 offset = (m_offsetPosition - oldpos); |
731 | } | 731 | av.OffsetPosition += offset; |
732 | av.SendFullUpdateToAllClients(); | ||
733 | } | ||
734 | } | ||
732 | } | 735 | } |
733 | } | 736 | } |
734 | TriggerScriptChangedEvent(Changed.POSITION); | 737 | TriggerScriptChangedEvent(Changed.POSITION); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 56e7e93..cca296e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2007,7 +2007,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2007 | if (autopilot) | 2007 | if (autopilot) |
2008 | { // its not a scripted sit | 2008 | { // its not a scripted sit |
2009 | // if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5) | 2009 | // if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5) |
2010 | if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 10.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 10.0f) ) | 2010 | if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 256.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 256.0f) ) |
2011 | { | 2011 | { |
2012 | autopilot = false; // close enough | 2012 | autopilot = false; // close enough |
2013 | m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup. | 2013 | m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup. |
@@ -2053,9 +2053,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2053 | //Console.WriteLine("Camera Eye ={0}", cameraEyeOffset); | 2053 | //Console.WriteLine("Camera Eye ={0}", cameraEyeOffset); |
2054 | 2054 | ||
2055 | //NOTE: SendSitResponse should be relative to the GROUP *NOT* THE PRIM if we're sitting on a child | 2055 | //NOTE: SendSitResponse should be relative to the GROUP *NOT* THE PRIM if we're sitting on a child |
2056 | ControllingClient.SendSitResponse(part.ParentGroup.UUID, ((offset * part.RotationOffset) + part.OffsetPosition), sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); | 2056 | Quaternion roffset = Quaternion.Identity; |
2057 | if (SitTargetisSet) | ||
2058 | { | ||
2059 | roffset = part.RotationOffset; | ||
2060 | } | ||
2061 | ControllingClient.SendSitResponse(part.ParentGroup.UUID, ((offset * roffset) + part.OffsetPosition), sitOrientation / part.RotationOffset, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); | ||
2057 | 2062 | ||
2058 | m_requestedSitTargetUUID = part.UUID; //KF: Correct autopilot target | ||
2059 | // This calls HandleAgentSit twice, once from here, and the client calls | 2063 | // This calls HandleAgentSit twice, once from here, and the client calls |
2060 | // HandleAgentSit itself after it gets to the location | 2064 | // HandleAgentSit itself after it gets to the location |
2061 | // It doesn't get to the location until we've moved them there though | 2065 | // It doesn't get to the location until we've moved them there though |
@@ -2374,8 +2378,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2374 | m_bodyRot = sitTargetOrient; | 2378 | m_bodyRot = sitTargetOrient; |
2375 | m_parentPosition = part.AbsolutePosition; | 2379 | m_parentPosition = part.AbsolutePosition; |
2376 | part.IsOccupied = true; | 2380 | part.IsOccupied = true; |
2377 | part.ParentGroup.AddAvatar(agentID); | 2381 | part.ParentGroup.AddAvatar(agentID); |
2378 | Console.WriteLine("Scripted Sit ofset {0}", m_pos); | ||
2379 | } | 2382 | } |
2380 | else | 2383 | else |
2381 | { | 2384 | { |
@@ -2441,7 +2444,7 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); | |||
2441 | } | 2444 | } |
2442 | 2445 | ||
2443 | m_linkedPrim = part.UUID; | 2446 | m_linkedPrim = part.UUID; |
2444 | 2447 | m_offsetRotation = m_offsetRotation / part.RotationOffset; | |
2445 | Velocity = Vector3.Zero; | 2448 | Velocity = Vector3.Zero; |
2446 | RemoveFromPhysicalScene(); | 2449 | RemoveFromPhysicalScene(); |
2447 | Animator.TrySetMovementAnimation(sitAnimation); | 2450 | Animator.TrySetMovementAnimation(sitAnimation); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index fffe65c..f0384f8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -1,507 +1,507 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim; | 35 | using OpenSim; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Region.CoreModules.World.LightShare; | 37 | using OpenSim.Region.CoreModules.World.LightShare; |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Region.ScriptEngine.Shared; | 40 | using OpenSim.Region.ScriptEngine.Shared; |
41 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | 41 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; |
42 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 42 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
43 | using OpenSim.Region.ScriptEngine.Interfaces; | 43 | using OpenSim.Region.ScriptEngine.Interfaces; |
44 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | 44 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; |
45 | 45 | ||
46 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | 46 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; |
47 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | 47 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; |
48 | using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | 48 | using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
49 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; | 49 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; |
50 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | 50 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; |
51 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | 51 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
52 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | 52 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; |
53 | 53 | ||
54 | namespace OpenSim.Region.ScriptEngine.Shared.Api | 54 | namespace OpenSim.Region.ScriptEngine.Shared.Api |
55 | { | 55 | { |
56 | [Serializable] | 56 | [Serializable] |
57 | public class LS_Api : MarshalByRefObject, ILS_Api, IScriptApi | 57 | public class LS_Api : MarshalByRefObject, ILS_Api, IScriptApi |
58 | { | 58 | { |
59 | internal IScriptEngine m_ScriptEngine; | 59 | internal IScriptEngine m_ScriptEngine; |
60 | internal SceneObjectPart m_host; | 60 | internal SceneObjectPart m_host; |
61 | internal uint m_localID; | 61 | internal uint m_localID; |
62 | internal UUID m_itemID; | 62 | internal UUID m_itemID; |
63 | internal bool m_LSFunctionsEnabled = false; | 63 | internal bool m_LSFunctionsEnabled = false; |
64 | internal IScriptModuleComms m_comms = null; | 64 | internal IScriptModuleComms m_comms = null; |
65 | 65 | ||
66 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 66 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) |
67 | { | 67 | { |
68 | m_ScriptEngine = ScriptEngine; | 68 | m_ScriptEngine = ScriptEngine; |
69 | m_host = host; | 69 | m_host = host; |
70 | m_localID = localID; | 70 | m_localID = localID; |
71 | m_itemID = itemID; | 71 | m_itemID = itemID; |
72 | 72 | ||
73 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) | 73 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) |
74 | m_LSFunctionsEnabled = true; | 74 | m_LSFunctionsEnabled = true; |
75 | 75 | ||
76 | if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false)) | 76 | if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false)) |
77 | m_LSFunctionsEnabled = true; | 77 | m_LSFunctionsEnabled = true; |
78 | 78 | ||
79 | m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); | 79 | m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); |
80 | if (m_comms == null) | 80 | if (m_comms == null) |
81 | m_LSFunctionsEnabled = false; | 81 | m_LSFunctionsEnabled = false; |
82 | } | 82 | } |
83 | 83 | ||
84 | public override Object InitializeLifetimeService() | 84 | public override Object InitializeLifetimeService() |
85 | { | 85 | { |
86 | ILease lease = (ILease)base.InitializeLifetimeService(); | 86 | ILease lease = (ILease)base.InitializeLifetimeService(); |
87 | 87 | ||
88 | if (lease.CurrentState == LeaseState.Initial) | 88 | if (lease.CurrentState == LeaseState.Initial) |
89 | { | 89 | { |
90 | lease.InitialLeaseTime = TimeSpan.FromMinutes(0); | 90 | lease.InitialLeaseTime = TimeSpan.FromMinutes(0); |
91 | // lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); | 91 | // lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); |
92 | // lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); | 92 | // lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); |
93 | } | 93 | } |
94 | return lease; | 94 | return lease; |
95 | } | 95 | } |
96 | 96 | ||
97 | public Scene World | 97 | public Scene World |
98 | { | 98 | { |
99 | get { return m_ScriptEngine.World; } | 99 | get { return m_ScriptEngine.World; } |
100 | } | 100 | } |
101 | 101 | ||
102 | // | 102 | // |
103 | //Dumps an error message on the debug console. | 103 | //Dumps an error message on the debug console. |
104 | // | 104 | // |
105 | 105 | ||
106 | internal void LSShoutError(string message) | 106 | internal void LSShoutError(string message) |
107 | { | 107 | { |
108 | if (message.Length > 1023) | 108 | if (message.Length > 1023) |
109 | message = message.Substring(0, 1023); | 109 | message = message.Substring(0, 1023); |
110 | 110 | ||
111 | World.SimChat(Utils.StringToBytes(message), | 111 | World.SimChat(Utils.StringToBytes(message), |
112 | ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); | 112 | ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); |
113 | 113 | ||
114 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 114 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
115 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); | 115 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); |
116 | } | 116 | } |
117 | 117 | ||
118 | /// <summary> | 118 | /// <summary> |
119 | /// Get the current Windlight scene | 119 | /// Get the current Windlight scene |
120 | /// </summary> | 120 | /// </summary> |
121 | /// <returns>List of windlight parameters</returns> | 121 | /// <returns>List of windlight parameters</returns> |
122 | public LSL_List lsGetWindlightScene(LSL_List rules) | 122 | public LSL_List lsGetWindlightScene(LSL_List rules) |
123 | { | 123 | { |
124 | if (!m_LSFunctionsEnabled) | 124 | if (!m_LSFunctionsEnabled) |
125 | { | 125 | { |
126 | LSShoutError("LightShare functions are not enabled."); | 126 | LSShoutError("LightShare functions are not enabled."); |
127 | return new LSL_List(); | 127 | return new LSL_List(); |
128 | } | 128 | } |
129 | m_host.AddScriptLPS(1); | 129 | m_host.AddScriptLPS(1); |
130 | RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; | 130 | RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; |
131 | 131 | ||
132 | LSL_List values = new LSL_List(); | 132 | LSL_List values = new LSL_List(); |
133 | int idx = 0; | 133 | int idx = 0; |
134 | while (idx < rules.Length) | 134 | while (idx < rules.Length) |
135 | { | 135 | { |
136 | uint rule = (uint)rules.GetLSLIntegerItem(idx); | 136 | uint rule = (uint)rules.GetLSLIntegerItem(idx); |
137 | LSL_List toadd = new LSL_List(); | 137 | LSL_List toadd = new LSL_List(); |
138 | 138 | ||
139 | switch (rule) | 139 | switch (rule) |
140 | { | 140 | { |
141 | case (int)ScriptBaseClass.WL_AMBIENT: | 141 | case (int)ScriptBaseClass.WL_AMBIENT: |
142 | toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W)); | 142 | toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W)); |
143 | break; | 143 | break; |
144 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: | 144 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: |
145 | toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f)); | 145 | toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f)); |
146 | break; | 146 | break; |
147 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: | 147 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: |
148 | toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W)); | 148 | toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W)); |
149 | break; | 149 | break; |
150 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: | 150 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: |
151 | toadd.Add(new LSL_Float(wl.blurMultiplier)); | 151 | toadd.Add(new LSL_Float(wl.blurMultiplier)); |
152 | break; | 152 | break; |
153 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: | 153 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: |
154 | toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W)); | 154 | toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W)); |
155 | break; | 155 | break; |
156 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: | 156 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: |
157 | toadd.Add(new LSL_Float(wl.cloudCoverage)); | 157 | toadd.Add(new LSL_Float(wl.cloudCoverage)); |
158 | break; | 158 | break; |
159 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: | 159 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: |
160 | toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z)); | 160 | toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z)); |
161 | break; | 161 | break; |
162 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: | 162 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: |
163 | toadd.Add(new LSL_Float(wl.cloudScale)); | 163 | toadd.Add(new LSL_Float(wl.cloudScale)); |
164 | break; | 164 | break; |
165 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: | 165 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: |
166 | toadd.Add(new LSL_Float(wl.cloudScrollX)); | 166 | toadd.Add(new LSL_Float(wl.cloudScrollX)); |
167 | break; | 167 | break; |
168 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: | 168 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: |
169 | toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0)); | 169 | toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0)); |
170 | break; | 170 | break; |
171 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: | 171 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: |
172 | toadd.Add(new LSL_Float(wl.cloudScrollY)); | 172 | toadd.Add(new LSL_Float(wl.cloudScrollY)); |
173 | break; | 173 | break; |
174 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: | 174 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: |
175 | toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0)); | 175 | toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0)); |
176 | break; | 176 | break; |
177 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: | 177 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: |
178 | toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z)); | 178 | toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z)); |
179 | break; | 179 | break; |
180 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: | 180 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: |
181 | toadd.Add(new LSL_Float(wl.densityMultiplier)); | 181 | toadd.Add(new LSL_Float(wl.densityMultiplier)); |
182 | break; | 182 | break; |
183 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: | 183 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: |
184 | toadd.Add(new LSL_Float(wl.distanceMultiplier)); | 184 | toadd.Add(new LSL_Float(wl.distanceMultiplier)); |
185 | break; | 185 | break; |
186 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: | 186 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: |
187 | toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0)); | 187 | toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0)); |
188 | break; | 188 | break; |
189 | case (int)ScriptBaseClass.WL_EAST_ANGLE: | 189 | case (int)ScriptBaseClass.WL_EAST_ANGLE: |
190 | toadd.Add(new LSL_Float(wl.eastAngle)); | 190 | toadd.Add(new LSL_Float(wl.eastAngle)); |
191 | break; | 191 | break; |
192 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: | 192 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: |
193 | toadd.Add(new LSL_Float(wl.fresnelOffset)); | 193 | toadd.Add(new LSL_Float(wl.fresnelOffset)); |
194 | break; | 194 | break; |
195 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: | 195 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: |
196 | toadd.Add(new LSL_Float(wl.fresnelScale)); | 196 | toadd.Add(new LSL_Float(wl.fresnelScale)); |
197 | break; | 197 | break; |
198 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: | 198 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: |
199 | toadd.Add(new LSL_Float(wl.hazeDensity)); | 199 | toadd.Add(new LSL_Float(wl.hazeDensity)); |
200 | break; | 200 | break; |
201 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: | 201 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: |
202 | toadd.Add(new LSL_Float(wl.hazeHorizon)); | 202 | toadd.Add(new LSL_Float(wl.hazeHorizon)); |
203 | break; | 203 | break; |
204 | case (int)ScriptBaseClass.WL_HORIZON: | 204 | case (int)ScriptBaseClass.WL_HORIZON: |
205 | toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W)); | 205 | toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W)); |
206 | break; | 206 | break; |
207 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: | 207 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: |
208 | toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f)); | 208 | toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f)); |
209 | break; | 209 | break; |
210 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: | 210 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: |
211 | toadd.Add(new LSL_Integer(wl.maxAltitude)); | 211 | toadd.Add(new LSL_Integer(wl.maxAltitude)); |
212 | break; | 212 | break; |
213 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: | 213 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: |
214 | toadd.Add(new LSL_Key(wl.normalMapTexture.ToString())); | 214 | toadd.Add(new LSL_Key(wl.normalMapTexture.ToString())); |
215 | break; | 215 | break; |
216 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: | 216 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: |
217 | toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z)); | 217 | toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z)); |
218 | break; | 218 | break; |
219 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: | 219 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: |
220 | toadd.Add(new LSL_Float(wl.refractScaleAbove)); | 220 | toadd.Add(new LSL_Float(wl.refractScaleAbove)); |
221 | break; | 221 | break; |
222 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: | 222 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: |
223 | toadd.Add(new LSL_Float(wl.refractScaleBelow)); | 223 | toadd.Add(new LSL_Float(wl.refractScaleBelow)); |
224 | break; | 224 | break; |
225 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: | 225 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: |
226 | toadd.Add(new LSL_Float(wl.sceneGamma)); | 226 | toadd.Add(new LSL_Float(wl.sceneGamma)); |
227 | break; | 227 | break; |
228 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: | 228 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: |
229 | toadd.Add(new LSL_Float(wl.starBrightness)); | 229 | toadd.Add(new LSL_Float(wl.starBrightness)); |
230 | break; | 230 | break; |
231 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: | 231 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: |
232 | toadd.Add(new LSL_Float(wl.sunGlowFocus)); | 232 | toadd.Add(new LSL_Float(wl.sunGlowFocus)); |
233 | break; | 233 | break; |
234 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: | 234 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: |
235 | toadd.Add(new LSL_Float(wl.sunGlowSize)); | 235 | toadd.Add(new LSL_Float(wl.sunGlowSize)); |
236 | break; | 236 | break; |
237 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | 237 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: |
238 | toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W)); | 238 | toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W)); |
239 | break; | 239 | break; |
240 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: | 240 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: |
241 | toadd.Add(new LSL_Float(wl.underwaterFogModifier)); | 241 | toadd.Add(new LSL_Float(wl.underwaterFogModifier)); |
242 | break; | 242 | break; |
243 | case (int)ScriptBaseClass.WL_WATER_COLOR: | 243 | case (int)ScriptBaseClass.WL_WATER_COLOR: |
244 | toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z)); | 244 | toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z)); |
245 | break; | 245 | break; |
246 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: | 246 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: |
247 | toadd.Add(new LSL_Float(wl.waterFogDensityExponent)); | 247 | toadd.Add(new LSL_Float(wl.waterFogDensityExponent)); |
248 | break; | 248 | break; |
249 | } | 249 | } |
250 | 250 | ||
251 | if (toadd.Length > 0) | 251 | if (toadd.Length > 0) |
252 | { | 252 | { |
253 | values.Add(rule); | 253 | values.Add(new LSL_Integer(rule)); |
254 | values.Add(toadd.Data[0]); | 254 | values.Add(toadd.Data[0]); |
255 | } | 255 | } |
256 | idx++; | 256 | idx++; |
257 | } | 257 | } |
258 | 258 | ||
259 | 259 | ||
260 | return values; | 260 | return values; |
261 | 261 | ||
262 | } | 262 | } |
263 | 263 | ||
264 | private RegionLightShareData getWindlightProfileFromRules(LSL_List rules) | 264 | private RegionLightShareData getWindlightProfileFromRules(LSL_List rules) |
265 | { | 265 | { |
266 | RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); | 266 | RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); |
267 | 267 | ||
268 | LSL_List values = new LSL_List(); | 268 | LSL_List values = new LSL_List(); |
269 | int idx = 0; | 269 | int idx = 0; |
270 | while (idx < rules.Length) | 270 | while (idx < rules.Length) |
271 | { | 271 | { |
272 | uint rule = (uint)rules.GetLSLIntegerItem(idx); | 272 | uint rule = (uint)rules.GetLSLIntegerItem(idx); |
273 | LSL_Types.Quaternion iQ; | 273 | LSL_Types.Quaternion iQ; |
274 | LSL_Types.Vector3 iV; | 274 | LSL_Types.Vector3 iV; |
275 | switch (rule) | 275 | switch (rule) |
276 | { | 276 | { |
277 | case (int)ScriptBaseClass.WL_SUN_MOON_POSITION: | 277 | case (int)ScriptBaseClass.WL_SUN_MOON_POSITION: |
278 | idx++; | 278 | idx++; |
279 | wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx); | 279 | wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx); |
280 | break; | 280 | break; |
281 | case (int)ScriptBaseClass.WL_AMBIENT: | 281 | case (int)ScriptBaseClass.WL_AMBIENT: |
282 | idx++; | 282 | idx++; |
283 | iQ = rules.GetQuaternionItem(idx); | 283 | iQ = rules.GetQuaternionItem(idx); |
284 | wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 284 | wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
285 | break; | 285 | break; |
286 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: | 286 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: |
287 | idx++; | 287 | idx++; |
288 | iV = rules.GetVector3Item(idx); | 288 | iV = rules.GetVector3Item(idx); |
289 | wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y); | 289 | wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y); |
290 | break; | 290 | break; |
291 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: | 291 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: |
292 | idx++; | 292 | idx++; |
293 | iQ = rules.GetQuaternionItem(idx); | 293 | iQ = rules.GetQuaternionItem(idx); |
294 | wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 294 | wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
295 | break; | 295 | break; |
296 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: | 296 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: |
297 | idx++; | 297 | idx++; |
298 | wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx); | 298 | wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx); |
299 | break; | 299 | break; |
300 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: | 300 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: |
301 | idx++; | 301 | idx++; |
302 | iQ = rules.GetQuaternionItem(idx); | 302 | iQ = rules.GetQuaternionItem(idx); |
303 | wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 303 | wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
304 | break; | 304 | break; |
305 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: | 305 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: |
306 | idx++; | 306 | idx++; |
307 | wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx); | 307 | wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx); |
308 | break; | 308 | break; |
309 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: | 309 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: |
310 | idx++; | 310 | idx++; |
311 | iV = rules.GetVector3Item(idx); | 311 | iV = rules.GetVector3Item(idx); |
312 | wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | 312 | wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); |
313 | break; | 313 | break; |
314 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: | 314 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: |
315 | idx++; | 315 | idx++; |
316 | wl.cloudScale = (float)rules.GetLSLFloatItem(idx); | 316 | wl.cloudScale = (float)rules.GetLSLFloatItem(idx); |
317 | break; | 317 | break; |
318 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: | 318 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: |
319 | idx++; | 319 | idx++; |
320 | wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx); | 320 | wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx); |
321 | break; | 321 | break; |
322 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: | 322 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: |
323 | idx++; | 323 | idx++; |
324 | wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | 324 | wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; |
325 | break; | 325 | break; |
326 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: | 326 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: |
327 | idx++; | 327 | idx++; |
328 | wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx); | 328 | wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx); |
329 | break; | 329 | break; |
330 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: | 330 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: |
331 | idx++; | 331 | idx++; |
332 | wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | 332 | wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; |
333 | break; | 333 | break; |
334 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: | 334 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: |
335 | idx++; | 335 | idx++; |
336 | iV = rules.GetVector3Item(idx); | 336 | iV = rules.GetVector3Item(idx); |
337 | wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | 337 | wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); |
338 | break; | 338 | break; |
339 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: | 339 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: |
340 | idx++; | 340 | idx++; |
341 | wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx); | 341 | wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx); |
342 | break; | 342 | break; |
343 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: | 343 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: |
344 | idx++; | 344 | idx++; |
345 | wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx); | 345 | wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx); |
346 | break; | 346 | break; |
347 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: | 347 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: |
348 | idx++; | 348 | idx++; |
349 | wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | 349 | wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; |
350 | break; | 350 | break; |
351 | case (int)ScriptBaseClass.WL_EAST_ANGLE: | 351 | case (int)ScriptBaseClass.WL_EAST_ANGLE: |
352 | idx++; | 352 | idx++; |
353 | wl.eastAngle = (float)rules.GetLSLFloatItem(idx); | 353 | wl.eastAngle = (float)rules.GetLSLFloatItem(idx); |
354 | break; | 354 | break; |
355 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: | 355 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: |
356 | idx++; | 356 | idx++; |
357 | wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx); | 357 | wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx); |
358 | break; | 358 | break; |
359 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: | 359 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: |
360 | idx++; | 360 | idx++; |
361 | wl.fresnelScale = (float)rules.GetLSLFloatItem(idx); | 361 | wl.fresnelScale = (float)rules.GetLSLFloatItem(idx); |
362 | break; | 362 | break; |
363 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: | 363 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: |
364 | idx++; | 364 | idx++; |
365 | wl.hazeDensity = (float)rules.GetLSLFloatItem(idx); | 365 | wl.hazeDensity = (float)rules.GetLSLFloatItem(idx); |
366 | break; | 366 | break; |
367 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: | 367 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: |
368 | idx++; | 368 | idx++; |
369 | wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx); | 369 | wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx); |
370 | break; | 370 | break; |
371 | case (int)ScriptBaseClass.WL_HORIZON: | 371 | case (int)ScriptBaseClass.WL_HORIZON: |
372 | idx++; | 372 | idx++; |
373 | iQ = rules.GetQuaternionItem(idx); | 373 | iQ = rules.GetQuaternionItem(idx); |
374 | wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 374 | wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
375 | break; | 375 | break; |
376 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: | 376 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: |
377 | idx++; | 377 | idx++; |
378 | iV = rules.GetVector3Item(idx); | 378 | iV = rules.GetVector3Item(idx); |
379 | wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y); | 379 | wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y); |
380 | break; | 380 | break; |
381 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: | 381 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: |
382 | idx++; | 382 | idx++; |
383 | wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value; | 383 | wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value; |
384 | break; | 384 | break; |
385 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: | 385 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: |
386 | idx++; | 386 | idx++; |
387 | wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); | 387 | wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); |
388 | break; | 388 | break; |
389 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: | 389 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: |
390 | idx++; | 390 | idx++; |
391 | iV = rules.GetVector3Item(idx); | 391 | iV = rules.GetVector3Item(idx); |
392 | wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | 392 | wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); |
393 | break; | 393 | break; |
394 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: | 394 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: |
395 | idx++; | 395 | idx++; |
396 | wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx); | 396 | wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx); |
397 | break; | 397 | break; |
398 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: | 398 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: |
399 | idx++; | 399 | idx++; |
400 | wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx); | 400 | wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx); |
401 | break; | 401 | break; |
402 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: | 402 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: |
403 | idx++; | 403 | idx++; |
404 | wl.sceneGamma = (float)rules.GetLSLFloatItem(idx); | 404 | wl.sceneGamma = (float)rules.GetLSLFloatItem(idx); |
405 | break; | 405 | break; |
406 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: | 406 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: |
407 | idx++; | 407 | idx++; |
408 | wl.starBrightness = (float)rules.GetLSLFloatItem(idx); | 408 | wl.starBrightness = (float)rules.GetLSLFloatItem(idx); |
409 | break; | 409 | break; |
410 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: | 410 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: |
411 | idx++; | 411 | idx++; |
412 | wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx); | 412 | wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx); |
413 | break; | 413 | break; |
414 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: | 414 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: |
415 | idx++; | 415 | idx++; |
416 | wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx); | 416 | wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx); |
417 | break; | 417 | break; |
418 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | 418 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: |
419 | idx++; | 419 | idx++; |
420 | iQ = rules.GetQuaternionItem(idx); | 420 | iQ = rules.GetQuaternionItem(idx); |
421 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 421 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
422 | break; | 422 | break; |
423 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: | 423 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: |
424 | idx++; | 424 | idx++; |
425 | wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx); | 425 | wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx); |
426 | break; | 426 | break; |
427 | case (int)ScriptBaseClass.WL_WATER_COLOR: | 427 | case (int)ScriptBaseClass.WL_WATER_COLOR: |
428 | idx++; | 428 | idx++; |
429 | iV = rules.GetVector3Item(idx); | 429 | iV = rules.GetVector3Item(idx); |
430 | wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | 430 | wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); |
431 | break; | 431 | break; |
432 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: | 432 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: |
433 | idx++; | 433 | idx++; |
434 | wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx); | 434 | wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx); |
435 | break; | 435 | break; |
436 | } | 436 | } |
437 | idx++; | 437 | idx++; |
438 | } | 438 | } |
439 | return wl; | 439 | return wl; |
440 | } | 440 | } |
441 | /// <summary> | 441 | /// <summary> |
442 | /// Set the current Windlight scene | 442 | /// Set the current Windlight scene |
443 | /// </summary> | 443 | /// </summary> |
444 | /// <param name="rules"></param> | 444 | /// <param name="rules"></param> |
445 | /// <returns>success: true or false</returns> | 445 | /// <returns>success: true or false</returns> |
446 | public int lsSetWindlightScene(LSL_List rules) | 446 | public int lsSetWindlightScene(LSL_List rules) |
447 | { | 447 | { |
448 | if (!m_LSFunctionsEnabled) | 448 | if (!m_LSFunctionsEnabled) |
449 | { | 449 | { |
450 | LSShoutError("LightShare functions are not enabled."); | 450 | LSShoutError("LightShare functions are not enabled."); |
451 | return 0; | 451 | return 0; |
452 | } | 452 | } |
453 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 453 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
454 | { | 454 | { |
455 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); | 455 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); |
456 | return 0; | 456 | return 0; |
457 | } | 457 | } |
458 | int success = 0; | 458 | int success = 0; |
459 | m_host.AddScriptLPS(1); | 459 | m_host.AddScriptLPS(1); |
460 | if (LightShareModule.EnableWindlight) | 460 | if (LightShareModule.EnableWindlight) |
461 | { | 461 | { |
462 | RegionLightShareData wl = getWindlightProfileFromRules(rules); | 462 | RegionLightShareData wl = getWindlightProfileFromRules(rules); |
463 | m_host.ParentGroup.Scene.StoreWindlightProfile(wl); | 463 | m_host.ParentGroup.Scene.StoreWindlightProfile(wl); |
464 | success = 1; | 464 | success = 1; |
465 | } | 465 | } |
466 | else | 466 | else |
467 | { | 467 | { |
468 | LSShoutError("Windlight module is disabled"); | 468 | LSShoutError("Windlight module is disabled"); |
469 | return 0; | 469 | return 0; |
470 | } | 470 | } |
471 | return success; | 471 | return success; |
472 | } | 472 | } |
473 | /// <summary> | 473 | /// <summary> |
474 | /// Set the current Windlight scene to a target avatar | 474 | /// Set the current Windlight scene to a target avatar |
475 | /// </summary> | 475 | /// </summary> |
476 | /// <param name="rules"></param> | 476 | /// <param name="rules"></param> |
477 | /// <returns>success: true or false</returns> | 477 | /// <returns>success: true or false</returns> |
478 | public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target) | 478 | public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target) |
479 | { | 479 | { |
480 | if (!m_LSFunctionsEnabled) | 480 | if (!m_LSFunctionsEnabled) |
481 | { | 481 | { |
482 | LSShoutError("LightShare functions are not enabled."); | 482 | LSShoutError("LightShare functions are not enabled."); |
483 | return 0; | 483 | return 0; |
484 | } | 484 | } |
485 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 485 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
486 | { | 486 | { |
487 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); | 487 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); |
488 | return 0; | 488 | return 0; |
489 | } | 489 | } |
490 | int success = 0; | 490 | int success = 0; |
491 | m_host.AddScriptLPS(1); | 491 | m_host.AddScriptLPS(1); |
492 | if (LightShareModule.EnableWindlight) | 492 | if (LightShareModule.EnableWindlight) |
493 | { | 493 | { |
494 | RegionLightShareData wl = getWindlightProfileFromRules(rules); | 494 | RegionLightShareData wl = getWindlightProfileFromRules(rules); |
495 | World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string)); | 495 | World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string)); |
496 | success = 1; | 496 | success = 1; |
497 | } | 497 | } |
498 | else | 498 | else |
499 | { | 499 | { |
500 | LSShoutError("Windlight module is disabled"); | 500 | LSShoutError("Windlight module is disabled"); |
501 | return 0; | 501 | return 0; |
502 | } | 502 | } |
503 | return success; | 503 | return success; |
504 | } | 504 | } |
505 | 505 | ||
506 | } | 506 | } |
507 | } | 507 | } |