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