aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs9
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs26
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs31
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs7
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs1
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs41
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs26
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs71
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs30
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs43
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs29
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs96
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs23
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs11
35 files changed, 539 insertions, 147 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index cf0c28b..be699db 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -422,7 +422,7 @@ namespace OpenSim.Region.ClientStack.Linden
422 string assetType) 422 string assetType)
423 { 423 {
424 m_log.DebugFormat( 424 m_log.DebugFormat(
425 "Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", 425 "[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}",
426 assetID, inventoryItem, inventoryType, assetType); 426 assetID, inventoryItem, inventoryType, assetType);
427 427
428 sbyte assType = 0; 428 sbyte assType = 0;
@@ -625,7 +625,12 @@ namespace OpenSim.Region.ClientStack.Linden
625 item.AssetType = assType; 625 item.AssetType = assType;
626 item.InvType = inType; 626 item.InvType = inType;
627 item.Folder = parentFolder; 627 item.Folder = parentFolder;
628 item.CurrentPermissions = (uint)PermissionMask.All; 628
629 // If we set PermissionMask.All then when we rez the item the next permissions will replace the current
630 // (owner) permissions. This becomes a problem if next permissions are changed.
631 item.CurrentPermissions
632 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
633
629 item.BasePermissions = (uint)PermissionMask.All; 634 item.BasePermissions = (uint)PermissionMask.All;
630 item.EveryOnePermissions = 0; 635 item.EveryOnePermissions = 0;
631 item.NextPermissions = (uint)PermissionMask.All; 636 item.NextPermissions = (uint)PermissionMask.All;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
index aed03b3..1117f2a 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
@@ -50,8 +50,7 @@ namespace OpenSim.Region.ClientStack.Linden
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule 51 public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule
52 { 52 {
53// private static readonly ILog m_log = 53// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 54
56 private Scene m_scene; 55 private Scene m_scene;
57// private IAssetService m_assetService; 56// private IAssetService m_assetService;
@@ -210,6 +209,9 @@ namespace OpenSim.Region.ClientStack.Linden
210 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, 209 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
211 string assetType,UUID AgentID) 210 string assetType,UUID AgentID)
212 { 211 {
212// m_log.DebugFormat(
213// "[NEW FILE AGENT INVENTORY VARIABLE PRICE MODULE]: Upload complete for {0}", inventoryItem);
214
213 sbyte assType = 0; 215 sbyte assType = 0;
214 sbyte inType = 0; 216 sbyte inType = 0;
215 217
@@ -259,13 +261,13 @@ namespace OpenSim.Region.ClientStack.Linden
259 item.AssetType = assType; 261 item.AssetType = assType;
260 item.InvType = inType; 262 item.InvType = inType;
261 item.Folder = parentFolder; 263 item.Folder = parentFolder;
262 item.CurrentPermissions = (uint)PermissionMask.All; 264 item.CurrentPermissions
265 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
263 item.BasePermissions = (uint)PermissionMask.All; 266 item.BasePermissions = (uint)PermissionMask.All;
264 item.EveryOnePermissions = 0; 267 item.EveryOnePermissions = 0;
265 item.NextPermissions = (uint)PermissionMask.All; 268 item.NextPermissions = (uint)PermissionMask.All;
266 item.CreationDate = Util.UnixTimeSinceEpoch(); 269 item.CreationDate = Util.UnixTimeSinceEpoch();
267 m_scene.AddInventoryItem(item); 270 m_scene.AddInventoryItem(item);
268
269 } 271 }
270 } 272 }
271} 273}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
index e4bacd4..7a3d97e 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
@@ -339,7 +339,7 @@ namespace OpenSim.Region.ClientStack.Linden
339 m_scene.AddSceneObject(grp); 339 m_scene.AddSceneObject(grp);
340 grp.AbsolutePosition = obj.Position; 340 grp.AbsolutePosition = obj.Position;
341 } 341 }
342 342
343 allparts[i] = grp; 343 allparts[i] = grp;
344 } 344 }
345 345
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 8273c6f..d98ff68 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5107,7 +5107,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5107 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage, false); 5107 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage, false);
5108 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship); 5108 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship);
5109 AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship); 5109 AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship);
5110 AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFrendship); 5110 AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFriendship);
5111 AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject); 5111 AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject);
5112 AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); 5112 AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject);
5113 AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); 5113 AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand);
@@ -5827,7 +5827,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5827 return true; 5827 return true;
5828 } 5828 }
5829 5829
5830 private bool HandlerTerminateFrendship(IClientAPI sender, Packet Pack) 5830 private bool HandlerTerminateFriendship(IClientAPI sender, Packet Pack)
5831 { 5831 {
5832 TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack; 5832 TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack;
5833 5833
@@ -5842,13 +5842,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5842 5842
5843 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID; 5843 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID;
5844 UUID exFriendID = tfriendpack.ExBlock.OtherID; 5844 UUID exFriendID = tfriendpack.ExBlock.OtherID;
5845 5845 FriendshipTermination TerminateFriendshipHandler = OnTerminateFriendship;
5846 FriendshipTermination handlerTerminateFriendship = OnTerminateFriendship; 5846 if (TerminateFriendshipHandler != null)
5847 if (handlerTerminateFriendship != null)
5848 { 5847 {
5849 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID); 5848 TerminateFriendshipHandler(this, listOwnerAgentID, exFriendID);
5849 return true;
5850 } 5850 }
5851 return true; 5851 return false;
5852 } 5852 }
5853 5853
5854 private bool HandleFindAgent(IClientAPI client, Packet Packet) 5854 private bool HandleFindAgent(IClientAPI client, Packet Packet)
@@ -7625,6 +7625,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7625 } 7625 }
7626 } 7626 }
7627 } 7627 }
7628 else
7629 if (transfer.TransferInfo.SourceType == (int)SourceType.SimEstate)
7630 {
7631 //TransferRequestPacket does not include covenant uuid?
7632 //get scene covenant uuid
7633 taskID = m_scene.RegionInfo.RegionSettings.Covenant;
7634 }
7628 7635
7629 MakeAssetRequest(transfer, taskID); 7636 MakeAssetRequest(transfer, taskID);
7630 7637
@@ -11985,6 +11992,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11985 { 11992 {
11986 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 11993 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
11987 } 11994 }
11995 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimEstate)
11996 {
11997 requestID = taskID;
11998 }
11999
11988 12000
11989// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); 12001// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
11990 12002
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 8d503bd..c7f4c20 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -111,6 +111,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
111 111
112 #region IAvatarFactoryModule 112 #region IAvatarFactoryModule
113 113
114 /// </summary>
115 /// <param name="sp"></param>
116 /// <param name="texture"></param>
117 /// <param name="visualParam"></param>
118 public void SetAppearance(IScenePresence sp, AvatarAppearance appearance)
119 {
120 SetAppearance(sp, appearance.Texture, appearance.VisualParams);
121 }
122
114 /// <summary> 123 /// <summary>
115 /// Set appearance data (texture asset IDs and slider settings) 124 /// Set appearance data (texture asset IDs and slider settings)
116 /// </summary> 125 /// </summary>
@@ -156,14 +165,23 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
156 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; 165 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
157 166
158// WriteBakedTexturesReport(sp, m_log.DebugFormat); 167// WriteBakedTexturesReport(sp, m_log.DebugFormat);
159 if (!ValidateBakedTextureCache(sp)) 168
169 // If bake textures are missing and this is not an NPC, request a rebake from client
170 if (!ValidateBakedTextureCache(sp) && (((ScenePresence)sp).PresenceType != PresenceType.Npc))
160 RequestRebake(sp, true); 171 RequestRebake(sp, true);
161 172
162 // This appears to be set only in the final stage of the appearance 173 // This appears to be set only in the final stage of the appearance
163 // update transaction. In theory, we should be able to do an immediate 174 // update transaction. In theory, we should be able to do an immediate
164 // appearance send and save here. 175 // appearance send and save here.
165 } 176 }
166 177
178 // NPC should send to clients immediately and skip saving appearance
179 if (((ScenePresence)sp).PresenceType == PresenceType.Npc)
180 {
181 SendAppearance((ScenePresence)sp);
182 return;
183 }
184
167 // save only if there were changes, send no matter what (doesn't hurt to send twice) 185 // save only if there were changes, send no matter what (doesn't hurt to send twice)
168 if (changed) 186 if (changed)
169 QueueAppearanceSave(sp.ControllingClient.AgentId); 187 QueueAppearanceSave(sp.ControllingClient.AgentId);
@@ -174,6 +192,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
174 // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); 192 // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
175 } 193 }
176 194
195 private void SendAppearance(ScenePresence sp)
196 {
197 // Send the appearance to everyone in the scene
198 sp.SendAppearanceToAllOtherAgents();
199
200 // Send animations back to the avatar as well
201 sp.Animator.SendAnimPack();
202 }
203
177 public bool SendAppearance(UUID agentId) 204 public bool SendAppearance(UUID agentId)
178 { 205 {
179// m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId); 206// m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId);
@@ -185,12 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
185 return false; 212 return false;
186 } 213 }
187 214
188 // Send the appearance to everyone in the scene 215 SendAppearance(sp);
189 sp.SendAppearanceToAllOtherAgents();
190
191 // Send animations back to the avatar as well
192 sp.Animator.SendAnimPack();
193
194 return true; 216 return true;
195 } 217 }
196 218
@@ -626,4 +648,4 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
626 outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt"); 648 outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
627 } 649 }
628 } 650 }
629} \ No newline at end of file 651}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 54b422b..63ba3d3 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -546,12 +546,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
546 return null; 546 return null;
547 547
548 userID = remoteClient.AgentId; 548 userID = remoteClient.AgentId;
549
550// m_log.DebugFormat(
551// "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is {1} {2}",
552// action, remoteClient.Name, userID);
549 } 553 }
550 else 554 else
551 { 555 {
552 // All returns / deletes go to the object owner 556 // All returns / deletes go to the object owner
553 // 557 //
554 userID = so.RootPart.OwnerID; 558 userID = so.RootPart.OwnerID;
559
560// m_log.DebugFormat(
561// "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is object owner {1}",
562// action, userID);
555 } 563 }
556 564
557 if (userID == UUID.Zero) // Can't proceed 565 if (userID == UUID.Zero) // Can't proceed
@@ -637,11 +645,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
637 } 645 }
638 646
639 // Override and put into where it came from, if it came 647 // Override and put into where it came from, if it came
640 // from anywhere in inventory 648 // from anywhere in inventory and the owner is taking it back.
641 // 649 //
642 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) 650 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
643 { 651 {
644 if (so.RootPart.FromFolderID != UUID.Zero) 652 if (so.RootPart.FromFolderID != UUID.Zero && userID == remoteClient.AgentId)
645 { 653 {
646 InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); 654 InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID);
647 folder = m_Scene.InventoryService.GetFolder(f); 655 folder = m_Scene.InventoryService.GetFolder(f);
@@ -789,6 +797,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
789 { 797 {
790 group = objlist[i]; 798 group = objlist[i];
791 799
800// m_log.DebugFormat(
801// "[InventoryAccessModule]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
802// group.Name, group.LocalId, group.UUID,
803// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
804// remoteClient.Name);
805
792// Vector3 storedPosition = group.AbsolutePosition; 806// Vector3 storedPosition = group.AbsolutePosition;
793 if (group.UUID == UUID.Zero) 807 if (group.UUID == UUID.Zero)
794 { 808 {
@@ -854,9 +868,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
854 rootPart.ScheduleFullUpdate(); 868 rootPart.ScheduleFullUpdate();
855 } 869 }
856 870
857// m_log.DebugFormat( 871// m_log.DebugFormat(
858// "[InventoryAccessModule]: Rezzed {0} {1} {2} for {3}", 872// "[InventoryAccessModule]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
859// group.Name, group.LocalId, group.UUID, remoteClient.Name); 873// group.Name, group.LocalId, group.UUID,
874// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
875// remoteClient.Name);
860 } 876 }
861 877
862 if (item != null) 878 if (item != null)
@@ -937,7 +953,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
937 } 953 }
938 954
939 rootPart.FromFolderID = item.Folder; 955 rootPart.FromFolderID = item.Folder;
940 956
957// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
958// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
959
941 if ((rootPart.OwnerID != item.Owner) || 960 if ((rootPart.OwnerID != item.Owner) ||
942 (item.CurrentPermissions & 16) != 0) 961 (item.CurrentPermissions & 16) != 0)
943 { 962 {
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index cdecd2f..f3c6a30 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -707,7 +707,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
707 // Object owners should be able to edit their own content 707 // Object owners should be able to edit their own content
708 if (currentUser == objectOwner) 708 if (currentUser == objectOwner)
709 { 709 {
710 permission = true; 710 // there is no way that later code can change this back to false
711 // so just return true immediately and short circuit the more
712 // expensive group checks
713 return true;
714
715 //permission = true;
711 } 716 }
712 else if (group.IsAttachment) 717 else if (group.IsAttachment)
713 { 718 {
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
index 39a760c..34aca33 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
@@ -35,6 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces
35 35
36 public interface IAvatarFactoryModule 36 public interface IAvatarFactoryModule
37 { 37 {
38 void SetAppearance(IScenePresence sp, AvatarAppearance appearance);
38 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams); 39 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams);
39 40
40 /// <summary> 41 /// <summary>
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 2731291..dc3ff89 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces
58 /// </param> 58 /// </param>
59 /// <param name="scene"></param> 59 /// <param name="scene"></param>
60 /// <param name="appearance">The avatar appearance to use for the new NPC.</param> 60 /// <param name="appearance">The avatar appearance to use for the new NPC.</param>
61 /// <returns>The UUID of the ScenePresence created.</returns> 61 /// <returns>The UUID of the ScenePresence created. UUID.Zero if there was a failure.</returns>
62 UUID CreateNPC( 62 UUID CreateNPC(
63 string firstname, 63 string firstname,
64 string lastname, 64 string lastname,
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 5dfd3e0..f678d07 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -148,7 +148,8 @@ namespace OpenSim.Region.Framework.Scenes
148 x = m_inventoryDeletes.Dequeue(); 148 x = m_inventoryDeletes.Dequeue();
149 149
150 m_log.DebugFormat( 150 m_log.DebugFormat(
151 "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", left, x.action, x.objectGroups.Count); 151 "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.",
152 left, x.action, x.objectGroups.Count);
152 153
153 try 154 try
154 { 155 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 6d7559e..5a5307c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -347,6 +347,12 @@ namespace OpenSim.Region.Framework.Scenes
347 { 347 {
348 item.Name = itemUpd.Name; 348 item.Name = itemUpd.Name;
349 item.Description = itemUpd.Description; 349 item.Description = itemUpd.Description;
350
351// m_log.DebugFormat(
352// "[USER INVENTORY]: itemUpd {0} {1} {2} {3}, item {4} {5} {6} {7}",
353// itemUpd.NextPermissions, itemUpd.GroupPermissions, itemUpd.EveryOnePermissions, item.Flags,
354// item.NextPermissions, item.GroupPermissions, item.EveryOnePermissions, item.CurrentPermissions);
355
350 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) 356 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
351 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; 357 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
352 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; 358 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
@@ -355,6 +361,9 @@ namespace OpenSim.Region.Framework.Scenes
355 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; 361 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
356 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions)) 362 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
357 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; 363 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
364
365// m_log.DebugFormat("[USER INVENTORY]: item.Flags {0}", item.Flags);
366
358 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; 367 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
359 item.GroupID = itemUpd.GroupID; 368 item.GroupID = itemUpd.GroupID;
360 item.GroupOwned = itemUpd.GroupOwned; 369 item.GroupOwned = itemUpd.GroupOwned;
@@ -2170,8 +2179,25 @@ namespace OpenSim.Region.Framework.Scenes
2170 m_sceneGraph.DelinkObjects(parts); 2179 m_sceneGraph.DelinkObjects(parts);
2171 } 2180 }
2172 2181
2182 /// <summary>
2183 /// Link the scene objects containing the indicated parts to a root object.
2184 /// </summary>
2185 /// <param name="client"></param>
2186 /// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
2187 /// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
2173 public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) 2188 public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds)
2174 { 2189 {
2190 LinkObjects(client.AgentId, parentPrimId, childPrimIds);
2191 }
2192
2193 /// <summary>
2194 /// Link the scene objects containing the indicated parts to a root object.
2195 /// </summary>
2196 /// <param name="agentId">The ID of the user linking.</param>
2197 /// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
2198 /// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
2199 public void LinkObjects(UUID agentId, uint parentPrimId, List<uint> childPrimIds)
2200 {
2175 List<UUID> owners = new List<UUID>(); 2201 List<UUID> owners = new List<UUID>();
2176 2202
2177 List<SceneObjectPart> children = new List<SceneObjectPart>(); 2203 List<SceneObjectPart> children = new List<SceneObjectPart>();
@@ -2183,7 +2209,7 @@ namespace OpenSim.Region.Framework.Scenes
2183 return; 2209 return;
2184 } 2210 }
2185 2211
2186 if (!Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID)) 2212 if (!Permissions.CanLinkObject(agentId, root.ParentGroup.RootPart.UUID))
2187 { 2213 {
2188 m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim"); 2214 m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim");
2189 return; 2215 return;
@@ -2199,7 +2225,7 @@ namespace OpenSim.Region.Framework.Scenes
2199 if (!owners.Contains(part.OwnerID)) 2225 if (!owners.Contains(part.OwnerID))
2200 owners.Add(part.OwnerID); 2226 owners.Add(part.OwnerID);
2201 2227
2202 if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) 2228 if (Permissions.CanLinkObject(agentId, part.ParentGroup.RootPart.UUID))
2203 children.Add(part); 2229 children.Add(part);
2204 } 2230 }
2205 2231
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3347822..4c8e2d2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3272,9 +3272,9 @@ namespace OpenSim.Region.Framework.Scenes
3272 3272
3273 // Don't disable this log message - it's too helpful 3273 // Don't disable this log message - it's too helpful
3274 m_log.DebugFormat( 3274 m_log.DebugFormat(
3275 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6}, position {7})", 3275 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags {8}, position {9})",
3276 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3276 RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname,
3277 agent.AgentID, agent.circuitcode, teleportFlags, agent.startpos); 3277 agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, teleportFlags, agent.startpos);
3278 3278
3279 if (LoginsDisabled) 3279 if (LoginsDisabled)
3280 { 3280 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 7d801b5..e66678a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -359,7 +359,7 @@ namespace OpenSim.Region.Framework.Scenes
359 m_log.ErrorFormat( 359 m_log.ErrorFormat(
360 "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}", 360 "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}",
361 sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero); 361 sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero);
362 362
363 return false; 363 return false;
364 } 364 }
365 365
@@ -368,12 +368,12 @@ namespace OpenSim.Region.Framework.Scenes
368// m_log.DebugFormat( 368// m_log.DebugFormat(
369// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", 369// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()",
370// m_parentScene.RegionInfo.RegionName, sceneObject.UUID); 370// m_parentScene.RegionInfo.RegionName, sceneObject.UUID);
371 371
372 return false; 372 return false;
373 } 373 }
374 374
375// m_log.DebugFormat( 375// m_log.DebugFormat(
376// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", 376// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
377// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); 377// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
378 378
379 SceneObjectPart[] parts = sceneObject.Parts; 379 SceneObjectPart[] parts = sceneObject.Parts;
@@ -409,7 +409,7 @@ namespace OpenSim.Region.Framework.Scenes
409 409
410 lock (SceneObjectGroupsByFullID) 410 lock (SceneObjectGroupsByFullID)
411 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 411 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
412 412
413 lock (SceneObjectGroupsByFullPartID) 413 lock (SceneObjectGroupsByFullPartID)
414 { 414 {
415 foreach (SceneObjectPart part in parts) 415 foreach (SceneObjectPart part in parts)
@@ -1662,6 +1662,10 @@ namespace OpenSim.Region.Framework.Scenes
1662 { 1662 {
1663 SceneObjectGroup child = children[i].ParentGroup; 1663 SceneObjectGroup child = children[i].ParentGroup;
1664 1664
1665 // Don't try and add a group to itself - this will only cause severe problems later on.
1666 if (child == parentGroup)
1667 continue;
1668
1665 // Make sure no child prim is set for sale 1669 // Make sure no child prim is set for sale
1666 // So that, on delink, no prims are unwittingly 1670 // So that, on delink, no prims are unwittingly
1667 // left for sale and sold off 1671 // left for sale and sold off
@@ -1684,11 +1688,13 @@ namespace OpenSim.Region.Framework.Scenes
1684 1688
1685 // We need to explicitly resend the newly link prim's object properties since no other actions 1689 // We need to explicitly resend the newly link prim's object properties since no other actions
1686 // occur on link to invoke this elsewhere (such as object selection) 1690 // occur on link to invoke this elsewhere (such as object selection)
1687 parentGroup.RootPart.CreateSelected = true; 1691 if (childGroups.Count > 0)
1688 parentGroup.TriggerScriptChangedEvent(Changed.LINK); 1692 {
1689 parentGroup.HasGroupChanged = true; 1693 parentGroup.RootPart.CreateSelected = true;
1690 parentGroup.ScheduleGroupForFullUpdate(); 1694 parentGroup.TriggerScriptChangedEvent(Changed.LINK);
1691 1695 parentGroup.HasGroupChanged = true;
1696 parentGroup.ScheduleGroupForFullUpdate();
1697 }
1692 } 1698 }
1693 finally 1699 finally
1694 { 1700 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index f173c95..a73d9b6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -265,6 +265,8 @@ namespace OpenSim.Region.Framework.Scenes
265 265
266 public void ApplyNextOwnerPermissions() 266 public void ApplyNextOwnerPermissions()
267 { 267 {
268// m_log.DebugFormat("[PRIM INVENTORY]: Applying next owner permissions to {0} {1}", Name, UUID);
269
268 SceneObjectPart[] parts = m_parts.GetArray(); 270 SceneObjectPart[] parts = m_parts.GetArray();
269 for (int i = 0; i < parts.Length; i++) 271 for (int i = 0; i < parts.Length; i++)
270 parts[i].ApplyNextOwnerPermissions(); 272 parts[i].ApplyNextOwnerPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 8939342..5b838f8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -567,7 +567,8 @@ namespace OpenSim.Region.Framework.Scenes
567 567
568// ~SceneObjectGroup() 568// ~SceneObjectGroup()
569// { 569// {
570// m_log.DebugFormat("[SCENE OBJECT GROUP]: Destructor called for {0}, local id {1}", Name, LocalId); 570// //m_log.DebugFormat("[SCENE OBJECT GROUP]: Destructor called for {0}, local id {1}", Name, LocalId);
571// Console.WriteLine("Destructor called for {0}, local id {1}", Name, LocalId);
571// } 572// }
572 573
573 #region Constructors 574 #region Constructors
@@ -1960,6 +1961,10 @@ namespace OpenSim.Region.Framework.Scenes
1960// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", 1961// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}",
1961// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); 1962// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID);
1962 1963
1964 // Linking to ourselves is not a valid operation.
1965 if (objectGroup == this)
1966 return;
1967
1963 SceneObjectPart linkPart = objectGroup.m_rootPart; 1968 SceneObjectPart linkPart = objectGroup.m_rootPart;
1964 1969
1965 Vector3 oldGroupPosition = linkPart.GroupPosition; 1970 Vector3 oldGroupPosition = linkPart.GroupPosition;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0e899ca..b130bf7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -303,6 +303,9 @@ namespace OpenSim.Region.Framework.Scenes
303 303
304// ~SceneObjectPart() 304// ~SceneObjectPart()
305// { 305// {
306// Console.WriteLine(
307// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}",
308// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId);
306// m_log.DebugFormat( 309// m_log.DebugFormat(
307// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", 310// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}",
308// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); 311// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId);
@@ -1501,7 +1504,7 @@ namespace OpenSim.Region.Framework.Scenes
1501 PhysActor = null; 1504 PhysActor = null;
1502 } 1505 }
1503 1506
1504 // Basic Physics returns null.. joy joy joy. 1507 // Basic Physics can also return null as well as an exception catch.
1505 if (PhysActor != null) 1508 if (PhysActor != null)
1506 { 1509 {
1507 PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info 1510 PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
@@ -1509,10 +1512,6 @@ namespace OpenSim.Region.Framework.Scenes
1509 DoPhysicsPropertyUpdate(RigidBody, true); 1512 DoPhysicsPropertyUpdate(RigidBody, true);
1510 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1513 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1511 } 1514 }
1512 else
1513 {
1514 m_log.DebugFormat("[SOP]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID);
1515 }
1516 } 1515 }
1517 } 1516 }
1518 } 1517 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 0c36dcd..f2d1915 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -267,10 +267,8 @@ namespace OpenSim.Region.Framework.Scenes
267 /// <returns></returns> 267 /// <returns></returns>
268 public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource) 268 public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource)
269 { 269 {
270 // m_log.InfoFormat( 270// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}",
271 // "[PRIM INVENTORY]: " + 271// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName);
272 // "Starting script {0}, {1} in prim {2}, {3}",
273 // item.Name, item.ItemID, Name, UUID);
274 272
275 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) 273 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
276 return; 274 return;
@@ -299,8 +297,7 @@ namespace OpenSim.Region.Framework.Scenes
299 if (null == asset) 297 if (null == asset)
300 { 298 {
301 m_log.ErrorFormat( 299 m_log.ErrorFormat(
302 "[PRIM INVENTORY]: " + 300 "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
303 "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
304 item.Name, item.ItemID, m_part.AbsolutePosition, 301 item.Name, item.ItemID, m_part.AbsolutePosition,
305 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); 302 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
306 } 303 }
@@ -400,8 +397,7 @@ namespace OpenSim.Region.Framework.Scenes
400 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); 397 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
401 else 398 else
402 m_log.ErrorFormat( 399 m_log.ErrorFormat(
403 "[PRIM INVENTORY]: " + 400 "[PRIM INVENTORY]: Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
404 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
405 itemId, m_part.Name, m_part.UUID, 401 itemId, m_part.Name, m_part.UUID,
406 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); 402 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
407 } 403 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5c56150..77f7b32 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -291,13 +291,10 @@ namespace OpenSim.Region.Framework.Scenes
291 /// </summary> 291 /// </summary>
292 public PhysicsActor PhysicsActor { get; private set; } 292 public PhysicsActor PhysicsActor { get; private set; }
293 293
294 private byte m_movementflag; 294 /// <summary>
295 295 /// Record user movement inputs.
296 public byte MovementFlag 296 /// </summary>
297 { 297 public byte MovementFlag { get; private set; }
298 set { m_movementflag = value; }
299 get { return m_movementflag; }
300 }
301 298
302 private bool m_updateflag; 299 private bool m_updateflag;
303 300
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index ab02f92..0a32214 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1470,7 +1470,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1470 m_SOPXmlProcessors, 1470 m_SOPXmlProcessors,
1471 reader, 1471 reader,
1472 (o, nodeName, e) 1472 (o, nodeName, e)
1473 => m_log.ErrorFormat( 1473 => m_log.DebugFormat(
1474 "[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}", 1474 "[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}",
1475 ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace)); 1475 ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace));
1476 1476
@@ -1535,14 +1535,18 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1535 1535
1536 reader.ReadStartElement(name, String.Empty); // Shape 1536 reader.ReadStartElement(name, String.Empty); // Shape
1537 1537
1538 ExternalRepresentationUtils.ExecuteReadProcessors( 1538 errors = ExternalRepresentationUtils.ExecuteReadProcessors(
1539 shape, 1539 shape,
1540 m_ShapeXmlProcessors, 1540 m_ShapeXmlProcessors,
1541 reader, 1541 reader,
1542 (o, nodeName, e) 1542 (o, nodeName, e)
1543 => m_log.ErrorFormat( 1543 =>
1544 "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", 1544 {
1545 nodeName, e.Message, e.StackTrace)); 1545 m_log.DebugFormat(
1546 "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}",
1547 nodeName, e.Message, e.StackTrace);
1548 }
1549 );
1546 1550
1547 reader.ReadEndElement(); // Shape 1551 reader.ReadEndElement(); // Shape
1548 1552
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 80f198d..7737d8e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using System.Threading;
30using NUnit.Framework; 31using NUnit.Framework;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
@@ -43,6 +44,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests
43 [TestFixture] 44 [TestFixture]
44 public class SceneObjectBasicTests 45 public class SceneObjectBasicTests
45 { 46 {
47// [TearDown]
48// public void TearDown()
49// {
50// Console.WriteLine("TearDown");
51// GC.Collect();
52// Thread.Sleep(3000);
53// }
54
55// public class GcNotify
56// {
57// public static AutoResetEvent gcEvent = new AutoResetEvent(false);
58// private static bool _initialized = false;
59//
60// public static void Initialize()
61// {
62// if (!_initialized)
63// {
64// _initialized = true;
65// new GcNotify();
66// }
67// }
68//
69// private GcNotify(){}
70//
71// ~GcNotify()
72// {
73// if (!Environment.HasShutdownStarted &&
74// !AppDomain.CurrentDomain.IsFinalizingForUnload())
75// {
76// Console.WriteLine("GcNotify called");
77// gcEvent.Set();
78// new GcNotify();
79// }
80// }
81// }
82
46 /// <summary> 83 /// <summary>
47 /// Test adding an object to a scene. 84 /// Test adding an object to a scene.
48 /// </summary> 85 /// </summary>
@@ -147,11 +184,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
147 public void TestDeleteSceneObject() 184 public void TestDeleteSceneObject()
148 { 185 {
149 TestHelpers.InMethod(); 186 TestHelpers.InMethod();
150 187
151 TestScene scene = SceneHelpers.SetupScene(); 188 TestScene scene = SceneHelpers.SetupScene();
152 SceneObjectPart part = SceneHelpers.AddSceneObject(scene); 189 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
153 scene.DeleteSceneObject(part.ParentGroup, false); 190 scene.DeleteSceneObject(part.ParentGroup, false);
154 191
155 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 192 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
156 Assert.That(retrievedPart, Is.Null); 193 Assert.That(retrievedPart, Is.Null);
157 } 194 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index a2332bb..be5b4a8 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -39,14 +39,31 @@ using log4net;
39 39
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 /// <summary>
43 /// Linking tests
44 /// </summary>
45 [TestFixture] 42 [TestFixture]
46 public class SceneObjectLinkingTests 43 public class SceneObjectLinkingTests
47 { 44 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 46
47 /// <summary>
48 /// Links to self should be ignored.
49 /// </summary>
50 [Test]
51 public void TestLinkToSelf()
52 {
53 TestHelpers.InMethod();
54
55 UUID ownerId = TestHelpers.ParseTail(0x1);
56 int nParts = 3;
57
58 TestScene scene = SceneHelpers.SetupScene();
59 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10);
60 scene.AddSceneObject(sog1);
61 scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId });
62// sog1.LinkToGroup(sog1);
63
64 Assert.That(sog1.Parts.Length, Is.EqualTo(nParts));
65 }
66
50 [Test] 67 [Test]
51 public void TestLinkDelink2SceneObjects() 68 public void TestLinkDelink2SceneObjects()
52 { 69 {
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index 1abef8d..e4b607d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -53,6 +53,30 @@ namespace OpenSim.Region.Framework.Tests
53 public class TaskInventoryTests 53 public class TaskInventoryTests
54 { 54 {
55 [Test] 55 [Test]
56 public void TestAddTaskInventoryItem()
57 {
58 TestHelpers.InMethod();
59// log4net.Config.XmlConfigurator.Configure();
60
61 Scene scene = SceneHelpers.SetupScene();
62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
63 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
64 SceneObjectPart sop1 = sog1.RootPart;
65
66 // Create an object embedded inside the first
67 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
68 TaskInventoryItem taskSceneObjectItem
69 = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
70
71 TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId);
72 Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId));
73 Assert.That(addedItem.OwnerID, Is.EqualTo(user1.PrincipalID));
74 Assert.That(addedItem.ParentID, Is.EqualTo(sop1.UUID));
75 Assert.That(addedItem.InvType, Is.EqualTo((int)InventoryType.Object));
76 Assert.That(addedItem.Type, Is.EqualTo((int)AssetType.Object));
77 }
78
79 [Test]
56 public void TestRezObjectFromInventoryItem() 80 public void TestRezObjectFromInventoryItem()
57 { 81 {
58 TestHelpers.InMethod(); 82 TestHelpers.InMethod();
@@ -66,7 +90,7 @@ namespace OpenSim.Region.Framework.Tests
66 // Create an object embedded inside the first 90 // Create an object embedded inside the first
67 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); 91 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
68 TaskInventoryItem taskSceneObjectItem 92 TaskInventoryItem taskSceneObjectItem
69 = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId); 93 = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
70 94
71 scene.AddSceneObject(sog1); 95 scene.AddSceneObject(sog1);
72 96
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 5323a95..05678c0 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -63,9 +63,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
64 64
65 // Capability string prefixes 65 // Capability string prefixes
66 private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; 66 private static readonly string m_parcelVoiceInfoRequestPath = "0207/";
67 private static readonly string m_provisionVoiceAccountRequestPath = "0008/"; 67 private static readonly string m_provisionVoiceAccountRequestPath = "0208/";
68 private static readonly string m_chatSessionRequestPath = "0009/"; 68 private static readonly string m_chatSessionRequestPath = "0209/";
69 69
70 // Control info 70 // Control info
71 private static bool m_Enabled = false; 71 private static bool m_Enabled = false;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 42008da..130513d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Collections.Specialized; 31using System.Collections.Specialized;
32using System.Reflection; 32using System.Reflection;
33using System.Threading;
33 34
34using Nwc.XmlRpc; 35using Nwc.XmlRpc;
35 36
@@ -167,6 +168,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
167 168
168 private bool m_debugEnabled = false; 169 private bool m_debugEnabled = false;
169 170
171 private Dictionary<string, bool> m_pendingRequests = new Dictionary<string,bool>();
172
170 private ExpiringCache<string, OSDMap> m_memoryCache; 173 private ExpiringCache<string, OSDMap> m_memoryCache;
171 private int m_cacheTimeout = 30; 174 private int m_cacheTimeout = 30;
172 175
@@ -1348,6 +1351,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1348 // Immediately forward the request if the cache is disabled. 1351 // Immediately forward the request if the cache is disabled.
1349 if (m_cacheTimeout == 0) 1352 if (m_cacheTimeout == 0)
1350 { 1353 {
1354 m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: cache is disabled");
1351 return WebUtil.PostToService(m_groupsServerURI, requestArgs); 1355 return WebUtil.PostToService(m_groupsServerURI, requestArgs);
1352 } 1356 }
1353 1357
@@ -1355,6 +1359,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1355 if (requestArgs["RequestMethod"] == "RemoveGeneric" 1359 if (requestArgs["RequestMethod"] == "RemoveGeneric"
1356 || requestArgs["RequestMethod"] == "AddGeneric") 1360 || requestArgs["RequestMethod"] == "AddGeneric")
1357 { 1361 {
1362 m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: clearing generics cache");
1363
1358 // Any and all updates cause the cache to clear 1364 // Any and all updates cause the cache to clear
1359 m_memoryCache.Clear(); 1365 m_memoryCache.Clear();
1360 1366
@@ -1366,18 +1372,67 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1366 1372
1367 // Create the cache key for the request and see if we have it cached 1373 // Create the cache key for the request and see if we have it cached
1368 string CacheKey = WebUtil.BuildQueryString(requestArgs); 1374 string CacheKey = WebUtil.BuildQueryString(requestArgs);
1369 OSDMap response = null; 1375
1370 if (!m_memoryCache.TryGetValue(CacheKey, out response)) 1376 // This code uses a leader/follower pattern. On a cache miss, the request is added
1377 // to a queue; the first thread to add it to the queue completes the request while
1378 // follow on threads busy wait for the results, this situation seems to happen
1379 // often when checking permissions
1380 while (true)
1371 { 1381 {
1372 // if it wasn't in the cache, pass the request to the Simian Grid Services 1382 OSDMap response = null;
1373 response = WebUtil.PostToService(m_groupsServerURI, requestArgs); 1383 bool firstRequest = false;
1374 1384
1375 // and cache the response 1385 lock (m_memoryCache)
1376 m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout)); 1386 {
1387 if (m_memoryCache.TryGetValue(CacheKey, out response))
1388 return response;
1389
1390 if (! m_pendingRequests.ContainsKey(CacheKey))
1391 {
1392 m_pendingRequests.Add(CacheKey,true);
1393 firstRequest = true;
1394 }
1395 }
1396
1397 if (firstRequest)
1398 {
1399 // if it wasn't in the cache, pass the request to the Simian Grid Services
1400 try
1401 {
1402 response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
1403 }
1404 catch (Exception e)
1405 {
1406 m_log.InfoFormat("[SIMIAN GROUPS CONNECTOR] request failed {0}",CacheKey);
1407 }
1408
1409 // and cache the response
1410 lock (m_memoryCache)
1411 {
1412 m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout));
1413 m_pendingRequests.Remove(CacheKey);
1414 }
1415
1416 return response;
1417 }
1418
1419 Thread.Sleep(50); // waiting for a web request to complete, 50msecs is reasonable
1377 } 1420 }
1378 1421
1379 // return cached response 1422 // if (!m_memoryCache.TryGetValue(CacheKey, out response))
1380 return response; 1423 // {
1424 // m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: query not in the cache");
1425 // Util.PrintCallStack();
1426
1427 // // if it wasn't in the cache, pass the request to the Simian Grid Services
1428 // response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
1429
1430 // // and cache the response
1431 // m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout));
1432 // }
1433
1434 // // return cached response
1435 // return response;
1381 } 1436 }
1382 #endregion 1437 #endregion
1383 1438
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 6a48b89..5359354 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -96,15 +96,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
96 if (!m_avatars.ContainsKey(agentId)) 96 if (!m_avatars.ContainsKey(agentId))
97 return false; 97 return false;
98 98
99 // Delete existing sp attachments
99 scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); 100 scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false);
100 101
101 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); 102 // Set new sp appearance. Also sends to clients.
102 sp.Appearance = npcAppearance; 103 scene.RequestModuleInterface<IAvatarFactoryModule>().SetAppearance(sp, new AvatarAppearance(appearance, true));
104
105 // Rez needed sp attachments
103 scene.AttachmentsModule.RezAttachments(sp); 106 scene.AttachmentsModule.RezAttachments(sp);
104 107
105 IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>();
106 module.SendAppearance(sp.UUID);
107
108 return true; 108 return true;
109 } 109 }
110 110
@@ -148,22 +148,21 @@ namespace OpenSim.Region.OptionalModules.World.NPC
148 ScenePresence sp; 148 ScenePresence sp;
149 if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) 149 if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
150 { 150 {
151 m_log.DebugFormat( 151// m_log.DebugFormat(
152 "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); 152// "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
153 153
154 sp.CompleteMovement(npcAvatar, false); 154 sp.CompleteMovement(npcAvatar, false);
155 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
156 m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
157
158 return npcAvatar.AgentId;
155 } 159 }
156 else 160 else
157 { 161 {
158 m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); 162 m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
163 return UUID.Zero;
159 } 164 }
160
161 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
162 } 165 }
163
164 m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
165
166 return npcAvatar.AgentId;
167 } 166 }
168 167
169 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget) 168 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget)
@@ -292,13 +291,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC
292 NPCAvatar av; 291 NPCAvatar av;
293 if (m_avatars.TryGetValue(agentID, out av)) 292 if (m_avatars.TryGetValue(agentID, out av))
294 { 293 {
294// m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name);
295 scene.RemoveClient(agentID, false); 295 scene.RemoveClient(agentID, false);
296 m_avatars.Remove(agentID); 296 m_avatars.Remove(agentID);
297 297
298// m_log.DebugFormat("[NPC MODULE]: Removed {0} {1}", agentID, av.Name);
298 return true; 299 return true;
299 } 300 }
300 } 301 }
301 302
303// m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID);
302 return false; 304 return false;
303 } 305 }
304 306
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 7c1c046..6d1f41d 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -156,6 +156,22 @@ namespace OpenSim.Region.Physics.OdePlugin
156 internal UUID m_uuid { get; private set; } 156 internal UUID m_uuid { get; private set; }
157 internal bool bad = false; 157 internal bool bad = false;
158 158
159 /// <summary>
160 /// ODE Avatar.
161 /// </summary>
162 /// <param name="avName"></param>
163 /// <param name="parent_scene"></param>
164 /// <param name="pos"></param>
165 /// <param name="size"></param>
166 /// <param name="pid_d"></param>
167 /// <param name="pid_p"></param>
168 /// <param name="capsule_radius"></param>
169 /// <param name="tensor"></param>
170 /// <param name="density">
171 /// Only used right now to return information to LSL. Not actually used to set mass in ODE!
172 /// </param>
173 /// <param name="walk_divisor"></param>
174 /// <param name="rundivisor"></param>
159 public OdeCharacter( 175 public OdeCharacter(
160 String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, 176 String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p,
161 float capsule_radius, float tensor, float density, 177 float capsule_radius, float tensor, float density,
@@ -786,6 +802,10 @@ namespace OpenSim.Region.Physics.OdePlugin
786 Vector3 vec = Vector3.Zero; 802 Vector3 vec = Vector3.Zero;
787 d.Vector3 vel = d.BodyGetLinearVel(Body); 803 d.Vector3 vel = d.BodyGetLinearVel(Body);
788 804
805// m_log.DebugFormat(
806// "[ODE CHARACTER]: Current velocity in Move() is <{0},{1},{2}>, target {3} for {4}",
807// vel.X, vel.Y, vel.Z, _target_velocity, Name);
808
789 float movementdivisor = 1f; 809 float movementdivisor = 1f;
790 810
791 if (!m_alwaysRun) 811 if (!m_alwaysRun)
@@ -884,18 +904,20 @@ namespace OpenSim.Region.Physics.OdePlugin
884 904
885 if (flying) 905 if (flying)
886 { 906 {
907 // This also acts as anti-gravity so that we hover when flying rather than fall.
887 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); 908 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
888 } 909 }
889 } 910 }
890 911
891 if (flying) 912 if (flying)
892 { 913 {
914 // Anti-gravity so that we hover when flying rather than fall.
893 vec.Z += ((-1 * _parent_scene.gravityz) * m_mass); 915 vec.Z += ((-1 * _parent_scene.gravityz) * m_mass);
894 916
895 //Added for auto fly height. Kitto Flora 917 //Added for auto fly height. Kitto Flora
896 //d.Vector3 pos = d.BodyGetPosition(Body); 918 //d.Vector3 pos = d.BodyGetPosition(Body);
897 float target_altitude = _parent_scene.GetTerrainHeightAtXY(_position.X, _position.Y) + MinimumGroundFlightOffset; 919 float target_altitude = _parent_scene.GetTerrainHeightAtXY(_position.X, _position.Y) + MinimumGroundFlightOffset;
898 920
899 if (_position.Z < target_altitude) 921 if (_position.Z < target_altitude)
900 { 922 {
901 vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f; 923 vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f;
@@ -921,6 +943,25 @@ namespace OpenSim.Region.Physics.OdePlugin
921 943
922 return; 944 return;
923 } 945 }
946
947 d.Vector3 newVel = d.BodyGetLinearVel(Body);
948 if (newVel.X >= 256 || newVel.X <= 256 || newVel.Y >= 256 || newVel.Y <= 256 || newVel.Z >= 256 || newVel.Z <= 256)
949 {
950// m_log.DebugFormat(
951// "[ODE CHARACTER]: Limiting falling velocity from {0} to {1} for {2}", newVel.Z, -9.8, Name);
952
953 newVel.X = Util.Clamp<float>(newVel.X, -255f, 255f);
954 newVel.Y = Util.Clamp<float>(newVel.Y, -255f, 255f);
955
956 if (!flying)
957 newVel.Z
958 = Util.Clamp<float>(
959 newVel.Z, -_parent_scene.AvatarTerminalVelocity, _parent_scene.AvatarTerminalVelocity);
960 else
961 newVel.Z = Util.Clamp<float>(newVel.Z, -255f, 255f);
962
963 d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
964 }
924 } 965 }
925 966
926 /// <summary> 967 /// <summary>
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 4530c09..598530c 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -144,6 +144,8 @@ namespace OpenSim.Region.Physics.OdePlugin
144 public float gravityy = 0f; 144 public float gravityy = 0f;
145 public float gravityz = -9.8f; 145 public float gravityz = -9.8f;
146 146
147 public float AvatarTerminalVelocity { get; set; }
148
147 private float contactsurfacelayer = 0.001f; 149 private float contactsurfacelayer = 0.001f;
148 150
149 private int worldHashspaceLow = -4; 151 private int worldHashspaceLow = -4;
@@ -459,6 +461,15 @@ namespace OpenSim.Region.Physics.OdePlugin
459 gravityy = physicsconfig.GetFloat("world_gravityy", 0f); 461 gravityy = physicsconfig.GetFloat("world_gravityy", 0f);
460 gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f); 462 gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f);
461 463
464 float avatarTerminalVelocity = physicsconfig.GetFloat("avatar_terminal_velocity", 54f);
465 AvatarTerminalVelocity = Util.Clamp<float>(avatarTerminalVelocity, 0, 255f);
466 if (AvatarTerminalVelocity != avatarTerminalVelocity)
467 {
468 m_log.WarnFormat(
469 "[ODE SCENE]: avatar_terminal_velocity of {0} is invalid. Clamping to {1}",
470 avatarTerminalVelocity, AvatarTerminalVelocity);
471 }
472
462 worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4); 473 worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4);
463 worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128); 474 worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128);
464 475
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 3e0e452..850f50b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -445,17 +445,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
445 Vector3 toRegionPos; 445 Vector3 toRegionPos;
446 double dis; 446 double dis;
447 447
448 Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence) 448 Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence =>
449 { 449 {
450 if ((ts.type & NPC) == 0 450 if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc)
451 && presence.PresenceType == PresenceType.Npc 451 {
452 && !npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent) 452 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
453 return; 453 if (npcData == null || !npcData.SenseAsAgent)
454 return;
455 }
454 456
455 if ((ts.type & AGENT) == 0 457 if ((ts.type & AGENT) == 0)
456 && (presence.PresenceType == PresenceType.User 458 {
457 || npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent)) 459 if (presence.PresenceType == PresenceType.User)
458 return; 460 {
461 return;
462 }
463 else
464 {
465 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
466 if (npcData != null && npcData.SenseAsAgent)
467 return;
468 }
469 }
459 470
460 if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) 471 if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0)
461 return; 472 return;
diff --git a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs
index 130e197..e35f79f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
44 string dirName = myDomain.FriendlyName; 44 string dirName = myDomain.FriendlyName;
45 string ScriptEnginesPath = myDomain.SetupInformation.PrivateBinPath; 45 string ScriptEnginesPath = myDomain.SetupInformation.PrivateBinPath;
46 46
47 string[] pathList = new string[] {"bin", ScriptEnginesPath, 47 string[] pathList = new string[] {"", "bin", ScriptEnginesPath,
48 Path.Combine(ScriptEnginesPath, dirName)}; 48 Path.Combine(ScriptEnginesPath, dirName)};
49 49
50 string assemblyName = args.Name; 50 string assemblyName = args.Name;
@@ -56,6 +56,8 @@ namespace OpenSim.Region.ScriptEngine.Shared
56 string path = Path.Combine(Directory.GetCurrentDirectory(), 56 string path = Path.Combine(Directory.GetCurrentDirectory(),
57 Path.Combine(s, assemblyName))+".dll"; 57 Path.Combine(s, assemblyName))+".dll";
58 58
59// Console.WriteLine("Trying to resolve {0}", path);
60
59 if (File.Exists(path)) 61 if (File.Exists(path))
60 return Assembly.LoadFrom(path); 62 return Assembly.LoadFrom(path);
61 } 63 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
index b1fb6c2..8b88588 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
@@ -28,12 +28,16 @@
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
32using log4net;
31using Tools; 33using Tools;
32 34
33namespace OpenSim.Region.ScriptEngine.Shared.CodeTools 35namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
34{ 36{
35 public class CSCodeGenerator : ICodeConverter 37 public class CSCodeGenerator : ICodeConverter
36 { 38 {
39// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40
37 private SYMBOL m_astRoot = null; 41 private SYMBOL m_astRoot = null;
38 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap; 42 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap;
39 private int m_indentWidth = 4; // for indentation 43 private int m_indentWidth = 4; // for indentation
@@ -87,6 +91,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
87 /// <returns>String containing the generated C# code.</returns> 91 /// <returns>String containing the generated C# code.</returns>
88 public string Convert(string script) 92 public string Convert(string script)
89 { 93 {
94// m_log.DebugFormat("[CS CODE GENERATOR]: Converting to C#\n{0}", script);
95
90 m_warnings.Clear(); 96 m_warnings.Clear();
91 ResetCounters(); 97 ResetCounters();
92 Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true)); 98 Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true));
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 734d4d5..c10143b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -291,6 +291,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
291 public void PerformScriptCompile(string Script, string asset, UUID ownerUUID, 291 public void PerformScriptCompile(string Script, string asset, UUID ownerUUID,
292 out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap) 292 out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap)
293 { 293 {
294// m_log.DebugFormat("[Compiler]: Compiling script\n{0}", Script);
295
294 linemap = null; 296 linemap = null;
295 m_warnings.Clear(); 297 m_warnings.Clear();
296 298
@@ -357,6 +359,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
357 if (Script.StartsWith("//yp", true, CultureInfo.InvariantCulture)) 359 if (Script.StartsWith("//yp", true, CultureInfo.InvariantCulture))
358 language = enumCompileType.yp; 360 language = enumCompileType.yp;
359 361
362// m_log.DebugFormat("[Compiler]: Compile language is {0}", language);
363
360 if (!AllowedCompilers.ContainsKey(language.ToString())) 364 if (!AllowedCompilers.ContainsKey(language.ToString()))
361 { 365 {
362 // Not allowed to compile to this language! 366 // Not allowed to compile to this language!
@@ -417,7 +421,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
417 } 421 }
418 422
419 assembly = CompileFromDotNetText(compileScript, language, asset, assembly); 423 assembly = CompileFromDotNetText(compileScript, language, asset, assembly);
420 return;
421 } 424 }
422 425
423 public string[] GetWarnings() 426 public string[] GetWarnings()
@@ -491,6 +494,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
491 /// <returns>Filename to .dll assembly</returns> 494 /// <returns>Filename to .dll assembly</returns>
492 internal string CompileFromDotNetText(string Script, enumCompileType lang, string asset, string assembly) 495 internal string CompileFromDotNetText(string Script, enumCompileType lang, string asset, string assembly)
493 { 496 {
497// m_log.DebugFormat("[Compiler]: Compiling to assembly\n{0}", Script);
498
494 string ext = "." + lang.ToString(); 499 string ext = "." + lang.ToString();
495 500
496 // Output assembly name 501 // Output assembly name
@@ -531,8 +536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
531 536
532 parameters.IncludeDebugInformation = true; 537 parameters.IncludeDebugInformation = true;
533 538
534 string rootPath = 539 string rootPath = AppDomain.CurrentDomain.BaseDirectory;
535 Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
536 540
537 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, 541 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath,
538 "OpenSim.Region.ScriptEngine.Shared.dll")); 542 "OpenSim.Region.ScriptEngine.Shared.dll"));
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 9b93135..bc1902b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -537,6 +537,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
537 537
538 public bool Stop(int timeout) 538 public bool Stop(int timeout)
539 { 539 {
540// m_log.DebugFormat(
541// "[SCRIPT INSTANCE]: Stopping script {0} {1} with timeout {2}", ScriptName, ItemID, timeout);
542
540 IScriptWorkItem result; 543 IScriptWorkItem result;
541 544
542 lock (m_EventQueue) 545 lock (m_EventQueue)
@@ -769,7 +772,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
769 } 772 }
770 catch (Exception e) 773 catch (Exception e)
771 { 774 {
772 // m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message); 775// m_log.DebugFormat(
776// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
777// ScriptName, ItemID, e.Message, e.StackTrace);
778
773 m_InEvent = false; 779 m_InEvent = false;
774 m_CurrentEvent = String.Empty; 780 m_CurrentEvent = String.Empty;
775 781
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
index b635d5c..7d7bd82 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
@@ -27,44 +27,100 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading;
30using Nini.Config; 31using Nini.Config;
31using NUnit.Framework; 32using NUnit.Framework;
32using OpenSim.Tests.Common.Mock;
33using OpenSim.Region.Framework.Scenes;
34using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Region.CoreModules.Scripting.WorldComm;
36using OpenSim.Region.Framework.Scenes;
35using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock;
36 40
37namespace OpenSim.Region.ScriptEngine.XEngine.Tests 41namespace OpenSim.Region.ScriptEngine.XEngine.Tests
38{ 42{
39 /// <summary> 43 /// <summary>
40 /// Scene presence tests 44 /// XEngine tests.
41 /// </summary> 45 /// </summary>
42 /// Commented out XEngineTests that don't do anything
43 /*
44 [TestFixture] 46 [TestFixture]
45 public class XEngineTest 47 public class XEngineTest
46 { 48 {
47 public Scene scene; 49 private TestScene m_scene;
48 50 private XEngine m_xEngine;
49 public static Random random; 51 private AutoResetEvent m_chatEvent = new AutoResetEvent(false);
50 public TestClient testclient; 52 private OSChatMessage m_osChatMessageReceived;
51 //TestCommunicationsManager cm;
52 53
53 [TestFixtureSetUp] 54 [TestFixtureSetUp]
54 public void Init() 55 public void Init()
55 { 56 {
56 TestCommunicationsManager cm = new TestCommunicationsManager(); 57 //AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory + "/bin");
57 scene = SceneSetupHelpers.SetupScene("My Test", UUID.Random(), 1000, 1000, cm); 58// Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory);
58 random = new Random(); 59 m_xEngine = new XEngine();
60
61 // Necessary to stop serialization complaining
62 WorldCommModule wcModule = new WorldCommModule();
63
64 IniConfigSource configSource = new IniConfigSource();
65
66 IConfig startupConfig = configSource.AddConfig("Startup");
67 startupConfig.Set("DefaultScriptEngine", "XEngine");
68
69 IConfig xEngineConfig = configSource.AddConfig("XEngine");
70 xEngineConfig.Set("Enabled", "true");
71
72 // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call
73 // to AssemblyResolver.OnAssemblyResolve fails.
74 xEngineConfig.Set("AppDomainLoading", "false");
75
76 m_scene = SceneHelpers.SetupScene("My Test", UUID.Random(), 1000, 1000, null, configSource);
77 SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule);
78 m_scene.StartScripts();
59 } 79 }
60 80
81 /// <summary>
82 /// Test compilation and starting of a script.
83 /// </summary>
84 /// <remarks>
85 /// This is a less than ideal regression test since it involves an asynchronous operation (in this case,
86 /// compilation of the script).
87 /// </remarks>
61 [Test] 88 [Test]
62 public void T001_XStart() 89 public void TestCompileAndStartScript()
63 { 90 {
64 INonSharedRegionModule xengine = new XEngine(); 91 TestHelpers.InMethod();
65 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), xengine); 92// log4net.Config.XmlConfigurator.Configure();
66 xengine.RegionLoaded(scene); 93
94 UUID userId = TestHelpers.ParseTail(0x1);
95// UUID objectId = TestHelpers.ParseTail(0x2);
96// UUID itemId = TestHelpers.ParseTail(0x3);
97 string itemName = "TestStartScript() Item";
98
99 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, "TestStartScriptPart_", 0x100);
100 m_scene.AddNewSceneObject(so, true);
101
102 InventoryItemBase itemTemplate = new InventoryItemBase();
103// itemTemplate.ID = itemId;
104 itemTemplate.Name = itemName;
105 itemTemplate.Folder = so.UUID;
106 itemTemplate.InvType = (int)InventoryType.LSL;
107
108 m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
109
110 m_scene.RezNewScript(userId, itemTemplate);
111
112 m_chatEvent.WaitOne(60000);
113
114 Assert.That(m_osChatMessageReceived, Is.Not.Null, "No chat message received in TestStartScript()");
115 Assert.That(m_osChatMessageReceived.Message, Is.EqualTo("Script running"));
116 }
117
118 private void OnChatFromWorld(object sender, OSChatMessage oscm)
119 {
120// Console.WriteLine("Got chat [{0}]", oscm.Message);
121
122 m_osChatMessageReceived = oscm;
123 m_chatEvent.Set();
67 } 124 }
68 } 125 }
69 */ 126} \ No newline at end of file
70}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index f11987e..c68f03f 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -680,6 +680,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
680 680
681 public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) 681 public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
682 { 682 {
683// m_log.DebugFormat(
684// "[XEngine]: OnRezScript event triggered for script {0}, startParam {1}, postOnRez {2}, engine {3}, stateSource {4}, script\n{5}",
685// itemID, startParam, postOnRez, engine, stateSource, script);
686
683 if (script.StartsWith("//MRM:")) 687 if (script.StartsWith("//MRM:"))
684 return; 688 return;
685 689
@@ -761,6 +765,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
761 m_CompileDict[itemID] = 0; 765 m_CompileDict[itemID] = 0;
762 } 766 }
763 767
768// m_log.DebugFormat("[XEngine]: Added script {0} to compile queue", itemID);
769
764 if (m_CurrentCompile == null) 770 if (m_CurrentCompile == null)
765 { 771 {
766 // NOTE: Although we use a lockless queue, the lock here 772 // NOTE: Although we use a lockless queue, the lock here
@@ -822,6 +828,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
822 bool postOnRez = (bool)p[4]; 828 bool postOnRez = (bool)p[4];
823 StateSource stateSource = (StateSource)p[5]; 829 StateSource stateSource = (StateSource)p[5];
824 830
831// m_log.DebugFormat("[XEngine]: DoOnRezScript called for script {0}", itemID);
832
825 lock (m_CompileDict) 833 lock (m_CompileDict)
826 { 834 {
827 if (!m_CompileDict.ContainsKey(itemID)) 835 if (!m_CompileDict.ContainsKey(itemID))
@@ -870,7 +878,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
870 { 878 {
871 try 879 try
872 { 880 {
873 lock (m_AddingAssemblies) 881 lock (m_AddingAssemblies)
874 { 882 {
875 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); 883 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap);
876 if (!m_AddingAssemblies.ContainsKey(assembly)) { 884 if (!m_AddingAssemblies.ContainsKey(assembly)) {
@@ -922,6 +930,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
922 } 930 }
923 catch (Exception e) 931 catch (Exception e)
924 { 932 {
933// m_log.ErrorFormat("[XEngine]: Exception when rezzing script {0}{1}", e.Message, e.StackTrace);
934
925 // try 935 // try
926 // { 936 // {
927 if (!m_ScriptErrors.ContainsKey(itemID)) 937 if (!m_ScriptErrors.ContainsKey(itemID))
@@ -1132,7 +1142,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1132 handlerObjectRemoved(part.UUID); 1142 handlerObjectRemoved(part.UUID);
1133 } 1143 }
1134 1144
1135
1136 ScriptRemoved handlerScriptRemoved = OnScriptRemoved; 1145 ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
1137 if (handlerScriptRemoved != null) 1146 if (handlerScriptRemoved != null)
1138 handlerScriptRemoved(itemID); 1147 handlerScriptRemoved(itemID);
@@ -1381,6 +1390,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1381 string path = Path.Combine(Directory.GetCurrentDirectory(), 1390 string path = Path.Combine(Directory.GetCurrentDirectory(),
1382 Path.Combine(s, assemblyName))+".dll"; 1391 Path.Combine(s, assemblyName))+".dll";
1383 1392
1393// Console.WriteLine("[XEngine]: Trying to resolve {0}", path);
1394
1384 if (File.Exists(path)) 1395 if (File.Exists(path))
1385 return Assembly.LoadFrom(path); 1396 return Assembly.LoadFrom(path);
1386 } 1397 }
@@ -1863,16 +1874,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1863 1874
1864 public void SuspendScript(UUID itemID) 1875 public void SuspendScript(UUID itemID)
1865 { 1876 {
1877// m_log.DebugFormat("[XEngine]: Received request to suspend script with ID {0}", itemID);
1878
1866 IScriptInstance instance = GetInstance(itemID); 1879 IScriptInstance instance = GetInstance(itemID);
1867 if (instance != null) 1880 if (instance != null)
1868 instance.Suspend(); 1881 instance.Suspend();
1882// else
1883// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
1869 } 1884 }
1870 1885
1871 public void ResumeScript(UUID itemID) 1886 public void ResumeScript(UUID itemID)
1872 { 1887 {
1888// m_log.DebugFormat("[XEngine]: Received request to resume script with ID {0}", itemID);
1889
1873 IScriptInstance instance = GetInstance(itemID); 1890 IScriptInstance instance = GetInstance(itemID);
1874 if (instance != null) 1891 if (instance != null)
1875 instance.Resume(); 1892 instance.Resume();
1893// else
1894// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
1876 } 1895 }
1877 } 1896 }
1878} \ No newline at end of file 1897} \ No newline at end of file
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 24a9418..f627e37 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -301,7 +301,7 @@ namespace OpenSim.Region.UserStatistics
301 301
302 public void OnRegisterCaps(UUID agentID, Caps caps) 302 public void OnRegisterCaps(UUID agentID, Caps caps)
303 { 303 {
304 m_log.DebugFormat("[VC]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); 304 m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
305 string capsPath = "/CAPS/VS/" + UUID.Random(); 305 string capsPath = "/CAPS/VS/" + UUID.Random();
306 caps.RegisterHandler("ViewerStats", 306 caps.RegisterHandler("ViewerStats",
307 new RestStreamHandler("POST", capsPath, 307 new RestStreamHandler("POST", capsPath,
@@ -462,7 +462,7 @@ namespace OpenSim.Region.UserStatistics
462 462
463 if (!m_sessions.ContainsKey(agentID)) 463 if (!m_sessions.ContainsKey(agentID))
464 { 464 {
465 m_log.Warn("[VS]: no session for stat disclosure"); 465 m_log.Warn("[WEB STATS MODULE]: no session for stat disclosure");
466 return new UserSessionID(); 466 return new UserSessionID();
467 } 467 }
468 uid = m_sessions[agentID]; 468 uid = m_sessions[agentID];
@@ -667,14 +667,13 @@ namespace OpenSim.Region.UserStatistics
667 { 667 {
668 updatecmd.ExecuteNonQuery(); 668 updatecmd.ExecuteNonQuery();
669 } 669 }
670 catch 670 catch (SqliteExecutionException)
671 (SqliteExecutionException)
672 { 671 {
673 m_log.Warn("[WEBSTATS]: failed to write stats to storage Execution Exception"); 672 m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage Execution Exception");
674 } 673 }
675 catch (SqliteSyntaxException) 674 catch (SqliteSyntaxException)
676 { 675 {
677 m_log.Warn("[WEBSTATS]: failed to write stats to storage SQL Syntax Exception"); 676 m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage SQL Syntax Exception");
678 } 677 }
679 678
680 } 679 }