aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs61
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs17
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs20
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs75
-rw-r--r--OpenSim/Region/Framework/Interfaces/IFriendsModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IGroupsModule.cs1
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs9
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs122
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs5
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs3
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs13
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs15
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs46
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs42
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs34
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs84
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs19
25 files changed, 441 insertions, 243 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 26fc85e..e3b2fd1 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5805,9 +5805,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5805 5805
5806 public ulong GetGroupPowers(UUID groupID) 5806 public ulong GetGroupPowers(UUID groupID)
5807 { 5807 {
5808 if (groupID == ActiveGroupId)
5809 return ActiveGroupPowers;
5810
5811 lock(m_groupPowers) 5808 lock(m_groupPowers)
5812 { 5809 {
5813 if (m_groupPowers.ContainsKey(groupID)) 5810 if (m_groupPowers.ContainsKey(groupID))
@@ -6729,11 +6726,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6729 RezObject handlerRezObject = OnRezObject; 6726 RezObject handlerRezObject = OnRezObject;
6730 if (handlerRezObject != null) 6727 if (handlerRezObject != null)
6731 { 6728 {
6732 handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd, 6729 UUID rezGroupID = rezPacket.AgentData.GroupID;
6733 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID, 6730 if(!IsGroupMember(rezGroupID))
6734 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection, 6731 rezGroupID = UUID.Zero;
6735 rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem, 6732 handlerRezObject(this, rezPacket.InventoryData.ItemID, rezGroupID, rezPacket.RezData.RayEnd,
6736 rezPacket.RezData.FromTaskID); 6733 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
6734 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
6735 rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem,
6736 rezPacket.RezData.FromTaskID);
6737 } 6737 }
6738 return true; 6738 return true;
6739 } 6739 }
@@ -7544,7 +7544,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7544 7544
7545 AddNewPrim handlerAddPrim = OnAddPrim; 7545 AddNewPrim handlerAddPrim = OnAddPrim;
7546 if (handlerAddPrim != null) 7546 if (handlerAddPrim != null)
7547 handlerAddPrim(AgentId, ActiveGroupId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection); 7547 handlerAddPrim(AgentId, addPacket.AgentData.GroupID, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection);
7548 } 7548 }
7549 return true; 7549 return true;
7550 } 7550 }
@@ -7644,9 +7644,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7644 handlerObjectDuplicate = OnObjectDuplicate; 7644 handlerObjectDuplicate = OnObjectDuplicate;
7645 if (handlerObjectDuplicate != null) 7645 if (handlerObjectDuplicate != null)
7646 { 7646 {
7647 UUID rezGroupID = dupe.AgentData.GroupID;
7648 if(!IsGroupMember(rezGroupID))
7649 rezGroupID = UUID.Zero;
7647 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, 7650 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
7648 dupe.SharedData.DuplicateFlags, AgentId, 7651 dupe.SharedData.DuplicateFlags, AgentId,
7649 ActiveGroupId); 7652 rezGroupID);
7650 } 7653 }
7651 } 7654 }
7652 7655
@@ -8266,10 +8269,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8266 handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay; 8269 handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay;
8267 if (handlerObjectDuplicateOnRay != null) 8270 if (handlerObjectDuplicateOnRay != null)
8268 { 8271 {
8269 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, 8272
8270 AgentId, ActiveGroupId, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, 8273 UUID rezGroupID = dupeOnRay.AgentData.GroupID;
8271 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection, 8274 if(!IsGroupMember(rezGroupID))
8272 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); 8275 rezGroupID = UUID.Zero;
8276
8277 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID,
8278 dupeOnRay.AgentData.DuplicateFlags, AgentId, rezGroupID,
8279 dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
8280 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast,
8281 dupeOnRay.AgentData.RayEndIsIntersection,
8282 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
8273 } 8283 }
8274 } 8284 }
8275 8285
@@ -13148,11 +13158,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13148 { 13158 {
13149 lock(m_groupPowers) 13159 lock(m_groupPowers)
13150 { 13160 {
13161 GroupMembershipData activeMembership = null;
13151 if (m_GroupsModule != null) 13162 if (m_GroupsModule != null)
13152 { 13163 {
13153 GroupMembershipData[] GroupMembership = 13164 GroupMembershipData[] GroupMembership =
13154 m_GroupsModule.GetMembershipData(AgentId); 13165 m_GroupsModule.GetMembershipData(AgentId);
13155 13166
13156 m_groupPowers.Clear(); 13167 m_groupPowers.Clear();
13157 13168
13158 if (GroupMembership != null) 13169 if (GroupMembership != null)
@@ -13162,6 +13173,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13162 m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers; 13173 m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers;
13163 } 13174 }
13164 } 13175 }
13176
13177 activeMembership = m_GroupsModule.GetActiveMembershipData(AgentId);
13178 if(activeMembership != null)
13179 {
13180 if(!m_groupPowers.ContainsKey(activeMembership.GroupID))
13181 activeMembership = null;
13182 else
13183 {
13184 m_activeGroupID = activeMembership.GroupID;
13185 m_activeGroupName = activeMembership.GroupName;
13186 m_activeGroupPowers = ActiveGroupPowers;
13187 }
13188 }
13189 }
13190
13191 if(activeMembership == null)
13192 {
13193 m_activeGroupID = UUID.Zero;
13194 m_activeGroupName = "";
13195 m_activeGroupPowers = 0;
13165 } 13196 }
13166 } 13197 }
13167 } 13198 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index c88142a..aaa331b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
217 217
218 scene.EventManager.OnNewClient += OnNewClient; 218 scene.EventManager.OnNewClient += OnNewClient;
219 scene.EventManager.OnClientClosed += OnClientClosed; 219 scene.EventManager.OnClientClosed += OnClientClosed;
220// scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; 220 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
221 scene.EventManager.OnClientLogin += OnClientLogin; 221 scene.EventManager.OnClientLogin += OnClientLogin;
222 } 222 }
223 223
@@ -362,18 +362,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
362 m_NeedsListOfOnlineFriends.Add(agentID); 362 m_NeedsListOfOnlineFriends.Add(agentID);
363 } 363 }
364 364
365 public void IsNpwRoot(ScenePresence sp) 365 public void IsNowRoot(ScenePresence sp)
366 { 366 {
367 RecacheFriends(sp.ControllingClient); 367 OnMakeRootAgent(sp);
368
369 lock (m_NeedsToNotifyStatus)
370 {
371 if (m_NeedsToNotifyStatus.Remove(sp.UUID))
372 {
373 // Inform the friends that this user is online. This can only be done once the client is a Root Agent.
374 StatusChange(sp.UUID, true);
375 }
376 }
377 } 368 }
378 369
379 public virtual bool SendFriendsOnlineIfNeeded(IClientAPI client) 370 public virtual bool SendFriendsOnlineIfNeeded(IClientAPI client)
diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
index b735c61..543410e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
@@ -182,11 +182,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
182 m_ClientMap.Add(client.AgentId, client); 182 m_ClientMap.Add(client.AgentId, client);
183 } 183 }
184 } 184 }
185
186 GroupMembershipData[] updateGroups = new GroupMembershipData[1];
187 updateGroups[0] = osGroup;
188
189 client.SendGroupMembership(updateGroups);
190 } 185 }
191 186
192 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, 187 private void OnAgentDataUpdateRequest(IClientAPI remoteClient,
@@ -237,6 +232,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
237 remote_client.SendGroupNameReply(groupUUID, groupnamereply); 232 remote_client.SendGroupNameReply(groupUUID, groupnamereply);
238 } 233 }
239 234
235 public GroupMembershipData[] GetMembershipData(UUID agentID)
236 {
237 GroupMembershipData[] updateGroups = new GroupMembershipData[1];
238 updateGroups[0] = osGroup;
239 return updateGroups;
240 }
241
242 public GroupMembershipData GetActiveMembershipData(UUID agentID)
243 {
244 return osGroup;
245 }
246
240 private void OnClientClosed(UUID agentID, Scene scene) 247 private void OnClientClosed(UUID agentID, Scene scene)
241 { 248 {
242 lock (m_ClientMap) 249 lock (m_ClientMap)
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 4119f90..4d7c25b 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -306,9 +306,21 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
306 /// 306 ///
307 /// RezObject 307 /// RezObject
308 /// 308 ///
309 public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, 309 // compatibility do not use
310 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 310 public override SceneObjectGroup RezObject(
311 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) 311 IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart,
312 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
313 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
314 {
315 return RezObject(remoteClient, itemID, UUID.Zero, RayEnd, RayStart,
316 RayTargetID, BypassRayCast, RayEndIsIntersection,
317 RezSelected, RemoveItem, fromTaskID, attachment);
318 }
319
320 public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID,
321 UUID groupID, Vector3 RayEnd, Vector3 RayStart,
322 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
323 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
312 { 324 {
313 m_log.DebugFormat("[HGScene]: RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); 325 m_log.DebugFormat("[HGScene]: RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID);
314 326
@@ -331,7 +343,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
331 //} 343 //}
332 344
333 // OK, we're done fetching. Pass it up to the default RezObject 345 // OK, we're done fetching. Pass it up to the default RezObject
334 SceneObjectGroup sog = base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, 346 SceneObjectGroup sog = base.RezObject(remoteClient, itemID, groupID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
335 RezSelected, RemoveItem, fromTaskID, attachment); 347 RezSelected, RemoveItem, fromTaskID, attachment);
336 348
337 return sog; 349 return sog;
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 8c560e5..00e2670 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -818,12 +818,22 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
818 818
819 return item; 819 return item;
820 } 820 }
821 821 // compatibility do not use
822 public virtual SceneObjectGroup RezObject( 822 public virtual SceneObjectGroup RezObject(
823 IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, 823 IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart,
824 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 824 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
825 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) 825 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
826 { 826 {
827 return RezObject(remoteClient, itemID, UUID.Zero, RayEnd, RayStart,
828 RayTargetID, BypassRayCast, RayEndIsIntersection,
829 RezSelected, RemoveItem, fromTaskID, attachment);
830 }
831
832 public virtual SceneObjectGroup RezObject(
833 IClientAPI remoteClient, UUID itemID, UUID rezGroupID, Vector3 RayEnd, Vector3 RayStart,
834 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
835 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
836 {
827// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); 837// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID);
828 InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID); 838 InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID);
829 839
@@ -835,16 +845,28 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
835 item.Owner = remoteClient.AgentId; 845 item.Owner = remoteClient.AgentId;
836 846
837 return RezObject( 847 return RezObject(
838 remoteClient, item, item.AssetID, 848 remoteClient, item, rezGroupID, item.AssetID,
839 RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, 849 RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
840 RezSelected, RemoveItem, fromTaskID, attachment); 850 RezSelected, RemoveItem, fromTaskID, attachment);
841 } 851 }
842 852 // compatility
843 public virtual SceneObjectGroup RezObject( 853 public virtual SceneObjectGroup RezObject(
844 IClientAPI remoteClient, InventoryItemBase item, UUID assetID, Vector3 RayEnd, Vector3 RayStart, 854 IClientAPI remoteClient, InventoryItemBase item, UUID assetID, Vector3 RayEnd, Vector3 RayStart,
845 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 855 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
846 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) 856 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
847 { 857 {
858 return RezObject(remoteClient, item, UUID.Zero, assetID,
859 RayEnd, RayStart, RayTargetID,
860 BypassRayCast, RayEndIsIntersection,
861 RezSelected, RemoveItem, fromTaskID, attachment);
862 }
863
864 public virtual SceneObjectGroup RezObject(
865 IClientAPI remoteClient, InventoryItemBase item, UUID groupID, UUID assetID,
866 Vector3 RayEnd, Vector3 RayStart, UUID RayTargetID,
867 byte BypassRayCast, bool RayEndIsIntersection,
868 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
869 {
848 AssetBase rezAsset = m_Scene.AssetService.Get(assetID.ToString()); 870 AssetBase rezAsset = m_Scene.AssetService.Get(assetID.ToString());
849 871
850 if (rezAsset == null) 872 if (rezAsset == null)
@@ -986,6 +1008,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
986 group.IsAttachment = true; 1008 group.IsAttachment = true;
987 } 1009 }
988 1010
1011 group.SetGroup(groupID, remoteClient);
1012
989 // If we're rezzing an attachment then don't ask 1013 // If we're rezzing an attachment then don't ask
990 // AddNewSceneObject() to update the client since 1014 // AddNewSceneObject() to update the client since
991 // we'll be doing that later on. Scheduling more than 1015 // we'll be doing that later on. Scheduling more than
@@ -995,12 +1019,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
995 m_Scene.AddNewSceneObject(group, true, false); 1019 m_Scene.AddNewSceneObject(group, true, false);
996 1020
997 if (!attachment) 1021 if (!attachment)
1022 {
998 group.AbsolutePosition = pos + veclist[i]; 1023 group.AbsolutePosition = pos + veclist[i];
999 1024
1000 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
1001
1002 if (!attachment)
1003 {
1004 // Fire on_rez 1025 // Fire on_rez
1005 group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); 1026 group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1);
1006 rootPart.ParentGroup.ResumeScripts(); 1027 rootPart.ParentGroup.ResumeScripts();
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
index 172b864..b31d4df 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
166 166
167 SceneObjectGroup so 167 SceneObjectGroup so
168 = m_iam.RezObject( 168 = m_iam.RezObject(
169 m_tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false); 169 m_tc, item1Id, UUID.Zero, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
170 170
171 Assert.That(so, Is.Not.Null); 171 Assert.That(so, Is.Not.Null);
172 172
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 6f10f51..959829c 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -1060,27 +1060,80 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1060 /// <param name="maxY"></param> 1060 /// <param name="maxY"></param>
1061 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 1061 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
1062 { 1062 {
1063 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag); 1063// m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag);
1064 1064
1065 GetAndSendBlocks(remoteClient, minX, minY, maxX, maxY, flag); 1065 GetAndSendBlocks(remoteClient, minX, minY, maxX, maxY, flag);
1066 } 1066 }
1067 1067
1068 private const double SPAMBLOCKTIMEms = 300000; // 5 minutes
1069 private Dictionary<UUID,double> spamBlocked = new Dictionary<UUID,double>();
1070
1068 protected virtual List<MapBlockData> GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 1071 protected virtual List<MapBlockData> GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
1069 { 1072 {
1070 MapBlockRequestData req = new MapBlockRequestData(); 1073 // anti spam because of FireStorm 4.7.7 absurd request repeat rates
1074 // possible others
1071 1075
1072 req.client = remoteClient; 1076 double now = Util.GetTimeStampMS();
1073 req.minX = minX; 1077 UUID agentID = remoteClient.AgentId;
1074 req.maxX = maxX;
1075 req.minY = minY;
1076 req.maxY = maxY;
1077 req.flags = flag;
1078 1078
1079 lock (m_mapBlockRequestEvent) 1079 lock (m_mapBlockRequestEvent)
1080 { 1080 {
1081 if (!m_mapBlockRequests.ContainsKey(remoteClient.AgentId)) 1081 if(spamBlocked.ContainsKey(agentID))
1082 m_mapBlockRequests[remoteClient.AgentId] = new Queue<MapBlockRequestData>(); 1082 {
1083 m_mapBlockRequests[remoteClient.AgentId].Enqueue(req); 1083 if(spamBlocked[agentID] < now &&
1084 (!m_mapBlockRequests.ContainsKey(agentID) ||
1085 m_mapBlockRequests[agentID].Count == 0 ))
1086 {
1087 spamBlocked.Remove(agentID);
1088 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks release spammer {0}", agentID);
1089 }
1090 else
1091 return new List<MapBlockData>();
1092 }
1093 else
1094 {
1095 // ugly slow expire spammers
1096 if(spamBlocked.Count > 0)
1097 {
1098 UUID k = UUID.Zero;
1099 bool expireone = false;
1100 foreach(UUID k2 in spamBlocked.Keys)
1101 {
1102 if(spamBlocked[k2] < now &&
1103 (!m_mapBlockRequests.ContainsKey(k2) ||
1104 m_mapBlockRequests[k2].Count == 0 ))
1105 {
1106 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks release spammer {0}", k2);
1107 k = k2;
1108 expireone = true;
1109 }
1110 break; // doing one at a time
1111 }
1112 if(expireone)
1113 spamBlocked.Remove(k);
1114 }
1115 }
1116
1117// m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag);
1118
1119 MapBlockRequestData req = new MapBlockRequestData();
1120
1121 req.client = remoteClient;
1122 req.minX = minX;
1123 req.maxX = maxX;
1124 req.minY = minY;
1125 req.maxY = maxY;
1126 req.flags = flag;
1127
1128 if (!m_mapBlockRequests.ContainsKey(agentID))
1129 m_mapBlockRequests[agentID] = new Queue<MapBlockRequestData>();
1130 if(m_mapBlockRequests[agentID].Count < 150 )
1131 m_mapBlockRequests[agentID].Enqueue(req);
1132 else
1133 {
1134 spamBlocked[agentID] = now + SPAMBLOCKTIMEms;
1135 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks blocking spammer {0} for {1} s",agentID, SPAMBLOCKTIMEms/1000.0);
1136 }
1084 m_mapBlockRequestEvent.Set(); 1137 m_mapBlockRequestEvent.Set();
1085 } 1138 }
1086 1139
diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
index 5c43b36..ec014f4 100644
--- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Framework.Interfaces
94 /// <param name="perms">These come from the FriendRights enum.</param> 94 /// <param name="perms">These come from the FriendRights enum.</param>
95 void GrantRights(IClientAPI remoteClient, UUID friendID, int perms); 95 void GrantRights(IClientAPI remoteClient, UUID friendID, int perms);
96 96
97 void IsNpwRoot(ScenePresence sp); 97 void IsNowRoot(ScenePresence sp);
98 bool SendFriendsOnlineIfNeeded(IClientAPI client); 98 bool SendFriendsOnlineIfNeeded(IClientAPI client);
99 } 99 }
100} \ No newline at end of file 100} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
index 9ae5e87..110cb00 100644
--- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
@@ -76,6 +76,7 @@ namespace OpenSim.Region.Framework.Interfaces
76 GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID); 76 GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID);
77 GroupMembershipData[] GetMembershipData(UUID UserID); 77 GroupMembershipData[] GetMembershipData(UUID UserID);
78 GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID); 78 GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID);
79 GroupMembershipData GetActiveMembershipData(UUID UserID);
79 80
80 void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); 81 void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
81 82
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
index 6bad018..292b0d6 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
@@ -70,6 +70,7 @@ namespace OpenSim.Region.Framework.Interfaces
70 /// </remarks> 70 /// </remarks>
71 /// <param name="remoteClient"></param> 71 /// <param name="remoteClient"></param>
72 /// <param name="itemID"></param> 72 /// <param name="itemID"></param>
73 /// <param name="rezGroupID"></param>
73 /// <param name="RayEnd"></param> 74 /// <param name="RayEnd"></param>
74 /// <param name="RayStart"></param> 75 /// <param name="RayStart"></param>
75 /// <param name="RayTargetID"></param> 76 /// <param name="RayTargetID"></param>
@@ -81,6 +82,11 @@ namespace OpenSim.Region.Framework.Interfaces
81 /// <param name="attachment"></param> 82 /// <param name="attachment"></param>
82 /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful.</returns> 83 /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful.</returns>
83 SceneObjectGroup RezObject( 84 SceneObjectGroup RezObject(
85 IClientAPI remoteClient, UUID itemID, UUID rezGroupID, Vector3 RayEnd, Vector3 RayStart,
86 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
87 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment);
88 // compatibily do not use
89 SceneObjectGroup RezObject(
84 IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, 90 IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart,
85 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 91 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
86 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); 92 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment);
@@ -97,6 +103,7 @@ namespace OpenSim.Region.Framework.Interfaces
97 /// The item from which the object asset came. Can be null, in which case pre and post rez item adjustment and checks are not performed. 103 /// The item from which the object asset came. Can be null, in which case pre and post rez item adjustment and checks are not performed.
98 /// </param> 104 /// </param>
99 /// <param name="assetID">The asset id for the object to rez.</param> 105 /// <param name="assetID">The asset id for the object to rez.</param>
106 /// <param name="rezObjectID">The requested group id for the object to rez.</param>
100 /// <param name="RayEnd"></param> 107 /// <param name="RayEnd"></param>
101 /// <param name="RayStart"></param> 108 /// <param name="RayStart"></param>
102 /// <param name="RayTargetID"></param> 109 /// <param name="RayTargetID"></param>
@@ -107,8 +114,16 @@ namespace OpenSim.Region.Framework.Interfaces
107 /// <param name="fromTaskID"></param> 114 /// <param name="fromTaskID"></param>
108 /// <param name="attachment"></param> 115 /// <param name="attachment"></param>
109 /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful.</returns> 116 /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful.</returns>
117
118 SceneObjectGroup RezObject(IClientAPI remoteClient, InventoryItemBase item, UUID rezGroupID,
119 UUID assetID, Vector3 RayEnd, Vector3 RayStart,
120 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
121 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment);
122
123 // compatibility do not use
110 SceneObjectGroup RezObject( 124 SceneObjectGroup RezObject(
111 IClientAPI remoteClient, InventoryItemBase item, UUID assetID, Vector3 RayEnd, Vector3 RayStart, 125 IClientAPI remoteClient, InventoryItemBase item,
126 UUID assetID, Vector3 RayEnd, Vector3 RayStart,
112 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 127 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
113 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); 128 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment);
114 129
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index f2df364..339fc15 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2454,6 +2454,7 @@ namespace OpenSim.Region.Framework.Scenes
2454 /// </summary> 2454 /// </summary>
2455 /// <param name="remoteClient"></param> 2455 /// <param name="remoteClient"></param>
2456 /// <param name="itemID"></param> 2456 /// <param name="itemID"></param>
2457 /// <param name="rezGroupID"></param>
2457 /// <param name="RayEnd"></param> 2458 /// <param name="RayEnd"></param>
2458 /// <param name="RayStart"></param> 2459 /// <param name="RayStart"></param>
2459 /// <param name="RayTargetID"></param> 2460 /// <param name="RayTargetID"></param>
@@ -2464,7 +2465,8 @@ namespace OpenSim.Region.Framework.Scenes
2464 /// <param name="RezSelected"></param> 2465 /// <param name="RezSelected"></param>
2465 /// <param name="RemoveItem"></param> 2466 /// <param name="RemoveItem"></param>
2466 /// <param name="fromTaskID"></param> 2467 /// <param name="fromTaskID"></param>
2467 public virtual void RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, 2468 public virtual void RezObject(IClientAPI remoteClient, UUID itemID, UUID rezGroupID,
2469 Vector3 RayEnd, Vector3 RayStart,
2468 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 2470 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
2469 bool RezSelected, bool RemoveItem, UUID fromTaskID) 2471 bool RezSelected, bool RemoveItem, UUID fromTaskID)
2470 { 2472 {
@@ -2477,7 +2479,7 @@ namespace OpenSim.Region.Framework.Scenes
2477 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); 2479 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
2478 if (invAccess != null) 2480 if (invAccess != null)
2479 invAccess.RezObject( 2481 invAccess.RezObject(
2480 remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, 2482 remoteClient, itemID, rezGroupID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
2481 RezSelected, RemoveItem, fromTaskID, false); 2483 RezSelected, RemoveItem, fromTaskID, false);
2482 } 2484 }
2483 else 2485 else
@@ -2504,8 +2506,7 @@ namespace OpenSim.Region.Framework.Scenes
2504 2506
2505 byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); 2507 byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
2506 Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); 2508 Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f);
2507 Vector3 pos 2509 Vector3 pos = GetNewRezLocation(
2508 = GetNewRezLocation(
2509 RayStart, RayEnd, RayTargetID, Quaternion.Identity, 2510 RayStart, RayEnd, RayTargetID, Quaternion.Identity,
2510 BypassRayCast, bRayEndIsIntersection, true, scale, false); 2511 BypassRayCast, bRayEndIsIntersection, true, scale, false);
2511 2512
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 00e699e..33418e6 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3115,14 +3115,9 @@ namespace OpenSim.Region.Framework.Scenes
3115 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 3115 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
3116 3116
3117 CheckHeartbeat(); 3117 CheckHeartbeat();
3118
3119 3118
3120 sp = GetScenePresence(client.AgentId); 3119 sp = GetScenePresence(client.AgentId);
3121 3120
3122 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this
3123 // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause
3124 // other problems, and possibly the code calling AddNewAgent() should ensure that no client is already
3125 // connected.
3126 if (sp == null) 3121 if (sp == null)
3127 { 3122 {
3128 m_log.DebugFormat( 3123 m_log.DebugFormat(
@@ -3137,15 +3132,6 @@ namespace OpenSim.Region.Framework.Scenes
3137 3132
3138 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; 3133 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
3139 3134
3140/* done in completMovement
3141 InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46);
3142 if (cof == null)
3143 sp.COF = UUID.Zero;
3144 else
3145 sp.COF = cof.ID;
3146
3147 m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF);
3148 */
3149 m_eventManager.TriggerOnNewPresence(sp); 3135 m_eventManager.TriggerOnNewPresence(sp);
3150 } 3136 }
3151 else 3137 else
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0b8076a..0847b0b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2712,8 +2712,7 @@ namespace OpenSim.Region.Framework.Scenes
2712 detobj.velVector = obj.Velocity; 2712 detobj.velVector = obj.Velocity;
2713 detobj.colliderType = 0; 2713 detobj.colliderType = 0;
2714 detobj.groupUUID = obj.GroupID; 2714 detobj.groupUUID = obj.GroupID;
2715 detobj.linkNumber = LinkNum; // pass my link number 2715 detobj.linkNumber = LinkNum;
2716
2717 return detobj; 2716 return detobj;
2718 } 2717 }
2719 2718
@@ -2726,9 +2725,13 @@ namespace OpenSim.Region.Framework.Scenes
2726 detobj.posVector = av.AbsolutePosition; 2725 detobj.posVector = av.AbsolutePosition;
2727 detobj.rotQuat = av.Rotation; 2726 detobj.rotQuat = av.Rotation;
2728 detobj.velVector = av.Velocity; 2727 detobj.velVector = av.Velocity;
2729 detobj.colliderType = 0; 2728 detobj.colliderType = av.isNPC ? 0x20 : 0x1; // OpenSim\Region\ScriptEngine\Shared\Helpers.cs
2729 if(av.IsSatOnObject)
2730 detobj.colliderType |= 0x4; //passive
2731 else if(detobj.velVector != Vector3.Zero)
2732 detobj.colliderType |= 0x2; //active
2730 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 2733 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2731 detobj.linkNumber = LinkNum; // pass my link number 2734 detobj.linkNumber = LinkNum;
2732 2735
2733 return detobj; 2736 return detobj;
2734 } 2737 }
@@ -2842,7 +2845,8 @@ namespace OpenSim.Region.Framework.Scenes
2842 if (ParentGroup.Scene == null || ParentGroup.IsDeleted) 2845 if (ParentGroup.Scene == null || ParentGroup.IsDeleted)
2843 return; 2846 return;
2844 2847
2845 // single threaded here 2848 // this a thread from physics ( heartbeat )
2849
2846 CollisionEventUpdate a = (CollisionEventUpdate)e; 2850 CollisionEventUpdate a = (CollisionEventUpdate)e;
2847 Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList; 2851 Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList;
2848 List<uint> thisHitColliders = new List<uint>(); 2852 List<uint> thisHitColliders = new List<uint>();
@@ -2860,7 +2864,6 @@ namespace OpenSim.Region.Framework.Scenes
2860 } 2864 }
2861 m_lastColliders.Clear(); 2865 m_lastColliders.Clear();
2862 } 2866 }
2863
2864 else 2867 else
2865 { 2868 {
2866 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>(); 2869 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
@@ -5256,7 +5259,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5256 { 5259 {
5257 // subscribe to physics updates. 5260 // subscribe to physics updates.
5258 pa.OnCollisionUpdate += PhysicsCollision; 5261 pa.OnCollisionUpdate += PhysicsCollision;
5259 pa.SubscribeEvents(50); // 20 reports per second 5262 pa.SubscribeEvents(100); // 10 reports per second
5260 } 5263 }
5261 else 5264 else
5262 { 5265 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e985903..732d5ef 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -224,7 +224,7 @@ namespace OpenSim.Region.Framework.Scenes
224 return true; 224 return true;
225 if (!land.LandData.GroupAVSounds) 225 if (!land.LandData.GroupAVSounds)
226 return false; 226 return false;
227 return land.LandData.GroupID == ControllingClient.ActiveGroupId; 227 return ControllingClient.IsGroupMember(land.LandData.GroupID);
228 } 228 }
229 } 229 }
230 catch 230 catch
@@ -1094,6 +1094,8 @@ namespace OpenSim.Region.Framework.Scenes
1094 m_LandingPointBehavior = LandingPointBehavior.SL; 1094 m_LandingPointBehavior = LandingPointBehavior.SL;
1095 } 1095 }
1096 1096
1097 ControllingClient.RefreshGroupMembership();
1098
1097 } 1099 }
1098 1100
1099 private float lastHealthSent = 0; 1101 private float lastHealthSent = 0;
@@ -1978,7 +1980,6 @@ namespace OpenSim.Region.Framework.Scenes
1978 1980
1979 if(!haveGroupInformation && !IsChildAgent && !isNPC) 1981 if(!haveGroupInformation && !IsChildAgent && !isNPC)
1980 { 1982 {
1981 // oh crap.. lets retry it directly
1982 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 1983 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
1983 if (gm != null) 1984 if (gm != null)
1984 Grouptitle = gm.GetGroupTitle(m_uuid); 1985 Grouptitle = gm.GetGroupTitle(m_uuid);
@@ -2195,13 +2196,14 @@ namespace OpenSim.Region.Framework.Scenes
2195 if (friendsModule != null) 2196 if (friendsModule != null)
2196 { 2197 {
2197 if(gotCrossUpdate) 2198 if(gotCrossUpdate)
2198 friendsModule.IsNpwRoot(this); 2199 friendsModule.IsNowRoot(this);
2199 else 2200 else
2200 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 2201 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
2201 } 2202 }
2202 m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2203 m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2203 2204
2204 } 2205 }
2206
2205 } 2207 }
2206 finally 2208 finally
2207 { 2209 {
@@ -2214,7 +2216,7 @@ namespace OpenSim.Region.Framework.Scenes
2214 // m_currentParcelHide = newhide; 2216 // m_currentParcelHide = newhide;
2215 // } 2217 // }
2216 2218
2217 haveGroupInformation = true; 2219 haveGroupInformation = false;
2218 gotCrossUpdate = false; 2220 gotCrossUpdate = false;
2219 crossingFlags = 0; 2221 crossingFlags = 0;
2220 2222
@@ -4547,24 +4549,12 @@ namespace OpenSim.Region.Framework.Scenes
4547 else 4549 else
4548 cAgent.CrossingFlags = 0; 4550 cAgent.CrossingFlags = 0;
4549 4551
4550 if(isCrossUpdate && haveGroupInformation) 4552 if(isCrossUpdate)
4551 { 4553 {
4552 cAgent.agentCOF = COF; 4554 cAgent.agentCOF = COF;
4553 cAgent.ActiveGroupID = ControllingClient.ActiveGroupId; 4555 cAgent.ActiveGroupID = ControllingClient.ActiveGroupId;
4554 cAgent.ActiveGroupName = ControllingClient.ActiveGroupName; 4556 cAgent.ActiveGroupName = ControllingClient.ActiveGroupName;
4555 cAgent.ActiveGroupTitle = Grouptitle; 4557 cAgent.ActiveGroupTitle = Grouptitle;
4556 Dictionary<UUID, ulong> gpowers = ControllingClient.GetGroupPowers();
4557 if(gpowers.Count >0)
4558 {
4559 cAgent.Groups = new AgentGroupData[gpowers.Count];
4560 int i = 0;
4561 foreach (UUID gid in gpowers.Keys)
4562 {
4563 // WARNING we dont' have AcceptNotices in cache.. sending as true mb no one notices ;)
4564 AgentGroupData agd = new AgentGroupData(gid,gpowers[gid],true);
4565 cAgent.Groups[i++] = agd;
4566 }
4567 }
4568 } 4558 }
4569 } 4559 }
4570 4560
@@ -4661,46 +4651,32 @@ namespace OpenSim.Region.Framework.Scenes
4661 if (Scene.AttachmentsModule != null) 4651 if (Scene.AttachmentsModule != null)
4662 Scene.AttachmentsModule.CopyAttachments(cAgent, this); 4652 Scene.AttachmentsModule.CopyAttachments(cAgent, this);
4663 4653
4664 haveGroupInformation = false; 4654 crossingFlags = cAgent.CrossingFlags;
4655 gotCrossUpdate = (crossingFlags != 0);
4665 4656
4657 haveGroupInformation = false;
4666 // using this as protocol detection don't want to mess with the numbers for now 4658 // using this as protocol detection don't want to mess with the numbers for now
4667 if(cAgent.ActiveGroupTitle != null) 4659 if(cAgent.ActiveGroupTitle != null)
4668 { 4660 {
4661 haveGroupInformation = true;
4669 COF = cAgent.agentCOF; 4662 COF = cAgent.agentCOF;
4670 ControllingClient.ActiveGroupId = cAgent.ActiveGroupID; 4663 if(ControllingClient.IsGroupMember(cAgent.ActiveGroupID))
4671 ControllingClient.ActiveGroupName = cAgent.ActiveGroupName;
4672 ControllingClient.ActiveGroupPowers = 0;
4673 Grouptitle = cAgent.ActiveGroupTitle;
4674
4675 if(cAgent.Groups != null && cAgent.Groups.Length > 0)
4676 { 4664 {
4677 int ngroups = cAgent.Groups.Length; 4665 ControllingClient.ActiveGroupId = cAgent.ActiveGroupID;
4678 Dictionary<UUID, ulong> gpowers = new Dictionary<UUID, ulong>(ngroups); 4666 ControllingClient.ActiveGroupName = cAgent.ActiveGroupName;
4679 for(int i = 0 ; i < ngroups; i++) 4667 Grouptitle = cAgent.ActiveGroupTitle;
4680 { 4668 ControllingClient.ActiveGroupPowers =
4681 AgentGroupData agd = cAgent.Groups[i]; 4669 ControllingClient.GetGroupPowers(cAgent.ActiveGroupID);
4682 gpowers[agd.GroupID] = agd.GroupPowers;
4683 }
4684
4685 ControllingClient.SetGroupPowers(gpowers);
4686
4687 if(cAgent.ActiveGroupID == UUID.Zero)
4688 haveGroupInformation = true;
4689 else if(gpowers.ContainsKey(cAgent.ActiveGroupID))
4690 {
4691 ControllingClient.ActiveGroupPowers = gpowers[cAgent.ActiveGroupID];
4692 haveGroupInformation = true;
4693 }
4694 } 4670 }
4695 else if(cAgent.ActiveGroupID == UUID.Zero) 4671 else
4696 { 4672 {
4697 haveGroupInformation = true; 4673 // we got a unknown active group so get what groups thinks about us
4674 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
4675 if (gm != null)
4676 gm.SendAgentGroupDataUpdate(ControllingClient);
4698 } 4677 }
4699 } 4678 }
4700 4679
4701 crossingFlags = cAgent.CrossingFlags;
4702 gotCrossUpdate = (crossingFlags != 0);
4703
4704 lock (m_originRegionIDAccessLock) 4680 lock (m_originRegionIDAccessLock)
4705 m_originRegionID = cAgent.RegionID; 4681 m_originRegionID = cAgent.RegionID;
4706 } 4682 }
@@ -6061,7 +6037,11 @@ namespace OpenSim.Region.Framework.Scenes
6061 detobj.posVector = av.AbsolutePosition; 6037 detobj.posVector = av.AbsolutePosition;
6062 detobj.rotQuat = av.Rotation; 6038 detobj.rotQuat = av.Rotation;
6063 detobj.velVector = av.Velocity; 6039 detobj.velVector = av.Velocity;
6064 detobj.colliderType = 0; 6040 detobj.colliderType = av.isNPC ? 0x20 : 0x1; // OpenSim\Region\ScriptEngine\Shared\Helpers.cs
6041 if(av.IsSatOnObject)
6042 detobj.colliderType |= 0x4; //passive
6043 else if(detobj.velVector != Vector3.Zero)
6044 detobj.colliderType |= 0x2; //active
6065 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 6045 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
6066 detobj.linkNumber = 0; 6046 detobj.linkNumber = 0;
6067 6047
@@ -6153,9 +6133,6 @@ namespace OpenSim.Region.Framework.Scenes
6153 List<uint> thisHitColliders = new List<uint>(); 6133 List<uint> thisHitColliders = new List<uint>();
6154 List<uint> endedColliders = new List<uint>(); 6134 List<uint> endedColliders = new List<uint>();
6155 List<uint> startedColliders = new List<uint>(); 6135 List<uint> startedColliders = new List<uint>();
6156 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
6157 CollisionForSoundInfo soundinfo;
6158 ContactPoint curcontact;
6159 6136
6160 if (coldata.Count == 0) 6137 if (coldata.Count == 0)
6161 { 6138 {
@@ -6168,30 +6145,41 @@ namespace OpenSim.Region.Framework.Scenes
6168 } 6145 }
6169 m_lastColliders.Clear(); 6146 m_lastColliders.Clear();
6170 } 6147 }
6171
6172 else 6148 else
6173 { 6149 {
6174 bool candoparcelSound = ParcelAllowThisAvatarSounds; 6150 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
6175 6151 if(ParcelAllowThisAvatarSounds)
6176 foreach (uint id in coldata.Keys)
6177 { 6152 {
6178 thisHitColliders.Add(id); 6153 CollisionForSoundInfo soundinfo;
6179 if (!m_lastColliders.Contains(id)) 6154 ContactPoint curcontact;
6155
6156 foreach (uint id in coldata.Keys)
6180 { 6157 {
6181 startedColliders.Add(id); 6158 thisHitColliders.Add(id);
6182 curcontact = coldata[id]; 6159 if (!m_lastColliders.Contains(id))
6183 if (candoparcelSound && Math.Abs(curcontact.RelativeSpeed) > 0.2)
6184 { 6160 {
6185 soundinfo = new CollisionForSoundInfo(); 6161 startedColliders.Add(id);
6186 soundinfo.colliderID = id; 6162 curcontact = coldata[id];
6187 soundinfo.position = curcontact.Position; 6163 if (Math.Abs(curcontact.RelativeSpeed) > 0.2)
6188 soundinfo.relativeVel = curcontact.RelativeSpeed; 6164 {
6189 soundinfolist.Add(soundinfo); 6165 soundinfo = new CollisionForSoundInfo();
6166 soundinfo.colliderID = id;
6167 soundinfo.position = curcontact.Position;
6168 soundinfo.relativeVel = curcontact.RelativeSpeed;
6169 soundinfolist.Add(soundinfo);
6170 }
6190 } 6171 }
6191 } 6172 }
6192 //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
6193 } 6173 }
6194 6174 else
6175 {
6176 foreach (uint id in coldata.Keys)
6177 {
6178 thisHitColliders.Add(id);
6179 if (!m_lastColliders.Contains(id))
6180 startedColliders.Add(id);
6181 }
6182 }
6195 // calculate things that ended colliding 6183 // calculate things that ended colliding
6196 foreach (uint localID in m_lastColliders) 6184 foreach (uint localID in m_lastColliders)
6197 { 6185 {
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
index 75b073d..142ad84 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
@@ -171,7 +171,7 @@ namespace OpenSim.Region.Framework.Tests
171 //Assert.That((retrievedItem1.CurrentPermissions & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); 171 //Assert.That((retrievedItem1.CurrentPermissions & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All);
172 172
173 // Rez the object 173 // Rez the object
174 scene.RezObject(sp2.ControllingClient, retrievedItem1.ID, Vector3.Zero, Vector3.Zero, UUID.Zero, 0, false, false, false, UUID.Zero); 174 scene.RezObject(sp2.ControllingClient, retrievedItem1.ID, UUID.Zero, Vector3.Zero, Vector3.Zero, UUID.Zero, 0, false, false, false, UUID.Zero);
175 SceneObjectGroup sog = scene.GetSceneObjectGroup("SomeObject"); 175 SceneObjectGroup sog = scene.GetSceneObjectGroup("SomeObject");
176 Assert.That(sog, Is.Not.Null); 176 Assert.That(sog, Is.Not.Null);
177 177
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 5205eae..112a41f 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -837,6 +837,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
837 return m_groupData.GetAgentGroupMembership(UUID.Zero, agentID, groupID); 837 return m_groupData.GetAgentGroupMembership(UUID.Zero, agentID, groupID);
838 } 838 }
839 839
840 public GroupMembershipData GetActiveMembershipData(UUID agentID)
841 {
842 return m_groupData.GetAgentActiveMembership(agentID, agentID);
843 }
844
840 public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) 845 public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
841 { 846 {
842 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 847 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
diff --git a/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs
index 0bb4044..caca303 100644
--- a/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs
@@ -83,7 +83,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
83 { this.Stale = true; }; 83 { this.Stale = true; };
84 client.OnObjectPermissions += delegate(IClientAPI controller, UUID agentID, UUID sessionID, 84 client.OnObjectPermissions += delegate(IClientAPI controller, UUID agentID, UUID sessionID,
85 byte field, uint localId, uint mask, byte set) { this.Stale = true; }; 85 byte field, uint localId, uint mask, byte set) { this.Stale = true; };
86 client.OnRezObject += delegate(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, 86 client.OnRezObject += delegate(IClientAPI remoteClient, UUID itemID, UUID groupID,
87 Vector3 RayEnd,
87 Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 88 Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
88 bool RezSelected, 89 bool RezSelected,
89 bool RemoveItem, UUID fromTaskID) { this.Stale = true; }; 90 bool RemoveItem, UUID fromTaskID) { this.Stale = true; };
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
index 49020e9..cef7063 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
@@ -1578,6 +1578,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1578 } 1578 }
1579 } 1579 }
1580 m_eventsubscription = 0; 1580 m_eventsubscription = 0;
1581 _parent_scene.RemoveCollisionEventReporting(this);
1581 } 1582 }
1582 1583
1583 public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) 1584 public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
@@ -1591,8 +1592,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1591 } 1592 }
1592 } 1593 }
1593 1594
1594 public void SendCollisions() 1595 public void SendCollisions(int timestep)
1595 { 1596 {
1597 if (m_cureventsubscription < 50000)
1598 m_cureventsubscription += timestep;
1599
1596 if (CollisionEventsThisFrame == null) 1600 if (CollisionEventsThisFrame == null)
1597 return; 1601 return;
1598 1602
@@ -1623,13 +1627,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1623 } 1627 }
1624 } 1628 }
1625 1629
1626 internal void AddCollisionFrameTime(int t)
1627 {
1628 // protect it from overflow crashing
1629 if (m_cureventsubscription < 50000)
1630 m_cureventsubscription += t;
1631 }
1632
1633 public override bool SubscribedEvents() 1630 public override bool SubscribedEvents()
1634 { 1631 {
1635 if (m_eventsubscription > 0) 1632 if (m_eventsubscription > 0)
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs
index c3b4dd8..d8a2272 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs
@@ -935,8 +935,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
935 float roll; 935 float roll;
936 float pitch; 936 float pitch;
937 937
938
939
940 float ftmp = m_invtimestep / m_verticalAttractionTimescale / m_verticalAttractionTimescale; 938 float ftmp = m_invtimestep / m_verticalAttractionTimescale / m_verticalAttractionTimescale;
941 939
942 float ftmp2; 940 float ftmp2;
@@ -957,7 +955,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
957 effroll = 1 - effroll; 955 effroll = 1 - effroll;
958 effroll *= roll; 956 effroll *= roll;
959 957
960
961 torque.X += effroll * ftmp; 958 torque.X += effroll * ftmp;
962 959
963 if ((m_flags & VehicleFlag.LIMIT_ROLL_ONLY) == 0) 960 if ((m_flags & VehicleFlag.LIMIT_ROLL_ONLY) == 0)
@@ -1074,10 +1071,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1074 torque.Z -= curLocalAngVel.Z * m_amdampZ; 1071 torque.Z -= curLocalAngVel.Z * m_amdampZ;
1075 } 1072 }
1076 1073
1074 force *= dmass.mass;
1075
1076 force += rootPrim.m_force;
1077 force += rootPrim.m_forceacc;
1078 rootPrim.m_forceacc = Vector3.Zero;
1077 1079
1078 if (force.X != 0 || force.Y != 0 || force.Z != 0) 1080 if (force.X != 0 || force.Y != 0 || force.Z != 0)
1079 { 1081 {
1080 force *= dmass.mass;
1081 d.BodyAddForce(Body, force.X, force.Y, force.Z); 1082 d.BodyAddForce(Body, force.X, force.Y, force.Z);
1082 } 1083 }
1083 1084
@@ -1091,6 +1092,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1091 d.MultiplyM3V3(out dvtmp, ref dmass.I, ref dtorque); 1092 d.MultiplyM3V3(out dvtmp, ref dmass.I, ref dtorque);
1092 d.BodyAddRelTorque(Body, dvtmp.X, dvtmp.Y, dvtmp.Z); // add torque in object frame 1093 d.BodyAddRelTorque(Body, dvtmp.X, dvtmp.Y, dvtmp.Z); // add torque in object frame
1093 } 1094 }
1095
1096 torque = rootPrim.m_torque;
1097 torque += rootPrim.m_angularForceacc;
1098 rootPrim.m_angularForceacc = Vector3.Zero;
1099 if (torque.X != 0 || torque.Y != 0 || torque.Z != 0)
1100 d.BodyAddTorque(Body,torque.X, torque.Y, torque.Z);
1094 } 1101 }
1095 } 1102 }
1096} 1103}
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index aaa2203..9f62644 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
65 internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively 65 internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively
66 private bool m_fakeisVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively 66 private bool m_fakeisVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively
67 67
68 protected bool m_building; 68 internal bool m_building;
69 protected bool m_forcePosOrRotation; 69 protected bool m_forcePosOrRotation;
70 private bool m_iscolliding; 70 private bool m_iscolliding;
71 71
@@ -81,7 +81,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
81 81
82 private Vector3 _position; 82 private Vector3 _position;
83 private Vector3 _velocity; 83 private Vector3 _velocity;
84 private Vector3 m_torque;
85 private Vector3 m_lastVelocity; 84 private Vector3 m_lastVelocity;
86 private Vector3 m_lastposition; 85 private Vector3 m_lastposition;
87 private Vector3 m_rotationalVelocity; 86 private Vector3 m_rotationalVelocity;
@@ -89,9 +88,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
89 private Vector3 _acceleration; 88 private Vector3 _acceleration;
90 private IntPtr Amotor; 89 private IntPtr Amotor;
91 90
92 private Vector3 m_force; 91 internal Vector3 m_force;
93 private Vector3 m_forceacc; 92 internal Vector3 m_forceacc;
94 private Vector3 m_angularForceacc; 93 internal Vector3 m_torque;
94 internal Vector3 m_angularForceacc;
95 95
96 private float m_invTimeStep; 96 private float m_invTimeStep;
97 private float m_timeStep; 97 private float m_timeStep;
@@ -1000,14 +1000,36 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1000 1000
1001 public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) 1001 public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
1002 { 1002 {
1003
1003 if (CollisionEventsThisFrame == null) 1004 if (CollisionEventsThisFrame == null)
1004 CollisionEventsThisFrame = new CollisionEventUpdate(); 1005 CollisionEventsThisFrame = new CollisionEventUpdate();
1005// if(CollisionEventsThisFrame.Count < 32) 1006 CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
1006 CollisionEventsThisFrame.AddCollider(CollidedWith, contact); 1007 _parent_scene.AddCollisionEventReporting(this);
1008 }
1009
1010 internal void SleeperAddCollisionEvents()
1011 {
1012 if (CollisionEventsThisFrame == null)
1013 return;
1014 if(CollisionEventsThisFrame.m_objCollisionList.Count == 0)
1015 return;
1016 foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionEventsThisFrame.m_objCollisionList)
1017 {
1018 OdePrim other = _parent_scene.getPrim(kvp.Key);
1019 if(other == null)
1020 continue;
1021 ContactPoint cp = kvp.Value;
1022 cp.SurfaceNormal = - cp.SurfaceNormal;
1023 cp.RelativeSpeed = -cp.RelativeSpeed;
1024 other.AddCollisionEvent(ParentActor.LocalID,cp);
1025 }
1007 } 1026 }
1008 1027
1009 public void SendCollisions() 1028 public void SendCollisions(int timestep)
1010 { 1029 {
1030 if (m_cureventsubscription < 50000)
1031 m_cureventsubscription += timestep;
1032
1011 if (CollisionEventsThisFrame == null) 1033 if (CollisionEventsThisFrame == null)
1012 return; 1034 return;
1013 1035
@@ -1027,7 +1049,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1027 SentEmptyCollisionsEvent = true; 1049 SentEmptyCollisionsEvent = true;
1028 _parent_scene.RemoveCollisionEventReporting(this); 1050 _parent_scene.RemoveCollisionEventReporting(this);
1029 } 1051 }
1030 else 1052 else if(Body == IntPtr.Zero || d.BodyIsEnabled(Body))
1031 { 1053 {
1032 SentEmptyCollisionsEvent = false; 1054 SentEmptyCollisionsEvent = false;
1033 CollisionEventsThisFrame.Clear(); 1055 CollisionEventsThisFrame.Clear();
@@ -1035,12 +1057,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1035 } 1057 }
1036 } 1058 }
1037 1059
1038 internal void AddCollisionFrameTime(int t)
1039 {
1040 if (m_cureventsubscription < 50000)
1041 m_cureventsubscription += t;
1042 }
1043
1044 public override bool SubscribedEvents() 1060 public override bool SubscribedEvents()
1045 { 1061 {
1046 if (m_eventsubscription > 0) 1062 if (m_eventsubscription > 0)
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index 8d87c30..6c5b405 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -228,8 +228,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
228 228
229 private d.NearCallback nearCallback; 229 private d.NearCallback nearCallback;
230 230
231 private Dictionary<uint,OdePrim> _prims = new Dictionary<uint,OdePrim>();
231 private HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>(); 232 private HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
232 private HashSet<OdePrim> _prims = new HashSet<OdePrim>();
233 private HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); 233 private HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
234 private HashSet<OdePrim> _activegroups = new HashSet<OdePrim>(); 234 private HashSet<OdePrim> _activegroups = new HashSet<OdePrim>();
235 235
@@ -1329,7 +1329,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1329 1329
1330 newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID); 1330 newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID);
1331 lock (_prims) 1331 lock (_prims)
1332 _prims.Add(newPrim); 1332 _prims[newPrim.LocalID] = newPrim;
1333 } 1333 }
1334 return newPrim; 1334 return newPrim;
1335 } 1335 }
@@ -1391,15 +1391,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1391 { 1391 {
1392// RemoveCollisionEventReporting(prim); 1392// RemoveCollisionEventReporting(prim);
1393 lock (_prims) 1393 lock (_prims)
1394 _prims.Remove(prim); 1394 _prims.Remove(prim.LocalID);
1395 } 1395 }
1396 1396
1397 } 1397 }
1398 1398
1399 public OdePrim getPrim(uint id)
1400 {
1401 lock (_prims)
1402 {
1403 if(_prims.ContainsKey(id))
1404 return _prims[id];
1405 else
1406 return null;
1407 }
1408 }
1409
1399 public bool havePrim(OdePrim prm) 1410 public bool havePrim(OdePrim prm)
1400 { 1411 {
1401 lock (_prims) 1412 lock (_prims)
1402 return _prims.Contains(prm); 1413 return _prims.ContainsKey(prm.LocalID);
1403 } 1414 }
1404 1415
1405 public bool haveActor(PhysicsActor actor) 1416 public bool haveActor(PhysicsActor actor)
@@ -1407,7 +1418,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1407 if (actor is OdePrim) 1418 if (actor is OdePrim)
1408 { 1419 {
1409 lock (_prims) 1420 lock (_prims)
1410 return _prims.Contains((OdePrim)actor); 1421 return _prims.ContainsKey(((OdePrim)actor).LocalID);
1411 } 1422 }
1412 else if (actor is OdeCharacter) 1423 else if (actor is OdeCharacter)
1413 { 1424 {
@@ -1708,6 +1719,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1708 m_rayCastManager.ProcessQueuedRequests(); 1719 m_rayCastManager.ProcessQueuedRequests();
1709 1720
1710 collision_optimized(); 1721 collision_optimized();
1722 List<OdePrim> sleepers = new List<OdePrim>();
1711 1723
1712 foreach (PhysicsActor obj in _collisionEventPrim) 1724 foreach (PhysicsActor obj in _collisionEventPrim)
1713 { 1725 {
@@ -1718,21 +1730,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1718 { 1730 {
1719 case ActorTypes.Agent: 1731 case ActorTypes.Agent:
1720 OdeCharacter cobj = (OdeCharacter)obj; 1732 OdeCharacter cobj = (OdeCharacter)obj;
1721 cobj.AddCollisionFrameTime((int)(odetimestepMS)); 1733 cobj.SendCollisions((int)(odetimestepMS));
1722 cobj.SendCollisions();
1723 break; 1734 break;
1724 1735
1725 case ActorTypes.Prim: 1736 case ActorTypes.Prim:
1726 OdePrim pobj = (OdePrim)obj; 1737 OdePrim pobj = (OdePrim)obj;
1727 if (!pobj.m_outbounds && (pobj.Body == IntPtr.Zero || d.BodyIsEnabled(pobj.Body))) 1738 if (!pobj.m_outbounds)
1728 { 1739 {
1729 pobj.AddCollisionFrameTime((int)(odetimestepMS)); 1740 pobj.SendCollisions((int)(odetimestepMS));
1730 pobj.SendCollisions(); 1741 if(pobj.Body != IntPtr.Zero && !pobj.m_isSelected &&
1742 !pobj.m_disabled && !pobj.m_building &&
1743 !d.BodyIsEnabled(pobj.Body))
1744 sleepers.Add(pobj);
1731 } 1745 }
1732 break; 1746 break;
1733 } 1747 }
1734 } 1748 }
1735 1749
1750 foreach(OdePrim prm in sleepers)
1751 prm.SleeperAddCollisionEvents();
1752 sleepers.Clear();
1753
1736 foreach (PhysicsActor obj in _collisionEventPrimRemove) 1754 foreach (PhysicsActor obj in _collisionEventPrimRemove)
1737 _collisionEventPrim.Remove(obj); 1755 _collisionEventPrim.Remove(obj);
1738 1756
@@ -2481,7 +2499,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2481 lock (_prims) 2499 lock (_prims)
2482 { 2500 {
2483 ChangesQueue.Clear(); 2501 ChangesQueue.Clear();
2484 foreach (OdePrim prm in _prims) 2502 foreach (OdePrim prm in _prims.Values)
2485 { 2503 {
2486 prm.DoAChange(changes.Remove, null); 2504 prm.DoAChange(changes.Remove, null);
2487 _collisionEventPrim.Remove(prm); 2505 _collisionEventPrim.Remove(prm);
@@ -2544,7 +2562,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2544 int cnt = 0; 2562 int cnt = 0;
2545 lock (_prims) 2563 lock (_prims)
2546 { 2564 {
2547 foreach (OdePrim prm in _prims) 2565 foreach (OdePrim prm in _prims.Values)
2548 { 2566 {
2549 if (prm.CollisionScore > 0) 2567 if (prm.CollisionScore > 0)
2550 { 2568 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index 81e30c9..3509968 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -94,14 +94,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
94 public string cmDetectedCountry(int number) 94 public string cmDetectedCountry(int number)
95 { 95 {
96 m_host.AddScriptLPS(1); 96 m_host.AddScriptLPS(1);
97 if(!m_CMFunctionsEnabled)
98 return String.Empty;
99 if(World.UserAccountService == null)
100 return String.Empty;
97 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); 101 DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
98 if (detectedParams == null) 102 if (detectedParams == null)
99 return String.Empty; 103 return String.Empty;
100 return detectedParams.Country; 104 UUID key = detectedParams.Key;
105 if(key == UUID.Zero)
106 return String.Empty;
107 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, key);
108 return account.UserCountry;
101 } 109 }
102 110
103 public string cmGetAgentCountry(LSL_Key key) 111 public string cmGetAgentCountry(LSL_Key key)
104 { 112 {
113 if(! m_CMFunctionsEnabled)
114 return "";
115 if(World.UserAccountService == null)
116 return String.Empty;
105 if (!World.Permissions.IsGod(m_host.OwnerID)) 117 if (!World.Permissions.IsGod(m_host.OwnerID))
106 return String.Empty; 118 return String.Empty;
107 119
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index cf61943..ce0e59c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6861,9 +6861,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6861 if (uuid == m_host.ParentGroup.RootPart.GroupID) 6861 if (uuid == m_host.ParentGroup.RootPart.GroupID)
6862 return new LSL_Integer(1); 6862 return new LSL_Integer(1);
6863 6863
6864 // We got passed a UUID.Zero 6864 // Handle object case
6865 if (uuid == UUID.Zero) 6865 SceneObjectPart part = World.GetSceneObjectPart(uuid);
6866 return new LSL_Integer(0); 6866 if (part != null)
6867 {
6868
6869 if(part.ParentGroup.IsAttachment)
6870 {
6871 uuid = part.ParentGroup.AttachedAvatar;
6872 }
6873 else
6874 {
6875 // This will handle both deed and non-deed and also the no
6876 // group case
6877 if (part.ParentGroup.RootPart.GroupID == m_host.ParentGroup.RootPart.GroupID)
6878 return new LSL_Integer(1);
6879
6880 return new LSL_Integer(0);
6881 }
6882 }
6867 6883
6868 // Handle the case where id names an avatar 6884 // Handle the case where id names an avatar
6869 ScenePresence presence = World.GetScenePresence(uuid); 6885 ScenePresence presence = World.GetScenePresence(uuid);
@@ -6879,18 +6895,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6879 return new LSL_Integer(0); 6895 return new LSL_Integer(0);
6880 } 6896 }
6881 6897
6882 // Handle object case
6883 SceneObjectPart part = World.GetSceneObjectPart(uuid);
6884 if (part != null)
6885 {
6886 // This will handle both deed and non-deed and also the no
6887 // group case
6888 if (part.ParentGroup.RootPart.GroupID == m_host.ParentGroup.RootPart.GroupID)
6889 return new LSL_Integer(1);
6890
6891 return new LSL_Integer(0);
6892 }
6893
6894 return new LSL_Integer(0); 6898 return new LSL_Integer(0);
6895 } 6899 }
6896 6900
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index e44a106..110fce6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -121,7 +121,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
121 Type = 0; 121 Type = 0;
122 Velocity = new LSL_Types.Vector3(); 122 Velocity = new LSL_Types.Vector3();
123 initializeSurfaceTouch(); 123 initializeSurfaceTouch();
124 Country = String.Empty;
125 } 124 }
126 125
127 public UUID Key; 126 public UUID Key;
@@ -153,8 +152,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
153 private int touchFace; 152 private int touchFace;
154 public int TouchFace { get { return touchFace; } } 153 public int TouchFace { get { return touchFace; } }
155 154
156 public string Country;
157
158 // This can be done in two places including the constructor 155 // This can be done in two places including the constructor
159 // so be carefull what gets added here 156 // so be carefull what gets added here
160 private void initializeSurfaceTouch() 157 private void initializeSurfaceTouch()
@@ -202,9 +199,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
202 return; 199 return;
203 200
204 Name = presence.Firstname + " " + presence.Lastname; 201 Name = presence.Firstname + " " + presence.Lastname;
205 UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, Key);
206 if (account != null)
207 Country = account.UserCountry;
208 202
209 Owner = Key; 203 Owner = Key;
210 Position = new LSL_Types.Vector3(presence.AbsolutePosition); 204 Position = new LSL_Types.Vector3(presence.AbsolutePosition);
@@ -219,24 +213,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
219 if (presence.PresenceType == PresenceType.Npc) 213 if (presence.PresenceType == PresenceType.Npc)
220 Type = 0x20; 214 Type = 0x20;
221 215
222 // Cope Impl. We don't use OS_NPC.
223 //if (presence.PresenceType != PresenceType.Npc)
224 //{
225 // Type = AGENT;
226 //}
227 //else
228 //{
229 // Type = OS_NPC;
230
231 // INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
232 // INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
233
234 // if (npcData.SenseAsAgent)
235 // {
236 // Type |= AGENT;
237 // }
238 //}
239
240 if (presence.Velocity != Vector3.Zero) 216 if (presence.Velocity != Vector3.Zero)
241 Type |= ACTIVE; 217 Type |= ACTIVE;
242 218
@@ -273,6 +249,66 @@ namespace OpenSim.Region.ScriptEngine.Shared
273 249
274 Velocity = new LSL_Types.Vector3(part.Velocity); 250 Velocity = new LSL_Types.Vector3(part.Velocity);
275 } 251 }
252
253 public void Populate(Scene scene, DetectedObject obj)
254 {
255 if(obj.keyUUID == UUID.Zero) // land
256 {
257 Position = new LSL_Types.Vector3(obj.posVector);
258 Rotation.s = 1.0;
259 return;
260 }
261
262 if((obj.colliderType & 0x21) != 0) // avatar or npc
263 {
264 ScenePresence presence = scene.GetScenePresence(obj.keyUUID);
265 if (presence == null)
266 return;
267
268 Name = obj.nameStr;
269 Key = obj.keyUUID;
270 Owner = obj.ownerUUID;
271 Group = obj.groupUUID;
272 Position = new LSL_Types.Vector3(obj.posVector);
273 Rotation = new LSL_Types.Quaternion(obj.rotQuat);
274 Velocity = new LSL_Types.Vector3(obj.velVector);
275 LinkNum = obj.linkNumber;
276 Type = obj.colliderType;
277 return;
278 }
279
280 SceneObjectPart part = scene.GetSceneObjectPart(obj.keyUUID);
281 if(part == null)
282 return;
283
284 Name = obj.nameStr;
285 Key = obj.keyUUID;
286 Owner = obj.ownerUUID;
287 Group = obj.groupUUID;
288 Position = new LSL_Types.Vector3(obj.posVector);
289 Rotation = new LSL_Types.Quaternion(obj.rotQuat);
290 Velocity = new LSL_Types.Vector3(obj.velVector);
291 LinkNum = obj.linkNumber;
292 if(obj.velVector == Vector3.Zero)
293 Type = 4;
294 else
295 Type = 2;
296
297 part = part.ParentGroup.RootPart;
298 foreach (SceneObjectPart p in part.ParentGroup.Parts)
299 {
300 if (p.Inventory.ContainsScripts())
301 {
302 // at sl a physical prim is active also if has active scripts
303 // assuming all scripts are in run state to save time
304 if((part.Flags & PrimFlags.Physics) != 0 )
305 Type = 10; // script + active
306 else
307 Type |= SCRIPTED; // Scripted
308 break;
309 }
310 }
311 }
276 } 312 }
277 313
278 /// <summary> 314 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index ad775ff..f1b1e66 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -244,7 +244,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
244 { 244 {
245 DetectParams d = new DetectParams(); 245 DetectParams d = new DetectParams();
246 d.Key =detobj.keyUUID; 246 d.Key =detobj.keyUUID;
247 d.Populate(myScriptEngine.World); 247 d.Populate(myScriptEngine.World, detobj);
248 d.LinkNum = detobj.linkNumber; // do it here since currently linknum is collided part 248 d.LinkNum = detobj.linkNumber; // do it here since currently linknum is collided part
249 det.Add(d); 249 det.Add(d);
250 } 250 }
@@ -264,9 +264,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
264 foreach (DetectedObject detobj in col.Colliders) 264 foreach (DetectedObject detobj in col.Colliders)
265 { 265 {
266 DetectParams d = new DetectParams(); 266 DetectParams d = new DetectParams();
267 d.Key =detobj.keyUUID; 267 d.Populate(myScriptEngine.World, detobj);
268 d.Populate(myScriptEngine.World);
269 d.LinkNum = detobj.linkNumber; // do it here since currently linknum is collided part
270 det.Add(d); 268 det.Add(d);
271 } 269 }
272 270
@@ -284,9 +282,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
284 foreach (DetectedObject detobj in col.Colliders) 282 foreach (DetectedObject detobj in col.Colliders)
285 { 283 {
286 DetectParams d = new DetectParams(); 284 DetectParams d = new DetectParams();
287 d.Key =detobj.keyUUID; 285 d.Populate(myScriptEngine.World, detobj);
288 d.Populate(myScriptEngine.World);
289 d.LinkNum = detobj.linkNumber; // do it here since currently linknum is collided part
290 det.Add(d); 286 det.Add(d);
291 } 287 }
292 288
@@ -304,8 +300,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
304 foreach (DetectedObject detobj in col.Colliders) 300 foreach (DetectedObject detobj in col.Colliders)
305 { 301 {
306 DetectParams d = new DetectParams(); 302 DetectParams d = new DetectParams();
307 d.Position = detobj.posVector; 303 d.Populate(myScriptEngine.World, detobj);
308 d.Populate(myScriptEngine.World);
309 det.Add(d); 304 det.Add(d);
310 myScriptEngine.PostObjectEvent(localID, new EventParams( 305 myScriptEngine.PostObjectEvent(localID, new EventParams(
311 "land_collision_start", 306 "land_collision_start",
@@ -322,8 +317,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
322 foreach (DetectedObject detobj in col.Colliders) 317 foreach (DetectedObject detobj in col.Colliders)
323 { 318 {
324 DetectParams d = new DetectParams(); 319 DetectParams d = new DetectParams();
325 d.Position = detobj.posVector; 320 d.Populate(myScriptEngine.World,detobj);
326 d.Populate(myScriptEngine.World);
327 det.Add(d); 321 det.Add(d);
328 myScriptEngine.PostObjectEvent(localID, new EventParams( 322 myScriptEngine.PostObjectEvent(localID, new EventParams(
329 "land_collision", 323 "land_collision",
@@ -339,8 +333,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
339 foreach (DetectedObject detobj in col.Colliders) 333 foreach (DetectedObject detobj in col.Colliders)
340 { 334 {
341 DetectParams d = new DetectParams(); 335 DetectParams d = new DetectParams();
342 d.Position = detobj.posVector; 336 d.Populate(myScriptEngine.World,detobj);
343 d.Populate(myScriptEngine.World);
344 det.Add(d); 337 det.Add(d);
345 myScriptEngine.PostObjectEvent(localID, new EventParams( 338 myScriptEngine.PostObjectEvent(localID, new EventParams(
346 "land_collision_end", 339 "land_collision_end",