diff options
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 106 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | 1009 |
2 files changed, 563 insertions, 552 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 94b9d40..512957d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -293,7 +293,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
293 | { | 293 | { |
294 | case ScriptBaseClass.LINK_SET: | 294 | case ScriptBaseClass.LINK_SET: |
295 | if (m_host.ParentGroup != null) | 295 | if (m_host.ParentGroup != null) |
296 | return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); | 296 | { |
297 | lock (m_host.ParentGroup.Children) | ||
298 | return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); | ||
299 | } | ||
297 | return ret; | 300 | return ret; |
298 | 301 | ||
299 | case ScriptBaseClass.LINK_ROOT: | 302 | case ScriptBaseClass.LINK_ROOT: |
@@ -308,7 +311,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
308 | case ScriptBaseClass.LINK_ALL_OTHERS: | 311 | case ScriptBaseClass.LINK_ALL_OTHERS: |
309 | if (m_host.ParentGroup == null) | 312 | if (m_host.ParentGroup == null) |
310 | return new List<SceneObjectPart>(); | 313 | return new List<SceneObjectPart>(); |
311 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); | 314 | |
315 | lock (m_host.ParentGroup.Children) | ||
316 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); | ||
317 | |||
312 | if (ret.Contains(m_host)) | 318 | if (ret.Contains(m_host)) |
313 | ret.Remove(m_host); | 319 | ret.Remove(m_host); |
314 | return ret; | 320 | return ret; |
@@ -316,7 +322,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
316 | case ScriptBaseClass.LINK_ALL_CHILDREN: | 322 | case ScriptBaseClass.LINK_ALL_CHILDREN: |
317 | if (m_host.ParentGroup == null) | 323 | if (m_host.ParentGroup == null) |
318 | return new List<SceneObjectPart>(); | 324 | return new List<SceneObjectPart>(); |
319 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); | 325 | |
326 | lock (m_host.ParentGroup.Children) | ||
327 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); | ||
328 | |||
320 | if (ret.Contains(m_host.ParentGroup.RootPart)) | 329 | if (ret.Contains(m_host.ParentGroup.RootPart)) |
321 | ret.Remove(m_host.ParentGroup.RootPart); | 330 | ret.Remove(m_host.ParentGroup.RootPart); |
322 | return ret; | 331 | return ret; |
@@ -1272,12 +1281,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1272 | if (group == null) | 1281 | if (group == null) |
1273 | return; | 1282 | return; |
1274 | bool allow = true; | 1283 | bool allow = true; |
1275 | foreach (SceneObjectPart part in group.Children.Values) | 1284 | |
1285 | lock (group.Children) | ||
1276 | { | 1286 | { |
1277 | if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys) | 1287 | foreach (SceneObjectPart part in group.Children.Values) |
1278 | { | 1288 | { |
1279 | allow = false; | 1289 | if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys) |
1280 | break; | 1290 | { |
1291 | allow = false; | ||
1292 | break; | ||
1293 | } | ||
1281 | } | 1294 | } |
1282 | } | 1295 | } |
1283 | 1296 | ||
@@ -2120,7 +2133,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2120 | 2133 | ||
2121 | if (part.ParentGroup.RootPart == part) | 2134 | if (part.ParentGroup.RootPart == part) |
2122 | { | 2135 | { |
2123 | if ((targetPos.z < ground) && disable_underground_movement) | 2136 | if ((targetPos.z < ground) && disable_underground_movement && m_host.AttachmentPoint == 0) |
2124 | targetPos.z = ground; | 2137 | targetPos.z = ground; |
2125 | SceneObjectGroup parent = part.ParentGroup; | 2138 | SceneObjectGroup parent = part.ParentGroup; |
2126 | LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); | 2139 | LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); |
@@ -2152,18 +2165,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2152 | protected LSL_Vector GetPartLocalPos(SceneObjectPart part) | 2165 | protected LSL_Vector GetPartLocalPos(SceneObjectPart part) |
2153 | { | 2166 | { |
2154 | m_host.AddScriptLPS(1); | 2167 | m_host.AddScriptLPS(1); |
2155 | if (part.ParentID != 0) | 2168 | if (part.ParentID == 0) |
2156 | { | ||
2157 | return new LSL_Vector(part.OffsetPosition.X, | ||
2158 | part.OffsetPosition.Y, | ||
2159 | part.OffsetPosition.Z); | ||
2160 | } | ||
2161 | else | ||
2162 | { | 2169 | { |
2163 | return new LSL_Vector(part.AbsolutePosition.X, | 2170 | return new LSL_Vector(part.AbsolutePosition.X, |
2164 | part.AbsolutePosition.Y, | 2171 | part.AbsolutePosition.Y, |
2165 | part.AbsolutePosition.Z); | 2172 | part.AbsolutePosition.Z); |
2166 | } | 2173 | } |
2174 | else | ||
2175 | { | ||
2176 | if (m_host.IsRoot) | ||
2177 | { | ||
2178 | return new LSL_Vector(m_host.AttachedPos.X, | ||
2179 | m_host.AttachedPos.Y, | ||
2180 | m_host.AttachedPos.Z); | ||
2181 | } | ||
2182 | else | ||
2183 | { | ||
2184 | return new LSL_Vector(part.OffsetPosition.X, | ||
2185 | part.OffsetPosition.Y, | ||
2186 | part.OffsetPosition.Z); | ||
2187 | } | ||
2188 | } | ||
2167 | } | 2189 | } |
2168 | 2190 | ||
2169 | public void llSetRot(LSL_Rotation rot) | 2191 | public void llSetRot(LSL_Rotation rot) |
@@ -3748,7 +3770,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3748 | { | 3770 | { |
3749 | m_host.AddScriptLPS(1); | 3771 | m_host.AddScriptLPS(1); |
3750 | 3772 | ||
3751 | if (m_host.ParentGroup.Children.Count > 1) | 3773 | if (m_host.ParentGroup.PrimCount > 1) |
3752 | { | 3774 | { |
3753 | return m_host.LinkNum; | 3775 | return m_host.LinkNum; |
3754 | } | 3776 | } |
@@ -3869,15 +3891,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3869 | case ScriptBaseClass.LINK_ALL_OTHERS: | 3891 | case ScriptBaseClass.LINK_ALL_OTHERS: |
3870 | case ScriptBaseClass.LINK_ALL_CHILDREN: | 3892 | case ScriptBaseClass.LINK_ALL_CHILDREN: |
3871 | case ScriptBaseClass.LINK_THIS: | 3893 | case ScriptBaseClass.LINK_THIS: |
3872 | foreach (SceneObjectPart part in parentPrim.Children.Values) | 3894 | lock (parentPrim.Children) |
3873 | { | 3895 | { |
3874 | if (part.UUID != m_host.UUID) | 3896 | foreach (SceneObjectPart part in parentPrim.Children.Values) |
3875 | { | 3897 | { |
3876 | childPrim = part; | 3898 | if (part.UUID != m_host.UUID) |
3877 | break; | 3899 | { |
3900 | childPrim = part; | ||
3901 | break; | ||
3902 | } | ||
3878 | } | 3903 | } |
3904 | break; | ||
3879 | } | 3905 | } |
3880 | break; | ||
3881 | default: | 3906 | default: |
3882 | childPrim = parentPrim.GetLinkNumPart(linknum); | 3907 | childPrim = parentPrim.GetLinkNumPart(linknum); |
3883 | if (childPrim.UUID == m_host.UUID) | 3908 | if (childPrim.UUID == m_host.UUID) |
@@ -3953,26 +3978,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3953 | if (parentPrim.RootPart.AttachmentPoint != 0) | 3978 | if (parentPrim.RootPart.AttachmentPoint != 0) |
3954 | return; // Fail silently if attached | 3979 | return; // Fail silently if attached |
3955 | 3980 | ||
3956 | List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); | 3981 | lock (parentPrim.Children) |
3957 | parts.Remove(parentPrim.RootPart); | ||
3958 | if (parts.Count > 0) | ||
3959 | { | 3982 | { |
3960 | try | 3983 | List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); |
3961 | { | 3984 | parts.Remove(parentPrim.RootPart); |
3962 | parts[0].ParentGroup.areUpdatesSuspended = true; | 3985 | |
3963 | foreach (SceneObjectPart part in parts) | 3986 | foreach (SceneObjectPart part in parts) |
3964 | { | ||
3965 | parentPrim.DelinkFromGroup(part.LocalId, true); | ||
3966 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | ||
3967 | } | ||
3968 | } | ||
3969 | finally | ||
3970 | { | 3987 | { |
3971 | parts[0].ParentGroup.areUpdatesSuspended = false; | 3988 | parentPrim.DelinkFromGroup(part.LocalId, true); |
3989 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | ||
3972 | } | 3990 | } |
3991 | parentPrim.HasGroupChanged = true; | ||
3992 | parentPrim.ScheduleGroupForFullUpdate(); | ||
3973 | } | 3993 | } |
3974 | parentPrim.HasGroupChanged = true; | ||
3975 | parentPrim.ScheduleGroupForFullUpdate(); | ||
3976 | } | 3994 | } |
3977 | 3995 | ||
3978 | public LSL_String llGetLinkKey(int linknum) | 3996 | public LSL_String llGetLinkKey(int linknum) |
@@ -4179,8 +4197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4179 | } | 4197 | } |
4180 | 4198 | ||
4181 | // destination is an avatar | 4199 | // destination is an avatar |
4182 | InventoryItemBase agentItem = | 4200 | InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); |
4183 | World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); | ||
4184 | 4201 | ||
4185 | if (agentItem == null) | 4202 | if (agentItem == null) |
4186 | return; | 4203 | return; |
@@ -4190,7 +4207,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4190 | byte[] objBytes = agentItem.ID.GetBytes(); | 4207 | byte[] objBytes = agentItem.ID.GetBytes(); |
4191 | Array.Copy(objBytes, 0, bucket, 1, 16); | 4208 | Array.Copy(objBytes, 0, bucket, 1, 16); |
4192 | 4209 | ||
4193 | Console.WriteLine("Giving inventory"); | ||
4194 | GridInstantMessage msg = new GridInstantMessage(World, | 4210 | GridInstantMessage msg = new GridInstantMessage(World, |
4195 | m_host.UUID, m_host.Name+", an object owned by "+ | 4211 | m_host.UUID, m_host.Name+", an object owned by "+ |
4196 | resolveName(m_host.OwnerID)+",", destId, | 4212 | resolveName(m_host.OwnerID)+",", destId, |
@@ -4538,7 +4554,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4538 | { | 4554 | { |
4539 | partItemID = item.ItemID; | 4555 | partItemID = item.ItemID; |
4540 | int linkNumber = m_host.LinkNum; | 4556 | int linkNumber = m_host.LinkNum; |
4541 | if (m_host.ParentGroup.Children.Count == 1) | 4557 | if (m_host.ParentGroup.PrimCount == 1) |
4542 | linkNumber = 0; | 4558 | linkNumber = 0; |
4543 | 4559 | ||
4544 | object[] resobj = new object[] | 4560 | object[] resobj = new object[] |
@@ -9595,8 +9611,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9595 | // we send to all | 9611 | // we send to all |
9596 | landData.MediaID = new UUID(texture); | 9612 | landData.MediaID = new UUID(texture); |
9597 | landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; | 9613 | landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; |
9598 | landData.MediaSize[0] = width; | 9614 | landData.MediaWidth = width; |
9599 | landData.MediaSize[1] = height; | 9615 | landData.MediaHeight = height; |
9600 | landData.MediaType = mediaType; | 9616 | landData.MediaType = mediaType; |
9601 | 9617 | ||
9602 | // do that one last, it will cause a ParcelPropertiesUpdate | 9618 | // do that one last, it will cause a ParcelPropertiesUpdate |
@@ -9682,8 +9698,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9682 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType)); | 9698 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType)); |
9683 | break; | 9699 | break; |
9684 | case ParcelMediaCommandEnum.Size: | 9700 | case ParcelMediaCommandEnum.Size: |
9685 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[0])); | 9701 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaWidth)); |
9686 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[1])); | 9702 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaHeight)); |
9687 | break; | 9703 | break; |
9688 | default: | 9704 | default: |
9689 | ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; | 9705 | ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index f0384f8..665b39f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -1,507 +1,502 @@ | |||
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 | m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); |
77 | m_LSFunctionsEnabled = true; | 77 | if (m_comms == null) |
78 | 78 | m_LSFunctionsEnabled = false; | |
79 | m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); | 79 | } |
80 | if (m_comms == null) | 80 | |
81 | m_LSFunctionsEnabled = false; | 81 | public override Object InitializeLifetimeService() |
82 | } | 82 | { |
83 | 83 | ILease lease = (ILease)base.InitializeLifetimeService(); | |
84 | public override Object InitializeLifetimeService() | 84 | |
85 | { | 85 | if (lease.CurrentState == LeaseState.Initial) |
86 | ILease lease = (ILease)base.InitializeLifetimeService(); | 86 | { |
87 | 87 | lease.InitialLeaseTime = TimeSpan.FromMinutes(0); | |
88 | if (lease.CurrentState == LeaseState.Initial) | 88 | // lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); |
89 | { | 89 | // lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); |
90 | lease.InitialLeaseTime = TimeSpan.FromMinutes(0); | 90 | } |
91 | // lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); | 91 | return lease; |
92 | // lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); | 92 | } |
93 | } | 93 | |
94 | return lease; | 94 | public Scene World |
95 | } | 95 | { |
96 | 96 | get { return m_ScriptEngine.World; } | |
97 | public Scene World | 97 | } |
98 | { | 98 | |
99 | get { return m_ScriptEngine.World; } | 99 | // |
100 | } | 100 | //Dumps an error message on the debug console. |
101 | 101 | // | |
102 | // | 102 | |
103 | //Dumps an error message on the debug console. | 103 | internal void LSShoutError(string message) |
104 | // | 104 | { |
105 | 105 | if (message.Length > 1023) | |
106 | internal void LSShoutError(string message) | 106 | message = message.Substring(0, 1023); |
107 | { | 107 | |
108 | if (message.Length > 1023) | 108 | World.SimChat(Utils.StringToBytes(message), |
109 | message = message.Substring(0, 1023); | 109 | ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); |
110 | 110 | ||
111 | World.SimChat(Utils.StringToBytes(message), | 111 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
112 | ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); | 112 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); |
113 | 113 | } | |
114 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 114 | |
115 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); | 115 | /// <summary> |
116 | } | 116 | /// Get the current Windlight scene |
117 | 117 | /// </summary> | |
118 | /// <summary> | 118 | /// <returns>List of windlight parameters</returns> |
119 | /// Get the current Windlight scene | 119 | public LSL_List lsGetWindlightScene(LSL_List rules) |
120 | /// </summary> | 120 | { |
121 | /// <returns>List of windlight parameters</returns> | 121 | if (!m_LSFunctionsEnabled) |
122 | public LSL_List lsGetWindlightScene(LSL_List rules) | 122 | { |
123 | { | 123 | LSShoutError("LightShare functions are not enabled."); |
124 | if (!m_LSFunctionsEnabled) | 124 | return new LSL_List(); |
125 | { | 125 | } |
126 | LSShoutError("LightShare functions are not enabled."); | 126 | m_host.AddScriptLPS(1); |
127 | return new LSL_List(); | 127 | RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; |
128 | } | 128 | |
129 | m_host.AddScriptLPS(1); | 129 | LSL_List values = new LSL_List(); |
130 | RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; | 130 | int idx = 0; |
131 | 131 | while (idx < rules.Length) | |
132 | LSL_List values = new LSL_List(); | 132 | { |
133 | int idx = 0; | 133 | uint rule = (uint)rules.GetLSLIntegerItem(idx); |
134 | while (idx < rules.Length) | 134 | LSL_List toadd = new LSL_List(); |
135 | { | 135 | |
136 | uint rule = (uint)rules.GetLSLIntegerItem(idx); | 136 | switch (rule) |
137 | LSL_List toadd = new LSL_List(); | 137 | { |
138 | 138 | case (int)ScriptBaseClass.WL_AMBIENT: | |
139 | switch (rule) | 139 | toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W)); |
140 | { | 140 | break; |
141 | case (int)ScriptBaseClass.WL_AMBIENT: | 141 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: |
142 | toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W)); | 142 | toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f)); |
143 | break; | 143 | break; |
144 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: | 144 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: |
145 | toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f)); | 145 | toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W)); |
146 | break; | 146 | break; |
147 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: | 147 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: |
148 | toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W)); | 148 | toadd.Add(new LSL_Float(wl.blurMultiplier)); |
149 | break; | 149 | break; |
150 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: | 150 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: |
151 | toadd.Add(new LSL_Float(wl.blurMultiplier)); | 151 | toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W)); |
152 | break; | 152 | break; |
153 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: | 153 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: |
154 | toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W)); | 154 | toadd.Add(new LSL_Float(wl.cloudCoverage)); |
155 | break; | 155 | break; |
156 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: | 156 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: |
157 | toadd.Add(new LSL_Float(wl.cloudCoverage)); | 157 | toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z)); |
158 | break; | 158 | break; |
159 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: | 159 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: |
160 | toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z)); | 160 | toadd.Add(new LSL_Float(wl.cloudScale)); |
161 | break; | 161 | break; |
162 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: | 162 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: |
163 | toadd.Add(new LSL_Float(wl.cloudScale)); | 163 | toadd.Add(new LSL_Float(wl.cloudScrollX)); |
164 | break; | 164 | break; |
165 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: | 165 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: |
166 | toadd.Add(new LSL_Float(wl.cloudScrollX)); | 166 | toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0)); |
167 | break; | 167 | break; |
168 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: | 168 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: |
169 | toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0)); | 169 | toadd.Add(new LSL_Float(wl.cloudScrollY)); |
170 | break; | 170 | break; |
171 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: | 171 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: |
172 | toadd.Add(new LSL_Float(wl.cloudScrollY)); | 172 | toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0)); |
173 | break; | 173 | break; |
174 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: | 174 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: |
175 | toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0)); | 175 | toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z)); |
176 | break; | 176 | break; |
177 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: | 177 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: |
178 | toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z)); | 178 | toadd.Add(new LSL_Float(wl.densityMultiplier)); |
179 | break; | 179 | break; |
180 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: | 180 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: |
181 | toadd.Add(new LSL_Float(wl.densityMultiplier)); | 181 | toadd.Add(new LSL_Float(wl.distanceMultiplier)); |
182 | break; | 182 | break; |
183 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: | 183 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: |
184 | toadd.Add(new LSL_Float(wl.distanceMultiplier)); | 184 | toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0)); |
185 | break; | 185 | break; |
186 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: | 186 | case (int)ScriptBaseClass.WL_EAST_ANGLE: |
187 | toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0)); | 187 | toadd.Add(new LSL_Float(wl.eastAngle)); |
188 | break; | 188 | break; |
189 | case (int)ScriptBaseClass.WL_EAST_ANGLE: | 189 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: |
190 | toadd.Add(new LSL_Float(wl.eastAngle)); | 190 | toadd.Add(new LSL_Float(wl.fresnelOffset)); |
191 | break; | 191 | break; |
192 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: | 192 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: |
193 | toadd.Add(new LSL_Float(wl.fresnelOffset)); | 193 | toadd.Add(new LSL_Float(wl.fresnelScale)); |
194 | break; | 194 | break; |
195 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: | 195 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: |
196 | toadd.Add(new LSL_Float(wl.fresnelScale)); | 196 | toadd.Add(new LSL_Float(wl.hazeDensity)); |
197 | break; | 197 | break; |
198 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: | 198 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: |
199 | toadd.Add(new LSL_Float(wl.hazeDensity)); | 199 | toadd.Add(new LSL_Float(wl.hazeHorizon)); |
200 | break; | 200 | break; |
201 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: | 201 | case (int)ScriptBaseClass.WL_HORIZON: |
202 | toadd.Add(new LSL_Float(wl.hazeHorizon)); | 202 | toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W)); |
203 | break; | 203 | break; |
204 | case (int)ScriptBaseClass.WL_HORIZON: | 204 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: |
205 | toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W)); | 205 | toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f)); |
206 | break; | 206 | break; |
207 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: | 207 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: |
208 | toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f)); | 208 | toadd.Add(new LSL_Integer(wl.maxAltitude)); |
209 | break; | 209 | break; |
210 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: | 210 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: |
211 | toadd.Add(new LSL_Integer(wl.maxAltitude)); | 211 | toadd.Add(new LSL_Key(wl.normalMapTexture.ToString())); |
212 | break; | 212 | break; |
213 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: | 213 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: |
214 | toadd.Add(new LSL_Key(wl.normalMapTexture.ToString())); | 214 | toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z)); |
215 | break; | 215 | break; |
216 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: | 216 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: |
217 | toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z)); | 217 | toadd.Add(new LSL_Float(wl.refractScaleAbove)); |
218 | break; | 218 | break; |
219 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: | 219 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: |
220 | toadd.Add(new LSL_Float(wl.refractScaleAbove)); | 220 | toadd.Add(new LSL_Float(wl.refractScaleBelow)); |
221 | break; | 221 | break; |
222 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: | 222 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: |
223 | toadd.Add(new LSL_Float(wl.refractScaleBelow)); | 223 | toadd.Add(new LSL_Float(wl.sceneGamma)); |
224 | break; | 224 | break; |
225 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: | 225 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: |
226 | toadd.Add(new LSL_Float(wl.sceneGamma)); | 226 | toadd.Add(new LSL_Float(wl.starBrightness)); |
227 | break; | 227 | break; |
228 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: | 228 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: |
229 | toadd.Add(new LSL_Float(wl.starBrightness)); | 229 | toadd.Add(new LSL_Float(wl.sunGlowFocus)); |
230 | break; | 230 | break; |
231 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: | 231 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: |
232 | toadd.Add(new LSL_Float(wl.sunGlowFocus)); | 232 | toadd.Add(new LSL_Float(wl.sunGlowSize)); |
233 | break; | 233 | break; |
234 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: | 234 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: |
235 | toadd.Add(new LSL_Float(wl.sunGlowSize)); | 235 | toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W)); |
236 | break; | 236 | break; |
237 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | 237 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: |
238 | toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W)); | 238 | toadd.Add(new LSL_Float(wl.underwaterFogModifier)); |
239 | break; | 239 | break; |
240 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: | 240 | case (int)ScriptBaseClass.WL_WATER_COLOR: |
241 | toadd.Add(new LSL_Float(wl.underwaterFogModifier)); | 241 | toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z)); |
242 | break; | 242 | break; |
243 | case (int)ScriptBaseClass.WL_WATER_COLOR: | 243 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: |
244 | toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z)); | 244 | toadd.Add(new LSL_Float(wl.waterFogDensityExponent)); |
245 | break; | 245 | break; |
246 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: | 246 | } |
247 | toadd.Add(new LSL_Float(wl.waterFogDensityExponent)); | 247 | |
248 | break; | 248 | if (toadd.Length > 0) |
249 | } | 249 | { |
250 | 250 | values.Add(rule); | |
251 | if (toadd.Length > 0) | 251 | values.Add(toadd.Data[0]); |
252 | { | 252 | } |
253 | values.Add(new LSL_Integer(rule)); | 253 | idx++; |
254 | values.Add(toadd.Data[0]); | 254 | } |
255 | } | 255 | |
256 | idx++; | 256 | return values; |
257 | } | 257 | } |
258 | 258 | ||
259 | 259 | private RegionLightShareData getWindlightProfileFromRules(LSL_List rules) | |
260 | return values; | 260 | { |
261 | 261 | RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); | |
262 | } | 262 | |
263 | 263 | // LSL_List values = new LSL_List(); | |
264 | private RegionLightShareData getWindlightProfileFromRules(LSL_List rules) | 264 | int idx = 0; |
265 | { | 265 | while (idx < rules.Length) |
266 | RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); | 266 | { |
267 | 267 | uint rule = (uint)rules.GetLSLIntegerItem(idx); | |
268 | LSL_List values = new LSL_List(); | 268 | LSL_Types.Quaternion iQ; |
269 | int idx = 0; | 269 | LSL_Types.Vector3 iV; |
270 | while (idx < rules.Length) | 270 | switch (rule) |
271 | { | 271 | { |
272 | uint rule = (uint)rules.GetLSLIntegerItem(idx); | 272 | case (int)ScriptBaseClass.WL_SUN_MOON_POSITION: |
273 | LSL_Types.Quaternion iQ; | 273 | idx++; |
274 | LSL_Types.Vector3 iV; | 274 | wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx); |
275 | switch (rule) | 275 | break; |
276 | { | 276 | case (int)ScriptBaseClass.WL_AMBIENT: |
277 | case (int)ScriptBaseClass.WL_SUN_MOON_POSITION: | 277 | idx++; |
278 | idx++; | 278 | iQ = rules.GetQuaternionItem(idx); |
279 | wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx); | 279 | wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
280 | break; | 280 | break; |
281 | case (int)ScriptBaseClass.WL_AMBIENT: | 281 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: |
282 | idx++; | 282 | idx++; |
283 | iQ = rules.GetQuaternionItem(idx); | 283 | iV = rules.GetVector3Item(idx); |
284 | wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 284 | wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y); |
285 | break; | 285 | break; |
286 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: | 286 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: |
287 | idx++; | 287 | idx++; |
288 | iV = rules.GetVector3Item(idx); | 288 | iQ = rules.GetQuaternionItem(idx); |
289 | wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y); | 289 | wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
290 | break; | 290 | break; |
291 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: | 291 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: |
292 | idx++; | 292 | idx++; |
293 | iQ = rules.GetQuaternionItem(idx); | 293 | wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx); |
294 | wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 294 | break; |
295 | break; | 295 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: |
296 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: | 296 | idx++; |
297 | idx++; | 297 | iQ = rules.GetQuaternionItem(idx); |
298 | wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx); | 298 | wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
299 | break; | 299 | break; |
300 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: | 300 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: |
301 | idx++; | 301 | idx++; |
302 | iQ = rules.GetQuaternionItem(idx); | 302 | wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx); |
303 | wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 303 | break; |
304 | break; | 304 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: |
305 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: | 305 | idx++; |
306 | idx++; | 306 | iV = rules.GetVector3Item(idx); |
307 | wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx); | 307 | wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); |
308 | break; | 308 | break; |
309 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: | 309 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: |
310 | idx++; | 310 | idx++; |
311 | iV = rules.GetVector3Item(idx); | 311 | wl.cloudScale = (float)rules.GetLSLFloatItem(idx); |
312 | wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | 312 | break; |
313 | break; | 313 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: |
314 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: | 314 | idx++; |
315 | idx++; | 315 | wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx); |
316 | wl.cloudScale = (float)rules.GetLSLFloatItem(idx); | 316 | break; |
317 | break; | 317 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: |
318 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: | 318 | idx++; |
319 | idx++; | 319 | wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; |
320 | wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx); | 320 | break; |
321 | break; | 321 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: |
322 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: | 322 | idx++; |
323 | idx++; | 323 | wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx); |
324 | wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | 324 | break; |
325 | break; | 325 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: |
326 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: | 326 | idx++; |
327 | idx++; | 327 | wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; |
328 | wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx); | 328 | break; |
329 | break; | 329 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: |
330 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: | 330 | idx++; |
331 | idx++; | 331 | iV = rules.GetVector3Item(idx); |
332 | wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | 332 | wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); |
333 | break; | 333 | break; |
334 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: | 334 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: |
335 | idx++; | 335 | idx++; |
336 | iV = rules.GetVector3Item(idx); | 336 | wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx); |
337 | wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | 337 | break; |
338 | break; | 338 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: |
339 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: | 339 | idx++; |
340 | idx++; | 340 | wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx); |
341 | wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx); | 341 | break; |
342 | break; | 342 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: |
343 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: | 343 | idx++; |
344 | idx++; | 344 | wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; |
345 | wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx); | 345 | break; |
346 | break; | 346 | case (int)ScriptBaseClass.WL_EAST_ANGLE: |
347 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: | 347 | idx++; |
348 | idx++; | 348 | wl.eastAngle = (float)rules.GetLSLFloatItem(idx); |
349 | wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | 349 | break; |
350 | break; | 350 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: |
351 | case (int)ScriptBaseClass.WL_EAST_ANGLE: | 351 | idx++; |
352 | idx++; | 352 | wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx); |
353 | wl.eastAngle = (float)rules.GetLSLFloatItem(idx); | 353 | break; |
354 | break; | 354 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: |
355 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: | 355 | idx++; |
356 | idx++; | 356 | wl.fresnelScale = (float)rules.GetLSLFloatItem(idx); |
357 | wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx); | 357 | break; |
358 | break; | 358 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: |
359 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: | 359 | idx++; |
360 | idx++; | 360 | wl.hazeDensity = (float)rules.GetLSLFloatItem(idx); |
361 | wl.fresnelScale = (float)rules.GetLSLFloatItem(idx); | 361 | break; |
362 | break; | 362 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: |
363 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: | 363 | idx++; |
364 | idx++; | 364 | wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx); |
365 | wl.hazeDensity = (float)rules.GetLSLFloatItem(idx); | 365 | break; |
366 | break; | 366 | case (int)ScriptBaseClass.WL_HORIZON: |
367 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: | 367 | idx++; |
368 | idx++; | 368 | iQ = rules.GetQuaternionItem(idx); |
369 | wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx); | 369 | wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
370 | break; | 370 | break; |
371 | case (int)ScriptBaseClass.WL_HORIZON: | 371 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: |
372 | idx++; | 372 | idx++; |
373 | iQ = rules.GetQuaternionItem(idx); | 373 | iV = rules.GetVector3Item(idx); |
374 | wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 374 | wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y); |
375 | break; | 375 | break; |
376 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: | 376 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: |
377 | idx++; | 377 | idx++; |
378 | iV = rules.GetVector3Item(idx); | 378 | wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value; |
379 | wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y); | 379 | break; |
380 | break; | 380 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: |
381 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: | 381 | idx++; |
382 | idx++; | 382 | wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); |
383 | wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value; | 383 | break; |
384 | break; | 384 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: |
385 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: | 385 | idx++; |
386 | idx++; | 386 | iV = rules.GetVector3Item(idx); |
387 | wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); | 387 | wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); |
388 | break; | 388 | break; |
389 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: | 389 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: |
390 | idx++; | 390 | idx++; |
391 | iV = rules.GetVector3Item(idx); | 391 | wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx); |
392 | wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | 392 | break; |
393 | break; | 393 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: |
394 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: | 394 | idx++; |
395 | idx++; | 395 | wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx); |
396 | wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx); | 396 | break; |
397 | break; | 397 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: |
398 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: | 398 | idx++; |
399 | idx++; | 399 | wl.sceneGamma = (float)rules.GetLSLFloatItem(idx); |
400 | wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx); | 400 | break; |
401 | break; | 401 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: |
402 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: | 402 | idx++; |
403 | idx++; | 403 | wl.starBrightness = (float)rules.GetLSLFloatItem(idx); |
404 | wl.sceneGamma = (float)rules.GetLSLFloatItem(idx); | 404 | break; |
405 | break; | 405 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: |
406 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: | 406 | idx++; |
407 | idx++; | 407 | wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx); |
408 | wl.starBrightness = (float)rules.GetLSLFloatItem(idx); | 408 | break; |
409 | break; | 409 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: |
410 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: | 410 | idx++; |
411 | idx++; | 411 | wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx); |
412 | wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx); | 412 | break; |
413 | break; | 413 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: |
414 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: | 414 | idx++; |
415 | idx++; | 415 | iQ = rules.GetQuaternionItem(idx); |
416 | wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx); | 416 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
417 | break; | 417 | break; |
418 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | 418 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: |
419 | idx++; | 419 | idx++; |
420 | iQ = rules.GetQuaternionItem(idx); | 420 | wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx); |
421 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 421 | break; |
422 | break; | 422 | case (int)ScriptBaseClass.WL_WATER_COLOR: |
423 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: | 423 | idx++; |
424 | idx++; | 424 | iV = rules.GetVector3Item(idx); |
425 | wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx); | 425 | wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); |
426 | break; | 426 | break; |
427 | case (int)ScriptBaseClass.WL_WATER_COLOR: | 427 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: |
428 | idx++; | 428 | idx++; |
429 | iV = rules.GetVector3Item(idx); | 429 | wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx); |
430 | wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | 430 | break; |
431 | break; | 431 | } |
432 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: | 432 | idx++; |
433 | idx++; | 433 | } |
434 | wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx); | 434 | return wl; |
435 | break; | 435 | } |
436 | } | 436 | /// <summary> |
437 | idx++; | 437 | /// Set the current Windlight scene |
438 | } | 438 | /// </summary> |
439 | return wl; | 439 | /// <param name="rules"></param> |
440 | } | 440 | /// <returns>success: true or false</returns> |
441 | /// <summary> | 441 | public int lsSetWindlightScene(LSL_List rules) |
442 | /// Set the current Windlight scene | 442 | { |
443 | /// </summary> | 443 | if (!m_LSFunctionsEnabled) |
444 | /// <param name="rules"></param> | 444 | { |
445 | /// <returns>success: true or false</returns> | 445 | LSShoutError("LightShare functions are not enabled."); |
446 | public int lsSetWindlightScene(LSL_List rules) | 446 | return 0; |
447 | { | 447 | } |
448 | if (!m_LSFunctionsEnabled) | 448 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
449 | { | 449 | { |
450 | LSShoutError("LightShare functions are not enabled."); | 450 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); |
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 | int success = 0; |
454 | { | 454 | m_host.AddScriptLPS(1); |
455 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); | 455 | if (LightShareModule.EnableWindlight) |
456 | return 0; | 456 | { |
457 | } | 457 | RegionLightShareData wl = getWindlightProfileFromRules(rules); |
458 | int success = 0; | 458 | m_host.ParentGroup.Scene.StoreWindlightProfile(wl); |
459 | m_host.AddScriptLPS(1); | 459 | success = 1; |
460 | if (LightShareModule.EnableWindlight) | 460 | } |
461 | { | 461 | else |
462 | RegionLightShareData wl = getWindlightProfileFromRules(rules); | 462 | { |
463 | m_host.ParentGroup.Scene.StoreWindlightProfile(wl); | 463 | LSShoutError("Windlight module is disabled"); |
464 | success = 1; | 464 | return 0; |
465 | } | 465 | } |
466 | else | 466 | return success; |
467 | { | 467 | } |
468 | LSShoutError("Windlight module is disabled"); | 468 | /// <summary> |
469 | return 0; | 469 | /// Set the current Windlight scene to a target avatar |
470 | } | 470 | /// </summary> |
471 | return success; | 471 | /// <param name="rules"></param> |
472 | } | 472 | /// <returns>success: true or false</returns> |
473 | /// <summary> | 473 | public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target) |
474 | /// Set the current Windlight scene to a target avatar | 474 | { |
475 | /// </summary> | 475 | if (!m_LSFunctionsEnabled) |
476 | /// <param name="rules"></param> | 476 | { |
477 | /// <returns>success: true or false</returns> | 477 | LSShoutError("LightShare functions are not enabled."); |
478 | public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target) | 478 | return 0; |
479 | { | 479 | } |
480 | if (!m_LSFunctionsEnabled) | 480 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
481 | { | 481 | { |
482 | LSShoutError("LightShare functions are not enabled."); | 482 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); |
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 | int success = 0; |
486 | { | 486 | m_host.AddScriptLPS(1); |
487 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); | 487 | if (LightShareModule.EnableWindlight) |
488 | return 0; | 488 | { |
489 | } | 489 | RegionLightShareData wl = getWindlightProfileFromRules(rules); |
490 | int success = 0; | 490 | World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string)); |
491 | m_host.AddScriptLPS(1); | 491 | success = 1; |
492 | if (LightShareModule.EnableWindlight) | 492 | } |
493 | { | 493 | else |
494 | RegionLightShareData wl = getWindlightProfileFromRules(rules); | 494 | { |
495 | World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string)); | 495 | LSShoutError("Windlight module is disabled"); |
496 | success = 1; | 496 | return 0; |
497 | } | 497 | } |
498 | else | 498 | return success; |
499 | { | 499 | } |
500 | LSShoutError("Windlight module is disabled"); | 500 | |
501 | return 0; | 501 | } |
502 | } | 502 | } |
503 | return success; | ||
504 | } | ||
505 | |||
506 | } | ||
507 | } | ||