diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
11 files changed, 1349 insertions, 341 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs new file mode 100644 index 0000000..99973b4 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | |||
@@ -0,0 +1,477 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Collections; | ||
4 | using System.Collections.Generic; | ||
5 | using System.Runtime.Remoting.Lifetime; | ||
6 | using OpenMetaverse; | ||
7 | using Nini.Config; | ||
8 | using OpenSim; | ||
9 | using OpenSim.Framework; | ||
10 | using OpenSim.Region.CoreModules.World.Meta7Windlight; | ||
11 | using OpenSim.Region.Framework.Interfaces; | ||
12 | using OpenSim.Region.Framework.Scenes; | ||
13 | using OpenSim.Region.ScriptEngine.Shared; | ||
14 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | ||
15 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | ||
16 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
17 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | ||
18 | |||
19 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | ||
20 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | ||
21 | using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
22 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; | ||
23 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | ||
24 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
25 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | ||
26 | |||
27 | namespace OpenSim.Region.ScriptEngine.Shared.Api | ||
28 | { | ||
29 | [Serializable] | ||
30 | public class CM_Api : MarshalByRefObject, ICM_Api, IScriptApi | ||
31 | { | ||
32 | internal IScriptEngine m_ScriptEngine; | ||
33 | internal SceneObjectPart m_host; | ||
34 | internal uint m_localID; | ||
35 | internal UUID m_itemID; | ||
36 | internal bool m_CMFunctionsEnabled = false; | ||
37 | internal IScriptModuleComms m_comms = null; | ||
38 | |||
39 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | ||
40 | { | ||
41 | m_ScriptEngine = ScriptEngine; | ||
42 | m_host = host; | ||
43 | m_localID = localID; | ||
44 | m_itemID = itemID; | ||
45 | |||
46 | if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false)) | ||
47 | m_CMFunctionsEnabled = true; | ||
48 | |||
49 | m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); | ||
50 | if (m_comms == null) | ||
51 | m_CMFunctionsEnabled = false; | ||
52 | } | ||
53 | |||
54 | public override Object InitializeLifetimeService() | ||
55 | { | ||
56 | ILease lease = (ILease)base.InitializeLifetimeService(); | ||
57 | |||
58 | if (lease.CurrentState == LeaseState.Initial) | ||
59 | { | ||
60 | lease.InitialLeaseTime = TimeSpan.FromMinutes(0); | ||
61 | // lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); | ||
62 | // lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); | ||
63 | } | ||
64 | return lease; | ||
65 | } | ||
66 | |||
67 | public Scene World | ||
68 | { | ||
69 | get { return m_ScriptEngine.World; } | ||
70 | } | ||
71 | |||
72 | // | ||
73 | //Dumps an error message on the debug console. | ||
74 | // | ||
75 | |||
76 | internal void CMShoutError(string message) | ||
77 | { | ||
78 | if (message.Length > 1023) | ||
79 | message = message.Substring(0, 1023); | ||
80 | |||
81 | World.SimChat(Utils.StringToBytes(message), | ||
82 | ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); | ||
83 | |||
84 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | ||
85 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); | ||
86 | } | ||
87 | |||
88 | /// <summary> | ||
89 | /// Get the current Windlight scene | ||
90 | /// </summary> | ||
91 | /// <returns>List of windlight parameters</returns> | ||
92 | public LSL_List cmGetWindlightScene(LSL_List rules) | ||
93 | { | ||
94 | if (!m_CMFunctionsEnabled) | ||
95 | { | ||
96 | CMShoutError("Careminster functions are not enabled."); | ||
97 | return new LSL_List(); | ||
98 | } | ||
99 | m_host.AddScriptLPS(1); | ||
100 | RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; | ||
101 | |||
102 | LSL_List values = new LSL_List(); | ||
103 | int idx = 0; | ||
104 | while (idx < rules.Length) | ||
105 | { | ||
106 | uint rule = (uint)rules.GetLSLIntegerItem(idx); | ||
107 | LSL_List toadd = new LSL_List(); | ||
108 | |||
109 | switch (rule) | ||
110 | { | ||
111 | case (int)ScriptBaseClass.WL_AMBIENT: | ||
112 | toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W)); | ||
113 | break; | ||
114 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: | ||
115 | toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f)); | ||
116 | break; | ||
117 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: | ||
118 | toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W)); | ||
119 | break; | ||
120 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: | ||
121 | toadd.Add(new LSL_Float(wl.blurMultiplier)); | ||
122 | break; | ||
123 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: | ||
124 | toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W)); | ||
125 | break; | ||
126 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: | ||
127 | toadd.Add(new LSL_Float(wl.cloudCoverage)); | ||
128 | break; | ||
129 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: | ||
130 | toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z)); | ||
131 | break; | ||
132 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: | ||
133 | toadd.Add(new LSL_Float(wl.cloudScale)); | ||
134 | break; | ||
135 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: | ||
136 | toadd.Add(new LSL_Float(wl.cloudScrollX)); | ||
137 | break; | ||
138 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: | ||
139 | toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0)); | ||
140 | break; | ||
141 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: | ||
142 | toadd.Add(new LSL_Float(wl.cloudScrollY)); | ||
143 | break; | ||
144 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: | ||
145 | toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0)); | ||
146 | break; | ||
147 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: | ||
148 | toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z)); | ||
149 | break; | ||
150 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: | ||
151 | toadd.Add(new LSL_Float(wl.densityMultiplier)); | ||
152 | break; | ||
153 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: | ||
154 | toadd.Add(new LSL_Float(wl.distanceMultiplier)); | ||
155 | break; | ||
156 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: | ||
157 | toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0)); | ||
158 | break; | ||
159 | case (int)ScriptBaseClass.WL_EAST_ANGLE: | ||
160 | toadd.Add(new LSL_Float(wl.eastAngle)); | ||
161 | break; | ||
162 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: | ||
163 | toadd.Add(new LSL_Float(wl.fresnelOffset)); | ||
164 | break; | ||
165 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: | ||
166 | toadd.Add(new LSL_Float(wl.fresnelScale)); | ||
167 | break; | ||
168 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: | ||
169 | toadd.Add(new LSL_Float(wl.hazeDensity)); | ||
170 | break; | ||
171 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: | ||
172 | toadd.Add(new LSL_Float(wl.hazeHorizon)); | ||
173 | break; | ||
174 | case (int)ScriptBaseClass.WL_HORIZON: | ||
175 | toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W)); | ||
176 | break; | ||
177 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: | ||
178 | toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f)); | ||
179 | break; | ||
180 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: | ||
181 | toadd.Add(new LSL_Integer(wl.maxAltitude)); | ||
182 | break; | ||
183 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: | ||
184 | toadd.Add(new LSL_Key(wl.normalMapTexture.ToString())); | ||
185 | break; | ||
186 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: | ||
187 | toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z)); | ||
188 | break; | ||
189 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: | ||
190 | toadd.Add(new LSL_Float(wl.refractScaleAbove)); | ||
191 | break; | ||
192 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: | ||
193 | toadd.Add(new LSL_Float(wl.refractScaleBelow)); | ||
194 | break; | ||
195 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: | ||
196 | toadd.Add(new LSL_Float(wl.sceneGamma)); | ||
197 | break; | ||
198 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: | ||
199 | toadd.Add(new LSL_Float(wl.starBrightness)); | ||
200 | break; | ||
201 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: | ||
202 | toadd.Add(new LSL_Float(wl.sunGlowFocus)); | ||
203 | break; | ||
204 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: | ||
205 | toadd.Add(new LSL_Float(wl.sunGlowSize)); | ||
206 | break; | ||
207 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | ||
208 | toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W)); | ||
209 | break; | ||
210 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: | ||
211 | toadd.Add(new LSL_Float(wl.underwaterFogModifier)); | ||
212 | break; | ||
213 | case (int)ScriptBaseClass.WL_WATER_COLOR: | ||
214 | toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z)); | ||
215 | break; | ||
216 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: | ||
217 | toadd.Add(new LSL_Float(wl.waterFogDensityExponent)); | ||
218 | break; | ||
219 | } | ||
220 | |||
221 | if (toadd.Length > 0) | ||
222 | { | ||
223 | values.Add(rule); | ||
224 | values.Add(toadd.Data[0]); | ||
225 | } | ||
226 | idx++; | ||
227 | } | ||
228 | |||
229 | |||
230 | return values; | ||
231 | |||
232 | } | ||
233 | |||
234 | private RegionMeta7WindlightData getWindlightProfileFromRules(LSL_List rules) | ||
235 | { | ||
236 | RegionMeta7WindlightData wl = (RegionMeta7WindlightData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); | ||
237 | |||
238 | LSL_List values = new LSL_List(); | ||
239 | int idx = 0; | ||
240 | while (idx < rules.Length) | ||
241 | { | ||
242 | uint rule = (uint)rules.GetLSLIntegerItem(idx); | ||
243 | LSL_Types.Quaternion iQ; | ||
244 | LSL_Types.Vector3 iV; | ||
245 | switch (rule) | ||
246 | { | ||
247 | case (int)ScriptBaseClass.WL_SUN_MOON_POSITION: | ||
248 | idx++; | ||
249 | wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx); | ||
250 | break; | ||
251 | case (int)ScriptBaseClass.WL_AMBIENT: | ||
252 | idx++; | ||
253 | iQ = rules.GetQuaternionItem(idx); | ||
254 | wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
255 | break; | ||
256 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: | ||
257 | idx++; | ||
258 | iV = rules.GetVector3Item(idx); | ||
259 | wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y); | ||
260 | break; | ||
261 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: | ||
262 | idx++; | ||
263 | iQ = rules.GetQuaternionItem(idx); | ||
264 | wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
265 | break; | ||
266 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: | ||
267 | idx++; | ||
268 | wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
269 | break; | ||
270 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: | ||
271 | idx++; | ||
272 | iQ = rules.GetQuaternionItem(idx); | ||
273 | wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
274 | break; | ||
275 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: | ||
276 | idx++; | ||
277 | wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx); | ||
278 | break; | ||
279 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: | ||
280 | idx++; | ||
281 | iV = rules.GetVector3Item(idx); | ||
282 | wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
283 | break; | ||
284 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: | ||
285 | idx++; | ||
286 | wl.cloudScale = (float)rules.GetLSLFloatItem(idx); | ||
287 | break; | ||
288 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: | ||
289 | idx++; | ||
290 | wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx); | ||
291 | break; | ||
292 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: | ||
293 | idx++; | ||
294 | wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
295 | break; | ||
296 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: | ||
297 | idx++; | ||
298 | wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx); | ||
299 | break; | ||
300 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: | ||
301 | idx++; | ||
302 | wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
303 | break; | ||
304 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: | ||
305 | idx++; | ||
306 | iV = rules.GetVector3Item(idx); | ||
307 | wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
308 | break; | ||
309 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: | ||
310 | idx++; | ||
311 | wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
312 | break; | ||
313 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: | ||
314 | idx++; | ||
315 | wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
316 | break; | ||
317 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: | ||
318 | idx++; | ||
319 | wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
320 | break; | ||
321 | case (int)ScriptBaseClass.WL_EAST_ANGLE: | ||
322 | idx++; | ||
323 | wl.eastAngle = (float)rules.GetLSLFloatItem(idx); | ||
324 | break; | ||
325 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: | ||
326 | idx++; | ||
327 | wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx); | ||
328 | break; | ||
329 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: | ||
330 | idx++; | ||
331 | wl.fresnelScale = (float)rules.GetLSLFloatItem(idx); | ||
332 | break; | ||
333 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: | ||
334 | idx++; | ||
335 | wl.hazeDensity = (float)rules.GetLSLFloatItem(idx); | ||
336 | break; | ||
337 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: | ||
338 | idx++; | ||
339 | wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx); | ||
340 | break; | ||
341 | case (int)ScriptBaseClass.WL_HORIZON: | ||
342 | idx++; | ||
343 | iQ = rules.GetQuaternionItem(idx); | ||
344 | wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
345 | break; | ||
346 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: | ||
347 | idx++; | ||
348 | iV = rules.GetVector3Item(idx); | ||
349 | wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y); | ||
350 | break; | ||
351 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: | ||
352 | idx++; | ||
353 | wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value; | ||
354 | break; | ||
355 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: | ||
356 | idx++; | ||
357 | wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); | ||
358 | break; | ||
359 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: | ||
360 | idx++; | ||
361 | iV = rules.GetVector3Item(idx); | ||
362 | wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
363 | break; | ||
364 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: | ||
365 | idx++; | ||
366 | wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx); | ||
367 | break; | ||
368 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: | ||
369 | idx++; | ||
370 | wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx); | ||
371 | break; | ||
372 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: | ||
373 | idx++; | ||
374 | wl.sceneGamma = (float)rules.GetLSLFloatItem(idx); | ||
375 | break; | ||
376 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: | ||
377 | idx++; | ||
378 | wl.starBrightness = (float)rules.GetLSLFloatItem(idx); | ||
379 | break; | ||
380 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: | ||
381 | idx++; | ||
382 | wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx); | ||
383 | break; | ||
384 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: | ||
385 | idx++; | ||
386 | wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx); | ||
387 | break; | ||
388 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | ||
389 | idx++; | ||
390 | iQ = rules.GetQuaternionItem(idx); | ||
391 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
392 | break; | ||
393 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: | ||
394 | idx++; | ||
395 | wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx); | ||
396 | break; | ||
397 | case (int)ScriptBaseClass.WL_WATER_COLOR: | ||
398 | idx++; | ||
399 | iV = rules.GetVector3Item(idx); | ||
400 | wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
401 | break; | ||
402 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: | ||
403 | idx++; | ||
404 | wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx); | ||
405 | break; | ||
406 | } | ||
407 | idx++; | ||
408 | } | ||
409 | return wl; | ||
410 | } | ||
411 | /// <summary> | ||
412 | /// Set the current Windlight scene | ||
413 | /// </summary> | ||
414 | /// <param name="rules"></param> | ||
415 | /// <returns>success: true or false</returns> | ||
416 | public int cmSetWindlightScene(LSL_List rules) | ||
417 | { | ||
418 | if (!m_CMFunctionsEnabled) | ||
419 | { | ||
420 | CMShoutError("Careminster functions are not enabled."); | ||
421 | return 0; | ||
422 | } | ||
423 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | ||
424 | { | ||
425 | CMShoutError("cmSetWindlightScene can only be used by estate managers or owners."); | ||
426 | return 0; | ||
427 | } | ||
428 | int success = 0; | ||
429 | m_host.AddScriptLPS(1); | ||
430 | if (Meta7WindlightModule.EnableWindlight) | ||
431 | { | ||
432 | RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules); | ||
433 | m_host.ParentGroup.Scene.StoreWindlightProfile(wl); | ||
434 | success = 1; | ||
435 | } | ||
436 | else | ||
437 | { | ||
438 | CMShoutError("Windlight module is disabled"); | ||
439 | return 0; | ||
440 | } | ||
441 | return success; | ||
442 | } | ||
443 | /// <summary> | ||
444 | /// Set the current Windlight scene to a target avatar | ||
445 | /// </summary> | ||
446 | /// <param name="rules"></param> | ||
447 | /// <returns>success: true or false</returns> | ||
448 | public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target) | ||
449 | { | ||
450 | if (!m_CMFunctionsEnabled) | ||
451 | { | ||
452 | CMShoutError("Careminster functions are not enabled."); | ||
453 | return 0; | ||
454 | } | ||
455 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | ||
456 | { | ||
457 | CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners."); | ||
458 | return 0; | ||
459 | } | ||
460 | int success = 0; | ||
461 | m_host.AddScriptLPS(1); | ||
462 | if (Meta7WindlightModule.EnableWindlight) | ||
463 | { | ||
464 | RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules); | ||
465 | World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string)); | ||
466 | success = 1; | ||
467 | } | ||
468 | else | ||
469 | { | ||
470 | CMShoutError("Windlight module is disabled"); | ||
471 | return 0; | ||
472 | } | ||
473 | return success; | ||
474 | } | ||
475 | |||
476 | } | ||
477 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a373046..3154f9e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Diagnostics; //for [DebuggerNonUserCode] | ||
31 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
32 | using System.Text; | 33 | using System.Text; |
33 | using System.Threading; | 34 | using System.Threading; |
@@ -151,6 +152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
151 | get { return m_ScriptEngine.World; } | 152 | get { return m_ScriptEngine.World; } |
152 | } | 153 | } |
153 | 154 | ||
155 | [DebuggerNonUserCode] | ||
154 | public void state(string newState) | 156 | public void state(string newState) |
155 | { | 157 | { |
156 | m_ScriptEngine.SetState(m_itemID, newState); | 158 | m_ScriptEngine.SetState(m_itemID, newState); |
@@ -160,6 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
160 | /// Reset the named script. The script must be present | 162 | /// Reset the named script. The script must be present |
161 | /// in the same prim. | 163 | /// in the same prim. |
162 | /// </summary> | 164 | /// </summary> |
165 | [DebuggerNonUserCode] | ||
163 | public void llResetScript() | 166 | public void llResetScript() |
164 | { | 167 | { |
165 | m_host.AddScriptLPS(1); | 168 | m_host.AddScriptLPS(1); |
@@ -218,7 +221,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
218 | 221 | ||
219 | public List<SceneObjectPart> GetLinkParts(int linkType) | 222 | public List<SceneObjectPart> GetLinkParts(int linkType) |
220 | { | 223 | { |
221 | List<SceneObjectPart> ret = new List<SceneObjectPart>(); | 224 | List<SceneObjectPart> ret = new List<SceneObjectPart>(); |
225 | if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted) | ||
226 | return ret; | ||
222 | ret.Add(m_host); | 227 | ret.Add(m_host); |
223 | 228 | ||
224 | switch (linkType) | 229 | switch (linkType) |
@@ -272,40 +277,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
272 | protected UUID InventorySelf() | 277 | protected UUID InventorySelf() |
273 | { | 278 | { |
274 | UUID invItemID = new UUID(); | 279 | UUID invItemID = new UUID(); |
275 | 280 | bool unlock = false; | |
276 | lock (m_host.TaskInventory) | 281 | if (!m_host.TaskInventory.IsReadLockedByMe()) |
277 | { | 282 | { |
278 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 283 | m_host.TaskInventory.LockItemsForRead(true); |
284 | unlock = true; | ||
285 | } | ||
286 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
287 | { | ||
288 | if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) | ||
279 | { | 289 | { |
280 | if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) | 290 | invItemID = inv.Key; |
281 | { | 291 | break; |
282 | invItemID = inv.Key; | ||
283 | break; | ||
284 | } | ||
285 | } | 292 | } |
286 | } | 293 | } |
287 | 294 | if (unlock) | |
295 | { | ||
296 | m_host.TaskInventory.LockItemsForRead(false); | ||
297 | } | ||
288 | return invItemID; | 298 | return invItemID; |
289 | } | 299 | } |
290 | 300 | ||
291 | protected UUID InventoryKey(string name, int type) | 301 | protected UUID InventoryKey(string name, int type) |
292 | { | 302 | { |
293 | m_host.AddScriptLPS(1); | 303 | m_host.AddScriptLPS(1); |
294 | 304 | m_host.TaskInventory.LockItemsForRead(true); | |
295 | lock (m_host.TaskInventory) | 305 | |
306 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
296 | { | 307 | { |
297 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 308 | if (inv.Value.Name == name) |
298 | { | 309 | { |
299 | if (inv.Value.Name == name) | 310 | m_host.TaskInventory.LockItemsForRead(false); |
311 | |||
312 | if (inv.Value.Type != type) | ||
300 | { | 313 | { |
301 | if (inv.Value.Type != type) | 314 | return UUID.Zero; |
302 | return UUID.Zero; | ||
303 | |||
304 | return inv.Value.AssetID; | ||
305 | } | 315 | } |
316 | |||
317 | return inv.Value.AssetID; | ||
306 | } | 318 | } |
307 | } | 319 | } |
308 | 320 | ||
321 | m_host.TaskInventory.LockItemsForRead(false); | ||
309 | return UUID.Zero; | 322 | return UUID.Zero; |
310 | } | 323 | } |
311 | 324 | ||
@@ -313,17 +326,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
313 | { | 326 | { |
314 | m_host.AddScriptLPS(1); | 327 | m_host.AddScriptLPS(1); |
315 | 328 | ||
316 | lock (m_host.TaskInventory) | 329 | |
330 | m_host.TaskInventory.LockItemsForRead(true); | ||
331 | |||
332 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
317 | { | 333 | { |
318 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 334 | if (inv.Value.Name == name) |
319 | { | 335 | { |
320 | if (inv.Value.Name == name) | 336 | m_host.TaskInventory.LockItemsForRead(false); |
321 | { | 337 | return inv.Value.AssetID; |
322 | return inv.Value.AssetID; | ||
323 | } | ||
324 | } | 338 | } |
325 | } | 339 | } |
326 | 340 | ||
341 | m_host.TaskInventory.LockItemsForRead(false); | ||
342 | |||
343 | |||
327 | return UUID.Zero; | 344 | return UUID.Zero; |
328 | } | 345 | } |
329 | 346 | ||
@@ -705,6 +722,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
705 | { | 722 | { |
706 | //A and B should both be normalized | 723 | //A and B should both be normalized |
707 | m_host.AddScriptLPS(1); | 724 | m_host.AddScriptLPS(1); |
725 | /* This method is more accurate than the SL one, and thus causes problems | ||
726 | for scripts that deal with the SL inaccuracy around 180-degrees -.- .._. | ||
727 | |||
708 | double dotProduct = LSL_Vector.Dot(a, b); | 728 | double dotProduct = LSL_Vector.Dot(a, b); |
709 | LSL_Vector crossProduct = LSL_Vector.Cross(a, b); | 729 | LSL_Vector crossProduct = LSL_Vector.Cross(a, b); |
710 | double magProduct = LSL_Vector.Mag(a) * LSL_Vector.Mag(b); | 730 | double magProduct = LSL_Vector.Mag(a) * LSL_Vector.Mag(b); |
@@ -721,8 +741,57 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
721 | return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f); | 741 | return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f); |
722 | 742 | ||
723 | return new LSL_Rotation((float)x, (float)y, (float)z, (float)w); | 743 | return new LSL_Rotation((float)x, (float)y, (float)z, (float)w); |
724 | } | 744 | */ |
725 | 745 | ||
746 | // This method mimics the 180 errors found in SL | ||
747 | // See www.euclideanspace.com... angleBetween | ||
748 | LSL_Vector vec_a = a; | ||
749 | LSL_Vector vec_b = b; | ||
750 | |||
751 | // Eliminate zero length | ||
752 | LSL_Float vec_a_mag = LSL_Vector.Mag(vec_a); | ||
753 | LSL_Float vec_b_mag = LSL_Vector.Mag(vec_b); | ||
754 | if (vec_a_mag < 0.00001 || | ||
755 | vec_b_mag < 0.00001) | ||
756 | { | ||
757 | return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f); | ||
758 | } | ||
759 | |||
760 | // Normalize | ||
761 | vec_a = llVecNorm(vec_a); | ||
762 | vec_b = llVecNorm(vec_b); | ||
763 | |||
764 | // Calculate axis and rotation angle | ||
765 | LSL_Vector axis = vec_a % vec_b; | ||
766 | LSL_Float cos_theta = vec_a * vec_b; | ||
767 | |||
768 | // Check if parallel | ||
769 | if (cos_theta > 0.99999) | ||
770 | { | ||
771 | return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f); | ||
772 | } | ||
773 | |||
774 | // Check if anti-parallel | ||
775 | else if (cos_theta < -0.99999) | ||
776 | { | ||
777 | LSL_Vector orthog_axis = new LSL_Vector(1.0, 0.0, 0.0) - (vec_a.x / (vec_a * vec_a) * vec_a); | ||
778 | if (LSL_Vector.Mag(orthog_axis) < 0.000001) orthog_axis = new LSL_Vector(0.0, 0.0, 1.0); | ||
779 | return new LSL_Rotation((float)orthog_axis.x, (float)orthog_axis.y, (float)orthog_axis.z, 0.0); | ||
780 | } | ||
781 | else // other rotation | ||
782 | { | ||
783 | LSL_Float theta = (LSL_Float)Math.Acos(cos_theta) * 0.5f; | ||
784 | axis = llVecNorm(axis); | ||
785 | double x, y, z, s, t; | ||
786 | s = Math.Cos(theta); | ||
787 | t = Math.Sin(theta); | ||
788 | x = axis.x * t; | ||
789 | y = axis.y * t; | ||
790 | z = axis.z * t; | ||
791 | return new LSL_Rotation(x,y,z,s); | ||
792 | } | ||
793 | } | ||
794 | |||
726 | public void llWhisper(int channelID, string text) | 795 | public void llWhisper(int channelID, string text) |
727 | { | 796 | { |
728 | m_host.AddScriptLPS(1); | 797 | m_host.AddScriptLPS(1); |
@@ -1049,7 +1118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1049 | public virtual void llDie() | 1118 | public virtual void llDie() |
1050 | { | 1119 | { |
1051 | m_host.AddScriptLPS(1); | 1120 | m_host.AddScriptLPS(1); |
1052 | throw new SelfDeleteException(); | 1121 | if (!m_host.IsAttachment) throw new SelfDeleteException(); |
1053 | } | 1122 | } |
1054 | 1123 | ||
1055 | public LSL_Float llGround(LSL_Vector offset) | 1124 | public LSL_Float llGround(LSL_Vector offset) |
@@ -1121,7 +1190,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1121 | } | 1190 | } |
1122 | 1191 | ||
1123 | public void llSetStatus(int status, int value) | 1192 | public void llSetStatus(int status, int value) |
1124 | { | 1193 | { |
1194 | if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted) | ||
1195 | return; | ||
1125 | m_host.AddScriptLPS(1); | 1196 | m_host.AddScriptLPS(1); |
1126 | 1197 | ||
1127 | int statusrotationaxis = 0; | 1198 | int statusrotationaxis = 0; |
@@ -1296,7 +1367,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1296 | } | 1367 | } |
1297 | 1368 | ||
1298 | protected void SetScale(SceneObjectPart part, LSL_Vector scale) | 1369 | protected void SetScale(SceneObjectPart part, LSL_Vector scale) |
1299 | { | 1370 | { |
1300 | // TODO: this needs to trigger a persistance save as well | 1371 | // TODO: this needs to trigger a persistance save as well |
1301 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 1372 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
1302 | return; | 1373 | return; |
@@ -1351,6 +1422,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1351 | { | 1422 | { |
1352 | m_host.AddScriptLPS(1); | 1423 | m_host.AddScriptLPS(1); |
1353 | 1424 | ||
1425 | SetColor(m_host, color, face); | ||
1426 | } | ||
1427 | |||
1428 | protected void SetColor(SceneObjectPart part, LSL_Vector color, int face) | ||
1429 | { | ||
1430 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
1431 | return; | ||
1432 | |||
1433 | Primitive.TextureEntry tex = part.Shape.Textures; | ||
1434 | Color4 texcolor; | ||
1435 | if (face >= 0 && face < GetNumberOfSides(part)) | ||
1436 | { | ||
1437 | texcolor = tex.CreateFace((uint)face).RGBA; | ||
1438 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
1439 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
1440 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
1441 | tex.FaceTextures[face].RGBA = texcolor; | ||
1442 | part.UpdateTexture(tex); | ||
1443 | return; | ||
1444 | } | ||
1445 | else if (face == ScriptBaseClass.ALL_SIDES) | ||
1446 | { | ||
1447 | for (uint i = 0; i < GetNumberOfSides(part); i++) | ||
1448 | { | ||
1449 | if (tex.FaceTextures[i] != null) | ||
1450 | { | ||
1451 | texcolor = tex.FaceTextures[i].RGBA; | ||
1452 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
1453 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
1454 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
1455 | tex.FaceTextures[i].RGBA = texcolor; | ||
1456 | } | ||
1457 | texcolor = tex.DefaultTexture.RGBA; | ||
1458 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
1459 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
1460 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
1461 | tex.DefaultTexture.RGBA = texcolor; | ||
1462 | } | ||
1463 | part.UpdateTexture(tex); | ||
1464 | return; | ||
1465 | } | ||
1466 | |||
1354 | if (face == ScriptBaseClass.ALL_SIDES) | 1467 | if (face == ScriptBaseClass.ALL_SIDES) |
1355 | face = SceneObjectPart.ALL_SIDES; | 1468 | face = SceneObjectPart.ALL_SIDES; |
1356 | 1469 | ||
@@ -1358,7 +1471,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1358 | } | 1471 | } |
1359 | 1472 | ||
1360 | public void SetTexGen(SceneObjectPart part, int face,int style) | 1473 | public void SetTexGen(SceneObjectPart part, int face,int style) |
1361 | { | 1474 | { |
1475 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
1476 | return; | ||
1477 | |||
1362 | Primitive.TextureEntry tex = part.Shape.Textures; | 1478 | Primitive.TextureEntry tex = part.Shape.Textures; |
1363 | MappingType textype; | 1479 | MappingType textype; |
1364 | textype = MappingType.Default; | 1480 | textype = MappingType.Default; |
@@ -1388,7 +1504,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1388 | } | 1504 | } |
1389 | 1505 | ||
1390 | public void SetGlow(SceneObjectPart part, int face, float glow) | 1506 | public void SetGlow(SceneObjectPart part, int face, float glow) |
1391 | { | 1507 | { |
1508 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
1509 | return; | ||
1510 | |||
1392 | Primitive.TextureEntry tex = part.Shape.Textures; | 1511 | Primitive.TextureEntry tex = part.Shape.Textures; |
1393 | if (face >= 0 && face < GetNumberOfSides(part)) | 1512 | if (face >= 0 && face < GetNumberOfSides(part)) |
1394 | { | 1513 | { |
@@ -1413,7 +1532,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1413 | } | 1532 | } |
1414 | 1533 | ||
1415 | public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump) | 1534 | public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump) |
1416 | { | 1535 | { |
1536 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
1537 | return; | ||
1417 | 1538 | ||
1418 | Shininess sval = new Shininess(); | 1539 | Shininess sval = new Shininess(); |
1419 | 1540 | ||
@@ -1463,7 +1584,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1463 | } | 1584 | } |
1464 | 1585 | ||
1465 | public void SetFullBright(SceneObjectPart part, int face, bool bright) | 1586 | public void SetFullBright(SceneObjectPart part, int face, bool bright) |
1466 | { | 1587 | { |
1588 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
1589 | return; | ||
1590 | |||
1467 | Primitive.TextureEntry tex = part.Shape.Textures; | 1591 | Primitive.TextureEntry tex = part.Shape.Textures; |
1468 | if (face >= 0 && face < GetNumberOfSides(part)) | 1592 | if (face >= 0 && face < GetNumberOfSides(part)) |
1469 | { | 1593 | { |
@@ -1530,7 +1654,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1530 | } | 1654 | } |
1531 | 1655 | ||
1532 | protected void SetAlpha(SceneObjectPart part, double alpha, int face) | 1656 | protected void SetAlpha(SceneObjectPart part, double alpha, int face) |
1533 | { | 1657 | { |
1658 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
1659 | return; | ||
1660 | |||
1534 | Primitive.TextureEntry tex = part.Shape.Textures; | 1661 | Primitive.TextureEntry tex = part.Shape.Textures; |
1535 | Color4 texcolor; | 1662 | Color4 texcolor; |
1536 | if (face >= 0 && face < GetNumberOfSides(part)) | 1663 | if (face >= 0 && face < GetNumberOfSides(part)) |
@@ -1575,8 +1702,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1575 | /// <param name="Force"></param> | 1702 | /// <param name="Force"></param> |
1576 | protected void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction, | 1703 | protected void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction, |
1577 | float wind, float tension, LSL_Vector Force) | 1704 | float wind, float tension, LSL_Vector Force) |
1578 | { | 1705 | { |
1579 | if (part == null) | 1706 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
1580 | return; | 1707 | return; |
1581 | 1708 | ||
1582 | if (flexi) | 1709 | if (flexi) |
@@ -1610,8 +1737,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1610 | /// <param name="radius"></param> | 1737 | /// <param name="radius"></param> |
1611 | /// <param name="falloff"></param> | 1738 | /// <param name="falloff"></param> |
1612 | protected void SetPointLight(SceneObjectPart part, bool light, LSL_Vector color, float intensity, float radius, float falloff) | 1739 | protected void SetPointLight(SceneObjectPart part, bool light, LSL_Vector color, float intensity, float radius, float falloff) |
1613 | { | 1740 | { |
1614 | if (part == null) | 1741 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
1615 | return; | 1742 | return; |
1616 | 1743 | ||
1617 | if (light) | 1744 | if (light) |
@@ -1696,7 +1823,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1696 | } | 1823 | } |
1697 | 1824 | ||
1698 | protected void SetTexture(SceneObjectPart part, string texture, int face) | 1825 | protected void SetTexture(SceneObjectPart part, string texture, int face) |
1699 | { | 1826 | { |
1827 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
1828 | return; | ||
1829 | |||
1700 | UUID textureID=new UUID(); | 1830 | UUID textureID=new UUID(); |
1701 | 1831 | ||
1702 | if (!UUID.TryParse(texture, out textureID)) | 1832 | if (!UUID.TryParse(texture, out textureID)) |
@@ -1741,7 +1871,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1741 | } | 1871 | } |
1742 | 1872 | ||
1743 | protected void ScaleTexture(SceneObjectPart part, double u, double v, int face) | 1873 | protected void ScaleTexture(SceneObjectPart part, double u, double v, int face) |
1744 | { | 1874 | { |
1875 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
1876 | return; | ||
1877 | |||
1745 | Primitive.TextureEntry tex = part.Shape.Textures; | 1878 | Primitive.TextureEntry tex = part.Shape.Textures; |
1746 | if (face >= 0 && face < GetNumberOfSides(part)) | 1879 | if (face >= 0 && face < GetNumberOfSides(part)) |
1747 | { | 1880 | { |
@@ -1777,7 +1910,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1777 | } | 1910 | } |
1778 | 1911 | ||
1779 | protected void OffsetTexture(SceneObjectPart part, double u, double v, int face) | 1912 | protected void OffsetTexture(SceneObjectPart part, double u, double v, int face) |
1780 | { | 1913 | { |
1914 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
1915 | return; | ||
1916 | |||
1781 | Primitive.TextureEntry tex = part.Shape.Textures; | 1917 | Primitive.TextureEntry tex = part.Shape.Textures; |
1782 | if (face >= 0 && face < GetNumberOfSides(part)) | 1918 | if (face >= 0 && face < GetNumberOfSides(part)) |
1783 | { | 1919 | { |
@@ -1813,7 +1949,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1813 | } | 1949 | } |
1814 | 1950 | ||
1815 | protected void RotateTexture(SceneObjectPart part, double rotation, int face) | 1951 | protected void RotateTexture(SceneObjectPart part, double rotation, int face) |
1816 | { | 1952 | { |
1953 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
1954 | return; | ||
1955 | |||
1817 | Primitive.TextureEntry tex = part.Shape.Textures; | 1956 | Primitive.TextureEntry tex = part.Shape.Textures; |
1818 | if (face >= 0 && face < GetNumberOfSides(part)) | 1957 | if (face >= 0 && face < GetNumberOfSides(part)) |
1819 | { | 1958 | { |
@@ -1883,7 +2022,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1883 | } | 2022 | } |
1884 | 2023 | ||
1885 | protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) | 2024 | protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) |
1886 | { | 2025 | { |
2026 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
2027 | return; | ||
2028 | |||
1887 | // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) | 2029 | // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) |
1888 | LSL_Vector currentPos = llGetLocalPos(); | 2030 | LSL_Vector currentPos = llGetLocalPos(); |
1889 | 2031 | ||
@@ -1977,7 +2119,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1977 | } | 2119 | } |
1978 | 2120 | ||
1979 | protected void SetRot(SceneObjectPart part, Quaternion rot) | 2121 | protected void SetRot(SceneObjectPart part, Quaternion rot) |
1980 | { | 2122 | { |
2123 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
2124 | return; | ||
2125 | |||
1981 | part.UpdateRotation(rot); | 2126 | part.UpdateRotation(rot); |
1982 | // Update rotation does not move the object in the physics scene if it's a linkset. | 2127 | // Update rotation does not move the object in the physics scene if it's a linkset. |
1983 | 2128 | ||
@@ -2597,12 +2742,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2597 | 2742 | ||
2598 | m_host.AddScriptLPS(1); | 2743 | m_host.AddScriptLPS(1); |
2599 | 2744 | ||
2745 | m_host.TaskInventory.LockItemsForRead(true); | ||
2600 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; | 2746 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; |
2601 | 2747 | m_host.TaskInventory.LockItemsForRead(false); | |
2602 | lock (m_host.TaskInventory) | ||
2603 | { | ||
2604 | item = m_host.TaskInventory[invItemID]; | ||
2605 | } | ||
2606 | 2748 | ||
2607 | if (item.PermsGranter == UUID.Zero) | 2749 | if (item.PermsGranter == UUID.Zero) |
2608 | return 0; | 2750 | return 0; |
@@ -2677,6 +2819,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2677 | if (dist > m_ScriptDistanceFactor * 10.0f) | 2819 | if (dist > m_ScriptDistanceFactor * 10.0f) |
2678 | return; | 2820 | return; |
2679 | 2821 | ||
2822 | //Clone is thread-safe | ||
2680 | TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); | 2823 | TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); |
2681 | 2824 | ||
2682 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory) | 2825 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory) |
@@ -2761,6 +2904,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2761 | // Orient the object to the angle calculated | 2904 | // Orient the object to the angle calculated |
2762 | //llSetRot(rot); | 2905 | //llSetRot(rot); |
2763 | } | 2906 | } |
2907 | |||
2908 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | ||
2909 | { | ||
2910 | m_host.AddScriptLPS(1); | ||
2911 | // NotImplemented("llRotLookAt"); | ||
2912 | m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); | ||
2913 | |||
2914 | } | ||
2764 | 2915 | ||
2765 | public void llStopLookAt() | 2916 | public void llStopLookAt() |
2766 | { | 2917 | { |
@@ -2808,13 +2959,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2808 | { | 2959 | { |
2809 | TaskInventoryItem item; | 2960 | TaskInventoryItem item; |
2810 | 2961 | ||
2811 | lock (m_host.TaskInventory) | 2962 | m_host.TaskInventory.LockItemsForRead(true); |
2963 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
2812 | { | 2964 | { |
2813 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 2965 | m_host.TaskInventory.LockItemsForRead(false); |
2814 | return; | 2966 | return; |
2815 | else | 2967 | } |
2816 | item = m_host.TaskInventory[InventorySelf()]; | 2968 | else |
2969 | { | ||
2970 | item = m_host.TaskInventory[InventorySelf()]; | ||
2817 | } | 2971 | } |
2972 | m_host.TaskInventory.LockItemsForRead(false); | ||
2818 | 2973 | ||
2819 | if (item.PermsGranter != UUID.Zero) | 2974 | if (item.PermsGranter != UUID.Zero) |
2820 | { | 2975 | { |
@@ -2836,13 +2991,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2836 | { | 2991 | { |
2837 | TaskInventoryItem item; | 2992 | TaskInventoryItem item; |
2838 | 2993 | ||
2994 | m_host.TaskInventory.LockItemsForRead(true); | ||
2839 | lock (m_host.TaskInventory) | 2995 | lock (m_host.TaskInventory) |
2840 | { | 2996 | { |
2997 | |||
2841 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 2998 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) |
2999 | { | ||
3000 | m_host.TaskInventory.LockItemsForRead(false); | ||
2842 | return; | 3001 | return; |
3002 | } | ||
2843 | else | 3003 | else |
3004 | { | ||
2844 | item = m_host.TaskInventory[InventorySelf()]; | 3005 | item = m_host.TaskInventory[InventorySelf()]; |
3006 | } | ||
2845 | } | 3007 | } |
3008 | m_host.TaskInventory.LockItemsForRead(false); | ||
2846 | 3009 | ||
2847 | m_host.AddScriptLPS(1); | 3010 | m_host.AddScriptLPS(1); |
2848 | 3011 | ||
@@ -2879,13 +3042,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2879 | 3042 | ||
2880 | TaskInventoryItem item; | 3043 | TaskInventoryItem item; |
2881 | 3044 | ||
2882 | lock (m_host.TaskInventory) | 3045 | m_host.TaskInventory.LockItemsForRead(true); |
3046 | |||
3047 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
2883 | { | 3048 | { |
2884 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 3049 | m_host.TaskInventory.LockItemsForRead(false); |
2885 | return; | 3050 | return; |
2886 | else | ||
2887 | item = m_host.TaskInventory[InventorySelf()]; | ||
2888 | } | 3051 | } |
3052 | else | ||
3053 | { | ||
3054 | item = m_host.TaskInventory[InventorySelf()]; | ||
3055 | } | ||
3056 | |||
3057 | m_host.TaskInventory.LockItemsForRead(false); | ||
2889 | 3058 | ||
2890 | if (item.PermsGranter != m_host.OwnerID) | 3059 | if (item.PermsGranter != m_host.OwnerID) |
2891 | return; | 3060 | return; |
@@ -2911,13 +3080,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2911 | 3080 | ||
2912 | TaskInventoryItem item; | 3081 | TaskInventoryItem item; |
2913 | 3082 | ||
2914 | lock (m_host.TaskInventory) | 3083 | m_host.TaskInventory.LockItemsForRead(true); |
3084 | |||
3085 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
2915 | { | 3086 | { |
2916 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 3087 | m_host.TaskInventory.LockItemsForRead(false); |
2917 | return; | 3088 | return; |
2918 | else | ||
2919 | item = m_host.TaskInventory[InventorySelf()]; | ||
2920 | } | 3089 | } |
3090 | else | ||
3091 | { | ||
3092 | item = m_host.TaskInventory[InventorySelf()]; | ||
3093 | } | ||
3094 | m_host.TaskInventory.LockItemsForRead(false); | ||
3095 | |||
2921 | 3096 | ||
2922 | if (item.PermsGranter != m_host.OwnerID) | 3097 | if (item.PermsGranter != m_host.OwnerID) |
2923 | return; | 3098 | return; |
@@ -2953,8 +3128,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2953 | return m_host.OwnerID.ToString(); | 3128 | return m_host.OwnerID.ToString(); |
2954 | } | 3129 | } |
2955 | 3130 | ||
3131 | [DebuggerNonUserCode] | ||
2956 | public void llInstantMessage(string user, string message) | 3132 | public void llInstantMessage(string user, string message) |
2957 | { | 3133 | { |
3134 | UUID result; | ||
3135 | if (!UUID.TryParse(user, out result)) | ||
3136 | { | ||
3137 | throw new Exception(String.Format("An invalid key of '{0} was passed to llInstantMessage", user)); | ||
3138 | return; | ||
3139 | } | ||
3140 | |||
3141 | |||
2958 | m_host.AddScriptLPS(1); | 3142 | m_host.AddScriptLPS(1); |
2959 | 3143 | ||
2960 | // We may be able to use ClientView.SendInstantMessage here, but we need a client instance. | 3144 | // We may be able to use ClientView.SendInstantMessage here, but we need a client instance. |
@@ -2969,7 +3153,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2969 | UUID friendTransactionID = UUID.Random(); | 3153 | UUID friendTransactionID = UUID.Random(); |
2970 | 3154 | ||
2971 | //m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); | 3155 | //m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); |
2972 | 3156 | ||
2973 | GridInstantMessage msg = new GridInstantMessage(); | 3157 | GridInstantMessage msg = new GridInstantMessage(); |
2974 | msg.fromAgentID = new Guid(m_host.UUID.ToString()); // fromAgentID.Guid; | 3158 | msg.fromAgentID = new Guid(m_host.UUID.ToString()); // fromAgentID.Guid; |
2975 | msg.toAgentID = new Guid(user); // toAgentID.Guid; | 3159 | msg.toAgentID = new Guid(user); // toAgentID.Guid; |
@@ -3118,13 +3302,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3118 | m_host.AddScriptLPS(1); | 3302 | m_host.AddScriptLPS(1); |
3119 | } | 3303 | } |
3120 | 3304 | ||
3121 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | ||
3122 | { | ||
3123 | m_host.AddScriptLPS(1); | ||
3124 | Quaternion rot = new Quaternion((float)target.x, (float)target.y, (float)target.z, (float)target.s); | ||
3125 | m_host.RotLookAt(rot, (float)strength, (float)damping); | ||
3126 | } | ||
3127 | |||
3128 | public LSL_Integer llStringLength(string str) | 3305 | public LSL_Integer llStringLength(string str) |
3129 | { | 3306 | { |
3130 | m_host.AddScriptLPS(1); | 3307 | m_host.AddScriptLPS(1); |
@@ -3148,14 +3325,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3148 | 3325 | ||
3149 | TaskInventoryItem item; | 3326 | TaskInventoryItem item; |
3150 | 3327 | ||
3151 | lock (m_host.TaskInventory) | 3328 | m_host.TaskInventory.LockItemsForRead(true); |
3329 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3152 | { | 3330 | { |
3153 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 3331 | m_host.TaskInventory.LockItemsForRead(false); |
3154 | return; | 3332 | return; |
3155 | else | ||
3156 | item = m_host.TaskInventory[InventorySelf()]; | ||
3157 | } | 3333 | } |
3158 | 3334 | else | |
3335 | { | ||
3336 | item = m_host.TaskInventory[InventorySelf()]; | ||
3337 | } | ||
3338 | m_host.TaskInventory.LockItemsForRead(false); | ||
3159 | if (item.PermsGranter == UUID.Zero) | 3339 | if (item.PermsGranter == UUID.Zero) |
3160 | return; | 3340 | return; |
3161 | 3341 | ||
@@ -3185,13 +3365,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3185 | 3365 | ||
3186 | TaskInventoryItem item; | 3366 | TaskInventoryItem item; |
3187 | 3367 | ||
3188 | lock (m_host.TaskInventory) | 3368 | m_host.TaskInventory.LockItemsForRead(true); |
3369 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3189 | { | 3370 | { |
3190 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 3371 | m_host.TaskInventory.LockItemsForRead(false); |
3191 | return; | 3372 | return; |
3192 | else | ||
3193 | item = m_host.TaskInventory[InventorySelf()]; | ||
3194 | } | 3373 | } |
3374 | else | ||
3375 | { | ||
3376 | item = m_host.TaskInventory[InventorySelf()]; | ||
3377 | } | ||
3378 | m_host.TaskInventory.LockItemsForRead(false); | ||
3379 | |||
3195 | 3380 | ||
3196 | if (item.PermsGranter == UUID.Zero) | 3381 | if (item.PermsGranter == UUID.Zero) |
3197 | return; | 3382 | return; |
@@ -3268,10 +3453,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3268 | 3453 | ||
3269 | TaskInventoryItem item; | 3454 | TaskInventoryItem item; |
3270 | 3455 | ||
3271 | lock (m_host.TaskInventory) | 3456 | |
3457 | m_host.TaskInventory.LockItemsForRead(true); | ||
3458 | if (!m_host.TaskInventory.ContainsKey(invItemID)) | ||
3459 | { | ||
3460 | m_host.TaskInventory.LockItemsForRead(false); | ||
3461 | return; | ||
3462 | } | ||
3463 | else | ||
3272 | { | 3464 | { |
3273 | item = m_host.TaskInventory[invItemID]; | 3465 | item = m_host.TaskInventory[invItemID]; |
3274 | } | 3466 | } |
3467 | m_host.TaskInventory.LockItemsForRead(false); | ||
3275 | 3468 | ||
3276 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions | 3469 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions |
3277 | { | 3470 | { |
@@ -3303,11 +3496,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3303 | 3496 | ||
3304 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms | 3497 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms |
3305 | { | 3498 | { |
3306 | lock (m_host.TaskInventory) | 3499 | m_host.TaskInventory.LockItemsForWrite(true); |
3307 | { | 3500 | m_host.TaskInventory[invItemID].PermsGranter = agentID; |
3308 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3501 | m_host.TaskInventory[invItemID].PermsMask = perm; |
3309 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3502 | m_host.TaskInventory.LockItemsForWrite(false); |
3310 | } | ||
3311 | 3503 | ||
3312 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3504 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
3313 | "run_time_permissions", new Object[] { | 3505 | "run_time_permissions", new Object[] { |
@@ -3327,11 +3519,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3327 | 3519 | ||
3328 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms | 3520 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms |
3329 | { | 3521 | { |
3330 | lock (m_host.TaskInventory) | 3522 | m_host.TaskInventory.LockItemsForWrite(true); |
3331 | { | 3523 | m_host.TaskInventory[invItemID].PermsGranter = agentID; |
3332 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3524 | m_host.TaskInventory[invItemID].PermsMask = perm; |
3333 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3525 | m_host.TaskInventory.LockItemsForWrite(false); |
3334 | } | ||
3335 | 3526 | ||
3336 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3527 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
3337 | "run_time_permissions", new Object[] { | 3528 | "run_time_permissions", new Object[] { |
@@ -3352,11 +3543,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3352 | 3543 | ||
3353 | if (!m_waitingForScriptAnswer) | 3544 | if (!m_waitingForScriptAnswer) |
3354 | { | 3545 | { |
3355 | lock (m_host.TaskInventory) | 3546 | m_host.TaskInventory.LockItemsForWrite(true); |
3356 | { | 3547 | m_host.TaskInventory[invItemID].PermsGranter = agentID; |
3357 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3548 | m_host.TaskInventory[invItemID].PermsMask = 0; |
3358 | m_host.TaskInventory[invItemID].PermsMask = 0; | 3549 | m_host.TaskInventory.LockItemsForWrite(false); |
3359 | } | ||
3360 | 3550 | ||
3361 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; | 3551 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; |
3362 | m_waitingForScriptAnswer=true; | 3552 | m_waitingForScriptAnswer=true; |
@@ -3391,10 +3581,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3391 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) | 3581 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) |
3392 | llReleaseControls(); | 3582 | llReleaseControls(); |
3393 | 3583 | ||
3394 | lock (m_host.TaskInventory) | 3584 | |
3395 | { | 3585 | m_host.TaskInventory.LockItemsForWrite(true); |
3396 | m_host.TaskInventory[invItemID].PermsMask = answer; | 3586 | m_host.TaskInventory[invItemID].PermsMask = answer; |
3397 | } | 3587 | m_host.TaskInventory.LockItemsForWrite(false); |
3588 | |||
3398 | 3589 | ||
3399 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3590 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
3400 | "run_time_permissions", new Object[] { | 3591 | "run_time_permissions", new Object[] { |
@@ -3406,16 +3597,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3406 | { | 3597 | { |
3407 | m_host.AddScriptLPS(1); | 3598 | m_host.AddScriptLPS(1); |
3408 | 3599 | ||
3409 | lock (m_host.TaskInventory) | 3600 | m_host.TaskInventory.LockItemsForRead(true); |
3601 | |||
3602 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
3410 | { | 3603 | { |
3411 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 3604 | if (item.Type == 10 && item.ItemID == m_itemID) |
3412 | { | 3605 | { |
3413 | if (item.Type == 10 && item.ItemID == m_itemID) | 3606 | m_host.TaskInventory.LockItemsForRead(false); |
3414 | { | 3607 | return item.PermsGranter.ToString(); |
3415 | return item.PermsGranter.ToString(); | ||
3416 | } | ||
3417 | } | 3608 | } |
3418 | } | 3609 | } |
3610 | m_host.TaskInventory.LockItemsForRead(false); | ||
3419 | 3611 | ||
3420 | return UUID.Zero.ToString(); | 3612 | return UUID.Zero.ToString(); |
3421 | } | 3613 | } |
@@ -3424,19 +3616,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3424 | { | 3616 | { |
3425 | m_host.AddScriptLPS(1); | 3617 | m_host.AddScriptLPS(1); |
3426 | 3618 | ||
3427 | lock (m_host.TaskInventory) | 3619 | m_host.TaskInventory.LockItemsForRead(true); |
3620 | |||
3621 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
3428 | { | 3622 | { |
3429 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 3623 | if (item.Type == 10 && item.ItemID == m_itemID) |
3430 | { | 3624 | { |
3431 | if (item.Type == 10 && item.ItemID == m_itemID) | 3625 | int perms = item.PermsMask; |
3432 | { | 3626 | if (m_automaticLinkPermission) |
3433 | int perms = item.PermsMask; | 3627 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
3434 | if (m_automaticLinkPermission) | 3628 | m_host.TaskInventory.LockItemsForRead(false); |
3435 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | 3629 | return perms; |
3436 | return perms; | ||
3437 | } | ||
3438 | } | 3630 | } |
3439 | } | 3631 | } |
3632 | m_host.TaskInventory.LockItemsForRead(false); | ||
3440 | 3633 | ||
3441 | return 0; | 3634 | return 0; |
3442 | } | 3635 | } |
@@ -3469,11 +3662,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3469 | UUID invItemID = InventorySelf(); | 3662 | UUID invItemID = InventorySelf(); |
3470 | 3663 | ||
3471 | TaskInventoryItem item; | 3664 | TaskInventoryItem item; |
3472 | lock (m_host.TaskInventory) | 3665 | m_host.TaskInventory.LockItemsForRead(true); |
3473 | { | 3666 | item = m_host.TaskInventory[invItemID]; |
3474 | item = m_host.TaskInventory[invItemID]; | 3667 | m_host.TaskInventory.LockItemsForRead(false); |
3475 | } | 3668 | |
3476 | |||
3477 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3669 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
3478 | && !m_automaticLinkPermission) | 3670 | && !m_automaticLinkPermission) |
3479 | { | 3671 | { |
@@ -3526,16 +3718,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3526 | m_host.AddScriptLPS(1); | 3718 | m_host.AddScriptLPS(1); |
3527 | UUID invItemID = InventorySelf(); | 3719 | UUID invItemID = InventorySelf(); |
3528 | 3720 | ||
3529 | lock (m_host.TaskInventory) | 3721 | m_host.TaskInventory.LockItemsForRead(true); |
3530 | { | ||
3531 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3722 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
3532 | && !m_automaticLinkPermission) | 3723 | && !m_automaticLinkPermission) |
3533 | { | 3724 | { |
3534 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); | 3725 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); |
3726 | m_host.TaskInventory.LockItemsForRead(false); | ||
3535 | return; | 3727 | return; |
3536 | } | 3728 | } |
3537 | } | 3729 | m_host.TaskInventory.LockItemsForRead(false); |
3538 | 3730 | ||
3539 | if (linknum < ScriptBaseClass.LINK_THIS) | 3731 | if (linknum < ScriptBaseClass.LINK_THIS) |
3540 | return; | 3732 | return; |
3541 | 3733 | ||
@@ -3712,17 +3904,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3712 | m_host.AddScriptLPS(1); | 3904 | m_host.AddScriptLPS(1); |
3713 | int count = 0; | 3905 | int count = 0; |
3714 | 3906 | ||
3715 | lock (m_host.TaskInventory) | 3907 | m_host.TaskInventory.LockItemsForRead(true); |
3908 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
3716 | { | 3909 | { |
3717 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 3910 | if (inv.Value.Type == type || type == -1) |
3718 | { | 3911 | { |
3719 | if (inv.Value.Type == type || type == -1) | 3912 | count = count + 1; |
3720 | { | ||
3721 | count = count + 1; | ||
3722 | } | ||
3723 | } | 3913 | } |
3724 | } | 3914 | } |
3725 | 3915 | ||
3916 | m_host.TaskInventory.LockItemsForRead(false); | ||
3726 | return count; | 3917 | return count; |
3727 | } | 3918 | } |
3728 | 3919 | ||
@@ -3731,16 +3922,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3731 | m_host.AddScriptLPS(1); | 3922 | m_host.AddScriptLPS(1); |
3732 | ArrayList keys = new ArrayList(); | 3923 | ArrayList keys = new ArrayList(); |
3733 | 3924 | ||
3734 | lock (m_host.TaskInventory) | 3925 | m_host.TaskInventory.LockItemsForRead(true); |
3926 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
3735 | { | 3927 | { |
3736 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 3928 | if (inv.Value.Type == type || type == -1) |
3737 | { | 3929 | { |
3738 | if (inv.Value.Type == type || type == -1) | 3930 | keys.Add(inv.Value.Name); |
3739 | { | ||
3740 | keys.Add(inv.Value.Name); | ||
3741 | } | ||
3742 | } | 3931 | } |
3743 | } | 3932 | } |
3933 | m_host.TaskInventory.LockItemsForRead(false); | ||
3744 | 3934 | ||
3745 | if (keys.Count == 0) | 3935 | if (keys.Count == 0) |
3746 | { | 3936 | { |
@@ -3777,20 +3967,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3777 | } | 3967 | } |
3778 | 3968 | ||
3779 | // move the first object found with this inventory name | 3969 | // move the first object found with this inventory name |
3780 | lock (m_host.TaskInventory) | 3970 | m_host.TaskInventory.LockItemsForRead(true); |
3971 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
3781 | { | 3972 | { |
3782 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 3973 | if (inv.Value.Name == inventory) |
3783 | { | 3974 | { |
3784 | if (inv.Value.Name == inventory) | 3975 | found = true; |
3785 | { | 3976 | objId = inv.Key; |
3786 | found = true; | 3977 | assetType = inv.Value.Type; |
3787 | objId = inv.Key; | 3978 | objName = inv.Value.Name; |
3788 | assetType = inv.Value.Type; | 3979 | break; |
3789 | objName = inv.Value.Name; | ||
3790 | break; | ||
3791 | } | ||
3792 | } | 3980 | } |
3793 | } | 3981 | } |
3982 | m_host.TaskInventory.LockItemsForRead(false); | ||
3794 | 3983 | ||
3795 | if (!found) | 3984 | if (!found) |
3796 | { | 3985 | { |
@@ -3835,24 +4024,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3835 | ScriptSleep(3000); | 4024 | ScriptSleep(3000); |
3836 | } | 4025 | } |
3837 | 4026 | ||
4027 | [DebuggerNonUserCode] | ||
3838 | public void llRemoveInventory(string name) | 4028 | public void llRemoveInventory(string name) |
3839 | { | 4029 | { |
3840 | m_host.AddScriptLPS(1); | 4030 | m_host.AddScriptLPS(1); |
3841 | 4031 | ||
3842 | lock (m_host.TaskInventory) | 4032 | m_host.TaskInventory.LockItemsForRead(true); |
4033 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
3843 | { | 4034 | { |
3844 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 4035 | if (item.Name == name) |
3845 | { | 4036 | { |
3846 | if (item.Name == name) | 4037 | if (item.ItemID == m_itemID) |
3847 | { | 4038 | throw new ScriptDeleteException(); |
3848 | if (item.ItemID == m_itemID) | 4039 | else |
3849 | throw new ScriptDeleteException(); | 4040 | m_host.Inventory.RemoveInventoryItem(item.ItemID); |
3850 | else | 4041 | |
3851 | m_host.Inventory.RemoveInventoryItem(item.ItemID); | 4042 | m_host.TaskInventory.LockItemsForRead(false); |
3852 | return; | 4043 | return; |
3853 | } | ||
3854 | } | 4044 | } |
3855 | } | 4045 | } |
4046 | m_host.TaskInventory.LockItemsForRead(false); | ||
3856 | } | 4047 | } |
3857 | 4048 | ||
3858 | public void llSetText(string text, LSL_Vector color, double alpha) | 4049 | public void llSetText(string text, LSL_Vector color, double alpha) |
@@ -3942,6 +4133,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3942 | { | 4133 | { |
3943 | m_host.AddScriptLPS(1); | 4134 | m_host.AddScriptLPS(1); |
3944 | 4135 | ||
4136 | //Clone is thread safe | ||
3945 | TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); | 4137 | TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); |
3946 | 4138 | ||
3947 | foreach (TaskInventoryItem item in itemDictionary.Values) | 4139 | foreach (TaskInventoryItem item in itemDictionary.Values) |
@@ -4030,17 +4222,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4030 | UUID soundId = UUID.Zero; | 4222 | UUID soundId = UUID.Zero; |
4031 | if (!UUID.TryParse(impact_sound, out soundId)) | 4223 | if (!UUID.TryParse(impact_sound, out soundId)) |
4032 | { | 4224 | { |
4033 | lock (m_host.TaskInventory) | 4225 | m_host.TaskInventory.LockItemsForRead(true); |
4226 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
4034 | { | 4227 | { |
4035 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 4228 | if (item.Type == (int)AssetType.Sound && item.Name == impact_sound) |
4036 | { | 4229 | { |
4037 | if (item.Type == (int)AssetType.Sound && item.Name == impact_sound) | 4230 | soundId = item.AssetID; |
4038 | { | 4231 | break; |
4039 | soundId = item.AssetID; | ||
4040 | break; | ||
4041 | } | ||
4042 | } | 4232 | } |
4043 | } | 4233 | } |
4234 | m_host.TaskInventory.LockItemsForRead(false); | ||
4044 | } | 4235 | } |
4045 | m_host.CollisionSound = soundId; | 4236 | m_host.CollisionSound = soundId; |
4046 | m_host.CollisionSoundVolume = (float)impact_volume; | 4237 | m_host.CollisionSoundVolume = (float)impact_volume; |
@@ -4086,6 +4277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4086 | UUID partItemID; | 4277 | UUID partItemID; |
4087 | foreach (SceneObjectPart part in parts) | 4278 | foreach (SceneObjectPart part in parts) |
4088 | { | 4279 | { |
4280 | //Clone is thread safe | ||
4089 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); | 4281 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); |
4090 | 4282 | ||
4091 | foreach (TaskInventoryItem item in itemsDictionary.Values) | 4283 | foreach (TaskInventoryItem item in itemsDictionary.Values) |
@@ -4300,17 +4492,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4300 | 4492 | ||
4301 | m_host.AddScriptLPS(1); | 4493 | m_host.AddScriptLPS(1); |
4302 | 4494 | ||
4303 | lock (m_host.TaskInventory) | 4495 | m_host.TaskInventory.LockItemsForRead(true); |
4496 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
4304 | { | 4497 | { |
4305 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 4498 | if (item.Type == 10 && item.ItemID == m_itemID) |
4306 | { | 4499 | { |
4307 | if (item.Type == 10 && item.ItemID == m_itemID) | 4500 | result = item.Name!=null?item.Name:String.Empty; |
4308 | { | 4501 | break; |
4309 | result = item.Name != null ? item.Name : String.Empty; | ||
4310 | break; | ||
4311 | } | ||
4312 | } | 4502 | } |
4313 | } | 4503 | } |
4504 | m_host.TaskInventory.LockItemsForRead(false); | ||
4314 | 4505 | ||
4315 | return result; | 4506 | return result; |
4316 | } | 4507 | } |
@@ -4463,23 +4654,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4463 | { | 4654 | { |
4464 | m_host.AddScriptLPS(1); | 4655 | m_host.AddScriptLPS(1); |
4465 | 4656 | ||
4466 | lock (m_host.TaskInventory) | 4657 | m_host.TaskInventory.LockItemsForRead(true); |
4658 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
4467 | { | 4659 | { |
4468 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 4660 | if (inv.Value.Name == name) |
4469 | { | 4661 | { |
4470 | if (inv.Value.Name == name) | 4662 | if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) |
4471 | { | 4663 | { |
4472 | if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) | 4664 | m_host.TaskInventory.LockItemsForRead(false); |
4473 | { | 4665 | return inv.Value.AssetID.ToString(); |
4474 | return inv.Value.AssetID.ToString(); | 4666 | } |
4475 | } | 4667 | else |
4476 | else | 4668 | { |
4477 | { | 4669 | m_host.TaskInventory.LockItemsForRead(false); |
4478 | return UUID.Zero.ToString(); | 4670 | return UUID.Zero.ToString(); |
4479 | } | ||
4480 | } | 4671 | } |
4481 | } | 4672 | } |
4482 | } | 4673 | } |
4674 | m_host.TaskInventory.LockItemsForRead(false); | ||
4483 | 4675 | ||
4484 | return UUID.Zero.ToString(); | 4676 | return UUID.Zero.ToString(); |
4485 | } | 4677 | } |
@@ -6032,14 +6224,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6032 | 6224 | ||
6033 | protected UUID GetTaskInventoryItem(string name) | 6225 | protected UUID GetTaskInventoryItem(string name) |
6034 | { | 6226 | { |
6035 | lock (m_host.TaskInventory) | 6227 | m_host.TaskInventory.LockItemsForRead(true); |
6228 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
6036 | { | 6229 | { |
6037 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 6230 | if (inv.Value.Name == name) |
6038 | { | 6231 | { |
6039 | if (inv.Value.Name == name) | 6232 | m_host.TaskInventory.LockItemsForRead(false); |
6040 | return inv.Key; | 6233 | return inv.Key; |
6041 | } | 6234 | } |
6042 | } | 6235 | } |
6236 | m_host.TaskInventory.LockItemsForRead(false); | ||
6043 | 6237 | ||
6044 | return UUID.Zero; | 6238 | return UUID.Zero; |
6045 | } | 6239 | } |
@@ -6367,22 +6561,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6367 | } | 6561 | } |
6368 | 6562 | ||
6369 | // copy the first script found with this inventory name | 6563 | // copy the first script found with this inventory name |
6370 | lock (m_host.TaskInventory) | 6564 | m_host.TaskInventory.LockItemsForRead(true); |
6565 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
6371 | { | 6566 | { |
6372 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 6567 | if (inv.Value.Name == name) |
6373 | { | 6568 | { |
6374 | if (inv.Value.Name == name) | 6569 | // make sure the object is a script |
6570 | if (10 == inv.Value.Type) | ||
6375 | { | 6571 | { |
6376 | // make sure the object is a script | 6572 | found = true; |
6377 | if (10 == inv.Value.Type) | 6573 | srcId = inv.Key; |
6378 | { | 6574 | break; |
6379 | found = true; | ||
6380 | srcId = inv.Key; | ||
6381 | break; | ||
6382 | } | ||
6383 | } | 6575 | } |
6384 | } | 6576 | } |
6385 | } | 6577 | } |
6578 | m_host.TaskInventory.LockItemsForRead(false); | ||
6386 | 6579 | ||
6387 | if (!found) | 6580 | if (!found) |
6388 | { | 6581 | { |
@@ -6464,8 +6657,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6464 | } | 6657 | } |
6465 | 6658 | ||
6466 | protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) | 6659 | protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) |
6467 | { | 6660 | { |
6468 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); | 6661 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); |
6662 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
6663 | return shapeBlock; | ||
6469 | 6664 | ||
6470 | if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT && | 6665 | if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT && |
6471 | holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE && | 6666 | holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE && |
@@ -6535,7 +6730,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6535 | } | 6730 | } |
6536 | 6731 | ||
6537 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge) | 6732 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge) |
6538 | { | 6733 | { |
6734 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
6735 | return; | ||
6736 | |||
6539 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 6737 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
6540 | 6738 | ||
6541 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); | 6739 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); |
@@ -6584,7 +6782,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6584 | } | 6782 | } |
6585 | 6783 | ||
6586 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge) | 6784 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge) |
6587 | { | 6785 | { |
6786 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
6787 | return; | ||
6788 | |||
6588 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 6789 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
6589 | 6790 | ||
6590 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); | 6791 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); |
@@ -6626,7 +6827,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6626 | } | 6827 | } |
6627 | 6828 | ||
6628 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte fudge) | 6829 | protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte fudge) |
6629 | { | 6830 | { |
6831 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
6832 | return; | ||
6833 | |||
6630 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 6834 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
6631 | 6835 | ||
6632 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); | 6836 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); |
@@ -6747,7 +6951,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6747 | } | 6951 | } |
6748 | 6952 | ||
6749 | protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type) | 6953 | protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type) |
6750 | { | 6954 | { |
6955 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
6956 | return; | ||
6957 | |||
6751 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); | 6958 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); |
6752 | UUID sculptId; | 6959 | UUID sculptId; |
6753 | 6960 | ||
@@ -6781,14 +6988,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6781 | } | 6988 | } |
6782 | 6989 | ||
6783 | public void llSetPrimitiveParams(LSL_List rules) | 6990 | public void llSetPrimitiveParams(LSL_List rules) |
6784 | { | 6991 | { |
6785 | m_host.AddScriptLPS(1); | 6992 | m_host.AddScriptLPS(1); |
6786 | SetPrimParams(m_host, rules); | 6993 | SetPrimParams(m_host, rules); |
6787 | } | 6994 | } |
6788 | 6995 | ||
6789 | public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) | 6996 | public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) |
6790 | { | 6997 | { |
6791 | m_host.AddScriptLPS(1); | 6998 | m_host.AddScriptLPS(1); |
6792 | 6999 | ||
6793 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 7000 | List<SceneObjectPart> parts = GetLinkParts(linknumber); |
6794 | 7001 | ||
@@ -6802,7 +7009,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6802 | } | 7009 | } |
6803 | 7010 | ||
6804 | protected void SetPrimParams(SceneObjectPart part, LSL_List rules) | 7011 | protected void SetPrimParams(SceneObjectPart part, LSL_List rules) |
6805 | { | 7012 | { |
7013 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | ||
7014 | return; | ||
7015 | |||
6806 | int idx = 0; | 7016 | int idx = 0; |
6807 | 7017 | ||
6808 | while (idx < rules.Length) | 7018 | while (idx < rules.Length) |
@@ -7633,25 +7843,96 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7633 | } | 7843 | } |
7634 | break; | 7844 | break; |
7635 | 7845 | ||
7636 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 7846 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
7637 | // TODO-------------- | 7847 | if (remain < 1) |
7638 | if (remain < 1) | 7848 | return res; |
7639 | return res; | 7849 | face = (int)rules.GetLSLIntegerItem(idx++); |
7640 | 7850 | ||
7641 | face=(int)rules.GetLSLIntegerItem(idx++); | 7851 | tex = part.Shape.Textures; |
7642 | 7852 | int shiny; | |
7643 | res.Add(new LSL_Integer(0)); | 7853 | if (face == ScriptBaseClass.ALL_SIDES) |
7644 | res.Add(new LSL_Integer(0)); | 7854 | { |
7855 | for (face = 0; face < GetNumberOfSides(part); face++) | ||
7856 | { | ||
7857 | Shininess shinyness = tex.GetFace((uint)face).Shiny; | ||
7858 | if (shinyness == Shininess.High) | ||
7859 | { | ||
7860 | shiny = ScriptBaseClass.PRIM_SHINY_HIGH; | ||
7861 | } | ||
7862 | else if (shinyness == Shininess.Medium) | ||
7863 | { | ||
7864 | shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM; | ||
7865 | } | ||
7866 | else if (shinyness == Shininess.Low) | ||
7867 | { | ||
7868 | shiny = ScriptBaseClass.PRIM_SHINY_LOW; | ||
7869 | } | ||
7870 | else | ||
7871 | { | ||
7872 | shiny = ScriptBaseClass.PRIM_SHINY_NONE; | ||
7873 | } | ||
7874 | res.Add(new LSL_Integer(shiny)); | ||
7875 | res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump)); | ||
7876 | } | ||
7877 | } | ||
7878 | else | ||
7879 | { | ||
7880 | Shininess shinyness = tex.GetFace((uint)face).Shiny; | ||
7881 | if (shinyness == Shininess.High) | ||
7882 | { | ||
7883 | shiny = ScriptBaseClass.PRIM_SHINY_HIGH; | ||
7884 | } | ||
7885 | else if (shinyness == Shininess.Medium) | ||
7886 | { | ||
7887 | shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM; | ||
7888 | } | ||
7889 | else if (shinyness == Shininess.Low) | ||
7890 | { | ||
7891 | shiny = ScriptBaseClass.PRIM_SHINY_LOW; | ||
7892 | } | ||
7893 | else | ||
7894 | { | ||
7895 | shiny = ScriptBaseClass.PRIM_SHINY_NONE; | ||
7896 | } | ||
7897 | res.Add(new LSL_Integer(shiny)); | ||
7898 | res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump)); | ||
7899 | } | ||
7645 | break; | 7900 | break; |
7646 | 7901 | ||
7647 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 7902 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
7648 | // TODO-------------- | 7903 | if (remain < 1) |
7649 | if (remain < 1) | 7904 | return res; |
7650 | return res; | 7905 | face = (int)rules.GetLSLIntegerItem(idx++); |
7651 | 7906 | ||
7652 | face=(int)rules.GetLSLIntegerItem(idx++); | 7907 | tex = part.Shape.Textures; |
7653 | 7908 | int fullbright; | |
7654 | res.Add(new LSL_Integer(0)); | 7909 | if (face == ScriptBaseClass.ALL_SIDES) |
7910 | { | ||
7911 | for (face = 0; face < GetNumberOfSides(part); face++) | ||
7912 | { | ||
7913 | if (tex.GetFace((uint)face).Fullbright == true) | ||
7914 | { | ||
7915 | fullbright = ScriptBaseClass.TRUE; | ||
7916 | } | ||
7917 | else | ||
7918 | { | ||
7919 | fullbright = ScriptBaseClass.FALSE; | ||
7920 | } | ||
7921 | res.Add(new LSL_Integer(fullbright)); | ||
7922 | } | ||
7923 | } | ||
7924 | else | ||
7925 | { | ||
7926 | if (tex.GetFace((uint)face).Fullbright == true) | ||
7927 | { | ||
7928 | fullbright = ScriptBaseClass.TRUE; | ||
7929 | } | ||
7930 | else | ||
7931 | { | ||
7932 | fullbright = ScriptBaseClass.FALSE; | ||
7933 | } | ||
7934 | res.Add(new LSL_Integer(fullbright)); | ||
7935 | } | ||
7655 | break; | 7936 | break; |
7656 | 7937 | ||
7657 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | 7938 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: |
@@ -7672,14 +7953,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7672 | break; | 7953 | break; |
7673 | 7954 | ||
7674 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 7955 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
7675 | // TODO-------------- | 7956 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) |
7676 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) | 7957 | if (remain < 1) |
7677 | if (remain < 1) | 7958 | return res; |
7678 | return res; | 7959 | face = (int)rules.GetLSLIntegerItem(idx++); |
7679 | 7960 | ||
7680 | face=(int)rules.GetLSLIntegerItem(idx++); | 7961 | tex = part.Shape.Textures; |
7681 | 7962 | if (face == ScriptBaseClass.ALL_SIDES) | |
7682 | res.Add(new LSL_Integer(0)); | 7963 | { |
7964 | for (face = 0; face < GetNumberOfSides(part); face++) | ||
7965 | { | ||
7966 | if (tex.GetFace((uint)face).TexMapType == MappingType.Planar) | ||
7967 | { | ||
7968 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR)); | ||
7969 | } | ||
7970 | else | ||
7971 | { | ||
7972 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); | ||
7973 | } | ||
7974 | } | ||
7975 | } | ||
7976 | else | ||
7977 | { | ||
7978 | if (tex.GetFace((uint)face).TexMapType == MappingType.Planar) | ||
7979 | { | ||
7980 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR)); | ||
7981 | } | ||
7982 | else | ||
7983 | { | ||
7984 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); | ||
7985 | } | ||
7986 | } | ||
7683 | break; | 7987 | break; |
7684 | 7988 | ||
7685 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | 7989 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: |
@@ -7697,14 +8001,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7697 | res.Add(new LSL_Float(shape.LightFalloff)); // falloff | 8001 | res.Add(new LSL_Float(shape.LightFalloff)); // falloff |
7698 | break; | 8002 | break; |
7699 | 8003 | ||
7700 | case (int)ScriptBaseClass.PRIM_GLOW: | 8004 | case (int)ScriptBaseClass.PRIM_GLOW: |
7701 | // TODO-------------- | 8005 | if (remain < 1) |
7702 | if (remain < 1) | ||
7703 | return res; | 8006 | return res; |
7704 | 8007 | face = (int)rules.GetLSLIntegerItem(idx++); | |
7705 | face=(int)rules.GetLSLIntegerItem(idx++); | 8008 | |
7706 | 8009 | tex = part.Shape.Textures; | |
7707 | res.Add(new LSL_Float(0)); | 8010 | float primglow; |
8011 | if (face == ScriptBaseClass.ALL_SIDES) | ||
8012 | { | ||
8013 | for (face = 0; face < GetNumberOfSides(part); face++) | ||
8014 | { | ||
8015 | primglow = tex.GetFace((uint)face).Glow; | ||
8016 | res.Add(new LSL_Float(primglow)); | ||
8017 | } | ||
8018 | } | ||
8019 | else | ||
8020 | { | ||
8021 | primglow = tex.GetFace((uint)face).Glow; | ||
8022 | res.Add(new LSL_Float(primglow)); | ||
8023 | } | ||
7708 | break; | 8024 | break; |
7709 | case (int)ScriptBaseClass.PRIM_TEXT: | 8025 | case (int)ScriptBaseClass.PRIM_TEXT: |
7710 | Color4 textColor = part.GetTextColor(); | 8026 | Color4 textColor = part.GetTextColor(); |
@@ -8241,28 +8557,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8241 | { | 8557 | { |
8242 | m_host.AddScriptLPS(1); | 8558 | m_host.AddScriptLPS(1); |
8243 | 8559 | ||
8244 | lock (m_host.TaskInventory) | 8560 | m_host.TaskInventory.LockItemsForRead(true); |
8561 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
8245 | { | 8562 | { |
8246 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 8563 | if (inv.Value.Name == item) |
8247 | { | 8564 | { |
8248 | if (inv.Value.Name == item) | 8565 | m_host.TaskInventory.LockItemsForRead(false); |
8566 | switch (mask) | ||
8249 | { | 8567 | { |
8250 | switch (mask) | 8568 | case 0: |
8251 | { | 8569 | return (int)inv.Value.BasePermissions; |
8252 | case 0: | 8570 | case 1: |
8253 | return (int)inv.Value.BasePermissions; | 8571 | return (int)inv.Value.CurrentPermissions; |
8254 | case 1: | 8572 | case 2: |
8255 | return (int)inv.Value.CurrentPermissions; | 8573 | return (int)inv.Value.GroupPermissions; |
8256 | case 2: | 8574 | case 3: |
8257 | return (int)inv.Value.GroupPermissions; | 8575 | return (int)inv.Value.EveryonePermissions; |
8258 | case 3: | 8576 | case 4: |
8259 | return (int)inv.Value.EveryonePermissions; | 8577 | return (int)inv.Value.NextPermissions; |
8260 | case 4: | ||
8261 | return (int)inv.Value.NextPermissions; | ||
8262 | } | ||
8263 | } | 8578 | } |
8264 | } | 8579 | } |
8265 | } | 8580 | } |
8581 | m_host.TaskInventory.LockItemsForRead(false); | ||
8266 | 8582 | ||
8267 | return -1; | 8583 | return -1; |
8268 | } | 8584 | } |
@@ -8309,16 +8625,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8309 | { | 8625 | { |
8310 | m_host.AddScriptLPS(1); | 8626 | m_host.AddScriptLPS(1); |
8311 | 8627 | ||
8312 | lock (m_host.TaskInventory) | 8628 | m_host.TaskInventory.LockItemsForRead(true); |
8629 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
8313 | { | 8630 | { |
8314 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 8631 | if (inv.Value.Name == item) |
8315 | { | 8632 | { |
8316 | if (inv.Value.Name == item) | 8633 | m_host.TaskInventory.LockItemsForRead(false); |
8317 | { | 8634 | return inv.Value.CreatorID.ToString(); |
8318 | return inv.Value.CreatorID.ToString(); | ||
8319 | } | ||
8320 | } | 8635 | } |
8321 | } | 8636 | } |
8637 | m_host.TaskInventory.LockItemsForRead(false); | ||
8322 | 8638 | ||
8323 | llSay(0, "No item name '" + item + "'"); | 8639 | llSay(0, "No item name '" + item + "'"); |
8324 | 8640 | ||
@@ -8847,16 +9163,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8847 | { | 9163 | { |
8848 | m_host.AddScriptLPS(1); | 9164 | m_host.AddScriptLPS(1); |
8849 | 9165 | ||
8850 | lock (m_host.TaskInventory) | 9166 | m_host.TaskInventory.LockItemsForRead(true); |
9167 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
8851 | { | 9168 | { |
8852 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 9169 | if (inv.Value.Name == name) |
8853 | { | 9170 | { |
8854 | if (inv.Value.Name == name) | 9171 | m_host.TaskInventory.LockItemsForRead(false); |
8855 | { | 9172 | return inv.Value.Type; |
8856 | return inv.Value.Type; | ||
8857 | } | ||
8858 | } | 9173 | } |
8859 | } | 9174 | } |
9175 | m_host.TaskInventory.LockItemsForRead(false); | ||
8860 | 9176 | ||
8861 | return -1; | 9177 | return -1; |
8862 | } | 9178 | } |
@@ -8866,16 +9182,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8866 | m_host.AddScriptLPS(1); | 9182 | m_host.AddScriptLPS(1); |
8867 | 9183 | ||
8868 | if (quick_pay_buttons.Data.Length < 4) | 9184 | if (quick_pay_buttons.Data.Length < 4) |
8869 | { | 9185 | { |
8870 | LSLError("List must have at least 4 elements"); | 9186 | int x; |
8871 | return; | 9187 | for (x=quick_pay_buttons.Data.Length; x<= 4; x++) |
9188 | { | ||
9189 | quick_pay_buttons.Add(ScriptBaseClass.PAY_HIDE); | ||
9190 | } | ||
8872 | } | 9191 | } |
8873 | m_host.ParentGroup.RootPart.PayPrice[0]=price; | 9192 | int[] nPrice = new int[5]; |
8874 | 9193 | nPrice[0]=price; | |
8875 | m_host.ParentGroup.RootPart.PayPrice[1]=(LSL_Integer)quick_pay_buttons.Data[0]; | 9194 | nPrice[1] = (LSL_Integer)quick_pay_buttons.Data[0]; |
8876 | m_host.ParentGroup.RootPart.PayPrice[2]=(LSL_Integer)quick_pay_buttons.Data[1]; | 9195 | nPrice[2] = (LSL_Integer)quick_pay_buttons.Data[1]; |
8877 | m_host.ParentGroup.RootPart.PayPrice[3]=(LSL_Integer)quick_pay_buttons.Data[2]; | 9196 | nPrice[3] = (LSL_Integer)quick_pay_buttons.Data[2]; |
8878 | m_host.ParentGroup.RootPart.PayPrice[4]=(LSL_Integer)quick_pay_buttons.Data[3]; | 9197 | nPrice[4] = (LSL_Integer)quick_pay_buttons.Data[3]; |
9198 | m_host.ParentGroup.RootPart.PayPrice = nPrice; | ||
8879 | m_host.ParentGroup.HasGroupChanged = true; | 9199 | m_host.ParentGroup.HasGroupChanged = true; |
8880 | } | 9200 | } |
8881 | 9201 | ||
@@ -8887,17 +9207,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8887 | if (invItemID == UUID.Zero) | 9207 | if (invItemID == UUID.Zero) |
8888 | return new LSL_Vector(); | 9208 | return new LSL_Vector(); |
8889 | 9209 | ||
8890 | lock (m_host.TaskInventory) | 9210 | m_host.TaskInventory.LockItemsForRead(true); |
9211 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | ||
8891 | { | 9212 | { |
8892 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | 9213 | m_host.TaskInventory.LockItemsForRead(false); |
8893 | return new LSL_Vector(); | 9214 | return new LSL_Vector(); |
9215 | } | ||
8894 | 9216 | ||
8895 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 9217 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
8896 | { | 9218 | { |
8897 | ShoutError("No permissions to track the camera"); | 9219 | ShoutError("No permissions to track the camera"); |
8898 | return new LSL_Vector(); | 9220 | m_host.TaskInventory.LockItemsForRead(false); |
8899 | } | 9221 | return new LSL_Vector(); |
8900 | } | 9222 | } |
9223 | m_host.TaskInventory.LockItemsForRead(false); | ||
8901 | 9224 | ||
8902 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 9225 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
8903 | if (presence != null) | 9226 | if (presence != null) |
@@ -8915,17 +9238,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8915 | if (invItemID == UUID.Zero) | 9238 | if (invItemID == UUID.Zero) |
8916 | return new LSL_Rotation(); | 9239 | return new LSL_Rotation(); |
8917 | 9240 | ||
8918 | lock (m_host.TaskInventory) | 9241 | m_host.TaskInventory.LockItemsForRead(true); |
9242 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | ||
8919 | { | 9243 | { |
8920 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | 9244 | m_host.TaskInventory.LockItemsForRead(false); |
8921 | return new LSL_Rotation(); | 9245 | return new LSL_Rotation(); |
8922 | 9246 | } | |
8923 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 9247 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
8924 | { | 9248 | { |
8925 | ShoutError("No permissions to track the camera"); | 9249 | ShoutError("No permissions to track the camera"); |
8926 | return new LSL_Rotation(); | 9250 | m_host.TaskInventory.LockItemsForRead(false); |
8927 | } | 9251 | return new LSL_Rotation(); |
8928 | } | 9252 | } |
9253 | m_host.TaskInventory.LockItemsForRead(false); | ||
8929 | 9254 | ||
8930 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 9255 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
8931 | if (presence != null) | 9256 | if (presence != null) |
@@ -9075,14 +9400,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9075 | if (objectID == UUID.Zero) return; | 9400 | if (objectID == UUID.Zero) return; |
9076 | 9401 | ||
9077 | UUID agentID; | 9402 | UUID agentID; |
9078 | lock (m_host.TaskInventory) | 9403 | m_host.TaskInventory.LockItemsForRead(true); |
9079 | { | 9404 | // we need the permission first, to know which avatar we want to set the camera for |
9080 | // we need the permission first, to know which avatar we want to set the camera for | 9405 | agentID = m_host.TaskInventory[invItemID].PermsGranter; |
9081 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
9082 | 9406 | ||
9083 | if (agentID == UUID.Zero) return; | 9407 | if (agentID == UUID.Zero) |
9084 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | 9408 | { |
9409 | m_host.TaskInventory.LockItemsForRead(false); | ||
9410 | return; | ||
9411 | } | ||
9412 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) | ||
9413 | { | ||
9414 | m_host.TaskInventory.LockItemsForRead(false); | ||
9415 | return; | ||
9085 | } | 9416 | } |
9417 | m_host.TaskInventory.LockItemsForRead(false); | ||
9086 | 9418 | ||
9087 | ScenePresence presence = World.GetScenePresence(agentID); | 9419 | ScenePresence presence = World.GetScenePresence(agentID); |
9088 | 9420 | ||
@@ -9132,12 +9464,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9132 | 9464 | ||
9133 | // we need the permission first, to know which avatar we want to clear the camera for | 9465 | // we need the permission first, to know which avatar we want to clear the camera for |
9134 | UUID agentID; | 9466 | UUID agentID; |
9135 | lock (m_host.TaskInventory) | 9467 | m_host.TaskInventory.LockItemsForRead(true); |
9468 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
9469 | if (agentID == UUID.Zero) | ||
9136 | { | 9470 | { |
9137 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | 9471 | m_host.TaskInventory.LockItemsForRead(false); |
9138 | if (agentID == UUID.Zero) return; | 9472 | return; |
9139 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | ||
9140 | } | 9473 | } |
9474 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) | ||
9475 | { | ||
9476 | m_host.TaskInventory.LockItemsForRead(false); | ||
9477 | return; | ||
9478 | } | ||
9479 | m_host.TaskInventory.LockItemsForRead(false); | ||
9141 | 9480 | ||
9142 | ScenePresence presence = World.GetScenePresence(agentID); | 9481 | ScenePresence presence = World.GetScenePresence(agentID); |
9143 | 9482 | ||
@@ -9594,15 +9933,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9594 | 9933 | ||
9595 | internal UUID ScriptByName(string name) | 9934 | internal UUID ScriptByName(string name) |
9596 | { | 9935 | { |
9597 | lock (m_host.TaskInventory) | 9936 | m_host.TaskInventory.LockItemsForRead(true); |
9937 | |||
9938 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
9598 | { | 9939 | { |
9599 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 9940 | if (item.Type == 10 && item.Name == name) |
9600 | { | 9941 | { |
9601 | if (item.Type == 10 && item.Name == name) | 9942 | m_host.TaskInventory.LockItemsForRead(false); |
9602 | return item.ItemID; | 9943 | return item.ItemID; |
9603 | } | 9944 | } |
9604 | } | 9945 | } |
9605 | 9946 | ||
9947 | m_host.TaskInventory.LockItemsForRead(false); | ||
9948 | |||
9606 | return UUID.Zero; | 9949 | return UUID.Zero; |
9607 | } | 9950 | } |
9608 | 9951 | ||
@@ -9643,6 +9986,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9643 | { | 9986 | { |
9644 | m_host.AddScriptLPS(1); | 9987 | m_host.AddScriptLPS(1); |
9645 | 9988 | ||
9989 | //Clone is thread safe | ||
9646 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); | 9990 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); |
9647 | 9991 | ||
9648 | UUID assetID = UUID.Zero; | 9992 | UUID assetID = UUID.Zero; |
@@ -9705,6 +10049,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9705 | { | 10049 | { |
9706 | m_host.AddScriptLPS(1); | 10050 | m_host.AddScriptLPS(1); |
9707 | 10051 | ||
10052 | //Clone is thread safe | ||
9708 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); | 10053 | TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); |
9709 | 10054 | ||
9710 | UUID assetID = UUID.Zero; | 10055 | UUID assetID = UUID.Zero; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2c8b0ea..1ddba1e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -728,18 +728,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
728 | if (target != null) | 728 | if (target != null) |
729 | { | 729 | { |
730 | UUID animID=UUID.Zero; | 730 | UUID animID=UUID.Zero; |
731 | lock (m_host.TaskInventory) | 731 | m_host.TaskInventory.LockItemsForRead(true); |
732 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
732 | { | 733 | { |
733 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 734 | if (inv.Value.Name == animation) |
734 | { | 735 | { |
735 | if (inv.Value.Name == animation) | 736 | if (inv.Value.Type == (int)AssetType.Animation) |
736 | { | 737 | animID = inv.Value.AssetID; |
737 | if (inv.Value.Type == (int)AssetType.Animation) | 738 | continue; |
738 | animID = inv.Value.AssetID; | ||
739 | continue; | ||
740 | } | ||
741 | } | 739 | } |
742 | } | 740 | } |
741 | m_host.TaskInventory.LockItemsForRead(false); | ||
743 | if (animID == UUID.Zero) | 742 | if (animID == UUID.Zero) |
744 | target.Animator.AddAnimation(animation, m_host.UUID); | 743 | target.Animator.AddAnimation(animation, m_host.UUID); |
745 | else | 744 | else |
@@ -761,18 +760,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
761 | if (target != null) | 760 | if (target != null) |
762 | { | 761 | { |
763 | UUID animID=UUID.Zero; | 762 | UUID animID=UUID.Zero; |
764 | lock (m_host.TaskInventory) | 763 | m_host.TaskInventory.LockItemsForRead(true); |
764 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
765 | { | 765 | { |
766 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 766 | if (inv.Value.Name == animation) |
767 | { | 767 | { |
768 | if (inv.Value.Name == animation) | 768 | if (inv.Value.Type == (int)AssetType.Animation) |
769 | { | 769 | animID = inv.Value.AssetID; |
770 | if (inv.Value.Type == (int)AssetType.Animation) | 770 | continue; |
771 | animID = inv.Value.AssetID; | ||
772 | continue; | ||
773 | } | ||
774 | } | 771 | } |
775 | } | 772 | } |
773 | m_host.TaskInventory.LockItemsForRead(false); | ||
776 | 774 | ||
777 | if (animID == UUID.Zero) | 775 | if (animID == UUID.Zero) |
778 | target.Animator.RemoveAnimation(animation); | 776 | target.Animator.RemoveAnimation(animation); |
@@ -1541,6 +1539,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1541 | 1539 | ||
1542 | if (!UUID.TryParse(name, out assetID)) | 1540 | if (!UUID.TryParse(name, out assetID)) |
1543 | { | 1541 | { |
1542 | m_host.TaskInventory.LockItemsForRead(true); | ||
1544 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 1543 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) |
1545 | { | 1544 | { |
1546 | if (item.Type == 7 && item.Name == name) | 1545 | if (item.Type == 7 && item.Name == name) |
@@ -1548,6 +1547,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1548 | assetID = item.AssetID; | 1547 | assetID = item.AssetID; |
1549 | } | 1548 | } |
1550 | } | 1549 | } |
1550 | m_host.TaskInventory.LockItemsForRead(false); | ||
1551 | } | 1551 | } |
1552 | 1552 | ||
1553 | if (assetID == UUID.Zero) | 1553 | if (assetID == UUID.Zero) |
@@ -1594,6 +1594,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1594 | 1594 | ||
1595 | if (!UUID.TryParse(name, out assetID)) | 1595 | if (!UUID.TryParse(name, out assetID)) |
1596 | { | 1596 | { |
1597 | m_host.TaskInventory.LockItemsForRead(true); | ||
1597 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 1598 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) |
1598 | { | 1599 | { |
1599 | if (item.Type == 7 && item.Name == name) | 1600 | if (item.Type == 7 && item.Name == name) |
@@ -1601,6 +1602,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1601 | assetID = item.AssetID; | 1602 | assetID = item.AssetID; |
1602 | } | 1603 | } |
1603 | } | 1604 | } |
1605 | m_host.TaskInventory.LockItemsForRead(false); | ||
1604 | } | 1606 | } |
1605 | 1607 | ||
1606 | if (assetID == UUID.Zero) | 1608 | if (assetID == UUID.Zero) |
@@ -1651,6 +1653,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1651 | 1653 | ||
1652 | if (!UUID.TryParse(name, out assetID)) | 1654 | if (!UUID.TryParse(name, out assetID)) |
1653 | { | 1655 | { |
1656 | m_host.TaskInventory.LockItemsForRead(true); | ||
1654 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 1657 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) |
1655 | { | 1658 | { |
1656 | if (item.Type == 7 && item.Name == name) | 1659 | if (item.Type == 7 && item.Name == name) |
@@ -1658,6 +1661,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1658 | assetID = item.AssetID; | 1661 | assetID = item.AssetID; |
1659 | } | 1662 | } |
1660 | } | 1663 | } |
1664 | m_host.TaskInventory.LockItemsForRead(false); | ||
1661 | } | 1665 | } |
1662 | 1666 | ||
1663 | if (assetID == UUID.Zero) | 1667 | if (assetID == UUID.Zero) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index eeb59d9..2fd33fe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | |||
@@ -109,25 +109,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
109 | if (Timers.Count == 0) | 109 | if (Timers.Count == 0) |
110 | return; | 110 | return; |
111 | 111 | ||
112 | Dictionary<string, TimerClass>.ValueCollection tvals; | ||
112 | lock (TimerListLock) | 113 | lock (TimerListLock) |
113 | { | 114 | { |
114 | // Go through all timers | 115 | // Go through all timers |
115 | Dictionary<string, TimerClass>.ValueCollection tvals = Timers.Values; | 116 | tvals = Timers.Values; |
116 | foreach (TimerClass ts in tvals) | 117 | } |
118 | |||
119 | foreach (TimerClass ts in tvals) | ||
120 | { | ||
121 | // Time has passed? | ||
122 | if (ts.next < DateTime.Now.Ticks) | ||
117 | { | 123 | { |
118 | // Time has passed? | 124 | //m_log.Debug("Time has passed: Now: " + DateTime.Now.Ticks + ", Passed: " + ts.next); |
119 | if (ts.next < DateTime.Now.Ticks) | 125 | // Add it to queue |
120 | { | 126 | m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID, |
121 | //m_log.Debug("Time has passed: Now: " + DateTime.Now.Ticks + ", Passed: " + ts.next); | 127 | new EventParams("timer", new Object[0], |
122 | // Add it to queue | 128 | new DetectParams[0])); |
123 | m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID, | 129 | // set next interval |
124 | new EventParams("timer", new Object[0], | 130 | |
125 | new DetectParams[0])); | 131 | //ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); |
126 | // set next interval | 132 | ts.next = DateTime.Now.Ticks + ts.interval; |
127 | |||
128 | //ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); | ||
129 | ts.next = DateTime.Now.Ticks + ts.interval; | ||
130 | } | ||
131 | } | 133 | } |
132 | } | 134 | } |
133 | } | 135 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs new file mode 100644 index 0000000..ef990a1 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs | |||
@@ -0,0 +1,21 @@ | |||
1 | using System.Collections; | ||
2 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
3 | |||
4 | using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
5 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | ||
6 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | ||
7 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; | ||
8 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
9 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | ||
10 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | ||
11 | |||
12 | namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | ||
13 | { | ||
14 | public interface ICM_Api | ||
15 | { | ||
16 | // Windlight Functions | ||
17 | LSL_List cmGetWindlightScene(LSL_List rules); | ||
18 | int cmSetWindlightScene(LSL_List rules); | ||
19 | int cmSetWindlightSceneTargeted(LSL_List rules, key target); | ||
20 | } | ||
21 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 60b8050..f5921e1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
80 | // Avatar Info Commands | 80 | // Avatar Info Commands |
81 | string osGetAgentIP(string agent); | 81 | string osGetAgentIP(string agent); |
82 | LSL_List osGetAgents(); | 82 | LSL_List osGetAgents(); |
83 | 83 | ||
84 | // Teleport commands | 84 | // Teleport commands |
85 | void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); | 85 | void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); |
86 | void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); | 86 | void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs new file mode 100644 index 0000000..522c020 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs | |||
@@ -0,0 +1,77 @@ | |||
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 | |||
28 | using System; | ||
29 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | ||
30 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | ||
31 | using LSLInteger = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | ||
32 | |||
33 | namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | ||
34 | { | ||
35 | public partial class ScriptBaseClass | ||
36 | { | ||
37 | // Constants for cmWindlight* | ||
38 | public const int WL_WATER_COLOR = 0; | ||
39 | public const int WL_WATER_FOG_DENSITY_EXPONENT = 1; | ||
40 | public const int WL_UNDERWATER_FOG_MODIFIER = 2; | ||
41 | public const int WL_REFLECTION_WAVELET_SCALE = 3; | ||
42 | public const int WL_FRESNEL_SCALE = 4; | ||
43 | public const int WL_FRESNEL_OFFSET = 5; | ||
44 | public const int WL_REFRACT_SCALE_ABOVE = 6; | ||
45 | public const int WL_REFRACT_SCALE_BELOW = 7; | ||
46 | public const int WL_BLUR_MULTIPLIER = 8; | ||
47 | public const int WL_BIG_WAVE_DIRECTION = 9; | ||
48 | public const int WL_LITTLE_WAVE_DIRECTION = 10; | ||
49 | public const int WL_NORMAL_MAP_TEXTURE = 11; | ||
50 | public const int WL_HORIZON = 12; | ||
51 | public const int WL_HAZE_HORIZON = 13; | ||
52 | public const int WL_BLUE_DENSITY = 14; | ||
53 | public const int WL_HAZE_DENSITY = 15; | ||
54 | public const int WL_DENSITY_MULTIPLIER = 16; | ||
55 | public const int WL_DISTANCE_MULTIPLIER = 17; | ||
56 | public const int WL_MAX_ALTITUDE = 18; | ||
57 | public const int WL_SUN_MOON_COLOR = 19; | ||
58 | public const int WL_AMBIENT = 20; | ||
59 | public const int WL_EAST_ANGLE = 21; | ||
60 | public const int WL_SUN_GLOW_FOCUS = 22; | ||
61 | public const int WL_SUN_GLOW_SIZE = 23; | ||
62 | public const int WL_SCENE_GAMMA = 24; | ||
63 | public const int WL_STAR_BRIGHTNESS = 25; | ||
64 | public const int WL_CLOUD_COLOR = 26; | ||
65 | public const int WL_CLOUD_XY_DENSITY = 27; | ||
66 | public const int WL_CLOUD_COVERAGE = 28; | ||
67 | public const int WL_CLOUD_SCALE = 29; | ||
68 | public const int WL_CLOUD_DETAIL_XY_DENSITY = 30; | ||
69 | public const int WL_CLOUD_SCROLL_X = 31; | ||
70 | public const int WL_CLOUD_SCROLL_Y = 32; | ||
71 | public const int WL_CLOUD_SCROLL_Y_LOCK = 33; | ||
72 | public const int WL_CLOUD_SCROLL_X_LOCK = 34; | ||
73 | public const int WL_DRAW_CLASSIC_CLOUDS = 35; | ||
74 | public const int WL_SUN_MOON_POSITION = 36; | ||
75 | |||
76 | } | ||
77 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs new file mode 100644 index 0000000..5bc3a88 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs | |||
@@ -0,0 +1,76 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Runtime.Remoting.Lifetime; | ||
30 | using System.Threading; | ||
31 | using System.Reflection; | ||
32 | using System.Collections; | ||
33 | using System.Collections.Generic; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
37 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | ||
38 | using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | ||
39 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | ||
40 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | ||
41 | using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
42 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; | ||
43 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
44 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | ||
45 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | ||
46 | |||
47 | namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | ||
48 | { | ||
49 | public partial class ScriptBaseClass : MarshalByRefObject | ||
50 | { | ||
51 | public ICM_Api m_CM_Functions; | ||
52 | |||
53 | public void ApiTypeCM(IScriptApi api) | ||
54 | { | ||
55 | if (!(api is ICM_Api)) | ||
56 | return; | ||
57 | |||
58 | m_CM_Functions = (ICM_Api)api; | ||
59 | } | ||
60 | |||
61 | public LSL_List cmGetWindlightScene(LSL_List rules) | ||
62 | { | ||
63 | return m_CM_Functions.cmGetWindlightScene(rules); | ||
64 | } | ||
65 | |||
66 | public int cmSetWindlightScene(LSL_List rules) | ||
67 | { | ||
68 | return m_CM_Functions.cmSetWindlightScene(rules); | ||
69 | } | ||
70 | |||
71 | public int cmSetWindlightSceneTargeted(LSL_List rules, key target) | ||
72 | { | ||
73 | return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target); | ||
74 | } | ||
75 | } | ||
76 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs index 9615315..943d7a2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Diagnostics; //for [DebuggerNonUserCode] | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
32 | using OpenSim.Region.ScriptEngine.Shared; | 33 | using OpenSim.Region.ScriptEngine.Shared; |
@@ -132,6 +133,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
132 | return (eventFlags); | 133 | return (eventFlags); |
133 | } | 134 | } |
134 | 135 | ||
136 | [DebuggerNonUserCode] | ||
135 | public void ExecuteEvent(string state, string FunctionName, object[] args) | 137 | public void ExecuteEvent(string state, string FunctionName, object[] args) |
136 | { | 138 | { |
137 | // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. | 139 | // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp index 98bbc68..23138ef 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp | |||
@@ -17,6 +17,8 @@ | |||
17 | <excludeFiles /> | 17 | <excludeFiles /> |
18 | </DeploymentInformation> | 18 | </DeploymentInformation> |
19 | <Contents> | 19 | <Contents> |
20 | <File name="./CM_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> | ||
21 | <File name="./CM_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> | ||
20 | <File name="./Executor.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> | 22 | <File name="./Executor.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> |
21 | <File name="./LSL_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> | 23 | <File name="./LSL_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> |
22 | <File name="./LSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> | 24 | <File name="./LSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs index edbbc2a..b138da3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs | |||
@@ -33,6 +33,7 @@ using System.Threading; | |||
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Collections; | 34 | using System.Collections; |
35 | using System.Collections.Generic; | 35 | using System.Collections.Generic; |
36 | using System.Diagnostics; //for [DebuggerNonUserCode] | ||
36 | using OpenSim.Region.ScriptEngine.Interfaces; | 37 | using OpenSim.Region.ScriptEngine.Interfaces; |
37 | using OpenSim.Region.ScriptEngine.Shared; | 38 | using OpenSim.Region.ScriptEngine.Shared; |
38 | using OpenSim.Region.ScriptEngine.Shared.Api.Runtime; | 39 | using OpenSim.Region.ScriptEngine.Shared.Api.Runtime; |
@@ -90,6 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
90 | return (int)m_Executor.GetStateEventFlags(state); | 91 | return (int)m_Executor.GetStateEventFlags(state); |
91 | } | 92 | } |
92 | 93 | ||
94 | [DebuggerNonUserCode] | ||
93 | public void ExecuteEvent(string state, string FunctionName, object[] args) | 95 | public void ExecuteEvent(string state, string FunctionName, object[] args) |
94 | { | 96 | { |
95 | m_Executor.ExecuteEvent(state, FunctionName, args); | 97 | m_Executor.ExecuteEvent(state, FunctionName, args); |