aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs296
1 files changed, 296 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
index c2b9a31..de19f4e 100644
--- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
@@ -25,10 +25,22 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27using System; 27using System;
28using System.Collections;
28using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Runtime.Remoting.Lifetime;
29using System.Text; 31using System.Text;
32using System.Threading;
33using Axiom.Math;
30using libsecondlife; 34using libsecondlife;
35using OpenSim.Framework;
36using OpenSim.Framework.Communications;
37using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 38using OpenSim.Region.Environment.Scenes;
39using OpenSim.Region.ScriptEngine.Common;
40using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
41using OpenSim.Region.Environment;
42using OpenSim.Region.Environment.Modules.LandManagement;
43//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
32 44
33namespace OpenSim.Region.ScriptEngine.Common 45namespace OpenSim.Region.ScriptEngine.Common
34{ 46{
@@ -242,5 +254,289 @@ namespace OpenSim.Region.ScriptEngine.Common
242 // public double Z; 254 // public double Z;
243 // public double R; 255 // public double R;
244 //} 256 //}
257
258
259 //
260 // OpenSim functions
261 //
262
263 public int osTerrainSetHeight(int x, int y, double val)
264 {
265 m_host.AddScriptLPS(1);
266 if (x > 255 || x < 0 || y > 255 || y < 0)
267 LSLError("osTerrainSetHeight: Coordinate out of bounds");
268
269 if (World.PermissionsMngr.CanTerraform(m_host.OwnerID, new LLVector3(x, y, 0)))
270 {
271 World.Heightmap[x, y] = val;
272 return 1;
273 }
274 else
275 {
276 return 0;
277 }
278 }
279
280 public double osTerrainGetHeight(int x, int y)
281 {
282 m_host.AddScriptLPS(1);
283 if (x > 255 || x < 0 || y > 255 || y < 0)
284 LSLError("osTerrainGetHeight: Coordinate out of bounds");
285
286 return World.Heightmap[x, y];
287 }
288
289 public int osRegionRestart(double seconds)
290 {
291 m_host.AddScriptLPS(1);
292 if (World.PermissionsMngr.CanRestartSim(m_host.OwnerID))
293 {
294 World.Restart((float)seconds);
295 return 1;
296 }
297 else
298 {
299 return 0;
300 }
301 }
302
303 public void osRegionNotice(string msg)
304 {
305 m_host.AddScriptLPS(1);
306 World.SendGeneralAlert(msg);
307 }
308
309 public void osSetRot(LLUUID target, Quaternion rotation)
310 {
311 m_host.AddScriptLPS(1);
312 if (World.Entities.ContainsKey(target))
313 {
314 World.Entities[target].Rotation = rotation;
315 }
316 else
317 {
318 LSLError("osSetRot: Invalid target");
319 }
320 }
321
322 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
323 int timer)
324 {
325 m_host.AddScriptLPS(1);
326 if (dynamicID == String.Empty)
327 {
328 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
329 LLUUID createdTexture =
330 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
331 extraParams, timer);
332 return createdTexture.ToString();
333 }
334 else
335 {
336 //TODO update existing dynamic textures
337 }
338
339 return LLUUID.Zero.ToString();
340 }
341
342 public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
343 int timer, int alpha)
344 {
345 m_host.AddScriptLPS(1);
346 if (dynamicID == String.Empty)
347 {
348 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
349 LLUUID createdTexture =
350 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
351 extraParams, timer, true, (byte) alpha );
352 return createdTexture.ToString();
353 }
354 else
355 {
356 //TODO update existing dynamic textures
357 }
358
359 return LLUUID.Zero.ToString();
360 }
361
362 public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams,
363 int timer)
364 {
365 m_host.AddScriptLPS(1);
366 if (dynamicID == String.Empty)
367 {
368 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
369 if (textureManager != null)
370 {
371 LLUUID createdTexture =
372 textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
373 extraParams, timer);
374 return createdTexture.ToString();
375 }
376 }
377 else
378 {
379 //TODO update existing dynamic textures
380 }
381
382 return LLUUID.Zero.ToString();
383 }
384
385 public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
386 int timer, int alpha)
387 {
388 m_host.AddScriptLPS(1);
389 if (dynamicID == String.Empty)
390 {
391 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
392 if (textureManager != null)
393 {
394 LLUUID createdTexture =
395 textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
396 extraParams, timer, true, (byte) alpha);
397 return createdTexture.ToString();
398 }
399 }
400 else
401 {
402 //TODO update existing dynamic textures
403 }
404
405 return LLUUID.Zero.ToString();
406 }
407
408 public bool osConsoleCommand(string command)
409 {
410 m_host.AddScriptLPS(1);
411 Nini.Config.IConfigSource config = new Nini.Config.IniConfigSource(Application.iniFilePath);
412 if (config.Configs["LL-Functions"] == null)
413 config.AddConfig("LL-Functions");
414
415 if (config.Configs["LL-Functions"].GetBoolean("AllowosConsoleCommand", false))
416 {
417 if (World.PermissionsMngr.CanRunConsoleCommand(m_host.OwnerID))
418 {
419 OpenSim.Framework.Console.MainConsole.Instance.RunCommand(command);
420 return true;
421 }
422 return false;
423 }
424 return false;
425 }
426 public void osSetPrimFloatOnWater(int floatYN)
427 {
428 m_host.AddScriptLPS(1);
429 if (m_host.ParentGroup != null)
430 {
431 if (m_host.ParentGroup.RootPart != null)
432 {
433 m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN);
434 }
435 }
436 }
437
438 // Adam's super super custom animation functions
439 public void osAvatarPlayAnimation(string avatar, string animation)
440 {
441 m_host.AddScriptLPS(1);
442 if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence)
443 {
444 ScenePresence target = (ScenePresence)World.Entities[avatar];
445 target.AddAnimation(avatar, 0);
446 }
447 }
448
449 public void osAvatarStopAnimation(string avatar, string animation)
450 {
451 m_host.AddScriptLPS(1);
452 if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence)
453 {
454 ScenePresence target = (ScenePresence)World.Entities[avatar];
455 target.RemoveAnimation(animation);
456 }
457 }
458
459 //Texture draw functions
460 public string osMovePen(string drawList, int x, int y)
461 {
462 m_host.AddScriptLPS(1);
463 drawList += "MoveTo " + x + "," + y + ";";
464 return drawList;
465 }
466
467 public string osDrawLine(string drawList, int startX, int startY, int endX, int endY)
468 {
469 m_host.AddScriptLPS(1);
470 drawList += "MoveTo "+ startX+","+ startY +"; LineTo "+endX +","+endY +"; ";
471 return drawList;
472 }
473
474 public string osDrawLine(string drawList, int endX, int endY)
475 {
476 m_host.AddScriptLPS(1);
477 drawList += "LineTo " + endX + "," + endY + "; ";
478 return drawList;
479 }
480
481 public string osDrawText(string drawList, string text)
482 {
483 m_host.AddScriptLPS(1);
484 drawList += "Text " + text + "; ";
485 return drawList;
486 }
487
488 public string osDrawEllipse(string drawList, int width, int height)
489 {
490 m_host.AddScriptLPS(1);
491 drawList += "Ellipse " + width + "," + height + "; ";
492 return drawList;
493 }
494
495 public string osDrawRectangle(string drawList, int width, int height)
496 {
497 m_host.AddScriptLPS(1);
498 drawList += "Rectangle " + width + "," + height + "; ";
499 return drawList;
500 }
501
502 public string osDrawFilledRectangle(string drawList, int width, int height)
503 {
504 m_host.AddScriptLPS(1);
505 drawList += "FillRectangle " + width + "," + height + "; ";
506 return drawList;
507 }
508
509 public string osSetFontSize(string drawList, int fontSize)
510 {
511 m_host.AddScriptLPS(1);
512 drawList += "FontSize "+ fontSize +"; ";
513 return drawList;
514 }
515
516 public string osSetPenSize(string drawList, int penSize)
517 {
518 m_host.AddScriptLPS(1);
519 drawList += "PenSize " + penSize + "; ";
520 return drawList;
521 }
522
523 public string osSetPenColour(string drawList, string colour)
524 {
525 m_host.AddScriptLPS(1);
526 drawList += "PenColour " + colour + "; ";
527 return drawList;
528 }
529
530 public string osDrawImage(string drawList, int width, int height, string imageUrl)
531 {
532 m_host.AddScriptLPS(1);
533 drawList +="Image " +width + "," + height+ ","+ imageUrl +"; " ;
534 return drawList;
535 }
536
537 public void osSetStateEvents(int events)
538 {
539 m_host.setScriptEvents(m_itemID, events);
540 }
245 } 541 }
246} 542}