aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs6
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEmailModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs22
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs2
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs99
20 files changed, 184 insertions, 99 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index a09b903..501d47f 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -192,9 +192,7 @@ namespace OpenSim
192 // Hook up to the watchdog timer 192 // Hook up to the watchdog timer
193 Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler; 193 Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
194 194
195 PrintFileToConsole("startuplogo.txt"); 195 PrintFileToConsole("startuplogo.txt");
196
197 m_log.InfoFormat("[NETWORK]: Using {0} as SYSTEMIP", Util.GetLocalHost().ToString());
198 196
199 // For now, start at the 'root' level by default 197 // For now, start at the 'root' level by default
200 if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it 198 if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 83be61e..f535fe8 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -367,13 +367,13 @@ namespace OpenSim
367 Environment.Exit(1); 367 Environment.Exit(1);
368 } 368 }
369 369
370 scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
371 scene.EventManager.TriggerParcelPrimCountUpdate();
372
370 // We need to do this after we've initialized the 373 // We need to do this after we've initialized the
371 // scripting engines. 374 // scripting engines.
372 scene.CreateScriptInstances(); 375 scene.CreateScriptInstances();
373 376
374 scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
375 scene.EventManager.TriggerParcelPrimCountUpdate();
376
377 m_sceneManager.Add(scene); 377 m_sceneManager.Add(scene);
378 378
379 if (m_autoCreateClientStack) 379 if (m_autoCreateClientStack)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index cdd22de..d2824bd 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -6303,8 +6303,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6303 if (handlerObjectDuplicate != null) 6303 if (handlerObjectDuplicate != null)
6304 { 6304 {
6305 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, 6305 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
6306 dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID, 6306 dupe.SharedData.DuplicateFlags, AgentId,
6307 AgentandGroupData.GroupID); 6307 m_activeGroupID);
6308 } 6308 }
6309 } 6309 }
6310 6310
@@ -6894,7 +6894,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6894 if (handlerObjectDuplicateOnRay != null) 6894 if (handlerObjectDuplicateOnRay != null)
6895 { 6895 {
6896 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, 6896 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags,
6897 dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, 6897 AgentId, m_activeGroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
6898 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection, 6898 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection,
6899 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); 6899 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
6900 } 6900 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
index f8e3d59..75efb79 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
@@ -131,6 +131,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
131 131
132 if (texture != null) 132 if (texture != null)
133 { 133 {
134 if (texture.Type != (sbyte)AssetType.Texture)
135 {
136 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
137 httpResponse.Send();
138 return null;
139 }
134 SendTexture(httpRequest, httpResponse, texture); 140 SendTexture(httpRequest, httpResponse, texture);
135 } 141 }
136 else 142 else
@@ -147,6 +153,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
147 153
148 if (texture != null) 154 if (texture != null)
149 { 155 {
156 if (texture.Type != (sbyte)AssetType.Texture)
157 {
158 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
159 httpResponse.Send();
160 return null;
161 }
150 SendTexture(httpRequest, httpResponse, texture); 162 SendTexture(httpRequest, httpResponse, texture);
151 } 163 }
152 else 164 else
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 5552be7..6f044cb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -768,8 +768,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
768 bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0; 768 bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0;
769 if (canEditObjectsChanged) 769 if (canEditObjectsChanged)
770 friendClient.SendChangeUserRights(userID, friendID, rights); 770 friendClient.SendChangeUserRights(userID, friendID, rights);
771
771 } 772 }
772 773
774 // update local cache
775 //m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID);
776 foreach (FriendInfo finfo in m_Friends[friendID].Friends)
777 if (finfo.Friend == userID.ToString())
778 finfo.TheirFlags = rights;
779
773 return true; 780 return true;
774 } 781 }
775 782
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 2ab46aa..58c396c 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
131 return ret; 131 return ret;
132 } 132 }
133 133
134 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, 134 public override UUID DeleteToInventory(DeRezAction action, UUID folderID,
135 SceneObjectGroup objectGroup, IClientAPI remoteClient) 135 SceneObjectGroup objectGroup, IClientAPI remoteClient)
136 { 136 {
137 UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient); 137 UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient);
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 3035d88..12b6aa0 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -286,23 +286,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
286 { 286 {
287 // Deleting someone else's item 287 // Deleting someone else's item
288 // 288 //
289
290
291 if (remoteClient == null || 289 if (remoteClient == null ||
292 objectGroup.OwnerID != remoteClient.AgentId) 290 objectGroup.OwnerID != remoteClient.AgentId)
293 { 291 {
294 // Folder skeleton may not be loaded and we 292
295 // have to wait for the inventory to find
296 // the destination folder
297 //
298 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); 293 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
299 } 294 }
300 else 295 else
301 { 296 {
302 // Assume inventory skeleton was loaded during login 297 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
303 // and all folders can be found
304 //
305 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
306 } 298 }
307 } 299 }
308 else if (action == DeRezAction.Return) 300 else if (action == DeRezAction.Return)
@@ -332,7 +324,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
332 324
333 if (folder == null) // None of the above 325 if (folder == null) // None of the above
334 { 326 {
335 //folder = userInfo.RootFolder.FindFolder(folderID);
336 folder = new InventoryFolderBase(folderID); 327 folder = new InventoryFolderBase(folderID);
337 328
338 if (folder == null) // Nowhere to put it 329 if (folder == null) // Nowhere to put it
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
index 83f004d..c0975ea 100644
--- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
@@ -40,7 +40,7 @@ using OpenSim.Region.Framework.Scenes;
40 40
41namespace OpenSim.Region.CoreModules.Scripting.EmailModules 41namespace OpenSim.Region.CoreModules.Scripting.EmailModules
42{ 42{
43 public class EmailModule : IEmailModule 43 public class EmailModule : IRegionModule, IEmailModule
44 { 44 {
45 // 45 //
46 // Log 46 // Log
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
index ae03cdf..209cf0d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
@@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory
96 96
97 Object[] args = new Object[] { m_Config, MainServer.Instance, "HGInventoryService" }; 97 Object[] args = new Object[] { m_Config, MainServer.Instance, "HGInventoryService" };
98 98
99 ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:HGInventoryServiceInConnector", args); 99 ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:XInventoryInConnector", args);
100 } 100 }
101 } 101 }
102 102
diff --git a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
index 3a2c423..4f1b91a 100644
--- a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces
38 public int numLeft; 38 public int numLeft;
39 } 39 }
40 40
41 public interface IEmailModule : IRegionModule 41 public interface IEmailModule
42 { 42 {
43 void SendEmail(UUID objectID, string address, string subject, string body); 43 void SendEmail(UUID objectID, string address, string subject, string body);
44 Email GetNextEmail(UUID objectID, string sender, string subject); 44 Email GetNextEmail(UUID objectID, string sender, string subject);
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 7b7677b..de3c360 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -52,6 +52,9 @@ namespace OpenSim.Region.Framework.Scenes
52 public double GetUpdatePriority(IClientAPI client, ISceneEntity entity) 52 public double GetUpdatePriority(IClientAPI client, ISceneEntity entity)
53 { 53 {
54 double priority = 0; 54 double priority = 0;
55
56 if (entity == null)
57 return 100000;
55 58
56 switch (m_scene.UpdatePrioritizationScheme) 59 switch (m_scene.UpdatePrioritizationScheme)
57 { 60 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 64bdc99..9278164 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -385,9 +385,9 @@ namespace OpenSim.Region.Framework.Scenes
385 if (Permissions.PropagatePermissions() && recipient != senderId) 385 if (Permissions.PropagatePermissions() && recipient != senderId)
386 { 386 {
387 // First, make sore base is limited to the next perms 387 // First, make sore base is limited to the next perms
388 itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions; 388 itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move);
389 // By default, current equals base 389 // By default, current equals base
390 itemCopy.CurrentPermissions = itemCopy.BasePermissions; 390 itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions;
391 391
392 // If this is an object, replace current perms 392 // If this is an object, replace current perms
393 // with folded perms 393 // with folded perms
@@ -398,7 +398,7 @@ namespace OpenSim.Region.Framework.Scenes
398 } 398 }
399 399
400 // Ensure there is no escalation 400 // Ensure there is no escalation
401 itemCopy.CurrentPermissions &= item.NextPermissions; 401 itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move);
402 402
403 // Need slam bit on xfer 403 // Need slam bit on xfer
404 itemCopy.CurrentPermissions |= 8; 404 itemCopy.CurrentPermissions |= 8;
@@ -897,14 +897,15 @@ namespace OpenSim.Region.Framework.Scenes
897 897
898 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) 898 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
899 { 899 {
900 agentItem.BasePermissions = taskItem.BasePermissions & taskItem.NextPermissions; 900 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
901 if (taskItem.InvType == (int)InventoryType.Object) 901 if (taskItem.InvType == (int)InventoryType.Object)
902 agentItem.CurrentPermissions = agentItem.BasePermissions & ((taskItem.CurrentPermissions & 7) << 13); 902 agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move));
903 agentItem.CurrentPermissions = agentItem.BasePermissions ; 903 else
904 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
904 905
905 agentItem.CurrentPermissions |= 8; 906 agentItem.CurrentPermissions |= 8;
906 agentItem.NextPermissions = taskItem.NextPermissions; 907 agentItem.NextPermissions = taskItem.NextPermissions;
907 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & taskItem.NextPermissions; 908 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
908 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; 909 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
909 } 910 }
910 else 911 else
@@ -1086,13 +1087,13 @@ namespace OpenSim.Region.Framework.Scenes
1086 if (Permissions.PropagatePermissions()) 1087 if (Permissions.PropagatePermissions())
1087 { 1088 {
1088 destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions & 1089 destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions &
1089 srcTaskItem.NextPermissions; 1090 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1090 destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions & 1091 destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions &
1091 srcTaskItem.NextPermissions; 1092 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1092 destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions & 1093 destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions &
1093 srcTaskItem.NextPermissions; 1094 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1094 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1095 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1095 srcTaskItem.NextPermissions; 1096 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1096 destTaskItem.CurrentPermissions |= 8; // Slam! 1097 destTaskItem.CurrentPermissions |= 8; // Slam!
1097 } 1098 }
1098 } 1099 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 240c688..40332a6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1747,9 +1747,31 @@ namespace OpenSim.Region.Framework.Scenes
1747 { 1747 {
1748 if (m_parentScene.Permissions.CanDuplicateObject(original.Children.Count, original.UUID, AgentID, original.AbsolutePosition)) 1748 if (m_parentScene.Permissions.CanDuplicateObject(original.Children.Count, original.UUID, AgentID, original.AbsolutePosition))
1749 { 1749 {
1750 SceneObjectGroup copy = original.Copy(AgentID, GroupID, true); 1750 SceneObjectGroup copy = original.Copy(true);
1751 copy.AbsolutePosition = copy.AbsolutePosition + offset; 1751 copy.AbsolutePosition = copy.AbsolutePosition + offset;
1752 1752
1753 if (original.OwnerID != AgentID)
1754 {
1755 copy.SetOwnerId(AgentID);
1756 copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID);
1757
1758 List<SceneObjectPart> partList =
1759 new List<SceneObjectPart>(copy.Children.Values);
1760
1761 if (m_parentScene.Permissions.PropagatePermissions())
1762 {
1763 foreach (SceneObjectPart child in partList)
1764 {
1765 child.Inventory.ChangeInventoryOwner(AgentID);
1766 child.TriggerScriptChangedEvent(Changed.OWNER);
1767 child.ApplyNextOwnerPermissions();
1768 }
1769 }
1770
1771 copy.RootPart.ObjectSaleType = 0;
1772 copy.RootPart.SalePrice = 10;
1773 }
1774
1753 Entities.Add(copy); 1775 Entities.Add(copy);
1754 1776
1755 // Since we copy from a source group that is in selected 1777 // Since we copy from a source group that is in selected
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index e23f39f..1ca390a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1472,7 +1472,7 @@ namespace OpenSim.Region.Framework.Scenes
1472 "[SCENE]: Storing {0}, {1} in {2}", 1472 "[SCENE]: Storing {0}, {1} in {2}",
1473 Name, UUID, m_scene.RegionInfo.RegionName); 1473 Name, UUID, m_scene.RegionInfo.RegionName);
1474 1474
1475 SceneObjectGroup backup_group = Copy(OwnerID, GroupID, false); 1475 SceneObjectGroup backup_group = Copy(false);
1476 backup_group.RootPart.Velocity = RootPart.Velocity; 1476 backup_group.RootPart.Velocity = RootPart.Velocity;
1477 backup_group.RootPart.Acceleration = RootPart.Acceleration; 1477 backup_group.RootPart.Acceleration = RootPart.Acceleration;
1478 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; 1478 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
@@ -1528,7 +1528,7 @@ namespace OpenSim.Region.Framework.Scenes
1528 /// Duplicates this object, including operations such as physics set up and attaching to the backup event. 1528 /// Duplicates this object, including operations such as physics set up and attaching to the backup event.
1529 /// </summary> 1529 /// </summary>
1530 /// <returns></returns> 1530 /// <returns></returns>
1531 public SceneObjectGroup Copy(UUID cAgentID, UUID cGroupID, bool userExposed) 1531 public SceneObjectGroup Copy(bool userExposed)
1532 { 1532 {
1533 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); 1533 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
1534 dupe.m_isBackedUp = false; 1534 dupe.m_isBackedUp = false;
@@ -1551,7 +1551,9 @@ namespace OpenSim.Region.Framework.Scenes
1551 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 1551 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
1552 1552
1553 if (!userExposed) 1553 if (!userExposed)
1554 {
1554 dupe.RootPart.IsAttachment = previousAttachmentStatus; 1555 dupe.RootPart.IsAttachment = previousAttachmentStatus;
1556 }
1555 1557
1556 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 1558 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
1557 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 1559 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
@@ -1576,16 +1578,6 @@ namespace OpenSim.Region.Framework.Scenes
1576 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); 1578 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
1577 } 1579 }
1578 1580
1579 // Now we've made a copy that replaces this one, we need to
1580 // switch the owner to the person who did the copying
1581 // Second Life copies an object and duplicates the first one in it's place
1582 // So, we have to make a copy of this one, set it in it's place then set the owner on this one
1583 if (userExposed)
1584 {
1585 SetRootPartOwner(m_rootPart, cAgentID, cGroupID);
1586 m_rootPart.ScheduleFullUpdate();
1587 }
1588
1589 List<SceneObjectPart> partList; 1581 List<SceneObjectPart> partList;
1590 1582
1591 lock (m_parts) 1583 lock (m_parts)
@@ -1606,12 +1598,6 @@ namespace OpenSim.Region.Framework.Scenes
1606 SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); 1598 SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
1607 1599
1608 newPart.LinkNum = part.LinkNum; 1600 newPart.LinkNum = part.LinkNum;
1609
1610 if (userExposed)
1611 {
1612 SetPartOwner(newPart, cAgentID, cGroupID);
1613 newPart.ScheduleFullUpdate();
1614 }
1615 } 1601 }
1616 } 1602 }
1617 1603
@@ -3595,7 +3581,7 @@ namespace OpenSim.Region.Framework.Scenes
3595 3581
3596 public virtual ISceneObject CloneForNewScene() 3582 public virtual ISceneObject CloneForNewScene()
3597 { 3583 {
3598 SceneObjectGroup sog = Copy(this.OwnerID, this.GroupID, false); 3584 SceneObjectGroup sog = Copy(false);
3599 sog.m_isDeleted = false; 3585 sog.m_isDeleted = false;
3600 return sog; 3586 return sog;
3601 } 3587 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 866bb6e..3a8f168 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Collections; 32using System.Collections;
33using System.Reflection; 33using System.Reflection;
34using System.Threading;
34using OpenMetaverse; 35using OpenMetaverse;
35using log4net; 36using log4net;
36using OpenSim.Framework; 37using OpenSim.Framework;
@@ -200,6 +201,7 @@ namespace OpenSim.Region.Framework.Scenes
200 if ((int)InventoryType.LSL == item.InvType) 201 if ((int)InventoryType.LSL == item.InvType)
201 { 202 {
202 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); 203 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
204 Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug
203 } 205 }
204 } 206 }
205 } 207 }
@@ -257,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes
257 // m_log.InfoFormat( 259 // m_log.InfoFormat(
258 // "[PRIM INVENTORY]: " + 260 // "[PRIM INVENTORY]: " +
259 // "Starting script {0}, {1} in prim {2}, {3}", 261 // "Starting script {0}, {1} in prim {2}, {3}",
260 // item.Name, item.ItemID, Name, UUID); 262 // item.Name, item.ItemID, m_part.Name, m_part.UUID);
261 263
262 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) 264 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
263 return; 265 return;
@@ -293,20 +295,20 @@ namespace OpenSim.Region.Framework.Scenes
293 } 295 }
294 else 296 else
295 { 297 {
296 if (m_part.ParentGroup.m_savedScriptState != null)
297 RestoreSavedScriptState(item.OldItemID, item.ItemID);
298
299 lock (m_items) 298 lock (m_items)
300 { 299 {
300 if (m_part.ParentGroup.m_savedScriptState != null)
301 RestoreSavedScriptState(item.OldItemID, item.ItemID);
302
301 m_items[item.ItemID].PermsMask = 0; 303 m_items[item.ItemID].PermsMask = 0;
302 m_items[item.ItemID].PermsGranter = UUID.Zero; 304 m_items[item.ItemID].PermsGranter = UUID.Zero;
305
306 string script = Utils.BytesToString(asset.Data);
307 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
308 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
309 m_part.ParentGroup.AddActiveScriptCount(1);
310 m_part.ScheduleFullUpdate();
303 } 311 }
304
305 string script = Utils.BytesToString(asset.Data);
306 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
307 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
308 m_part.ParentGroup.AddActiveScriptCount(1);
309 m_part.ScheduleFullUpdate();
310 } 312 }
311 } 313 }
312 } 314 }
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
index c277034..ada6701 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
73 public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics) 73 public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics)
74 : base(Unchanged, false) 74 : base(Unchanged, false)
75 { 75 {
76 m_UnchangedEntity = Unchanged.Copy(Unchanged.RootPart.OwnerID, Unchanged.RootPart.GroupID, false); 76 m_UnchangedEntity = Unchanged.Copy(false);
77 } 77 }
78 78
79 public ContentManagementEntity(string objectXML, Scene scene, bool physics) 79 public ContentManagementEntity(string objectXML, Scene scene, bool physics)
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
index 1a72971..841ee00 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
80 /// </summary> 80 /// </summary>
81 public MetaEntity(SceneObjectGroup orig, bool physics) 81 public MetaEntity(SceneObjectGroup orig, bool physics)
82 { 82 {
83 m_Entity = orig.Copy(orig.RootPart.OwnerID, orig.RootPart.GroupID, false); 83 m_Entity = orig.Copy(false);
84 Initialize(physics); 84 Initialize(physics);
85 } 85 }
86 86
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
index 9beeabb..2342bfa 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
@@ -675,7 +675,7 @@ namespace OpenSim.Region.Physics.OdePlugin
675 m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity 675 m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity
676 676
677 d.Vector3 pos = d.BodyGetPosition(Body); 677 d.Vector3 pos = d.BodyGetPosition(Body);
678 Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f); 678// Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f);
679 Vector3 posChange = new Vector3(); 679 Vector3 posChange = new Vector3();
680 posChange.X = pos.X - m_lastPositionVector.X; 680 posChange.X = pos.X - m_lastPositionVector.X;
681 posChange.Y = pos.Y - m_lastPositionVector.Y; 681 posChange.Y = pos.Y - m_lastPositionVector.Y;
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 0720b5e..3cf4501 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -1576,19 +1576,19 @@ Console.WriteLine(" JointCreateFixed");
1576//Console.WriteLine("Move " + m_primName); 1576//Console.WriteLine("Move " + m_primName);
1577 if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 1577 if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
1578 // NON-'VEHICLES' are dealt with here 1578 // NON-'VEHICLES' are dealt with here
1579 if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) 1579// if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f))
1580 { 1580// {
1581 d.Vector3 avel2 = d.BodyGetAngularVel(Body); 1581// d.Vector3 avel2 = d.BodyGetAngularVel(Body);
1582 /* 1582// /*
1583 if (m_angularlock.X == 1) 1583// if (m_angularlock.X == 1)
1584 avel2.X = 0; 1584// avel2.X = 0;
1585 if (m_angularlock.Y == 1) 1585// if (m_angularlock.Y == 1)
1586 avel2.Y = 0; 1586// avel2.Y = 0;
1587 if (m_angularlock.Z == 1) 1587// if (m_angularlock.Z == 1)
1588 avel2.Z = 0; 1588// avel2.Z = 0;
1589 d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z); 1589// d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z);
1590 */ 1590// */
1591 } 1591// }
1592 //float PID_P = 900.0f; 1592 //float PID_P = 900.0f;
1593 1593
1594 float m_mass = CalculateMass(); 1594 float m_mass = CalculateMass();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 59ab26b..712bd7d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -705,22 +705,75 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
705 { 705 {
706 //A and B should both be normalized 706 //A and B should both be normalized
707 m_host.AddScriptLPS(1); 707 m_host.AddScriptLPS(1);
708 double dotProduct = LSL_Vector.Dot(a, b); 708 LSL_Rotation rotBetween;
709 LSL_Vector crossProduct = LSL_Vector.Cross(a, b); 709 // Check for zero vectors. If either is zero, return zero rotation. Otherwise,
710 double magProduct = LSL_Vector.Mag(a) * LSL_Vector.Mag(b); 710 // continue calculation.
711 double angle = Math.Acos(dotProduct / magProduct); 711 if (a == new LSL_Vector(0.0f, 0.0f, 0.0f) || b == new LSL_Vector(0.0f, 0.0f, 0.0f))
712 LSL_Vector axis = LSL_Vector.Norm(crossProduct); 712 {
713 double s = Math.Sin(angle / 2); 713 rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
714 714 }
715 double x = axis.x * s; 715 else
716 double y = axis.y * s; 716 {
717 double z = axis.z * s; 717 a = LSL_Vector.Norm(a);
718 double w = Math.Cos(angle / 2); 718 b = LSL_Vector.Norm(b);
719 719 double dotProduct = LSL_Vector.Dot(a, b);
720 if (Double.IsNaN(x) || Double.IsNaN(y) || Double.IsNaN(z) || Double.IsNaN(w)) 720 // There are two degenerate cases possible. These are for vectors 180 or
721 return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f); 721 // 0 degrees apart. These have to be detected and handled individually.
722 722 //
723 return new LSL_Rotation((float)x, (float)y, (float)z, (float)w); 723 // Check for vectors 180 degrees apart.
724 // A dot product of -1 would mean the angle between vectors is 180 degrees.
725 if (dotProduct < -0.9999999f)
726 {
727 // First assume X axis is orthogonal to the vectors.
728 LSL_Vector orthoVector = new LSL_Vector(1.0f, 0.0f, 0.0f);
729 orthoVector = orthoVector - a * (a.x / LSL_Vector.Dot(a, a));
730 // Check for near zero vector. A very small non-zero number here will create
731 // a rotation in an undesired direction.
732 if (LSL_Vector.Mag(orthoVector) > 0.0001)
733 {
734 rotBetween = new LSL_Rotation(orthoVector.x, orthoVector.y, orthoVector.z, 0.0f);
735 }
736 // If the magnitude of the vector was near zero, then assume the X axis is not
737 // orthogonal and use the Z axis instead.
738 else
739 {
740 // Set 180 z rotation.
741 rotBetween = new LSL_Rotation(0.0f, 0.0f, 1.0f, 0.0f);
742 }
743 }
744 // Check for parallel vectors.
745 // A dot product of 1 would mean the angle between vectors is 0 degrees.
746 else if (dotProduct > 0.9999999f)
747 {
748 // Set zero rotation.
749 rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
750 }
751 else
752 {
753 // All special checks have been performed so get the axis of rotation.
754 LSL_Vector crossProduct = LSL_Vector.Cross(a, b);
755 // Quarternion s value is the length of the unit vector + dot product.
756 double qs = 1.0 + dotProduct;
757 rotBetween = new LSL_Rotation(crossProduct.x, crossProduct.y, crossProduct.z, qs);
758 // Normalize the rotation.
759 double mag = LSL_Rotation.Mag(rotBetween);
760 // We shouldn't have to worry about a divide by zero here. The qs value will be
761 // non-zero because we already know if we're here, then the dotProduct is not -1 so
762 // qs will not be zero. Also, we've already handled the input vectors being zero so the
763 // crossProduct vector should also not be zero.
764 rotBetween.x = rotBetween.x / mag;
765 rotBetween.y = rotBetween.y / mag;
766 rotBetween.z = rotBetween.z / mag;
767 rotBetween.s = rotBetween.s / mag;
768 // Check for undefined values and set zero rotation if any found. This code might not actually be required
769 // any longer since zero vectors are checked for at the top.
770 if (Double.IsNaN(rotBetween.x) || Double.IsNaN(rotBetween.y) || Double.IsNaN(rotBetween.z) || Double.IsNaN(rotBetween.s))
771 {
772 rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
773 }
774 }
775 }
776 return rotBetween;
724 } 777 }
725 778
726 public void llWhisper(int channelID, string text) 779 public void llWhisper(int channelID, string text)
@@ -6520,6 +6573,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6520 if (cut.y - cut.x < 0.05f) 6573 if (cut.y - cut.x < 0.05f)
6521 { 6574 {
6522 cut.x = cut.y - 0.05f; 6575 cut.x = cut.y - 0.05f;
6576 if (cut.x < 0.0f)
6577 {
6578 cut.x = 0.0f;
6579 cut.y = 0.05f;
6580 }
6523 } 6581 }
6524 shapeBlock.ProfileBegin = (ushort)(50000 * cut.x); 6582 shapeBlock.ProfileBegin = (ushort)(50000 * cut.x);
6525 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - cut.y)); 6583 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - cut.y));
@@ -6715,9 +6773,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6715 { 6773 {
6716 profilecut.y = 1f; 6774 profilecut.y = 1f;
6717 } 6775 }
6718 if (profilecut.y - cut.x < 0.05f) 6776 if (profilecut.y - profilecut.x < 0.05f)
6719 { 6777 {
6720 profilecut.x = cut.y - 0.05f; 6778 profilecut.x = profilecut.y - 0.05f;
6779 if (profilecut.x < 0.0f)
6780 {
6781 profilecut.x = 0.0f;
6782 profilecut.y = 0.05f;
6783 }
6721 } 6784 }
6722 shapeBlock.ProfileBegin = (ushort)(50000 * profilecut.x); 6785 shapeBlock.ProfileBegin = (ushort)(50000 * profilecut.x);
6723 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - profilecut.y)); 6786 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - profilecut.y));