aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authormeta72010-08-07 16:18:44 -0700
committermeta72010-08-07 16:18:44 -0700
commita6048518b7afb27cb523c0074d38c849ea0b6884 (patch)
treee2365652b5f8bb18a41a54a23497df0e2db36344 /OpenSim/Region/ScriptEngine
parentFix the distance from which autopilot is negated when sitting on an unscripte... (diff)
downloadopensim-SC_OLD-a6048518b7afb27cb523c0074d38c849ea0b6884.zip
opensim-SC_OLD-a6048518b7afb27cb523c0074d38c849ea0b6884.tar.gz
opensim-SC_OLD-a6048518b7afb27cb523c0074d38c849ea0b6884.tar.bz2
opensim-SC_OLD-a6048518b7afb27cb523c0074d38c849ea0b6884.tar.xz
Repair lsGetWindlightScene, the constant was added to the list as a uint, which is bad - convert to LSL_Integer first.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs1014
1 files changed, 507 insertions, 507 deletions
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
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
33using OpenMetaverse; 33using OpenMetaverse;
34using Nini.Config; 34using Nini.Config;
35using OpenSim; 35using OpenSim;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Region.CoreModules.World.LightShare; 37using OpenSim.Region.CoreModules.World.LightShare;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.ScriptEngine.Shared; 40using OpenSim.Region.ScriptEngine.Shared;
41using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; 41using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
42using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 42using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
43using OpenSim.Region.ScriptEngine.Interfaces; 43using OpenSim.Region.ScriptEngine.Interfaces;
44using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 44using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
45 45
46using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; 46using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
47using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 47using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
48using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 48using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
49using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; 49using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
50using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; 50using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
51using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 51using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
52using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 52using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
53 53
54namespace OpenSim.Region.ScriptEngine.Shared.Api 54namespace 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}