diff options
author | Tedd Hansen | 2008-04-20 10:40:39 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-04-20 10:40:39 +0000 |
commit | 8a13edb115788949af437879532297dbefa6495e (patch) | |
tree | 785720395a1931403a888758cb3d359092f78a81 | |
parent | * Fixed up event discovery regexes to work with a specific string format m#1012 (diff) | |
download | opensim-SC-8a13edb115788949af437879532297dbefa6495e.zip opensim-SC-8a13edb115788949af437879532297dbefa6495e.tar.gz opensim-SC-8a13edb115788949af437879532297dbefa6495e.tar.bz2 opensim-SC-8a13edb115788949af437879532297dbefa6495e.tar.xz |
Moved script engine os* commands to OSSL_BuilIn_Commands.cs and OSSL_BuilIn_Commands_Interface.cs where they belong.
4 files changed, 340 insertions, 324 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 4192d40..c00254d 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -52,11 +52,11 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
52 | { | 52 | { |
53 | // private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 53 | // private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
54 | 54 | ||
55 | private ScriptEngineBase.ScriptEngine m_ScriptEngine; | 55 | internal ScriptEngineBase.ScriptEngine m_ScriptEngine; |
56 | private SceneObjectPart m_host; | 56 | internal SceneObjectPart m_host; |
57 | private uint m_localID; | 57 | internal uint m_localID; |
58 | private LLUUID m_itemID; | 58 | internal LLUUID m_itemID; |
59 | private bool throwErrorOnNotImplemented = true; | 59 | internal bool throwErrorOnNotImplemented = true; |
60 | 60 | ||
61 | public LSL_BuiltIn_Commands(ScriptEngineBase.ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) | 61 | public LSL_BuiltIn_Commands(ScriptEngineBase.ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) |
62 | { | 62 | { |
@@ -5303,317 +5303,36 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5303 | return new LSL_Types.list(); | 5303 | return new LSL_Types.list(); |
5304 | } | 5304 | } |
5305 | 5305 | ||
5306 | // | ||
5307 | // OpenSim functions | ||
5308 | // | ||
5309 | |||
5310 | public int osTerrainSetHeight(int x, int y, double val) | ||
5311 | { | ||
5312 | m_host.AddScriptLPS(1); | ||
5313 | if (x > 255 || x < 0 || y > 255 || y < 0) | ||
5314 | LSLError("osTerrainSetHeight: Coordinate out of bounds"); | ||
5315 | |||
5316 | if (World.PermissionsMngr.CanTerraform(m_host.OwnerID, new LLVector3(x, y, 0))) | ||
5317 | { | ||
5318 | World.Heightmap[x, y] = val; | ||
5319 | return 1; | ||
5320 | } | ||
5321 | else | ||
5322 | { | ||
5323 | return 0; | ||
5324 | } | ||
5325 | } | ||
5326 | |||
5327 | public double osTerrainGetHeight(int x, int y) | ||
5328 | { | ||
5329 | m_host.AddScriptLPS(1); | ||
5330 | if (x > 255 || x < 0 || y > 255 || y < 0) | ||
5331 | LSLError("osTerrainGetHeight: Coordinate out of bounds"); | ||
5332 | |||
5333 | return World.Heightmap[x, y]; | ||
5334 | } | ||
5335 | |||
5336 | public int osRegionRestart(double seconds) | ||
5337 | { | ||
5338 | m_host.AddScriptLPS(1); | ||
5339 | if (World.PermissionsMngr.CanRestartSim(m_host.OwnerID)) | ||
5340 | { | ||
5341 | World.Restart((float)seconds); | ||
5342 | return 1; | ||
5343 | } | ||
5344 | else | ||
5345 | { | ||
5346 | return 0; | ||
5347 | } | ||
5348 | } | ||
5349 | |||
5350 | public void osRegionNotice(string msg) | ||
5351 | { | ||
5352 | m_host.AddScriptLPS(1); | ||
5353 | World.SendGeneralAlert(msg); | ||
5354 | } | ||
5355 | |||
5356 | public void osSetRot(LLUUID target, Quaternion rotation) | ||
5357 | { | ||
5358 | m_host.AddScriptLPS(1); | ||
5359 | if (World.Entities.ContainsKey(target)) | ||
5360 | { | ||
5361 | World.Entities[target].Rotation = rotation; | ||
5362 | } | ||
5363 | else | ||
5364 | { | ||
5365 | LSLError("osSetRot: Invalid target"); | ||
5366 | } | ||
5367 | } | ||
5368 | |||
5369 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, | ||
5370 | int timer) | ||
5371 | { | ||
5372 | m_host.AddScriptLPS(1); | ||
5373 | if (dynamicID == String.Empty) | ||
5374 | { | ||
5375 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | ||
5376 | LLUUID createdTexture = | ||
5377 | textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, | ||
5378 | extraParams, timer); | ||
5379 | return createdTexture.ToString(); | ||
5380 | } | ||
5381 | else | ||
5382 | { | ||
5383 | //TODO update existing dynamic textures | ||
5384 | } | ||
5385 | |||
5386 | return LLUUID.Zero.ToString(); | ||
5387 | } | ||
5388 | |||
5389 | public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, | ||
5390 | int timer, int alpha) | ||
5391 | { | ||
5392 | m_host.AddScriptLPS(1); | ||
5393 | if (dynamicID == String.Empty) | ||
5394 | { | ||
5395 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | ||
5396 | LLUUID createdTexture = | ||
5397 | textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, | ||
5398 | extraParams, timer, true, (byte) alpha ); | ||
5399 | return createdTexture.ToString(); | ||
5400 | } | ||
5401 | else | ||
5402 | { | ||
5403 | //TODO update existing dynamic textures | ||
5404 | } | ||
5405 | |||
5406 | return LLUUID.Zero.ToString(); | ||
5407 | } | ||
5408 | |||
5409 | public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, | ||
5410 | int timer) | ||
5411 | { | ||
5412 | m_host.AddScriptLPS(1); | ||
5413 | if (dynamicID == String.Empty) | ||
5414 | { | ||
5415 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | ||
5416 | if (textureManager != null) | ||
5417 | { | ||
5418 | LLUUID createdTexture = | ||
5419 | textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data, | ||
5420 | extraParams, timer); | ||
5421 | return createdTexture.ToString(); | ||
5422 | } | ||
5423 | } | ||
5424 | else | ||
5425 | { | ||
5426 | //TODO update existing dynamic textures | ||
5427 | } | ||
5428 | |||
5429 | return LLUUID.Zero.ToString(); | ||
5430 | } | ||
5431 | |||
5432 | public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, | ||
5433 | int timer, int alpha) | ||
5434 | { | ||
5435 | m_host.AddScriptLPS(1); | ||
5436 | if (dynamicID == String.Empty) | ||
5437 | { | ||
5438 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | ||
5439 | if (textureManager != null) | ||
5440 | { | ||
5441 | LLUUID createdTexture = | ||
5442 | textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data, | ||
5443 | extraParams, timer, true, (byte) alpha); | ||
5444 | return createdTexture.ToString(); | ||
5445 | } | ||
5446 | } | ||
5447 | else | ||
5448 | { | ||
5449 | //TODO update existing dynamic textures | ||
5450 | } | ||
5451 | 5306 | ||
5452 | return LLUUID.Zero.ToString(); | 5307 | internal LLUUID ScriptByName(string name) |
5453 | } | ||
5454 | |||
5455 | public bool osConsoleCommand(string command) | ||
5456 | { | ||
5457 | m_host.AddScriptLPS(1); | ||
5458 | Nini.Config.IConfigSource config = new Nini.Config.IniConfigSource(Application.iniFilePath); | ||
5459 | if (config.Configs["LL-Functions"] == null) | ||
5460 | config.AddConfig("LL-Functions"); | ||
5461 | |||
5462 | if (config.Configs["LL-Functions"].GetBoolean("AllowosConsoleCommand", false)) | ||
5463 | { | ||
5464 | if (World.PermissionsMngr.CanRunConsoleCommand(m_host.OwnerID)) | ||
5465 | { | ||
5466 | OpenSim.Framework.Console.MainConsole.Instance.RunCommand(command); | ||
5467 | return true; | ||
5468 | } | ||
5469 | return false; | ||
5470 | } | ||
5471 | return false; | ||
5472 | } | ||
5473 | |||
5474 | private LLUUID ScriptByName(string name) | ||
5475 | { | 5308 | { |
5476 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 5309 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) |
5477 | { | 5310 | { |
5478 | if(item.Type == 10 && item.Name == name) | 5311 | if (item.Type == 10 && item.Name == name) |
5479 | return item.ItemID; | 5312 | return item.ItemID; |
5480 | } | 5313 | } |
5481 | return LLUUID.Zero; | 5314 | return LLUUID.Zero; |
5482 | } | 5315 | } |
5483 | 5316 | ||
5484 | private void ShoutError(string msg) | 5317 | internal void ShoutError(string msg) |
5485 | { | ||
5486 | llShout(BuiltIn_Commands_BaseClass.DEBUG_CHANNEL,msg); | ||
5487 | } | ||
5488 | |||
5489 | public void osSetPrimFloatOnWater(int floatYN) | ||
5490 | { | ||
5491 | m_host.AddScriptLPS(1); | ||
5492 | if (m_host.ParentGroup != null) | ||
5493 | { | ||
5494 | if (m_host.ParentGroup.RootPart != null) | ||
5495 | { | ||
5496 | m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN); | ||
5497 | } | ||
5498 | } | ||
5499 | } | ||
5500 | |||
5501 | // Adam's super super custom animation functions | ||
5502 | public void osAvatarPlayAnimation(string avatar, string animation) | ||
5503 | { | 5318 | { |
5504 | m_host.AddScriptLPS(1); | 5319 | llShout(BuiltIn_Commands_BaseClass.DEBUG_CHANNEL, msg); |
5505 | if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence) | ||
5506 | { | ||
5507 | ScenePresence target = (ScenePresence)World.Entities[avatar]; | ||
5508 | target.AddAnimation(avatar, 0); | ||
5509 | } | ||
5510 | } | ||
5511 | |||
5512 | public void osAvatarStopAnimation(string avatar, string animation) | ||
5513 | { | ||
5514 | m_host.AddScriptLPS(1); | ||
5515 | if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence) | ||
5516 | { | ||
5517 | ScenePresence target = (ScenePresence)World.Entities[avatar]; | ||
5518 | target.RemoveAnimation(animation); | ||
5519 | } | ||
5520 | } | 5320 | } |
5521 | 5321 | ||
5522 | //Texture draw functions | ||
5523 | public string osMovePen(string drawList, int x, int y) | ||
5524 | { | ||
5525 | m_host.AddScriptLPS(1); | ||
5526 | drawList += "MoveTo " + x + "," + y + ";"; | ||
5527 | return drawList; | ||
5528 | } | ||
5529 | 5322 | ||
5530 | public string osDrawLine(string drawList, int startX, int startY, int endX, int endY) | ||
5531 | { | ||
5532 | m_host.AddScriptLPS(1); | ||
5533 | drawList += "MoveTo "+ startX+","+ startY +"; LineTo "+endX +","+endY +"; "; | ||
5534 | return drawList; | ||
5535 | } | ||
5536 | |||
5537 | public string osDrawLine(string drawList, int endX, int endY) | ||
5538 | { | ||
5539 | m_host.AddScriptLPS(1); | ||
5540 | drawList += "LineTo " + endX + "," + endY + "; "; | ||
5541 | return drawList; | ||
5542 | } | ||
5543 | |||
5544 | public string osDrawText(string drawList, string text) | ||
5545 | { | ||
5546 | m_host.AddScriptLPS(1); | ||
5547 | drawList += "Text " + text + "; "; | ||
5548 | return drawList; | ||
5549 | } | ||
5550 | |||
5551 | public string osDrawEllipse(string drawList, int width, int height) | ||
5552 | { | ||
5553 | m_host.AddScriptLPS(1); | ||
5554 | drawList += "Ellipse " + width + "," + height + "; "; | ||
5555 | return drawList; | ||
5556 | } | ||
5557 | |||
5558 | public string osDrawRectangle(string drawList, int width, int height) | ||
5559 | { | ||
5560 | m_host.AddScriptLPS(1); | ||
5561 | drawList += "Rectangle " + width + "," + height + "; "; | ||
5562 | return drawList; | ||
5563 | } | ||
5564 | |||
5565 | public string osDrawFilledRectangle(string drawList, int width, int height) | ||
5566 | { | ||
5567 | m_host.AddScriptLPS(1); | ||
5568 | drawList += "FillRectangle " + width + "," + height + "; "; | ||
5569 | return drawList; | ||
5570 | } | ||
5571 | |||
5572 | public string osSetFontSize(string drawList, int fontSize) | ||
5573 | { | ||
5574 | m_host.AddScriptLPS(1); | ||
5575 | drawList += "FontSize "+ fontSize +"; "; | ||
5576 | return drawList; | ||
5577 | } | ||
5578 | |||
5579 | public string osSetPenSize(string drawList, int penSize) | ||
5580 | { | ||
5581 | m_host.AddScriptLPS(1); | ||
5582 | drawList += "PenSize " + penSize + "; "; | ||
5583 | return drawList; | ||
5584 | } | ||
5585 | |||
5586 | public string osSetPenColour(string drawList, string colour) | ||
5587 | { | ||
5588 | m_host.AddScriptLPS(1); | ||
5589 | drawList += "PenColour " + colour + "; "; | ||
5590 | return drawList; | ||
5591 | } | ||
5592 | |||
5593 | public string osDrawImage(string drawList, int width, int height, string imageUrl) | ||
5594 | { | ||
5595 | m_host.AddScriptLPS(1); | ||
5596 | drawList +="Image " +width + "," + height+ ","+ imageUrl +"; " ; | ||
5597 | return drawList; | ||
5598 | } | ||
5599 | |||
5600 | public void osSetStateEvents(int events) | ||
5601 | { | ||
5602 | m_host.setScriptEvents(m_itemID,events); | ||
5603 | } | ||
5604 | 5323 | ||
5605 | private void NotImplemented(string command) | 5324 | internal void NotImplemented(string command) |
5606 | { | 5325 | { |
5607 | if (throwErrorOnNotImplemented) | 5326 | if (throwErrorOnNotImplemented) |
5608 | throw new NotImplementedException("Command not implemented: " + command); | 5327 | throw new NotImplementedException("Command not implemented: " + command); |
5609 | } | 5328 | } |
5610 | 5329 | ||
5611 | private void Deprecated(string command) | 5330 | internal void Deprecated(string command) |
5612 | { | 5331 | { |
5613 | throw new Exception("Command deprecated: " + command); | 5332 | throw new Exception("Command deprecated: " + command); |
5614 | } | 5333 | } |
5615 | 5334 | ||
5616 | private void LSLError(string msg) | 5335 | internal void LSLError(string msg) |
5617 | { | 5336 | { |
5618 | throw new Exception("LSL Runtime Error: " + msg); | 5337 | throw new Exception("LSL Runtime Error: " + msg); |
5619 | } | 5338 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 205e908..8d8e0bc 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | |||
@@ -638,37 +638,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
638 | LSL_Types.list llGetParcelDetails(LSL_Types.Vector3 pos, LSL_Types.list param); | 638 | LSL_Types.list llGetParcelDetails(LSL_Types.Vector3 pos, LSL_Types.list param); |
639 | string llStringTrim(string src, int type); | 639 | string llStringTrim(string src, int type); |
640 | LSL_Types.list llGetObjectDetails(string id, LSL_Types.list args); | 640 | LSL_Types.list llGetObjectDetails(string id, LSL_Types.list args); |
641 | //OpenSim functions | ||
642 | string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); | ||
643 | string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, | ||
644 | int timer, int alpha); | ||
645 | string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer); | ||
646 | string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, | ||
647 | int timer, int alpha); | ||
648 | double osTerrainGetHeight(int x, int y); | ||
649 | int osTerrainSetHeight(int x, int y, double val); | ||
650 | int osRegionRestart(double seconds); | ||
651 | void osRegionNotice(string msg); | ||
652 | bool osConsoleCommand(string Command); | ||
653 | void osSetParcelMediaURL(string url); | ||
654 | void osSetPrimFloatOnWater(int floatYN); | ||
655 | 641 | ||
656 | // Animation commands | ||
657 | void osAvatarPlayAnimation(string avatar, string animation); | ||
658 | void osAvatarStopAnimation(string avatar, string animation); | ||
659 | |||
660 | //texture draw functions | ||
661 | string osMovePen(string drawList, int x, int y); | ||
662 | string osDrawLine(string drawList, int startX, int startY, int endX, int endY); | ||
663 | string osDrawLine(string drawList, int endX, int endY); | ||
664 | string osDrawText(string drawList, string text); | ||
665 | string osDrawEllipse(string drawList, int width, int height); | ||
666 | string osDrawRectangle(string drawList, int width, int height); | ||
667 | string osDrawFilledRectangle(string drawList, int width, int height); | ||
668 | string osSetFontSize(string drawList, int fontSize); | ||
669 | string osSetPenSize(string drawList, int penSize); | ||
670 | string osSetPenColour(string drawList, string colour); | ||
671 | string osDrawImage(string drawList, int width, int height, string imageUrl); | ||
672 | void osSetStateEvents(int events); | ||
673 | } | 642 | } |
674 | } | 643 | } |
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 | */ |
27 | using System; | 27 | using System; |
28 | using System.Collections; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Runtime.Remoting.Lifetime; | ||
29 | using System.Text; | 31 | using System.Text; |
32 | using System.Threading; | ||
33 | using Axiom.Math; | ||
30 | using libsecondlife; | 34 | using libsecondlife; |
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Communications; | ||
37 | using OpenSim.Region.Environment.Interfaces; | ||
31 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
39 | using OpenSim.Region.ScriptEngine.Common; | ||
40 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | ||
41 | using OpenSim.Region.Environment; | ||
42 | using OpenSim.Region.Environment.Modules.LandManagement; | ||
43 | //using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; | ||
32 | 44 | ||
33 | namespace OpenSim.Region.ScriptEngine.Common | 45 | namespace 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 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs index 1d754ca..3102e3f 100644 --- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs | |||
@@ -33,5 +33,37 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
33 | { | 33 | { |
34 | public interface OSSL_BuilIn_Commands_Interface | 34 | public interface OSSL_BuilIn_Commands_Interface |
35 | { | 35 | { |
36 | //OpenSim functions | ||
37 | string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); | ||
38 | string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, | ||
39 | int timer, int alpha); | ||
40 | string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer); | ||
41 | string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, | ||
42 | int timer, int alpha); | ||
43 | double osTerrainGetHeight(int x, int y); | ||
44 | int osTerrainSetHeight(int x, int y, double val); | ||
45 | int osRegionRestart(double seconds); | ||
46 | void osRegionNotice(string msg); | ||
47 | bool osConsoleCommand(string Command); | ||
48 | void osSetParcelMediaURL(string url); | ||
49 | void osSetPrimFloatOnWater(int floatYN); | ||
50 | |||
51 | // Animation commands | ||
52 | void osAvatarPlayAnimation(string avatar, string animation); | ||
53 | void osAvatarStopAnimation(string avatar, string animation); | ||
54 | |||
55 | //texture draw functions | ||
56 | string osMovePen(string drawList, int x, int y); | ||
57 | string osDrawLine(string drawList, int startX, int startY, int endX, int endY); | ||
58 | string osDrawLine(string drawList, int endX, int endY); | ||
59 | string osDrawText(string drawList, string text); | ||
60 | string osDrawEllipse(string drawList, int width, int height); | ||
61 | string osDrawRectangle(string drawList, int width, int height); | ||
62 | string osDrawFilledRectangle(string drawList, int width, int height); | ||
63 | string osSetFontSize(string drawList, int fontSize); | ||
64 | string osSetPenSize(string drawList, int penSize); | ||
65 | string osSetPenColour(string drawList, string colour); | ||
66 | string osDrawImage(string drawList, int width, int height, string imageUrl); | ||
67 | void osSetStateEvents(int events); | ||
36 | } | 68 | } |
37 | } | 69 | } |