aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs26
-rw-r--r--OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs125
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs17
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs13
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs138
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs1
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsVector.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs4
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSCharacter.cs6
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSScene.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs32
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs82
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs29
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs43
22 files changed, 530 insertions, 116 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index a7a5aa3..dd01780 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -7090,14 +7090,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7090 if (OnRemoveInventoryFolder != null) 7090 if (OnRemoveInventoryFolder != null)
7091 { 7091 {
7092 handlerRemoveInventoryFolder = null; 7092 handlerRemoveInventoryFolder = null;
7093 List<UUID> uuids = new List<UUID>();
7093 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData) 7094 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData)
7094 { 7095 {
7095 handlerRemoveInventoryFolder = OnRemoveInventoryFolder; 7096 uuids.Add(datablock.FolderID);
7096 7097 }
7097 if (handlerRemoveInventoryFolder != null) 7098 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
7098 { 7099 if (handlerRemoveInventoryFolder != null)
7099 handlerRemoveInventoryFolder(this, datablock.FolderID); 7100 {
7100 } 7101 handlerRemoveInventoryFolder(this, uuids);
7101 } 7102 }
7102 } 7103 }
7103 break; 7104 break;
@@ -7114,14 +7115,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7114 if (OnRemoveInventoryFolder != null) 7115 if (OnRemoveInventoryFolder != null)
7115 { 7116 {
7116 handlerRemoveInventoryFolder = null; 7117 handlerRemoveInventoryFolder = null;
7118 List<UUID> uuids = new List<UUID>();
7117 foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData) 7119 foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData)
7118 { 7120 {
7119 handlerRemoveInventoryFolder = OnRemoveInventoryFolder; 7121 uuids.Add(datablock.FolderID);
7120 7122 }
7121 if (handlerRemoveInventoryFolder != null) 7123 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
7122 { 7124 if (handlerRemoveInventoryFolder != null)
7123 handlerRemoveInventoryFolder(this, datablock.FolderID); 7125 {
7124 } 7126 handlerRemoveInventoryFolder(this, uuids);
7125 } 7127 }
7126 } 7128 }
7127 7129
diff --git a/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs b/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
new file mode 100644
index 0000000..cd2fe4f
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Region.Framework.Scenes;
30
31namespace OpenSim.Region.CoreModules.Avatar.NPC
32{
33 public interface INPCModule
34 {
35 UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom);
36 void Autopilot(UUID agentID, Scene scene, Vector3 pos);
37 void Say(UUID agentID, Scene scene, string text);
38 void DeleteNPC(UUID agentID, Scene scene);
39 }
40} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 2640f08..e577fbe 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -443,7 +443,16 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
443 endPoint.X = (int) x; 443 endPoint.X = (int) x;
444 endPoint.Y = (int) y; 444 endPoint.Y = (int) y;
445 Image image = ImageHttpRequest(nextLine); 445 Image image = ImageHttpRequest(nextLine);
446 graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y); 446 if (image != null)
447 {
448 graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y);
449 }
450 else
451 {
452 graph.DrawString("URL couldn't be resolved or is", new Font("Arial",6), myBrush, startPoint);
453 graph.DrawString("not an image. Please check URL.", new Font("Arial", 6), myBrush, new Point(startPoint.X, 12 + startPoint.Y));
454 graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
455 }
447 startPoint.X += endPoint.X; 456 startPoint.X += endPoint.X;
448 startPoint.Y += endPoint.Y; 457 startPoint.Y += endPoint.Y;
449 } 458 }
@@ -469,13 +478,19 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
469 startPoint.X += endPoint.X; 478 startPoint.X += endPoint.X;
470 startPoint.Y += endPoint.Y; 479 startPoint.Y += endPoint.Y;
471 } 480 }
481 else if (nextLine.StartsWith("FillPolygon"))
482 {
483 PointF[] points = null;
484 GetParams(partsDelimiter, ref nextLine, 11, ref points);
485 graph.FillPolygon(myBrush, points);
486 }
472 else if (nextLine.StartsWith("Ellipse")) 487 else if (nextLine.StartsWith("Ellipse"))
473 { 488 {
474 float x = 0; 489 float x = 0;
475 float y = 0; 490 float y = 0;
476 GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); 491 GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y);
477 endPoint.X = (int) x; 492 endPoint.X = (int)x;
478 endPoint.Y = (int) y; 493 endPoint.Y = (int)y;
479 graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); 494 graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
480 startPoint.X += endPoint.X; 495 startPoint.X += endPoint.X;
481 startPoint.Y += endPoint.Y; 496 startPoint.Y += endPoint.Y;
@@ -492,30 +507,31 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
492 nextLine = nextLine.Remove(0, 8); 507 nextLine = nextLine.Remove(0, 8);
493 nextLine = nextLine.Trim(); 508 nextLine = nextLine.Trim();
494 509
495 string [] fprops = nextLine.Split(partsDelimiter); 510 string[] fprops = nextLine.Split(partsDelimiter);
496 foreach (string prop in fprops) { 511 foreach (string prop in fprops)
497 512 {
513
498 switch (prop) 514 switch (prop)
499 { 515 {
500 case "B": 516 case "B":
501 if (!(myFont.Bold)) 517 if (!(myFont.Bold))
502 myFont = new Font(myFont, myFont.Style | FontStyle.Bold); 518 myFont = new Font(myFont, myFont.Style | FontStyle.Bold);
503 break; 519 break;
504 case "I": 520 case "I":
505 if (!(myFont.Italic)) 521 if (!(myFont.Italic))
506 myFont = new Font(myFont, myFont.Style | FontStyle.Italic); 522 myFont = new Font(myFont, myFont.Style | FontStyle.Italic);
507 break; 523 break;
508 case "U": 524 case "U":
509 if (!(myFont.Underline)) 525 if (!(myFont.Underline))
510 myFont = new Font(myFont, myFont.Style | FontStyle.Underline); 526 myFont = new Font(myFont, myFont.Style | FontStyle.Underline);
511 break; 527 break;
512 case "S": 528 case "S":
513 if (!(myFont.Strikeout)) 529 if (!(myFont.Strikeout))
514 myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout); 530 myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout);
515 break; 531 break;
516 case "R": 532 case "R":
517 myFont = new Font(myFont, FontStyle.Regular); 533 myFont = new Font(myFont, FontStyle.Regular);
518 break; 534 break;
519 } 535 }
520 } 536 }
521 } 537 }
@@ -532,6 +548,57 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
532 float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); 548 float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture);
533 drawPen.Width = size; 549 drawPen.Width = size;
534 } 550 }
551 else if (nextLine.StartsWith("PenCap"))
552 {
553 bool start = true, end = true;
554 nextLine = nextLine.Remove(0, 6);
555 nextLine = nextLine.Trim();
556 string[] cap = nextLine.Split(partsDelimiter);
557 if (cap[0].ToLower() == "start")
558 end = false;
559 else if (cap[0].ToLower() == "end")
560 start = false;
561 else if (cap[0].ToLower() != "both")
562 return;
563 string type = cap[1].ToLower();
564
565 if (end)
566 {
567 switch (type)
568 {
569 case "arrow":
570 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
571 break;
572 case "round":
573 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.RoundAnchor;
574 break;
575 case "diamond":
576 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor;
577 break;
578 case "flat":
579 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.Flat;
580 break;
581 }
582 }
583 if (start)
584 {
585 switch (type)
586 {
587 case "arrow":
588 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
589 break;
590 case "round":
591 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.RoundAnchor;
592 break;
593 case "diamond":
594 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor;
595 break;
596 case "flat":
597 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.Flat;
598 break;
599 }
600 }
601 }
535 else if (nextLine.StartsWith("PenColour")) 602 else if (nextLine.StartsWith("PenColour"))
536 { 603 {
537 nextLine = nextLine.Remove(0, 9); 604 nextLine = nextLine.Remove(0, 9);
@@ -542,7 +609,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
542 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) 609 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
543 { 610 {
544 newColour = Color.FromArgb(hex); 611 newColour = Color.FromArgb(hex);
545 } 612 }
546 else 613 else
547 { 614 {
548 // this doesn't fail, it just returns black if nothing is found 615 // this doesn't fail, it just returns black if nothing is found
@@ -582,18 +649,40 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
582 } 649 }
583 } 650 }
584 651
652 private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref PointF[] points)
653 {
654 line = line.Remove(0, startLength);
655 string[] parts = line.Split(partsDelimiter);
656 if (parts.Length > 1 && parts.Length % 2 == 0)
657 {
658 points = new PointF[parts.Length / 2];
659 for (int i = 0; i < parts.Length; i = i + 2)
660 {
661 string xVal = parts[i].Trim();
662 string yVal = parts[i+1].Trim();
663 float x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture);
664 float y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture);
665 PointF point = new PointF(x, y);
666 points[i / 2] = point;
667 }
668 }
669 }
670
585 private Bitmap ImageHttpRequest(string url) 671 private Bitmap ImageHttpRequest(string url)
586 { 672 {
673 try
674 {
587 WebRequest request = HttpWebRequest.Create(url); 675 WebRequest request = HttpWebRequest.Create(url);
588//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. 676//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used.
589//Ckrinke Stream str = null; 677//Ckrinke Stream str = null;
590 HttpWebResponse response = (HttpWebResponse) (request).GetResponse(); 678 HttpWebResponse response = (HttpWebResponse)(request).GetResponse();
591 if (response.StatusCode == HttpStatusCode.OK) 679 if (response.StatusCode == HttpStatusCode.OK)
592 { 680 {
593 Bitmap image = new Bitmap(response.GetResponseStream()); 681 Bitmap image = new Bitmap(response.GetResponseStream());
594 return image; 682 return image;
683 }
595 } 684 }
596 685 catch { }
597 return null; 686 return null;
598 } 687 }
599 } 688 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
index d4cb616..bd32f3b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -139,6 +139,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
139 public abstract bool MoveFolder(InventoryFolderBase folder); 139 public abstract bool MoveFolder(InventoryFolderBase folder);
140 140
141 /// <summary> 141 /// <summary>
142 /// Delete a list of inventory folders (from trash)
143 /// </summary>
144 public abstract bool DeleteFolders(UUID ownerID, List<UUID> folderIDs);
145
146 /// <summary>
142 /// Purge an inventory folder of all its items and subfolders. 147 /// Purge an inventory folder of all its items and subfolders.
143 /// </summary> 148 /// </summary>
144 /// <param name="folder"></param> 149 /// <param name="folder"></param>
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 787c6c8..1c66254 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -330,6 +330,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
330 } 330 }
331 } 331 }
332 332
333 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
334 {
335 if (folderIDs == null)
336 return false;
337 if (folderIDs.Count == 0)
338 return false;
339
340 if (IsLocalGridUser(ownerID))
341 return m_GridService.DeleteFolders(ownerID, folderIDs);
342 else
343 {
344 UUID sessionID = GetSessionID(ownerID);
345 string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
346 return m_HGService.DeleteFolders(uri, folderIDs, sessionID);
347 }
348 }
349
333 public override bool MoveFolder(InventoryFolderBase folder) 350 public override bool MoveFolder(InventoryFolderBase folder)
334 { 351 {
335 if (folder == null) 352 if (folder == null)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index e6edcf2..66d11dd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -258,6 +258,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
258 return m_InventoryService.MoveFolder(folder); 258 return m_InventoryService.MoveFolder(folder);
259 } 259 }
260 260
261 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
262 {
263 return m_InventoryService.DeleteFolders(ownerID, folderIDs);
264 }
265
261 /// <summary> 266 /// <summary>
262 /// Purge an inventory folder of all its items and subfolders. 267 /// Purge an inventory folder of all its items and subfolders.
263 /// </summary> 268 /// </summary>
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
index 201442c..0d32c77 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
@@ -243,6 +243,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
243 return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); 243 return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID);
244 } 244 }
245 245
246 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
247 {
248 if (folderIDs == null)
249 return false;
250 if (folderIDs.Count == 0)
251 return false;
252
253 UUID sessionID = GetSessionID(ownerID);
254 return m_RemoteConnector.DeleteFolders(ownerID.ToString(), folderIDs, sessionID);
255 }
256
257
246 public override bool PurgeFolder(InventoryFolderBase folder) 258 public override bool PurgeFolder(InventoryFolderBase folder)
247 { 259 {
248 if (folder == null) 260 if (folder == null)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index a9d361b..3301536 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -789,23 +789,15 @@ namespace OpenSim.Region.Framework.Scenes
789 } 789 }
790 790
791 /// <summary> 791 /// <summary>
792 /// Removes an inventory folder. Although there is a packet in the Linden protocol for this, it may be 792 /// Removes an inventory folder. This packet is sent when the user
793 /// legacy and not currently used (purge folder is used to remove folders from trash instead). 793 /// right-clicks a folder that's already in trash and chooses "purge"
794 /// </summary> 794 /// </summary>
795 /// <param name="remoteClient"></param> 795 /// <param name="remoteClient"></param>
796 /// <param name="folderID"></param> 796 /// <param name="folderID"></param>
797 private void RemoveInventoryFolder(IClientAPI remoteClient, UUID folderID) 797 private void RemoveInventoryFolder(IClientAPI remoteClient, List<UUID> folderIDs)
798 { 798 {
799 // Unclear is this handler is ever called by the Linden client, but it might 799 m_log.DebugFormat("[SCENE INVENTORY]: RemoveInventoryFolders count {0}", folderIDs.Count);
800 800 InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs);
801 InventoryFolderBase folder = new InventoryFolderBase(folderID);
802 folder.Owner = remoteClient.AgentId;
803 InventoryFolderBase trash = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder);
804 if (trash != null)
805 {
806 folder.ParentID = trash.ID;
807 InventoryService.MoveFolder(folder);
808 }
809 } 801 }
810 802
811 private SceneObjectGroup GetGroupByPrim(uint localID) 803 private SceneObjectGroup GetGroupByPrim(uint localID)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index d722e23..d3e414f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -441,9 +441,24 @@ namespace OpenSim.Region.Framework.Scenes
441 return; 441 return;
442 } 442 }
443 443
444 // We're going to send the reply async, because there may be
445 // an enormous quantity of packets -- basically the entire inventory!
446 // We don't want to block the client thread while all that is happening.
447 SendInventoryDelegate d = SendInventoryAsync;
448 d.BeginInvoke(remoteClient, folderID, ownerID, fetchFolders, fetchItems, sortOrder, SendInventoryComplete, d);
449 }
450
451 delegate void SendInventoryDelegate(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder);
452
453 void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
454 {
444 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); 455 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
445 } 456 }
446 457
458 void SendInventoryComplete(IAsyncResult iar)
459 {
460 }
461
447 /// <summary> 462 /// <summary>
448 /// Handle the caps inventory descendents fetch. 463 /// Handle the caps inventory descendents fetch.
449 /// 464 ///
@@ -537,7 +552,7 @@ namespace OpenSim.Region.Framework.Scenes
537 552
538 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) 553 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
539 { 554 {
540 InventoryFolderBase folder = new InventoryFolderBase(folderID); 555 InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId);
541 folder = InventoryService.GetFolder(folder); 556 folder = InventoryService.GetFolder(folder);
542 if (folder != null) 557 if (folder != null)
543 { 558 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index cb4e443..acf0375 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2143,9 +2143,14 @@ namespace OpenSim.Region.Framework.Scenes
2143 { 2143 {
2144 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2144 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2145 2145
2146 m_log.DebugFormat( 2146 m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2147 "[SCENE]: Adding new {0} agent for {1} in {2}", 2147 /*
2148 ((aCircuit.child == true) ? "child" : "root"), client.Name, RegionInfo.RegionName); 2148 string logMsg = string.Format("[SCENE]: Adding new {0} agent for {1} in {2}",
2149 ((aCircuit.child == true) ? "child" : "root"), client.Name,
2150 RegionInfo.RegionName);
2151
2152 m_log.Debug(logMsg);
2153 */
2149 2154
2150 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); 2155 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
2151 2156
@@ -2154,7 +2159,7 @@ namespace OpenSim.Region.Framework.Scenes
2154 // HERE!!! Do the initial attachments right here 2159 // HERE!!! Do the initial attachments right here
2155 // first agent upon login is a root agent by design. 2160 // first agent upon login is a root agent by design.
2156 // All other AddNewClient calls find aCircuit.child to be true 2161 // All other AddNewClient calls find aCircuit.child to be true
2157 if (aCircuit.child == false) 2162 if (aCircuit == null || aCircuit.child == false)
2158 { 2163 {
2159 sp.IsChildAgent = false; 2164 sp.IsChildAgent = false;
2160 sp.RezAttachments(); 2165 sp.RezAttachments();
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
index b61959f..3c5e8c9 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
@@ -213,7 +213,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
213 m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword); 213 m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword);
214 string[] excludes = config.GetString("exclude_list", "").Trim().Split(new Char[] { ',' }); 214 string[] excludes = config.GetString("exclude_list", "").Trim().Split(new Char[] { ',' });
215 cs.ExcludeList = new List<string>(excludes.Length); 215 cs.ExcludeList = new List<string>(excludes.Length);
216 foreach(string name in excludes) 216 foreach (string name in excludes)
217 { 217 {
218 cs.ExcludeList.Add(name.Trim().ToLower()); 218 cs.ExcludeList.Add(name.Trim().ToLower());
219 } 219 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index a3cefc9..b3bfe07 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -26,73 +26,157 @@
26 */ 26 */
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Threading;
29using OpenMetaverse; 30using OpenMetaverse;
30using Nini.Config; 31using Nini.Config;
31using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.CoreModules.Avatar.NPC;
33using OpenSim.Framework; 35using OpenSim.Framework;
36using Timer=System.Timers.Timer;
34 37
35namespace OpenSim.Region.OptionalModules.World.NPC 38namespace OpenSim.Region.OptionalModules.World.NPC
36{ 39{
37 public interface INPCModule
38 {
39 UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom);
40 void Autopilot(UUID agentID, Scene scene, Vector3 pos);
41 void Say(UUID agentID, Scene scene, string text);
42 void DeleteNPC(UUID agentID, Scene scene);
43 }
44
45 public class NPCModule : IRegionModule, INPCModule 40 public class NPCModule : IRegionModule, INPCModule
46 { 41 {
47 // private const bool m_enabled = false; 42 // private const bool m_enabled = false;
48 43
44 private Mutex m_createMutex = new Mutex(false);
45
46 private Timer m_timer = new Timer(500);
47
49 private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); 48 private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
50 49
50 private Dictionary<UUID,AvatarAppearance> m_appearanceCache = new Dictionary<UUID, AvatarAppearance>();
51
52 // Timer vars.
53 private bool p_inUse = false;
54 private readonly object p_lock = new object();
55 // Private Temporary Variables.
56 private string p_firstname;
57 private string p_lastname;
58 private Vector3 p_position;
59 private Scene p_scene;
60 private UUID p_cloneAppearanceFrom;
61 private UUID p_returnUuid;
62
63 private AvatarAppearance GetAppearance(UUID target, Scene scene)
64 {
65 if (m_appearanceCache.ContainsKey(target))
66 return m_appearanceCache[target];
67
68 AvatarAppearance x = scene.CommsManager.AvatarService.GetUserAppearance(target);
69
70 m_appearanceCache.Add(target, x);
71
72 return x;
73 }
74
51 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom) 75 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom)
52 { 76 {
53 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); 77 // Block.
54 scene.AddNewClient(npcAvatar); 78 m_createMutex.WaitOne();
55 79
56 ScenePresence sp; 80 // Copy Temp Variables for Timer to pick up.
57 if(scene.TryGetAvatar(npcAvatar.AgentId, out sp)) 81 lock (p_lock)
58 { 82 {
59 AvatarAppearance x = scene.CommsManager.AvatarService.GetUserAppearance(cloneAppearanceFrom); 83 p_firstname = firstname;
60 84 p_lastname = lastname;
61 List<byte> wearbyte = new List<byte>(); 85 p_position = position;
62 for (int i = 0; i < x.VisualParams.Length; i++) 86 p_scene = scene;
63 { 87 p_cloneAppearanceFrom = cloneAppearanceFrom;
64 wearbyte.Add(x.VisualParams[i]); 88 p_inUse = true;
65 } 89 p_returnUuid = UUID.Zero;
90 }
66 91
67 sp.SetAppearance(x.Texture.GetBytes(), wearbyte); 92 while (p_returnUuid == UUID.Zero)
93 {
94 Thread.Sleep(250);
68 } 95 }
69 96
70 m_avatars.Add(npcAvatar.AgentId, npcAvatar); 97 m_createMutex.ReleaseMutex();
71 98
72 return npcAvatar.AgentId; 99 return p_returnUuid;
73 } 100 }
74 101
75 public void Autopilot(UUID agentID, Scene scene, Vector3 pos) 102 public void Autopilot(UUID agentID, Scene scene, Vector3 pos)
76 { 103 {
77 ScenePresence sp; 104 lock (m_avatars)
78 scene.TryGetAvatar(agentID, out sp); 105 {
79 sp.DoAutoPilot(0,pos,m_avatars[agentID]); 106 if (m_avatars.ContainsKey(agentID))
107 {
108 ScenePresence sp;
109 scene.TryGetAvatar(agentID, out sp);
110 sp.DoAutoPilot(0, pos, m_avatars[agentID]);
111 }
112 }
80 } 113 }
81 114
82 public void Say(UUID agentID, Scene scene, string text) 115 public void Say(UUID agentID, Scene scene, string text)
83 { 116 {
84 m_avatars[agentID].Say(text); 117 lock (m_avatars)
118 {
119 if (m_avatars.ContainsKey(agentID))
120 {
121 m_avatars[agentID].Say(text);
122 }
123 }
85 } 124 }
86 125
87 public void DeleteNPC(UUID agentID, Scene scene) 126 public void DeleteNPC(UUID agentID, Scene scene)
88 { 127 {
89 scene.RemoveClient(agentID); 128 lock (m_avatars)
129 {
130 if (m_avatars.ContainsKey(agentID))
131 {
132 scene.RemoveClient(agentID);
133 m_avatars.Remove(agentID);
134 }
135 }
90 } 136 }
91 137
92 138
93 public void Initialise(Scene scene, IConfigSource source) 139 public void Initialise(Scene scene, IConfigSource source)
94 { 140 {
95 scene.RegisterModuleInterface<INPCModule>(this); 141 scene.RegisterModuleInterface<INPCModule>(this);
142
143 m_timer.Elapsed += m_timer_Elapsed;
144 m_timer.Start();
145 }
146
147 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
148 {
149 lock (p_lock)
150 {
151 if (p_inUse)
152 {
153 p_inUse = false;
154
155 NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene);
156 npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue);
157
158 p_scene.ClientManager.Add(npcAvatar.CircuitCode, npcAvatar);
159 p_scene.AddNewClient(npcAvatar);
160
161 ScenePresence sp;
162 if (p_scene.TryGetAvatar(npcAvatar.AgentId, out sp))
163 {
164 AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene);
165
166 List<byte> wearbyte = new List<byte>();
167 for (int i = 0; i < x.VisualParams.Length; i++)
168 {
169 wearbyte.Add(x.VisualParams[i]);
170 }
171
172 sp.SetAppearance(x.Texture.GetBytes(), wearbyte);
173 }
174
175 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
176
177 p_returnUuid = npcAvatar.AgentId;
178 }
179 }
96 } 180 }
97 181
98 public void PostInitialise() 182 public void PostInitialise()
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
index a74eb0c..8d8b3fe 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
@@ -43,6 +43,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
43 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 43 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
44 private bool flying; 44 private bool flying;
45 private bool iscolliding; 45 private bool iscolliding;
46
46 public BasicActor() 47 public BasicActor()
47 { 48 {
48 _velocity = new PhysicsVector(); 49 _velocity = new PhysicsVector();
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
index c275021..d6f4d0d 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
@@ -46,12 +46,17 @@ namespace OpenSim.Region.Physics.Manager
46 Z = z; 46 Z = z;
47 } 47 }
48 48
49 public PhysicsVector(PhysicsVector pv) : this(pv.X, pv.Y, pv.Z)
50 {
51 }
52
49 public void setValues(float x, float y, float z) 53 public void setValues(float x, float y, float z)
50 { 54 {
51 X = x; 55 X = x;
52 Y = y; 56 Y = y;
53 Z = z; 57 Z = z;
54 } 58 }
59
55 public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); 60 public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f);
56 61
57 public override string ToString() 62 public override string ToString()
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 35433c6..38df751 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -1025,7 +1025,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1025 } 1025 }
1026 } 1026 }
1027 1027
1028
1029 if (flying) 1028 if (flying)
1030 { 1029 {
1031 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); 1030 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
@@ -1044,7 +1043,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1044 vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f; 1043 vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f;
1045 } 1044 }
1046 // end add Kitto Flora 1045 // end add Kitto Flora
1047
1048 } 1046 }
1049 if (PhysicsVector.isFinite(vec)) 1047 if (PhysicsVector.isFinite(vec))
1050 { 1048 {
@@ -1080,8 +1078,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1080 _parent_scene.geom_name_map.Remove(Shell); 1078 _parent_scene.geom_name_map.Remove(Shell);
1081 Shell = IntPtr.Zero; 1079 Shell = IntPtr.Zero;
1082 } 1080 }
1083
1084 return;
1085 } 1081 }
1086 } 1082 }
1087 1083
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
index 1973adf..35fc616 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Region.Physics.POSPlugin
43 private PhysicsVector _acceleration; 43 private PhysicsVector _acceleration;
44 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 44 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
45 private bool flying; 45 private bool flying;
46 private bool iscolliding; 46 private bool isColliding;
47 47
48 public POSCharacter() 48 public POSCharacter()
49 { 49 {
@@ -116,8 +116,8 @@ namespace OpenSim.Region.Physics.POSPlugin
116 116
117 public override bool IsColliding 117 public override bool IsColliding
118 { 118 {
119 get { return iscolliding; } 119 get { return isColliding; }
120 set { iscolliding = value; } 120 set { isColliding = value; }
121 } 121 }
122 122
123 public override bool CollidingGround 123 public override bool CollidingGround
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
index 5361be0..fa8cc70 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
@@ -113,20 +113,16 @@ namespace OpenSim.Region.Physics.POSPlugin
113 c.Position.Z - p.Position.Z) * Quaternion.Inverse(p.Orientation); 113 c.Position.Z - p.Position.Z) * Quaternion.Inverse(p.Orientation);
114 Vector3 avatarSize = new Vector3(c.Size.X, c.Size.Y, c.Size.Z) * Quaternion.Inverse(p.Orientation); 114 Vector3 avatarSize = new Vector3(c.Size.X, c.Size.Y, c.Size.Z) * Quaternion.Inverse(p.Orientation);
115 115
116 if (Math.Abs(rotatedPos.X) >= (p.Size.X*0.5 + Math.Abs(avatarSize.X)) || 116 return (Math.Abs(rotatedPos.X) < (p.Size.X*0.5 + Math.Abs(avatarSize.X)) &&
117 Math.Abs(rotatedPos.Y) >= (p.Size.Y*0.5 + Math.Abs(avatarSize.Y)) || 117 Math.Abs(rotatedPos.Y) < (p.Size.Y*0.5 + Math.Abs(avatarSize.Y)) &&
118 Math.Abs(rotatedPos.Z) >= (p.Size.Z*0.5 + Math.Abs(avatarSize.Z))) 118 Math.Abs(rotatedPos.Z) < (p.Size.Z*0.5 + Math.Abs(avatarSize.Z)));
119 {
120 return false;
121 }
122 return true;
123 } 119 }
124 120
125 private bool isCollidingWithPrim(POSCharacter c) 121 private bool isCollidingWithPrim(POSCharacter c)
126 { 122 {
127 for (int i = 0; i < _prims.Count; ++i) 123 foreach (POSPrim p in _prims)
128 { 124 {
129 if (isColliding(c, _prims[i])) 125 if (isColliding(c, p))
130 { 126 {
131 return true; 127 return true;
132 } 128 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 972e71c..16dd834 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1978,25 +1978,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
1979 } 1979 }
1980 1980
1981 private LSL_Rotation GetPartRot( SceneObjectPart part ) 1981 private LSL_Rotation GetPartRot(SceneObjectPart part)
1982 { 1982 {
1983 Quaternion q; 1983 Quaternion q;
1984 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim 1984 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim
1985 { 1985 {
1986 if (part.ParentGroup.RootPart.AttachmentPoint != 0) 1986 if (part.ParentGroup.RootPart.AttachmentPoint != 0)
1987 { 1987 {
1988 ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); 1988 ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar);
1989 if (avatar != null) 1989 if (avatar != null)
1990 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) 1990 {
1991 q = avatar.CameraRotation; // Mouselook 1991 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
1992 else 1992 q = avatar.CameraRotation; // Mouselook
1993 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 1993 else
1994 else 1994 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
1995 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case 1995 }
1996 } 1996 else
1997 else 1997 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
1998 q = part.ParentGroup.GroupRotation; // just the group rotation 1998 }
1999 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 1999 else
2000 q = part.ParentGroup.GroupRotation; // just the group rotation
2001 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2000 } 2002 }
2001 q = part.GetWorldRotation(); 2003 q = part.GetWorldRotation();
2002 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2004 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 6e3a3ab..b1c357c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -31,12 +31,14 @@ using System.Collections.Generic;
31using System.Runtime.Remoting.Lifetime; 31using System.Runtime.Remoting.Lifetime;
32using System.Text; 32using System.Text;
33using System.Net; 33using System.Net;
34using System.Threading;
34using OpenMetaverse; 35using OpenMetaverse;
35using Nini.Config; 36using Nini.Config;
36using OpenSim; 37using OpenSim;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Region.CoreModules.Avatar.NPC;
40using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Scenes.Hypergrid; 44using OpenSim.Region.Framework.Scenes.Hypergrid;
@@ -831,6 +833,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
831 return drawList; 833 return drawList;
832 } 834 }
833 835
836 public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y)
837 {
838 CheckThreatLevel(ThreatLevel.None, "osDrawFilledPolygon");
839
840 m_host.AddScriptLPS(1);
841
842 if (x.Length != y.Length || x.Length < 3)
843 {
844 return "";
845 }
846 drawList += "FillPolygon " + x.GetLSLStringItem(0) + "," + y.GetLSLStringItem(0);
847 for (int i = 1; i < x.Length; i++)
848 {
849 drawList += "," + x.GetLSLStringItem(i) + "," + y.GetLSLStringItem(i);
850 }
851 drawList += "; ";
852 return drawList;
853 }
854
834 public string osSetFontSize(string drawList, int fontSize) 855 public string osSetFontSize(string drawList, int fontSize)
835 { 856 {
836 CheckThreatLevel(ThreatLevel.None, "osSetFontSize"); 857 CheckThreatLevel(ThreatLevel.None, "osSetFontSize");
@@ -858,6 +879,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
858 return drawList; 879 return drawList;
859 } 880 }
860 881
882 public string osSetPenCap(string drawList, string direction, string type)
883 {
884 CheckThreatLevel(ThreatLevel.None, "osSetPenColour");
885
886 m_host.AddScriptLPS(1);
887 drawList += "PenCap " + direction + "," + type + "; ";
888 return drawList;
889 }
890
861 public string osDrawImage(string drawList, int width, int height, string imageUrl) 891 public string osDrawImage(string drawList, int width, int height, string imageUrl)
862 { 892 {
863 CheckThreatLevel(ThreatLevel.None, "osDrawImage"); 893 CheckThreatLevel(ThreatLevel.None, "osDrawImage");
@@ -1762,5 +1792,57 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1762 return retVal; 1792 return retVal;
1763 } 1793 }
1764 1794
1795 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom)
1796 {
1797 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
1798 //QueueUserWorkItem
1799
1800 INPCModule module = World.RequestModuleInterface<INPCModule>();
1801 if (module != null)
1802 {
1803 UUID x = module.CreateNPC(firstname,
1804 lastname,
1805 new Vector3((float) position.x, (float) position.y, (float) position.z),
1806 World,
1807 new UUID(cloneFrom));
1808
1809 return new LSL_Key(x.ToString());
1810 }
1811 return new LSL_Key(UUID.Zero.ToString());
1812 }
1813
1814 public void osNpcMoveTo(LSL_Key npc, LSL_Vector position)
1815 {
1816 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
1817
1818 INPCModule module = World.RequestModuleInterface<INPCModule>();
1819 if (module != null)
1820 {
1821 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
1822 module.Autopilot(new UUID(npc.m_string), World, pos);
1823 }
1824 }
1825
1826 public void osNpcSay(LSL_Key npc, string message)
1827 {
1828 CheckThreatLevel(ThreatLevel.High, "osNpcSay");
1829
1830 INPCModule module = World.RequestModuleInterface<INPCModule>();
1831 if (module != null)
1832 {
1833 module.Say(new UUID(npc.m_string), World, message);
1834 }
1835 }
1836
1837 public void osNpcRemove(LSL_Key npc)
1838 {
1839 CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
1840
1841 INPCModule module = World.RequestModuleInterface<INPCModule>();
1842 if (module != null)
1843 {
1844 module.DeleteNPC(new UUID(npc.m_string), World);
1845 }
1846 }
1765 } 1847 }
1766} 1848}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 0be29f2..2365bee 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -97,9 +97,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
97 string osDrawEllipse(string drawList, int width, int height); 97 string osDrawEllipse(string drawList, int width, int height);
98 string osDrawRectangle(string drawList, int width, int height); 98 string osDrawRectangle(string drawList, int width, int height);
99 string osDrawFilledRectangle(string drawList, int width, int height); 99 string osDrawFilledRectangle(string drawList, int width, int height);
100 string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y);
100 string osSetFontSize(string drawList, int fontSize); 101 string osSetFontSize(string drawList, int fontSize);
101 string osSetPenSize(string drawList, int penSize); 102 string osSetPenSize(string drawList, int penSize);
102 string osSetPenColour(string drawList, string colour); 103 string osSetPenColour(string drawList, string colour);
104 string osSetPenCap(string drawList, string direction, string type);
103 string osDrawImage(string drawList, int width, int height, string imageUrl); 105 string osDrawImage(string drawList, int width, int height, string imageUrl);
104 vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize); 106 vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize);
105 void osSetStateEvents(int events); 107 void osSetStateEvents(int events);
@@ -149,5 +151,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
149 151
150 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); 152 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
151 153
154
155 key osNpcCreate(string user, string name, vector position, key cloneFrom);
156 void osNpcMoveTo(key npc, vector position);
157 void osNpcSay(key npc, string message);
158 void osNpcRemove(key npc);
159
152 } 160 }
153} 161}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index abdba05..f877acb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -267,6 +267,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
267 return m_OSSL_Functions.osDrawFilledRectangle(drawList, width, height); 267 return m_OSSL_Functions.osDrawFilledRectangle(drawList, width, height);
268 } 268 }
269 269
270 public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y)
271 {
272 return m_OSSL_Functions.osDrawFilledPolygon(drawList, x, y);
273 }
274
270 public string osSetFontSize(string drawList, int fontSize) 275 public string osSetFontSize(string drawList, int fontSize)
271 { 276 {
272 return m_OSSL_Functions.osSetFontSize(drawList, fontSize); 277 return m_OSSL_Functions.osSetFontSize(drawList, fontSize);
@@ -277,6 +282,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
277 return m_OSSL_Functions.osSetPenSize(drawList, penSize); 282 return m_OSSL_Functions.osSetPenSize(drawList, penSize);
278 } 283 }
279 284
285 public string osSetPenCap(string drawList, string direction, string type)
286 {
287 return m_OSSL_Functions.osSetPenCap(drawList, direction, type);
288 }
289
280 public string osSetPenColour(string drawList, string colour) 290 public string osSetPenColour(string drawList, string colour)
281 { 291 {
282 return m_OSSL_Functions.osSetPenColour(drawList, colour); 292 return m_OSSL_Functions.osSetPenColour(drawList, colour);
@@ -393,6 +403,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
393 return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); 403 return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules);
394 } 404 }
395 405
406 public key osNpcCreate(string user, string name, vector position, key cloneFrom)
407 {
408 return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom);
409 }
410
411 public void osNpcMoveTo(key npc, vector position)
412 {
413 m_OSSL_Functions.osNpcMoveTo(npc, position);
414 }
415
416 public void osNpcSay(key npc, string message)
417 {
418 m_OSSL_Functions.osNpcSay(npc, message);
419 }
420
421 public void osNpcRemove(key npc)
422 {
423 m_OSSL_Functions.osNpcRemove(npc);
424 }
396 425
397 public OSSLPrim Prim; 426 public OSSLPrim Prim;
398 427
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index bdacf8b..2842f6b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -439,6 +439,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
439 439
440 set {m_data = value; } 440 set {m_data = value; }
441 } 441 }
442 // Function to obtain LSL type from an index. This is needed
443 // because LSL lists allow for multiple types, and safely
444 // iterating in them requires a type check.
445 public Type GetLSLListItemType(int itemIndex)
446 {
447 return m_data[itemIndex].GetType();
448 }
442 449
443 // Member functions to obtain item as specific types. 450 // Member functions to obtain item as specific types.
444 // For cases where implicit conversions would apply if items 451 // For cases where implicit conversions would apply if items
@@ -465,6 +472,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
465 { 472 {
466 return new LSL_Types.LSLFloat((Double)m_data[itemIndex]); 473 return new LSL_Types.LSLFloat((Double)m_data[itemIndex]);
467 } 474 }
475 else if (m_data[itemIndex] is LSL_Types.LSLString)
476 {
477 return new LSL_Types.LSLFloat(m_data[itemIndex].ToString());
478 }
468 else 479 else
469 { 480 {
470 return (LSL_Types.LSLFloat)m_data[itemIndex]; 481 return (LSL_Types.LSLFloat)m_data[itemIndex];
@@ -481,20 +492,32 @@ namespace OpenSim.Region.ScriptEngine.Shared
481 { 492 {
482 return new LSL_Types.LSLString((string)m_data[itemIndex]); 493 return new LSL_Types.LSLString((string)m_data[itemIndex]);
483 } 494 }
495 else if (m_data[itemIndex] is LSL_Types.LSLFloat)
496 {
497 return new LSL_Types.LSLString((LSLFloat)m_data[itemIndex]);
498 }
499 else if (m_data[itemIndex] is LSL_Types.LSLInteger)
500 {
501 return new LSL_Types.LSLString((LSLInteger)m_data[itemIndex]);
502 }
484 else 503 else
485 { 504 {
486 return (LSL_Types.LSLString)m_data[itemIndex]; 505 return (LSL_Types.LSLString)m_data[itemIndex];
487 } 506 }
488 } 507 }
489 508
490 public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex) 509 public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex)
491 { 510 {
492 if (m_data[itemIndex] is LSL_Types.LSLInteger) 511 if (m_data[itemIndex] is LSL_Types.LSLInteger)
493 return (LSL_Types.LSLInteger)m_data[itemIndex]; 512 return (LSL_Types.LSLInteger)m_data[itemIndex];
494 else if (m_data[itemIndex] is Int32) 513 if (m_data[itemIndex] is LSL_Types.LSLFloat)
495 return new LSLInteger((int)m_data[itemIndex]); 514 return new LSLInteger((int)m_data[itemIndex]);
496 else 515 else if (m_data[itemIndex] is Int32)
497 throw new InvalidCastException(); 516 return new LSLInteger((int)m_data[itemIndex]);
517 else if (m_data[itemIndex] is LSL_Types.LSLString)
518 return new LSLInteger((string)m_data[itemIndex]);
519 else
520 throw new InvalidCastException();
498 } 521 }
499 522
500 public LSL_Types.Vector3 GetVector3Item(int itemIndex) 523 public LSL_Types.Vector3 GetVector3Item(int itemIndex)
@@ -1331,6 +1354,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
1331 m_string=s; 1354 m_string=s;
1332 } 1355 }
1333 1356
1357 public LSLString(LSLInteger i)
1358 {
1359 string s = String.Format("{0}", i);
1360 m_string = s;
1361 }
1362
1334 #endregion 1363 #endregion
1335 1364
1336 #region Operators 1365 #region Operators