aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs21
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs40
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs27
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs235
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs79
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs74
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs347
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs36
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs16
-rw-r--r--OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs15
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs29
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs2
27 files changed, 758 insertions, 246 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index bb4f8a7..311dd31 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -772,9 +772,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
772 catch (Exception e) 772 catch (Exception e)
773 { 773 {
774 // Make sure that we see any exception caused by the asynchronous operation. 774 // Make sure that we see any exception caused by the asynchronous operation.
775 m_log.ErrorFormat( 775 m_log.Error(
776 "[LLCLIENTVIEW]: Caught exception while processing {0} for {1}, {2} {3}", 776 string.Format(
777 packetObject.Pack, Name, e.Message, e.StackTrace); 777 "[LLCLIENTVIEW]: Caught exception while processing {0} for {1} ", packetObject.Pack, Name),
778 e);
778 } 779 }
779 } 780 }
780 781
@@ -9903,6 +9904,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9903 } 9904 }
9904 return true; 9905 return true;
9905 9906
9907 case "kickestate":
9908
9909 if(((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
9910 {
9911 UUID invoice = messagePacket.MethodData.Invoice;
9912 UUID SenderID = messagePacket.AgentData.AgentID;
9913 UUID Prey;
9914
9915 UUID.TryParse(Utils.BytesToString(messagePacket.ParamList[0].Parameter), out Prey);
9916
9917 OnEstateTeleportOneUserHomeRequest(this, invoice, SenderID, Prey);
9918 }
9919 return true;
9920
9906 default: 9921 default:
9907 m_log.WarnFormat( 9922 m_log.WarnFormat(
9908 "[LLCLIENTVIEW]: EstateOwnerMessage: Unknown method {0} requested for {1} in {2}", 9923 "[LLCLIENTVIEW]: EstateOwnerMessage: Unknown method {0} requested for {1} in {2}",
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 5fb995b..f0dc238 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
546 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); 546 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
547 TaskInventoryItem scriptItem 547 TaskInventoryItem scriptItem
548 = TaskInventoryHelpers.AddScript( 548 = TaskInventoryHelpers.AddScript(
549 scene, 549 scene.AssetService,
550 so.RootPart, 550 so.RootPart,
551 "scriptItem", 551 "scriptItem",
552 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); 552 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");
@@ -659,7 +659,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
659 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); 659 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
660 TaskInventoryItem scriptTaskItem 660 TaskInventoryItem scriptTaskItem
661 = TaskInventoryHelpers.AddScript( 661 = TaskInventoryHelpers.AddScript(
662 scene, 662 scene.AssetService,
663 so.RootPart, 663 so.RootPart,
664 "scriptItem", 664 "scriptItem",
665 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); 665 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index c632798..c88141c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -455,6 +455,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
455 { 455 {
456 // Check if it's a type of message that we should handle 456 // Check if it's a type of message that we should handle
457 if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered) 457 if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered)
458 || (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered)
458 || (im.dialog == (byte) InstantMessageDialog.InventoryAccepted) 459 || (im.dialog == (byte) InstantMessageDialog.InventoryAccepted)
459 || (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) 460 || (im.dialog == (byte) InstantMessageDialog.InventoryDeclined)
460 || (im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined))) 461 || (im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined)))
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index 6abdc6f..8b09b3e 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -318,8 +318,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
318 writer.WriteString(reader.Value); 318 writer.WriteString(reader.Value);
319 break; 319 break;
320 320
321 case XmlNodeType.XmlDeclaration:
322 // For various reasons, not all serializations have xml declarations (or consistent ones)
323 // and as it's embedded inside a byte stream we don't need it anyway, so ignore.
324 break;
325
321 default: 326 default:
322 m_log.WarnFormat("[HG ASSET MAPPER]: Unrecognized node in asset XML transform in {0}", m_scene.Name); 327 m_log.WarnFormat(
328 "[HG ASSET MAPPER]: Unrecognized node {0} in asset XML transform in {1}",
329 reader.NodeType, m_scene.Name);
323 break; 330 break;
324 } 331 }
325 } 332 }
@@ -336,8 +343,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
336 { 343 {
337 TransformXml(reader, writer); 344 TransformXml(reader, writer);
338 345
339 writer.WriteEndDocument();
340
341// Console.WriteLine("Output: [{0}]", sw.ToString()); 346// Console.WriteLine("Output: [{0}]", sw.ToString());
342 347
343 return sw.ToString(); 348 return sw.ToString();
@@ -478,12 +483,37 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
478 { 483 {
479 asset = m_scene.AssetService.Get(uuid.ToString()); 484 asset = m_scene.AssetService.Get(uuid.ToString());
480 if (asset == null) 485 if (asset == null)
486 {
481 m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid); 487 m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid);
488 }
482 else 489 else
483 success &= PostAsset(userAssetURL, asset); 490 {
491 try
492 {
493 success &= PostAsset(userAssetURL, asset);
494 }
495 catch (Exception e)
496 {
497 m_log.Error(
498 string.Format(
499 "[HG ASSET MAPPER]: Failed to post asset {0} (type {1}, length {2}) referenced from {3} to {4} with exception ",
500 asset.ID, asset.Type, asset.Data.Length, assetID, userAssetURL),
501 e);
502
503 // For debugging purposes for now we will continue to throw the exception up the stack as was already happening. However, after
504 // debugging we may want to simply report the failure if we can tell this is due to a failure
505 // with a particular asset and not a destination network failure where all asset posts will fail (and
506 // generate large amounts of log spam).
507 throw e;
508 }
509 }
484 } 510 }
485 else 511 else
486 m_log.DebugFormat("[HG ASSET MAPPER]: Didn't post asset {0} because it already exists in asset server {1}", uuid, userAssetURL); 512 {
513 m_log.DebugFormat(
514 "[HG ASSET MAPPER]: Didn't post asset {0} referenced from {1} because it already exists in asset server {2}",
515 uuid, assetID, userAssetURL);
516 }
487 } 517 }
488 518
489 if (!success) 519 if (!success)
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index f958510..a77bc63 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -614,6 +614,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
614 protected InventoryItemBase CreateItemForObject( 614 protected InventoryItemBase CreateItemForObject(
615 DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID) 615 DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID)
616 { 616 {
617// m_log.DebugFormat(
618// "[BASIC INVENTORY ACCESS MODULE]: Creating item for object {0} {1} for folder {2}, action {3}",
619// so.Name, so.UUID, folderID, action);
620//
617 // Get the user info of the item destination 621 // Get the user info of the item destination
618 // 622 //
619 UUID userID = UUID.Zero; 623 UUID userID = UUID.Zero;
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index d8f9f8c..780ec69 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -801,8 +801,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
801 801
802 // Friends with benefits should be able to edit the objects too 802 // Friends with benefits should be able to edit the objects too
803 if (IsFriendWithPerms(currentUser, objectOwner)) 803 if (IsFriendWithPerms(currentUser, objectOwner))
804 {
804 // Return immediately, so that the administrator can share objects with friends 805 // Return immediately, so that the administrator can share objects with friends
805 return true; 806 return true;
807 }
806 808
807 // Users should be able to edit what is over their land. 809 // Users should be able to edit what is over their land.
808 ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y); 810 ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
@@ -1522,6 +1524,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1522 if (m_bypassPermissions) return m_bypassPermissionsValue; 1524 if (m_bypassPermissions) return m_bypassPermissionsValue;
1523 1525
1524 bool permission = GenericObjectPermission(userID, objectID, false); 1526 bool permission = GenericObjectPermission(userID, objectID, false);
1527
1528 SceneObjectGroup so = (SceneObjectGroup)m_scene.Entities[objectID];
1529
1525 if (!permission) 1530 if (!permission)
1526 { 1531 {
1527 if (!m_scene.Entities.ContainsKey(objectID)) 1532 if (!m_scene.Entities.ContainsKey(objectID))
@@ -1535,31 +1540,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1535 return false; 1540 return false;
1536 } 1541 }
1537 1542
1538 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
1539 // UUID taskOwner = null; 1543 // UUID taskOwner = null;
1540 // Added this because at this point in time it wouldn't be wise for 1544 // Added this because at this point in time it wouldn't be wise for
1541 // the administrator object permissions to take effect. 1545 // the administrator object permissions to take effect.
1542 // UUID objectOwner = task.OwnerID; 1546 // UUID objectOwner = task.OwnerID;
1543 1547
1544 if ((task.RootPart.EveryoneMask & PERM_COPY) != 0) 1548 if ((so.RootPart.EveryoneMask & PERM_COPY) != 0)
1545 permission = true; 1549 permission = true;
1550 }
1546 1551
1547 if (task.OwnerID != userID) 1552 if (so.OwnerID != userID)
1548 { 1553 {
1549 if ((task.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS)) 1554 if ((so.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS))
1550 permission = false; 1555 permission = false;
1551 }
1552 else
1553 {
1554 if ((task.GetEffectivePermissions() & PERM_COPY) != PERM_COPY)
1555 permission = false;
1556 }
1557 } 1556 }
1558 else 1557 else
1559 { 1558 {
1560 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID]; 1559 if ((so.GetEffectivePermissions() & PERM_COPY) != PERM_COPY)
1561
1562 if ((task.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS))
1563 permission = false; 1560 permission = false;
1564 } 1561 }
1565 1562
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
index 62d232e..be1fb24 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.IO; 29using System.IO;
30using OpenSim.Framework;
30using OpenSim.Region.Framework.Interfaces; 31using OpenSim.Region.Framework.Interfaces;
31using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
32 33
@@ -73,12 +74,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
73 public ITerrainChannel LoadFile(string filename) 74 public ITerrainChannel LoadFile(string filename)
74 { 75 {
75 FileInfo file = new FileInfo(filename); 76 FileInfo file = new FileInfo(filename);
76 FileStream s = file.Open(FileMode.Open, FileAccess.Read);
77 ITerrainChannel retval = LoadStream(s);
78 77
79 s.Close(); 78 ITerrainChannel channel;
80 79
81 return retval; 80 using (FileStream s = file.Open(FileMode.Open, FileAccess.Read))
81 channel = LoadStream(s);
82
83 return channel;
82 } 84 }
83 85
84 public ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight) 86 public ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight)
@@ -86,153 +88,159 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
86 TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight); 88 TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight);
87 89
88 FileInfo file = new FileInfo(filename); 90 FileInfo file = new FileInfo(filename);
89 FileStream s = file.Open(FileMode.Open, FileAccess.Read);
90 BinaryReader bs = new BinaryReader(s);
91 91
92 int currFileYOffset = fileHeight - 1; 92 using (FileStream s = file.Open(FileMode.Open, FileAccess.Read))
93 93 using (BinaryReader bs = new BinaryReader(s))
94 // if our region isn't on the first Y section of the areas to be landscaped, then
95 // advance to our section of the file
96 while (currFileYOffset > offsetY)
97 { 94 {
98 // read a whole strip of regions 95 int currFileYOffset = fileHeight - 1;
99 int heightsToRead = sectionHeight * (fileWidth * sectionWidth);
100 bs.ReadBytes(heightsToRead * 13); // because there are 13 fun channels
101 currFileYOffset--;
102 }
103 96
104 // got to the Y start offset within the file of our region 97 // if our region isn't on the first Y section of the areas to be landscaped, then
105 // so read the file bits associated with our region 98 // advance to our section of the file
106 int y; 99 while (currFileYOffset > offsetY)
107 // for each Y within our Y offset
108 for (y = sectionHeight - 1; y >= 0; y--)
109 {
110 int currFileXOffset = 0;
111
112 // if our region isn't the first X section of the areas to be landscaped, then
113 // advance the stream to the X start pos of our section in the file
114 // i.e. eat X upto where we start
115 while (currFileXOffset < offsetX)
116 { 100 {
117 bs.ReadBytes(sectionWidth * 13); 101 // read a whole strip of regions
118 currFileXOffset++; 102 int heightsToRead = sectionHeight * (fileWidth * sectionWidth);
103 bs.ReadBytes(heightsToRead * 13); // because there are 13 fun channels
104 currFileYOffset--;
119 } 105 }
120 106
121 // got to our X offset, so write our regions X line 107 // got to the Y start offset within the file of our region
122 int x; 108 // so read the file bits associated with our region
123 for (x = 0; x < sectionWidth; x++) 109 int y;
124 {
125 // Read a strip and continue
126 retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 128.0);
127 bs.ReadBytes(11);
128 }
129 // record that we wrote it
130 currFileXOffset++;
131 110
132 // if our region isn't the last X section of the areas to be landscaped, then 111 // for each Y within our Y offset
133 // advance the stream to the end of this Y column 112 for (y = sectionHeight - 1; y >= 0; y--)
134 while (currFileXOffset < fileWidth)
135 { 113 {
136 // eat the next regions x line 114 int currFileXOffset = 0;
137 bs.ReadBytes(sectionWidth * 13); //The 13 channels again 115
116 // if our region isn't the first X section of the areas to be landscaped, then
117 // advance the stream to the X start pos of our section in the file
118 // i.e. eat X upto where we start
119 while (currFileXOffset < offsetX)
120 {
121 bs.ReadBytes(sectionWidth * 13);
122 currFileXOffset++;
123 }
124
125 // got to our X offset, so write our regions X line
126 int x;
127 for (x = 0; x < sectionWidth; x++)
128 {
129 // Read a strip and continue
130 retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 128.0);
131 bs.ReadBytes(11);
132 }
133 // record that we wrote it
138 currFileXOffset++; 134 currFileXOffset++;
135
136 // if our region isn't the last X section of the areas to be landscaped, then
137 // advance the stream to the end of this Y column
138 while (currFileXOffset < fileWidth)
139 {
140 // eat the next regions x line
141 bs.ReadBytes(sectionWidth * 13); //The 13 channels again
142 currFileXOffset++;
143 }
139 } 144 }
140 } 145 }
141 146
142 bs.Close();
143 s.Close();
144
145 return retval; 147 return retval;
146 } 148 }
147 149
148 public ITerrainChannel LoadStream(Stream s) 150 public ITerrainChannel LoadStream(Stream s)
149 { 151 {
150 TerrainChannel retval = new TerrainChannel(); 152 // The raw format doesn't contain any dimension information.
153 // Guess the square dimensions by using the length of the raw file.
154 double dimension = Math.Sqrt((double)(s.Length / 13));
155 // Regions are always multiples of 256.
156 int trimmedDimension = (int)dimension - ((int)dimension % (int)Constants.RegionSize);
157 if (trimmedDimension < Constants.RegionSize)
158 trimmedDimension = (int)Constants.RegionSize;
159
160 TerrainChannel retval = new TerrainChannel(trimmedDimension, trimmedDimension);
151 161
152 BinaryReader bs = new BinaryReader(s); 162 using (BinaryReader bs = new BinaryReader(s))
153 int y;
154 for (y = 0; y < retval.Height; y++)
155 { 163 {
156 int x; 164 int y;
157 for (x = 0; x < retval.Width; x++) 165 for (y = 0; y < retval.Height; y++)
158 { 166 {
159 retval[x, (retval.Height - 1) - y] = bs.ReadByte() * (bs.ReadByte() / 128.0); 167 int x;
160 bs.ReadBytes(11); // Advance the stream to next bytes. 168 for (x = 0; x < retval.Width; x++)
169 {
170 retval[x, (retval.Height - 1) - y] = bs.ReadByte() * (bs.ReadByte() / 128.0);
171 bs.ReadBytes(11); // Advance the stream to next bytes.
172 }
161 } 173 }
162 } 174 }
163 175
164 bs.Close();
165
166 return retval; 176 return retval;
167 } 177 }
168 178
169 public void SaveFile(string filename, ITerrainChannel map) 179 public void SaveFile(string filename, ITerrainChannel map)
170 { 180 {
171 FileInfo file = new FileInfo(filename); 181 FileInfo file = new FileInfo(filename);
172 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
173 SaveStream(s, map);
174 182
175 s.Close(); 183 using (FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write))
184 SaveStream(s, map);
176 } 185 }
177 186
178 public void SaveStream(Stream s, ITerrainChannel map) 187 public void SaveStream(Stream s, ITerrainChannel map)
179 { 188 {
180 BinaryWriter binStream = new BinaryWriter(s); 189 using (BinaryWriter binStream = new BinaryWriter(s))
181
182 // Output the calculated raw
183 for (int y = 0; y < map.Height; y++)
184 { 190 {
185 for (int x = 0; x < map.Width; x++) 191 // Output the calculated raw
192 for (int y = 0; y < map.Height; y++)
186 { 193 {
187 double t = map[x, (map.Height - 1) - y]; 194 for (int x = 0; x < map.Width; x++)
188 //if height is less than 0, set it to 0 as
189 //can't save -ve values in a LLRAW file
190 if (t < 0d)
191 { 195 {
192 t = 0d; 196 double t = map[x, (map.Height - 1) - y];
197 //if height is less than 0, set it to 0 as
198 //can't save -ve values in a LLRAW file
199 if (t < 0d)
200 {
201 t = 0d;
202 }
203
204 int index = 0;
205
206 // The lookup table is pre-sorted, so we either find an exact match or
207 // the next closest (smaller) match with a binary search
208 index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, (float)t));
209 if (index < 0)
210 index = ~index - 1;
211
212 index = LookupHeightTable[index].Index;
213
214 byte red = (byte) (index & 0xFF);
215 byte green = (byte) ((index >> 8) & 0xFF);
216 const byte blue = 20;
217 const byte alpha1 = 0;
218 const byte alpha2 = 0;
219 const byte alpha3 = 0;
220 const byte alpha4 = 0;
221 const byte alpha5 = 255;
222 const byte alpha6 = 255;
223 const byte alpha7 = 255;
224 const byte alpha8 = 255;
225 byte alpha9 = red;
226 byte alpha10 = green;
227
228 binStream.Write(red);
229 binStream.Write(green);
230 binStream.Write(blue);
231 binStream.Write(alpha1);
232 binStream.Write(alpha2);
233 binStream.Write(alpha3);
234 binStream.Write(alpha4);
235 binStream.Write(alpha5);
236 binStream.Write(alpha6);
237 binStream.Write(alpha7);
238 binStream.Write(alpha8);
239 binStream.Write(alpha9);
240 binStream.Write(alpha10);
193 } 241 }
194
195 int index = 0;
196
197 // The lookup table is pre-sorted, so we either find an exact match or
198 // the next closest (smaller) match with a binary search
199 index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, (float)t));
200 if (index < 0)
201 index = ~index - 1;
202
203 index = LookupHeightTable[index].Index;
204
205 byte red = (byte) (index & 0xFF);
206 byte green = (byte) ((index >> 8) & 0xFF);
207 const byte blue = 20;
208 const byte alpha1 = 0;
209 const byte alpha2 = 0;
210 const byte alpha3 = 0;
211 const byte alpha4 = 0;
212 const byte alpha5 = 255;
213 const byte alpha6 = 255;
214 const byte alpha7 = 255;
215 const byte alpha8 = 255;
216 byte alpha9 = red;
217 byte alpha10 = green;
218
219 binStream.Write(red);
220 binStream.Write(green);
221 binStream.Write(blue);
222 binStream.Write(alpha1);
223 binStream.Write(alpha2);
224 binStream.Write(alpha3);
225 binStream.Write(alpha4);
226 binStream.Write(alpha5);
227 binStream.Write(alpha6);
228 binStream.Write(alpha7);
229 binStream.Write(alpha8);
230 binStream.Write(alpha9);
231 binStream.Write(alpha10);
232 } 242 }
233 } 243 }
234
235 binStream.Close();
236 } 244 }
237 245
238 public string FileExtension 246 public string FileExtension
@@ -259,7 +267,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
259 public bool SupportsTileSave() 267 public bool SupportsTileSave()
260 { 268 {
261 return false; 269 return false;
262 } 270 }
263
264 } 271 }
265} 272} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index c1a398d..d862f18 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -217,8 +217,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
217 { 217 {
218 if (regionInfos.Count == 0) 218 if (regionInfos.Count == 0)
219 remoteClient.SendAlertMessage("No regions found with that name."); 219 remoteClient.SendAlertMessage("No regions found with that name.");
220 else if (regionInfos.Count == 1) 220 // this seems unnecessary because found regions will show up in the search results
221 remoteClient.SendAlertMessage("Region found!"); 221 //else if (regionInfos.Count == 1)
222 // remoteClient.SendAlertMessage("Region found!");
222 } 223 }
223 } 224 }
224 225
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 55db968..4961309 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -807,7 +807,7 @@ namespace OpenSim.Region.Framework.Scenes
807 UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) 807 UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
808 { 808 {
809 //// Retrieve the folder from the sender 809 //// Retrieve the folder from the sender
810 InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId)); 810 InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId, senderId));
811 if (null == folder) 811 if (null == folder)
812 { 812 {
813 m_log.ErrorFormat( 813 m_log.ErrorFormat(
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 527ca35..81cef5b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -265,6 +265,7 @@ namespace OpenSim.Region.Framework.Scenes
265 for (int i = 0; i < parts.Length; i++) 265 for (int i = 0; i < parts.Length; i++)
266 { 266 {
267 SceneObjectPart part = parts[i]; 267 SceneObjectPart part = parts[i];
268// m_log.DebugFormat("[SCENE OBJECT GROUP INVENTORY]: Effective perms of {0} are {1}", part.Name, (OpenMetaverse.PermissionMask)part.OwnerMask);
268 ownerMask &= part.OwnerMask; 269 ownerMask &= part.OwnerMask;
269 perms &= part.Inventory.MaskEffectivePermissions(); 270 perms &= part.Inventory.MaskEffectivePermissions();
270 } 271 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 19e557f..0a1a226 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -924,13 +924,17 @@ namespace OpenSim.Region.Framework.Scenes
924 924
925 string uuid = reader.GetAttribute("UUID"); 925 string uuid = reader.GetAttribute("UUID");
926 926
927 // Even if there is no UUID attribute for some strange reason, we must always read the inner XML
928 // so we don't continually keep checking the same SavedScriptedState element.
929 string innerXml = reader.ReadInnerXml();
930
927 if (uuid != null) 931 if (uuid != null)
928 { 932 {
929// m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name); 933// m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name);
930 934
931 UUID itemid = new UUID(uuid); 935 UUID itemid = new UUID(uuid);
932 if (itemid != UUID.Zero) 936 if (itemid != UUID.Zero)
933 m_savedScriptState[itemid] = reader.ReadInnerXml(); 937 m_savedScriptState[itemid] = innerXml;
934 } 938 }
935 else 939 else
936 { 940 {
@@ -2943,6 +2947,11 @@ namespace OpenSim.Region.Framework.Scenes
2943 uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); 2947 uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify);
2944 uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); 2948 uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify);
2945 RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); 2949 RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
2950
2951// m_log.DebugFormat(
2952// "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}",
2953// (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name);
2954
2946 RootPart.ScheduleFullUpdate(); 2955 RootPart.ScheduleFullUpdate();
2947 } 2956 }
2948 2957
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 1ca250a..57ec1ae 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -266,7 +266,7 @@ namespace OpenSim.Region.Framework.Scenes
266 266
267 public Quaternion SpinOldOrientation = Quaternion.Identity; 267 public Quaternion SpinOldOrientation = Quaternion.Identity;
268 268
269 protected int m_APIDIterations = 0; 269 protected bool m_APIDActive = false;
270 protected Quaternion m_APIDTarget = Quaternion.Identity; 270 protected Quaternion m_APIDTarget = Quaternion.Identity;
271 protected float m_APIDDamp = 0; 271 protected float m_APIDDamp = 0;
272 protected float m_APIDStrength = 0; 272 protected float m_APIDStrength = 0;
@@ -642,6 +642,12 @@ namespace OpenSim.Region.Framework.Scenes
642 } 642 }
643 } 643 }
644 644
645 protected bool APIDActive
646 {
647 get { return m_APIDActive; }
648 set { m_APIDActive = value; }
649 }
650
645 protected Quaternion APIDTarget 651 protected Quaternion APIDTarget
646 { 652 {
647 get { return m_APIDTarget; } 653 get { return m_APIDTarget; }
@@ -923,14 +929,17 @@ namespace OpenSim.Region.Framework.Scenes
923 929
924 set 930 set
925 { 931 {
926 m_velocity = value; 932 if (Util.IsNanOrInfinity(value))
933 m_velocity = Vector3.Zero;
934 else
935 m_velocity = value;
927 936
928 PhysicsActor actor = PhysActor; 937 PhysicsActor actor = PhysActor;
929 if (actor != null) 938 if (actor != null)
930 { 939 {
931 if (actor.IsPhysical) 940 if (actor.IsPhysical)
932 { 941 {
933 actor.Velocity = value; 942 actor.Velocity = m_velocity;
934 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 943 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
935 } 944 }
936 } 945 }
@@ -957,14 +966,30 @@ namespace OpenSim.Region.Framework.Scenes
957 } 966 }
958 return m_angularVelocity; 967 return m_angularVelocity;
959 } 968 }
960 set { m_angularVelocity = value; } 969 set
970 {
971 if (Util.IsNanOrInfinity(value))
972 m_angularVelocity = Vector3.Zero;
973 else
974 m_angularVelocity = value;
975
976 PhysicsActor actor = PhysActor;
977 if ((actor != null) && actor.IsPhysical)
978 actor.RotationalVelocity = m_angularVelocity;
979 }
961 } 980 }
962 981
963 /// <summary></summary> 982 /// <summary></summary>
964 public Vector3 Acceleration 983 public Vector3 Acceleration
965 { 984 {
966 get { return m_acceleration; } 985 get { return m_acceleration; }
967 set { m_acceleration = value; } 986 set
987 {
988 if (Util.IsNanOrInfinity(value))
989 m_acceleration = Vector3.Zero;
990 else
991 m_acceleration = value;
992 }
968 } 993 }
969 994
970 public string Description { get; set; } 995 public string Description { get; set; }
@@ -2610,7 +2635,7 @@ namespace OpenSim.Region.Framework.Scenes
2610 return; 2635 return;
2611 } 2636 }
2612 2637
2613 m_APIDIterations = 1 + (int)(Math.PI * APIDStrength); 2638 APIDActive = true;
2614 } 2639 }
2615 2640
2616 // Necessary to get the lookat deltas applied 2641 // Necessary to get the lookat deltas applied
@@ -2624,7 +2649,7 @@ namespace OpenSim.Region.Framework.Scenes
2624 2649
2625 public void StopLookAt() 2650 public void StopLookAt()
2626 { 2651 {
2627 APIDTarget = Quaternion.Identity; 2652 APIDActive = false;
2628 } 2653 }
2629 2654
2630 2655
@@ -4873,20 +4898,44 @@ namespace OpenSim.Region.Framework.Scenes
4873 { 4898 {
4874 try 4899 try
4875 { 4900 {
4876 if (APIDTarget != Quaternion.Identity) 4901 if (APIDActive)
4877 { 4902 {
4878 if (m_APIDIterations <= 1) 4903 PhysicsActor pa = ParentGroup.RootPart.PhysActor;
4904 if (pa == null || !pa.IsPhysical || APIDStrength < 0.04)
4879 { 4905 {
4880 UpdateRotation(APIDTarget); 4906 StopLookAt();
4881 APIDTarget = Quaternion.Identity;
4882 return; 4907 return;
4883 } 4908 }
4884 4909
4885 Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations); 4910 Quaternion currRot = GetWorldRotation();
4886 rot.Normalize(); 4911 currRot.Normalize();
4887 UpdateRotation(rot); 4912
4913 // difference between current orientation and desired orientation
4914 Quaternion dR = new Quaternion(currRot.X, currRot.Y, currRot.Z, -currRot.W) * APIDTarget;
4888 4915
4889 m_APIDIterations--; 4916 // find axis of rotation to rotate to desired orientation
4917 Vector3 axis = Vector3.UnitX;
4918 float s = (float)Math.Sqrt(1.0f - dR.W * dR.W);
4919 if (s >= 0.001)
4920 {
4921 float invS = 1.0f / s;
4922 if (dR.W < 0) invS = -invS;
4923 axis = new Vector3(dR.X * invS, dR.Y * invS, dR.Z * invS) * currRot;
4924 axis.Normalize();
4925 }
4926
4927 // angle between current and desired orientation
4928 float angle = 2.0f * (float)Math.Acos(dR.W);
4929 if (angle > Math.PI)
4930 angle = 2.0f * (float)Math.PI - angle;
4931
4932 // clamp strength to avoid overshoot
4933 float strength = 1.0f / APIDStrength;
4934 if (strength > 1.0) strength = 1.0f;
4935
4936 // set angular velocity to rotate to desired orientation
4937 // with velocity proportional to strength and angle
4938 AngularVelocity = axis * angle * strength * (float)Math.PI;
4890 4939
4891 // This ensures that we'll check this object on the next iteration 4940 // This ensures that we'll check this object on the next iteration
4892 ParentGroup.QueueForUpdateCheck(); 4941 ParentGroup.QueueForUpdateCheck();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0414f89..b0aa434 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -379,6 +379,11 @@ namespace OpenSim.Region.Framework.Scenes
379 public uint MovementFlag { get; private set; } 379 public uint MovementFlag { get; private set; }
380 380
381 /// <summary> 381 /// <summary>
382 /// Set this if we need to force a movement update on the next received AgentUpdate from the viewer.
383 /// </summary>
384 private const uint ForceUpdateMovementFlagValue = uint.MaxValue;
385
386 /// <summary>
382 /// Is the agent stop control flag currently active? 387 /// Is the agent stop control flag currently active?
383 /// </summary> 388 /// </summary>
384 public bool AgentControlStopActive { get; private set; } 389 public bool AgentControlStopActive { get; private set; }
@@ -822,7 +827,7 @@ namespace OpenSim.Region.Framework.Scenes
822 } 827 }
823 828
824 private bool m_mouseLook; 829 private bool m_mouseLook;
825 private bool m_leftButtonDown; 830// private bool m_leftButtonDown;
826 831
827 private bool m_inTransit; 832 private bool m_inTransit;
828 833
@@ -1005,23 +1010,6 @@ namespace OpenSim.Region.Framework.Scenes
1005 Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge 1010 Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
1006 } 1011 }
1007 1012
1008 private Vector3[] GetWalkDirectionVectors()
1009 {
1010 Vector3[] vector = new Vector3[11];
1011 vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD
1012 vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK
1013 vector[2] = Vector3.UnitY; //LEFT
1014 vector[3] = -Vector3.UnitY; //RIGHT
1015 vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP
1016 vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN
1017 vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE
1018 vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE
1019 vector[8] = Vector3.UnitY; //LEFT_NUDGE
1020 vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
1021 vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE
1022 return vector;
1023 }
1024
1025 #endregion 1013 #endregion
1026 1014
1027 #region Status Methods 1015 #region Status Methods
@@ -1267,7 +1255,7 @@ namespace OpenSim.Region.Framework.Scenes
1267 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will 1255 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
1268 // stall on the border crossing since the existing child agent will still have the last movement 1256 // stall on the border crossing since the existing child agent will still have the last movement
1269 // recorded, which stops the input from being processed. 1257 // recorded, which stops the input from being processed.
1270 MovementFlag = 0; 1258 MovementFlag = ForceUpdateMovementFlagValue;
1271 1259
1272 m_scene.EventManager.TriggerOnMakeRootAgent(this); 1260 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1273 1261
@@ -1925,13 +1913,13 @@ namespace OpenSim.Region.Framework.Scenes
1925 /// </summary> 1913 /// </summary>
1926 public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) 1914 public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
1927 { 1915 {
1928 //m_log.DebugFormat( 1916// m_log.DebugFormat(
1929 // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", 1917// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
1930 // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); 1918// Scene.Name, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
1931 1919
1932 if (IsChildAgent) 1920 if (IsChildAgent)
1933 { 1921 {
1934 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); 1922// m_log.DebugFormat("DEBUG: HandleAgentUpdate: child agent in {0}", Scene.Name);
1935 return; 1923 return;
1936 } 1924 }
1937 1925
@@ -1973,7 +1961,12 @@ namespace OpenSim.Region.Framework.Scenes
1973 // DrawDistance = Scene.DefaultDrawDistance; 1961 // DrawDistance = Scene.DefaultDrawDistance;
1974 1962
1975 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; 1963 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
1976 m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; 1964
1965 // FIXME: This does not work as intended because the viewer only sends the lbutton down when the button
1966 // is first pressed, not whilst it is held down. If this is required in the future then need to look
1967 // for an AGENT_CONTROL_LBUTTON_UP event and make sure to handle cases where an initial DOWN is not
1968 // received (e.g. on holding LMB down on the avatar in a viewer).
1969// m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0;
1977 1970
1978 #endregion Inputs 1971 #endregion Inputs
1979 1972
@@ -2066,6 +2059,14 @@ namespace OpenSim.Region.Framework.Scenes
2066 2059
2067 bool update_movementflag = false; 2060 bool update_movementflag = false;
2068 2061
2062 // If we were just made root agent then we must perform movement updates for the first AgentUpdate that
2063 // we get
2064 if (MovementFlag == ForceUpdateMovementFlagValue)
2065 {
2066 MovementFlag = 0;
2067 update_movementflag = true;
2068 }
2069
2069 if (agentData.UseClientAgentPosition) 2070 if (agentData.UseClientAgentPosition)
2070 { 2071 {
2071 MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; 2072 MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
@@ -2097,15 +2098,6 @@ namespace OpenSim.Region.Framework.Scenes
2097 { 2098 {
2098 bool bAllowUpdateMoveToPosition = false; 2099 bool bAllowUpdateMoveToPosition = false;
2099 2100
2100 Vector3[] dirVectors;
2101
2102 // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying
2103 // this prevents 'jumping' in inappropriate situations.
2104 if (!Flying && (m_mouseLook || m_leftButtonDown))
2105 dirVectors = GetWalkDirectionVectors();
2106 else
2107 dirVectors = Dir_Vectors;
2108
2109 // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. 2101 // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction.
2110 foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) 2102 foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
2111 { 2103 {
@@ -2115,7 +2107,9 @@ namespace OpenSim.Region.Framework.Scenes
2115 2107
2116 try 2108 try
2117 { 2109 {
2118 agent_control_v3 += dirVectors[i]; 2110 // Don't slide against ground when crouching if camera is panned around avatar
2111 if (Flying || DCF != Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN)
2112 agent_control_v3 += Dir_Vectors[i];
2119 //m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]); 2113 //m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]);
2120 } 2114 }
2121 catch (IndexOutOfRangeException) 2115 catch (IndexOutOfRangeException)
@@ -3149,7 +3143,17 @@ namespace OpenSim.Region.Framework.Scenes
3149// "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", 3143// "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}",
3150// vec, Rotation, thisAddSpeedModifier, Name); 3144// vec, Rotation, thisAddSpeedModifier, Name);
3151 3145
3152 Vector3 direc = vec * Rotation; 3146 Quaternion rot = Rotation;
3147 if (!(Flying && m_mouseLook) && (PresenceType != PresenceType.Npc))
3148 {
3149 // The only situation in which we care about X and Y is in mouselook flying. The rest of the time
3150 // these parameters are not relevant for determining avatar movement direction and cause issues such
3151 // as wrong walk speed if the camera is rotated.
3152 rot.X = 0;
3153 rot.Y = 0;
3154 }
3155
3156 Vector3 direc = vec * rot;
3153 direc.Normalize(); 3157 direc.Normalize();
3154 3158
3155 if (Flying != FlyingOld) // add for fly velocity control 3159 if (Flying != FlyingOld) // add for fly velocity control
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
new file mode 100644
index 0000000..1d41d33
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
@@ -0,0 +1,347 @@
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 System;
29using System.Collections.Generic;
30using System.Reflection;
31using Nini.Config;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Framework.EntityTransfer;
37using OpenSim.Region.CoreModules.Framework.InventoryAccess;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
39using OpenSim.Region.CoreModules.World.Permissions;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces;
42using OpenSim.Tests.Common;
43
44namespace OpenSim.Region.Framework.Scenes.Tests
45{
46 /// <summary>
47 /// Test copying of scene objects.
48 /// </summary>
49 /// <remarks>
50 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
51 /// </remarks>
52 [TestFixture]
53 public class SceneObjectCopyTests : OpenSimTestCase
54 {
55 [TestFixtureSetUp]
56 public void FixtureInit()
57 {
58 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
59 // This facility was added after the original async delete tests were written, so it may be possible now
60 // to not bother explicitly disabling their async (since everything will be running sync).
61 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
62 }
63
64 [TestFixtureTearDown]
65 public void TearDown()
66 {
67 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
68 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
69 // tests really shouldn't).
70 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
71 }
72
73 [Test]
74 public void TestTakeCopyWhenCopierIsOwnerWithPerms()
75 {
76 TestHelpers.InMethod();
77// TestHelpers.EnableLogging();
78
79 IConfigSource config = new IniConfigSource();
80 config.AddConfig("Modules");
81 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
82
83 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
84 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
85 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
86 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
87
88 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
89 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
90 sogd.Enabled = false;
91
92 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID);
93 uint soLocalId = so.LocalId;
94// so.UpdatePermissions(
95// ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Copy, 1);
96// so.UpdatePermissions(
97// ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
98// so.UpdatePermissions(
99// ua.PrincipalID, (byte)PermissionWho.Base, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
100// scene.HandleObjectPermissionsUpdate(client, client.AgentId, client.SessionId, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
101
102 // Ideally we might change these via client-focussed method calls as commented out above. However, this
103 // becomes very convoluted so we will set only the copy perm directly.
104 so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy;
105// so.RootPart.OwnerMask = (uint)OpenMetaverse.PermissionMask.Copy;
106
107 List<uint> localIds = new List<uint>();
108 localIds.Add(so.LocalId);
109
110 // Specifying a UUID.Zero in this case will currently plop it in Lost and Found
111 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
112
113 // Check that object isn't copied until we crank the sogd handle.
114 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
115 Assert.That(retrievedPart, Is.Not.Null);
116 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
117
118 sogd.InventoryDeQueueAndDelete();
119
120 // Check that object is still there.
121 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
122 Assert.That(retrievedPart2, Is.Not.Null);
123 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
124
125 // Check that we have a copy in inventory
126 InventoryItemBase item
127 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1");
128 Assert.That(item, Is.Not.Null);
129 }
130
131 [Test]
132 public void TestTakeCopyWhenCopierIsOwnerWithoutPerms()
133 {
134 TestHelpers.InMethod();
135// TestHelpers.EnableLogging();
136
137 IConfigSource config = new IniConfigSource();
138 config.AddConfig("Modules");
139 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
140
141 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
142 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
143 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
144 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
145
146 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
147 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
148 sogd.Enabled = false;
149
150 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID);
151 uint soLocalId = so.LocalId;
152
153 so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.All & ~OpenMetaverse.PermissionMask.Copy);
154 //so.RootPart.OwnerMask = (uint)(OpenMetaverse.PermissionMask.Copy & ~OpenMetaverse.PermissionMask.Copy);
155
156 List<uint> localIds = new List<uint>();
157 localIds.Add(so.LocalId);
158
159 // Specifying a UUID.Zero in this case will currently plop it in Lost and Found
160 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
161
162 // Check that object isn't copied until we crank the sogd handle.
163 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
164 Assert.That(retrievedPart, Is.Not.Null);
165 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
166
167 sogd.InventoryDeQueueAndDelete();
168
169 // Check that object is still there.
170 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
171 Assert.That(retrievedPart2, Is.Not.Null);
172 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
173
174 // Check that we do not have a copy in inventory
175 InventoryItemBase item
176 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1");
177 Assert.That(item, Is.Null);
178 }
179
180 [Test]
181 public void TestTakeCopyWhenCopierIsNotOwnerWithPerms()
182 {
183 TestHelpers.InMethod();
184// TestHelpers.EnableLogging();
185
186 IConfigSource config = new IniConfigSource();
187 config.AddConfig("Modules");
188 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
189
190 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
191 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
192 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
193 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
194
195 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
196 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
197 sogd.Enabled = false;
198
199 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2));
200 uint soLocalId = so.LocalId;
201
202 // Base must allow transfer and copy
203 so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer);
204 // Must be set so anyone can copy
205 so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
206
207 List<uint> localIds = new List<uint>();
208 localIds.Add(so.LocalId);
209
210 // Specifying a UUID.Zero in this case will plop it in the Objects folder
211 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
212
213 // Check that object isn't copied until we crank the sogd handle.
214 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
215 Assert.That(retrievedPart, Is.Not.Null);
216 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
217
218 sogd.InventoryDeQueueAndDelete();
219
220 // Check that object is still there.
221 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
222 Assert.That(retrievedPart2, Is.Not.Null);
223 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
224
225 // Check that we have a copy in inventory
226 InventoryItemBase item
227 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
228 Assert.That(item, Is.Not.Null);
229 }
230
231 [Test]
232 public void TestTakeCopyWhenCopierIsNotOwnerWithoutPerms()
233 {
234 TestHelpers.InMethod();
235// TestHelpers.EnableLogging();
236
237 IConfigSource config = new IniConfigSource();
238 config.AddConfig("Modules");
239 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
240
241 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
242 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
243 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
244 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
245
246 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
247 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
248 sogd.Enabled = false;
249
250 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2));
251 uint soLocalId = so.LocalId;
252
253 {
254 // Check that object is not copied if copy base perms is missing.
255 // Should not allow copy if base does not have this.
256 so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Transfer;
257 // Must be set so anyone can copy
258 so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
259
260 // Check that object is not copied
261 List<uint> localIds = new List<uint>();
262 localIds.Add(so.LocalId);
263
264 // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
265 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
266
267 // Check that object isn't copied until we crank the sogd handle.
268 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
269 Assert.That(retrievedPart, Is.Not.Null);
270 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
271
272 sogd.InventoryDeQueueAndDelete();
273 // Check that object is still there.
274 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
275 Assert.That(retrievedPart2, Is.Not.Null);
276 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
277
278 // Check that we have a copy in inventory
279 InventoryItemBase item
280 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
281 Assert.That(item, Is.Null);
282 }
283
284 {
285 // Check that object is not copied if copy trans perms is missing.
286 // Should not allow copy if base does not have this.
287 so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy;
288 // Must be set so anyone can copy
289 so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
290
291 // Check that object is not copied
292 List<uint> localIds = new List<uint>();
293 localIds.Add(so.LocalId);
294
295 // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
296 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
297
298 // Check that object isn't copied until we crank the sogd handle.
299 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
300 Assert.That(retrievedPart, Is.Not.Null);
301 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
302
303 sogd.InventoryDeQueueAndDelete();
304 // Check that object is still there.
305 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
306 Assert.That(retrievedPart2, Is.Not.Null);
307 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
308
309 // Check that we have a copy in inventory
310 InventoryItemBase item
311 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
312 Assert.That(item, Is.Null);
313 }
314
315 {
316 // Check that object is not copied if everyone copy perms is missing.
317 // Should not allow copy if base does not have this.
318 so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer);
319 // Make sure everyone perm does not allow copy
320 so.RootPart.EveryoneMask = (uint)(OpenMetaverse.PermissionMask.All & ~OpenMetaverse.PermissionMask.Copy);
321
322 // Check that object is not copied
323 List<uint> localIds = new List<uint>();
324 localIds.Add(so.LocalId);
325
326 // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
327 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
328
329 // Check that object isn't copied until we crank the sogd handle.
330 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
331 Assert.That(retrievedPart, Is.Not.Null);
332 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
333
334 sogd.InventoryDeQueueAndDelete();
335 // Check that object is still there.
336 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
337 Assert.That(retrievedPart2, Is.Not.Null);
338 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
339
340 // Check that we have a copy in inventory
341 InventoryItemBase item
342 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
343 Assert.That(item, Is.Null);
344 }
345 }
346 }
347} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index 9655d19..8ec6974 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Tests
64 64
65 // Create an object embedded inside the first 65 // Create an object embedded inside the first
66 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); 66 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
67 TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); 67 TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
68 68
69 TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); 69 TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId);
70 Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); 70 Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId));
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Tests
88 // Create an object embedded inside the first 88 // Create an object embedded inside the first
89 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); 89 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
90 TaskInventoryItem taskSceneObjectItem 90 TaskInventoryItem taskSceneObjectItem
91 = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); 91 = TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
92 92
93 scene.AddSceneObject(sog1); 93 scene.AddSceneObject(sog1);
94 94
@@ -129,7 +129,7 @@ namespace OpenSim.Region.Framework.Tests
129 SceneObjectPart sop1 = sog1.RootPart; 129 SceneObjectPart sop1 = sog1.RootPart;
130 TaskInventoryItem sopItem1 130 TaskInventoryItem sopItem1
131 = TaskInventoryHelpers.AddNotecard( 131 = TaskInventoryHelpers.AddNotecard(
132 scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); 132 scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
133 133
134 InventoryFolderBase folder 134 InventoryFolderBase folder
135 = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; 135 = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
@@ -162,7 +162,7 @@ namespace OpenSim.Region.Framework.Tests
162 SceneObjectPart sop1 = sog1.RootPart; 162 SceneObjectPart sop1 = sog1.RootPart;
163 TaskInventoryItem sopItem1 163 TaskInventoryItem sopItem1
164 = TaskInventoryHelpers.AddNotecard( 164 = TaskInventoryHelpers.AddNotecard(
165 scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); 165 scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
166 166
167 // Perform test 167 // Perform test
168 string message; 168 string message;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 4ae27d7..937c414 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
89 { 89 {
90 TestHelpers.InMethod(); 90 TestHelpers.InMethod();
91// TestHelpers.EnableLogging(); 91// TestHelpers.EnableLogging();
92 92
93 UUID ownerId = TestHelpers.ParseTail(0x10); 93 UUID ownerId = TestHelpers.ParseTail(0x10);
94 UUID embeddedId = TestHelpers.ParseTail(0x20); 94 UUID embeddedId = TestHelpers.ParseTail(0x20);
95 UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21); 95 UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21);
@@ -120,5 +120,39 @@ namespace OpenSim.Region.Framework.Scenes.Tests
120 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId)); 120 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId));
121 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId)); 121 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId));
122 } 122 }
123
124 [Test]
125 public void TestTaskItems()
126 {
127 TestHelpers.InMethod();
128// TestHelpers.EnableLogging();
129
130 UUID ownerId = TestHelpers.ParseTail(0x10);
131
132 SceneObjectGroup soL0 = SceneHelpers.CreateSceneObject(1, ownerId, "l0", 0x20);
133 SceneObjectGroup soL1 = SceneHelpers.CreateSceneObject(1, ownerId, "l1", 0x21);
134 SceneObjectGroup soL2 = SceneHelpers.CreateSceneObject(1, ownerId, "l2", 0x22);
135
136 TaskInventoryHelpers.AddScript(
137 m_assetService, soL2.RootPart, TestHelpers.ParseTail(0x33), TestHelpers.ParseTail(0x43), "l3-script", "gibberish");
138
139 TaskInventoryHelpers.AddSceneObject(
140 m_assetService, soL1.RootPart, "l2-item", TestHelpers.ParseTail(0x32), soL2, TestHelpers.ParseTail(0x42));
141 TaskInventoryHelpers.AddSceneObject(
142 m_assetService, soL0.RootPart, "l1-item", TestHelpers.ParseTail(0x31), soL1, TestHelpers.ParseTail(0x41));
143
144 m_uuidGatherer.AddForInspection(soL0);
145 m_uuidGatherer.GatherAll();
146
147// foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys)
148// System.Console.WriteLine("key : {0}", key);
149
150 // We expect to see the default prim texture and the assets of the contained task items
151 Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(4));
152 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(new UUID(Constants.DefaultTexture)));
153 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x41)));
154 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x42)));
155 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x43)));
156 }
123 } 157 }
124} \ No newline at end of file 158} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 69dc133..9ec4e1d 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -123,6 +123,8 @@ namespace OpenSim.Region.Framework.Scenes
123 if (m_assetUuidsToInspect.Contains(uuid)) 123 if (m_assetUuidsToInspect.Contains(uuid))
124 return false; 124 return false;
125 125
126// m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid);
127
126 m_assetUuidsToInspect.Enqueue(uuid); 128 m_assetUuidsToInspect.Enqueue(uuid);
127 129
128 return true; 130 return true;
@@ -238,7 +240,11 @@ namespace OpenSim.Region.Framework.Scenes
238 if (Complete) 240 if (Complete)
239 return false; 241 return false;
240 242
241 GetAssetUuids(m_assetUuidsToInspect.Dequeue()); 243 UUID nextToInspect = m_assetUuidsToInspect.Dequeue();
244
245// m_log.DebugFormat("[UUID GATHERER]: Inspecting asset {0}", nextToInspect);
246
247 GetAssetUuids(nextToInspect);
242 248
243 return true; 249 return true;
244 } 250 }
@@ -322,8 +328,6 @@ namespace OpenSim.Region.Framework.Scenes
322 // Here, we want to collect uuids which require further asset fetches but mark the others as gathered 328 // Here, we want to collect uuids which require further asset fetches but mark the others as gathered
323 try 329 try
324 { 330 {
325 GatheredUuids[assetUuid] = assetType;
326
327 if ((sbyte)AssetType.Bodypart == assetType 331 if ((sbyte)AssetType.Bodypart == assetType
328 || (sbyte)AssetType.Clothing == assetType 332 || (sbyte)AssetType.Clothing == assetType
329 || (sbyte)AssetType.Gesture == assetType 333 || (sbyte)AssetType.Gesture == assetType
@@ -334,11 +338,15 @@ namespace OpenSim.Region.Framework.Scenes
334 { 338 {
335 AddForInspection(assetUuid); 339 AddForInspection(assetUuid);
336 } 340 }
341 else
342 {
343 GatheredUuids[assetUuid] = assetType;
344 }
337 } 345 }
338 catch (Exception) 346 catch (Exception)
339 { 347 {
340 m_log.ErrorFormat( 348 m_log.ErrorFormat(
341 "[ITERATABLE UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}", 349 "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
342 assetUuid, assetType); 350 assetUuid, assetType);
343 throw; 351 throw;
344 } 352 }
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
index ea582fa..3ce6178 100644
--- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
+++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
@@ -67,18 +67,17 @@ namespace OpenSim.Region.OptionalModules.Materials
67 private bool m_enabled = false; 67 private bool m_enabled = false;
68 68
69 public Dictionary<UUID, OSDMap> m_regionMaterials = new Dictionary<UUID, OSDMap>(); 69 public Dictionary<UUID, OSDMap> m_regionMaterials = new Dictionary<UUID, OSDMap>();
70 70
71 public void Initialise(IConfigSource source) 71 public void Initialise(IConfigSource source)
72 { 72 {
73 IConfig config = source.Configs["Materials"]; 73 m_enabled = true; // default is enabled
74 if (config == null)
75 return;
76 74
77 m_enabled = config.GetBoolean("enable_materials", true); 75 IConfig config = source.Configs["Materials"];
78 if (!m_enabled) 76 if (config != null)
79 return; 77 m_enabled = config.GetBoolean("enable_materials", m_enabled);
80 78
81 m_log.DebugFormat("[Materials]: Initialized"); 79 if (m_enabled)
80 m_log.DebugFormat("[Materials]: Initialized");
82 } 81 }
83 82
84 public void Close() 83 public void Close()
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index f5a25d6..f934b8a 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -785,6 +785,14 @@ namespace OpenSim.Region.Physics.OdePlugin
785 } 785 }
786 } 786 }
787 787
788 private void setAngularVelocity(float x, float y, float z)
789 {
790 if (Body != (IntPtr)0)
791 {
792 d.BodySetAngularVel(Body, x, y, z);
793 }
794 }
795
788 /// <summary> 796 /// <summary>
789 /// Stop a prim from being subject to physics. 797 /// Stop a prim from being subject to physics.
790 /// </summary> 798 /// </summary>
@@ -2645,6 +2653,7 @@ Console.WriteLine(" JointCreateFixed");
2645 if (value.IsFinite()) 2653 if (value.IsFinite())
2646 { 2654 {
2647 m_rotationalVelocity = value; 2655 m_rotationalVelocity = value;
2656 setAngularVelocity(value.X, value.Y, value.Z);
2648 } 2657 }
2649 else 2658 else
2650 { 2659 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 97e3eeb..23b74ce 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3092,26 +3092,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3092 // Determine where we are looking from 3092 // Determine where we are looking from
3093 LSL_Vector from = llGetPos(); 3093 LSL_Vector from = llGetPos();
3094 3094
3095 // Work out the normalised vector from the source to the target 3095 // normalized direction to target
3096 LSL_Vector delta = llVecNorm(target - from); 3096 LSL_Vector dir = llVecNorm(target - from);
3097 LSL_Vector angle = new LSL_Vector(0,0,0); 3097 // use vertical to help compute left axis
3098 3098 LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0);
3099 // Calculate the yaw 3099 // find normalized left axis parallel to horizon
3100 // subtracting PI_BY_TWO is required to compensate for the odd SL co-ordinate system 3100 LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir));
3101 angle.x = llAtan2(delta.z, delta.y) - ScriptBaseClass.PI_BY_TWO; 3101 // make up orthogonal to left and dir
3102 3102 up = LSL_Vector.Cross(dir, left);
3103 // Calculate pitch 3103
3104 angle.y = llAtan2(delta.x, llSqrt((delta.y * delta.y) + (delta.z * delta.z))); 3104 // compute rotation based on orthogonal axes
3105 3105 LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up);
3106 // we need to convert from a vector describing
3107 // the angles of rotation in radians into rotation value
3108 LSL_Rotation rot = llEuler2Rot(angle);
3109 3106
3110 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply 3107 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
3111 // set the rotation of the object, copy that behavior 3108 // set the rotation of the object, copy that behavior
3112 PhysicsActor pa = m_host.PhysActor; 3109 PhysicsActor pa = m_host.PhysActor;
3113 3110
3114 if (strength == 0 || pa == null || !pa.IsPhysical) 3111 if (m_host.ParentGroup.IsAttachment || strength == 0 || pa == null || !pa.IsPhysical)
3115 { 3112 {
3116 llSetRot(rot); 3113 llSetRot(rot);
3117 } 3114 }
@@ -9012,7 +9009,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9012 res.Add(new LSL_Vector(textColor.R, 9009 res.Add(new LSL_Vector(textColor.R,
9013 textColor.G, 9010 textColor.G,
9014 textColor.B)); 9011 textColor.B));
9015 res.Add(new LSL_Float(textColor.A)); 9012 res.Add(new LSL_Float(1.0 - textColor.A));
9016 break; 9013 break;
9017 case (int)ScriptBaseClass.PRIM_NAME: 9014 case (int)ScriptBaseClass.PRIM_NAME:
9018 res.Add(new LSL_String(part.Name)); 9015 res.Add(new LSL_String(part.Name));
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
index 14e45ff..e35de9c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
@@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
100 SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule); 100 SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule);
101 101
102 SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); 102 SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
103 m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, so.RootPart); 103 m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, so.RootPart);
104 104
105 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. 105 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
106 // Possibly this could be done and we could obtain it directly from the MockScriptEngine. 106 // Possibly this could be done and we could obtain it directly from the MockScriptEngine.
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
index 9fd8532..3ff4c6b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -91,7 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
91 91
92 // Create an object embedded inside the first 92 // Create an object embedded inside the first
93 UUID itemId = TestHelpers.ParseTail(0x20); 93 UUID itemId = TestHelpers.ParseTail(0x20);
94 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); 94 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, userId);
95 95
96 LSL_Api api = new LSL_Api(); 96 LSL_Api api = new LSL_Api();
97 api.Initialize(m_engine, so1.RootPart, null, null); 97 api.Initialize(m_engine, so1.RootPart, null, null);
@@ -131,7 +131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
131 131
132 // Create an object embedded inside the first 132 // Create an object embedded inside the first
133 UUID itemId = TestHelpers.ParseTail(0x20); 133 UUID itemId = TestHelpers.ParseTail(0x20);
134 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); 134 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id);
135 135
136 // Create a second object 136 // Create a second object
137 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); 137 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
@@ -188,7 +188,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
188 188
189 // Create an object embedded inside the first 189 // Create an object embedded inside the first
190 UUID itemId = TestHelpers.ParseTail(0x20); 190 UUID itemId = TestHelpers.ParseTail(0x20);
191 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); 191 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id);
192 192
193 UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); 193 UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
194 194
@@ -223,7 +223,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
223 // Create an object embedded inside the first 223 // Create an object embedded inside the first
224 UUID itemId = TestHelpers.ParseTail(0x20); 224 UUID itemId = TestHelpers.ParseTail(0x20);
225 TaskInventoryItem tii 225 TaskInventoryItem tii
226 = TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); 226 = TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id);
227 tii.NextPermissions &= ~((uint)PermissionMask.Modify); 227 tii.NextPermissions &= ~((uint)PermissionMask.Modify);
228 228
229 UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); 229 UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
@@ -251,7 +251,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
251 m_scene.AddSceneObject(sourceSo); 251 m_scene.AddSceneObject(sourceSo);
252 LSL_Api api = new LSL_Api(); 252 LSL_Api api = new LSL_Api();
253 api.Initialize(m_engine, sourceSo.RootPart, null, null); 253 api.Initialize(m_engine, sourceSo.RootPart, null, null);
254 TaskInventoryHelpers.AddScript(m_scene, sourceSo.RootPart, "script", "Hello World"); 254 TaskInventoryHelpers.AddScript(m_scene.AssetService, sourceSo.RootPart, "script", "Hello World");
255 255
256 SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id); 256 SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id);
257 SceneObjectGroup otherOwnedTargetSo = SceneHelpers.AddSceneObject(m_scene, "otherOwnedTargetSo", user2Id); 257 SceneObjectGroup otherOwnedTargetSo = SceneHelpers.AddSceneObject(m_scene, "otherOwnedTargetSo", user2Id);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
index f347869..b6f5e09 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
@@ -92,7 +92,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
92 // FIXME: This should really be a script item (with accompanying script) 92 // FIXME: This should really be a script item (with accompanying script)
93 TaskInventoryItem grp1Item 93 TaskInventoryItem grp1Item
94 = TaskInventoryHelpers.AddNotecard( 94 = TaskInventoryHelpers.AddNotecard(
95 m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); 95 m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
96 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 96 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
97 97
98 SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); 98 SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20);
@@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
126 // FIXME: This should really be a script item (with accompanying script) 126 // FIXME: This should really be a script item (with accompanying script)
127 TaskInventoryItem grp1Item 127 TaskInventoryItem grp1Item
128 = TaskInventoryHelpers.AddNotecard( 128 = TaskInventoryHelpers.AddNotecard(
129 m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); 129 m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
130 130
131 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 131 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
132 132
@@ -155,7 +155,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
155 // FIXME: This should really be a script item (with accompanying script) 155 // FIXME: This should really be a script item (with accompanying script)
156 TaskInventoryItem grp1Item 156 TaskInventoryItem grp1Item
157 = TaskInventoryHelpers.AddNotecard( 157 = TaskInventoryHelpers.AddNotecard(
158 m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); 158 m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
159 159
160 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 160 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
161 161
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
index b9028ab..2ac12cb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
61 SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine); 61 SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine);
62 62
63 m_so = SceneHelpers.AddSceneObject(m_scene); 63 m_so = SceneHelpers.AddSceneObject(m_scene);
64 m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart); 64 m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart);
65 65
66 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. 66 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
67 // Possibly this could be done and we could obtain it directly from the MockScriptEngine. 67 // Possibly this could be done and we could obtain it directly from the MockScriptEngine.
@@ -77,7 +77,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
77 string[] ncLines = { "One", "Twoè", "Three" }; 77 string[] ncLines = { "One", "Twoè", "Three" };
78 78
79 TaskInventoryItem ncItem 79 TaskInventoryItem ncItem
80 = TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines)); 80 = TaskInventoryHelpers.AddNotecard(m_scene.AssetService, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines));
81 81
82 AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]); 82 AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]);
83 AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]); 83 AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]);
@@ -102,7 +102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
102 { 102 {
103 TestHelpers.InMethod(); 103 TestHelpers.InMethod();
104 104
105 TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart, "nc1", "Not important"); 105 TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart, "nc1", "Not important");
106 106
107 AssertInValidNotecardLine(ncItem.Name, 0); 107 AssertInValidNotecardLine(ncItem.Name, 0);
108 } 108 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
index 6424ea1..40082b5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
68 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, userId); 68 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
69 69
70 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; 70 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
71 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, part); 71 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, part);
72 72
73 LSL_Api apiGrp1 = new LSL_Api(); 73 LSL_Api apiGrp1 = new LSL_Api();
74 apiGrp1.Initialize(m_engine, part, scriptItem, null); 74 apiGrp1.Initialize(m_engine, part, scriptItem, null);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
index caba4a4..2fe558a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
@@ -96,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
96 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); 96 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1);
97 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); 97 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID);
98 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 98 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
99 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); 99 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
100 100
101 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 101 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
102 OSSL_Api osslApi = new OSSL_Api(); 102 OSSL_Api osslApi = new OSSL_Api();
@@ -105,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
105// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); 105// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID);
106 106
107 // Create an object embedded inside the first 107 // Create an object embedded inside the first
108 TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); 108 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID);
109 109
110 osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint); 110 osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint);
111 111
@@ -142,7 +142,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
142 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); 142 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1);
143 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); 143 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID);
144 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 144 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
145 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); 145 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
146 146
147 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 147 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
148 OSSL_Api osslApi = new OSSL_Api(); 148 OSSL_Api osslApi = new OSSL_Api();
@@ -150,7 +150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
150 150
151 // Create an object embedded inside the first 151 // Create an object embedded inside the first
152 TaskInventoryHelpers.AddNotecard( 152 TaskInventoryHelpers.AddNotecard(
153 m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!"); 153 m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!");
154 154
155 bool exceptionCaught = false; 155 bool exceptionCaught = false;
156 156
@@ -190,7 +190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
190 190
191 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1); 191 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1);
192 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 192 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
193 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); 193 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
194 194
195 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 195 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
196 OSSL_Api osslApi = new OSSL_Api(); 196 OSSL_Api osslApi = new OSSL_Api();
@@ -198,7 +198,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
198 198
199 // Create an object embedded inside the first 199 // Create an object embedded inside the first
200 TaskInventoryHelpers.AddSceneObject( 200 TaskInventoryHelpers.AddSceneObject(
201 m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); 201 m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID);
202 202
203 ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); 203 ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2);
204 204
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs
index 5b7e5f7..2ef4058 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs
@@ -114,7 +114,7 @@ namespace OpenSim.Region.ScriptEngine.Tests
114 114
115 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); 115 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
116 TaskInventoryHelpers.AddScript( 116 TaskInventoryHelpers.AddScript(
117 scene, 117 scene.AssetService,
118 so.RootPart, 118 so.RootPart,
119 "scriptItem", 119 "scriptItem",
120 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); 120 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");