aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
diff options
context:
space:
mode:
authorMelanie2010-06-11 17:46:29 +0100
committerMelanie2010-06-11 17:46:29 +0100
commitaa2f5bdd77b6694b5fd4547a881f339f4679933e (patch)
tree664a8658067f6f9c0e0c3e9befd1f79aba733293 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
parentRemove cmGetAvatarList() (diff)
parentRename CM files to LS (diff)
downloadopensim-SC-aa2f5bdd77b6694b5fd4547a881f339f4679933e.zip
opensim-SC-aa2f5bdd77b6694b5fd4547a881f339f4679933e.tar.gz
opensim-SC-aa2f5bdd77b6694b5fd4547a881f339f4679933e.tar.bz2
opensim-SC-aa2f5bdd77b6694b5fd4547a881f339f4679933e.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs504
1 files changed, 504 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
new file mode 100644
index 0000000..fe71ed5
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -0,0 +1,504 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using System.Collections;
31using System.Collections.Generic;
32using System.Runtime.Remoting.Lifetime;
33using OpenMetaverse;
34using Nini.Config;
35using OpenSim;
36using OpenSim.Framework;
37using OpenSim.Region.CoreModules.World.LightShare;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.ScriptEngine.Shared;
41using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
42using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
43using OpenSim.Region.ScriptEngine.Interfaces;
44using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
45
46using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
47using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
48using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
49using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
50using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
51using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
52using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
53
54namespace OpenSim.Region.ScriptEngine.Shared.Api
55{
56 [Serializable]
57 public class LS_Api : MarshalByRefObject, ILS_Api, IScriptApi
58 {
59 internal IScriptEngine m_ScriptEngine;
60 internal SceneObjectPart m_host;
61 internal uint m_localID;
62 internal UUID m_itemID;
63 internal bool m_LSFunctionsEnabled = false;
64 internal IScriptModuleComms m_comms = null;
65
66 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
67 {
68 m_ScriptEngine = ScriptEngine;
69 m_host = host;
70 m_localID = localID;
71 m_itemID = itemID;
72
73 if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
74 m_LSFunctionsEnabled = true;
75
76 m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
77 if (m_comms == null)
78 m_LSFunctionsEnabled = false;
79 }
80
81 public override Object InitializeLifetimeService()
82 {
83 ILease lease = (ILease)base.InitializeLifetimeService();
84
85 if (lease.CurrentState == LeaseState.Initial)
86 {
87 lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
88 // lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
89 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
90 }
91 return lease;
92 }
93
94 public Scene World
95 {
96 get { return m_ScriptEngine.World; }
97 }
98
99 //
100 //Dumps an error message on the debug console.
101 //
102
103 internal void LSShoutError(string message)
104 {
105 if (message.Length > 1023)
106 message = message.Substring(0, 1023);
107
108 World.SimChat(Utils.StringToBytes(message),
109 ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
110
111 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
112 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
113 }
114
115 /// <summary>
116 /// Get the current Windlight scene
117 /// </summary>
118 /// <returns>List of windlight parameters</returns>
119 public LSL_List lsGetWindlightScene(LSL_List rules)
120 {
121 if (!m_LSFunctionsEnabled)
122 {
123 LSShoutError("LightShare functions are not enabled.");
124 return new LSL_List();
125 }
126 m_host.AddScriptLPS(1);
127 RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
128
129 LSL_List values = new LSL_List();
130 int idx = 0;
131 while (idx < rules.Length)
132 {
133 uint rule = (uint)rules.GetLSLIntegerItem(idx);
134 LSL_List toadd = new LSL_List();
135
136 switch (rule)
137 {
138 case (int)ScriptBaseClass.WL_AMBIENT:
139 toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
140 break;
141 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
142 toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
143 break;
144 case (int)ScriptBaseClass.WL_BLUE_DENSITY:
145 toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
146 break;
147 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
148 toadd.Add(new LSL_Float(wl.blurMultiplier));
149 break;
150 case (int)ScriptBaseClass.WL_CLOUD_COLOR:
151 toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
152 break;
153 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
154 toadd.Add(new LSL_Float(wl.cloudCoverage));
155 break;
156 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
157 toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
158 break;
159 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
160 toadd.Add(new LSL_Float(wl.cloudScale));
161 break;
162 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
163 toadd.Add(new LSL_Float(wl.cloudScrollX));
164 break;
165 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
166 toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
167 break;
168 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
169 toadd.Add(new LSL_Float(wl.cloudScrollY));
170 break;
171 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
172 toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
173 break;
174 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
175 toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
176 break;
177 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
178 toadd.Add(new LSL_Float(wl.densityMultiplier));
179 break;
180 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
181 toadd.Add(new LSL_Float(wl.distanceMultiplier));
182 break;
183 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
184 toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
185 break;
186 case (int)ScriptBaseClass.WL_EAST_ANGLE:
187 toadd.Add(new LSL_Float(wl.eastAngle));
188 break;
189 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
190 toadd.Add(new LSL_Float(wl.fresnelOffset));
191 break;
192 case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
193 toadd.Add(new LSL_Float(wl.fresnelScale));
194 break;
195 case (int)ScriptBaseClass.WL_HAZE_DENSITY:
196 toadd.Add(new LSL_Float(wl.hazeDensity));
197 break;
198 case (int)ScriptBaseClass.WL_HAZE_HORIZON:
199 toadd.Add(new LSL_Float(wl.hazeHorizon));
200 break;
201 case (int)ScriptBaseClass.WL_HORIZON:
202 toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
203 break;
204 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
205 toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
206 break;
207 case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
208 toadd.Add(new LSL_Integer(wl.maxAltitude));
209 break;
210 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
211 toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
212 break;
213 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
214 toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
215 break;
216 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
217 toadd.Add(new LSL_Float(wl.refractScaleAbove));
218 break;
219 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
220 toadd.Add(new LSL_Float(wl.refractScaleBelow));
221 break;
222 case (int)ScriptBaseClass.WL_SCENE_GAMMA:
223 toadd.Add(new LSL_Float(wl.sceneGamma));
224 break;
225 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
226 toadd.Add(new LSL_Float(wl.starBrightness));
227 break;
228 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
229 toadd.Add(new LSL_Float(wl.sunGlowFocus));
230 break;
231 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
232 toadd.Add(new LSL_Float(wl.sunGlowSize));
233 break;
234 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
235 toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
236 break;
237 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
238 toadd.Add(new LSL_Float(wl.underwaterFogModifier));
239 break;
240 case (int)ScriptBaseClass.WL_WATER_COLOR:
241 toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
242 break;
243 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
244 toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
245 break;
246 }
247
248 if (toadd.Length > 0)
249 {
250 values.Add(rule);
251 values.Add(toadd.Data[0]);
252 }
253 idx++;
254 }
255
256
257 return values;
258
259 }
260
261 private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
262 {
263 RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
264
265 LSL_List values = new LSL_List();
266 int idx = 0;
267 while (idx < rules.Length)
268 {
269 uint rule = (uint)rules.GetLSLIntegerItem(idx);
270 LSL_Types.Quaternion iQ;
271 LSL_Types.Vector3 iV;
272 switch (rule)
273 {
274 case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
275 idx++;
276 wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
277 break;
278 case (int)ScriptBaseClass.WL_AMBIENT:
279 idx++;
280 iQ = rules.GetQuaternionItem(idx);
281 wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
282 break;
283 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
284 idx++;
285 iV = rules.GetVector3Item(idx);
286 wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
287 break;
288 case (int)ScriptBaseClass.WL_BLUE_DENSITY:
289 idx++;
290 iQ = rules.GetQuaternionItem(idx);
291 wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
292 break;
293 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
294 idx++;
295 wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
296 break;
297 case (int)ScriptBaseClass.WL_CLOUD_COLOR:
298 idx++;
299 iQ = rules.GetQuaternionItem(idx);
300 wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
301 break;
302 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
303 idx++;
304 wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
305 break;
306 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
307 idx++;
308 iV = rules.GetVector3Item(idx);
309 wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
310 break;
311 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
312 idx++;
313 wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
314 break;
315 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
316 idx++;
317 wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
318 break;
319 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
320 idx++;
321 wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
322 break;
323 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
324 idx++;
325 wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
326 break;
327 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
328 idx++;
329 wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
330 break;
331 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
332 idx++;
333 iV = rules.GetVector3Item(idx);
334 wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
335 break;
336 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
337 idx++;
338 wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
339 break;
340 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
341 idx++;
342 wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
343 break;
344 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
345 idx++;
346 wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
347 break;
348 case (int)ScriptBaseClass.WL_EAST_ANGLE:
349 idx++;
350 wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
351 break;
352 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
353 idx++;
354 wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
355 break;
356 case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
357 idx++;
358 wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
359 break;
360 case (int)ScriptBaseClass.WL_HAZE_DENSITY:
361 idx++;
362 wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
363 break;
364 case (int)ScriptBaseClass.WL_HAZE_HORIZON:
365 idx++;
366 wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
367 break;
368 case (int)ScriptBaseClass.WL_HORIZON:
369 idx++;
370 iQ = rules.GetQuaternionItem(idx);
371 wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
372 break;
373 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
374 idx++;
375 iV = rules.GetVector3Item(idx);
376 wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
377 break;
378 case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
379 idx++;
380 wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
381 break;
382 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
383 idx++;
384 wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
385 break;
386 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
387 idx++;
388 iV = rules.GetVector3Item(idx);
389 wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
390 break;
391 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
392 idx++;
393 wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
394 break;
395 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
396 idx++;
397 wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
398 break;
399 case (int)ScriptBaseClass.WL_SCENE_GAMMA:
400 idx++;
401 wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
402 break;
403 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
404 idx++;
405 wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
406 break;
407 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
408 idx++;
409 wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
410 break;
411 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
412 idx++;
413 wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
414 break;
415 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
416 idx++;
417 iQ = rules.GetQuaternionItem(idx);
418 wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
419 break;
420 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
421 idx++;
422 wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
423 break;
424 case (int)ScriptBaseClass.WL_WATER_COLOR:
425 idx++;
426 iV = rules.GetVector3Item(idx);
427 wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
428 break;
429 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
430 idx++;
431 wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
432 break;
433 }
434 idx++;
435 }
436 return wl;
437 }
438 /// <summary>
439 /// Set the current Windlight scene
440 /// </summary>
441 /// <param name="rules"></param>
442 /// <returns>success: true or false</returns>
443 public int lsSetWindlightScene(LSL_List rules)
444 {
445 if (!m_LSFunctionsEnabled)
446 {
447 LSShoutError("LightShare functions are not enabled.");
448 return 0;
449 }
450 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
451 {
452 LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
453 return 0;
454 }
455 int success = 0;
456 m_host.AddScriptLPS(1);
457 if (LightShareModule.EnableWindlight)
458 {
459 RegionLightShareData wl = getWindlightProfileFromRules(rules);
460 m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
461 success = 1;
462 }
463 else
464 {
465 LSShoutError("Windlight module is disabled");
466 return 0;
467 }
468 return success;
469 }
470 /// <summary>
471 /// Set the current Windlight scene to a target avatar
472 /// </summary>
473 /// <param name="rules"></param>
474 /// <returns>success: true or false</returns>
475 public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
476 {
477 if (!m_LSFunctionsEnabled)
478 {
479 LSShoutError("LightShare functions are not enabled.");
480 return 0;
481 }
482 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
483 {
484 LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
485 return 0;
486 }
487 int success = 0;
488 m_host.AddScriptLPS(1);
489 if (LightShareModule.EnableWindlight)
490 {
491 RegionLightShareData wl = getWindlightProfileFromRules(rules);
492 World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
493 success = 1;
494 }
495 else
496 {
497 LSShoutError("Windlight module is disabled");
498 return 0;
499 }
500 return success;
501 }
502
503 }
504}