aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Addons/Groups/GroupsMessagingModule.cs2
-rw-r--r--OpenSim/Addons/Groups/GroupsModule.cs3
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs79
-rw-r--r--OpenSim/Framework/GridInstantMessage.cs19
-rw-r--r--OpenSim/Framework/IClientAPI.cs10
-rw-r--r--OpenSim/Framework/IMoneyModule.cs7
-rw-r--r--OpenSim/Framework/ISceneAgent.cs1
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs11
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs7
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs8
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs11
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs31
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs47
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs52
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs219
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs33
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs16
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs45
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEventQueue.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IFriendsModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs29
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs361
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs10
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs181
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs3
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs12
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs9
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs14
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs21
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs11
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs81
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs43
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs15
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs10
-rw-r--r--OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs4
42 files changed, 854 insertions, 624 deletions
diff --git a/OpenSim/Addons/Groups/GroupsMessagingModule.cs b/OpenSim/Addons/Groups/GroupsMessagingModule.cs
index e95db41..2ec9652 100644
--- a/OpenSim/Addons/Groups/GroupsMessagingModule.cs
+++ b/OpenSim/Addons/Groups/GroupsMessagingModule.cs
@@ -627,6 +627,7 @@ namespace OpenSim.Groups
627 , false //canVoiceChat 627 , false //canVoiceChat
628 , false //isModerator 628 , false //isModerator
629 , false //text mute 629 , false //text mute
630 , true // Enter
630 ); 631 );
631 } 632 }
632 } 633 }
@@ -669,6 +670,7 @@ namespace OpenSim.Groups
669 , false //canVoiceChat 670 , false //canVoiceChat
670 , false //isModerator 671 , false //isModerator
671 , false //text mute 672 , false //text mute
673 , true
672 ); 674 );
673 } 675 }
674 } 676 }
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs
index 1afdd0f..e586dd7 100644
--- a/OpenSim/Addons/Groups/GroupsModule.cs
+++ b/OpenSim/Addons/Groups/GroupsModule.cs
@@ -249,7 +249,8 @@ namespace OpenSim.Groups
249 // There might be some problem with the thread we're generating this on but not 249 // There might be some problem with the thread we're generating this on but not
250 // doing the update at this time causes problems (Mantis #7920 and #7915) 250 // doing the update at this time causes problems (Mantis #7920 and #7915)
251 // TODO: move sending this update to a later time in the rootification of the client. 251 // TODO: move sending this update to a later time in the rootification of the client.
252 SendAgentGroupDataUpdate(sp.ControllingClient, false); 252 if(!sp.haveGroupInformation)
253 SendAgentGroupDataUpdate(sp.ControllingClient, false);
253 } 254 }
254 255
255 private void OnMakeChild(ScenePresence sp) 256 private void OnMakeChild(ScenePresence sp)
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 72c2c34..74f18bf 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -353,6 +353,10 @@ namespace OpenSim.Framework
353 public UUID PreyAgent; 353 public UUID PreyAgent;
354 public Byte AgentAccess; 354 public Byte AgentAccess;
355 public UUID ActiveGroupID; 355 public UUID ActiveGroupID;
356 public string ActiveGroupName;
357 public string ActiveGroupTitle = null;
358 public UUID agentCOF;
359 public byte CrossingFlags;
356 360
357 public AgentGroupData[] Groups; 361 public AgentGroupData[] Groups;
358 public Dictionary<ulong, string> ChildrenCapSeeds = null; 362 public Dictionary<ulong, string> ChildrenCapSeeds = null;
@@ -361,7 +365,6 @@ namespace OpenSim.Framework
361 public Animation AnimState = null; 365 public Animation AnimState = null;
362 public Byte MotionState = 0; 366 public Byte MotionState = 0;
363 367
364 public UUID GranterID;
365 public UUID ParentPart; 368 public UUID ParentPart;
366 public Vector3 SitOffset; 369 public Vector3 SitOffset;
367 370
@@ -374,12 +377,6 @@ namespace OpenSim.Framework
374 MethodBase.GetCurrentMethod().DeclaringType); 377 MethodBase.GetCurrentMethod().DeclaringType);
375// DEBUG OFF 378// DEBUG OFF
376 379
377/*
378 public byte[] AgentTextures;
379 public byte[] VisualParams;
380 public UUID[] Wearables;
381 public AvatarAttachment[] Attachments;
382*/
383 // Scripted 380 // Scripted
384 public ControllerData[] Controllers; 381 public ControllerData[] Controllers;
385 382
@@ -393,8 +390,6 @@ namespace OpenSim.Framework
393 390
394 public virtual OSDMap Pack(EntityTransferContext ctx) 391 public virtual OSDMap Pack(EntityTransferContext ctx)
395 { 392 {
396 int wearablesCount = -1;
397
398// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); 393// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
399 394
400 OSDMap args = new OSDMap(); 395 OSDMap args = new OSDMap();
@@ -433,8 +428,14 @@ namespace OpenSim.Framework
433 args["prey_agent"] = OSD.FromUUID(PreyAgent); 428 args["prey_agent"] = OSD.FromUUID(PreyAgent);
434 args["agent_access"] = OSD.FromString(AgentAccess.ToString()); 429 args["agent_access"] = OSD.FromString(AgentAccess.ToString());
435 430
431 args["agent_cof"] = OSD.FromUUID(agentCOF);
432 args["crossingflags"] = OSD.FromInteger(CrossingFlags);
433
436 args["active_group_id"] = OSD.FromUUID(ActiveGroupID); 434 args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
437 435 args["active_group_name"] = OSD.FromString(ActiveGroupName);
436 if(ActiveGroupTitle != null)
437 args["active_group_title"] = OSD.FromString(ActiveGroupTitle);
438
438 if ((Groups != null) && (Groups.Length > 0)) 439 if ((Groups != null) && (Groups.Length > 0))
439 { 440 {
440 OSDArray groups = new OSDArray(Groups.Length); 441 OSDArray groups = new OSDArray(Groups.Length);
@@ -497,48 +498,6 @@ namespace OpenSim.Framework
497 if (Appearance != null) 498 if (Appearance != null)
498 args["packed_appearance"] = Appearance.Pack(ctx); 499 args["packed_appearance"] = Appearance.Pack(ctx);
499 500
500 //if ((AgentTextures != null) && (AgentTextures.Length > 0))
501 //{
502 // OSDArray textures = new OSDArray(AgentTextures.Length);
503 // foreach (UUID uuid in AgentTextures)
504 // textures.Add(OSD.FromUUID(uuid));
505 // args["agent_textures"] = textures;
506 //}
507
508 // The code to pack textures, visuals, wearables and attachments
509 // should be removed; packed appearance contains the full appearance
510 // This is retained for backward compatibility only
511
512/* then lets remove
513 if (Appearance.Texture != null)
514 {
515 byte[] rawtextures = Appearance.Texture.GetBytes();
516 args["texture_entry"] = OSD.FromBinary(rawtextures);
517 }
518
519 if ((Appearance.VisualParams != null) && (Appearance.VisualParams.Length > 0))
520 args["visual_params"] = OSD.FromBinary(Appearance.VisualParams);
521
522 // We might not pass this in all cases...
523 if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0))
524 {
525 OSDArray wears = new OSDArray(Appearance.Wearables.Length);
526 foreach (AvatarWearable awear in Appearance.Wearables)
527 wears.Add(awear.Pack());
528
529 args["wearables"] = wears;
530 }
531
532 List<AvatarAttachment> attachments = Appearance.GetAttachments();
533 if ((attachments != null) && (attachments.Count > 0))
534 {
535 OSDArray attachs = new OSDArray(attachments.Count);
536 foreach (AvatarAttachment att in attachments)
537 attachs.Add(att.Pack());
538 args["attachments"] = attachs;
539 }
540 // End of code to remove
541*/
542 if ((Controllers != null) && (Controllers.Length > 0)) 501 if ((Controllers != null) && (Controllers.Length > 0))
543 { 502 {
544 OSDArray controls = new OSDArray(Controllers.Length); 503 OSDArray controls = new OSDArray(Controllers.Length);
@@ -662,10 +621,22 @@ namespace OpenSim.Framework
662 if (args["agent_access"] != null) 621 if (args["agent_access"] != null)
663 Byte.TryParse(args["agent_access"].AsString(), out AgentAccess); 622 Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);
664 623
665 if (args["active_group_id"] != null) 624 if (args.ContainsKey("agent_cof") && args["agent_cof"] != null)
625 agentCOF = args["agent_cof"].AsUUID();
626
627 if (args.ContainsKey("crossingflags") && args["crossingflags"] != null)
628 CrossingFlags = (byte)args["crossingflags"].AsInteger();
629
630 if (args.ContainsKey("active_group_id") && args["active_group_id"] != null)
666 ActiveGroupID = args["active_group_id"].AsUUID(); 631 ActiveGroupID = args["active_group_id"].AsUUID();
667 632
668 if ((args["groups"] != null) && (args["groups"]).Type == OSDType.Array) 633 if (args.ContainsKey("active_group_name") && args["active_group_name"] != null)
634 ActiveGroupName = args["active_group_name"].AsString();
635
636 if(args.ContainsKey("active_group_title") && args["active_group_title"] != null)
637 ActiveGroupTitle = args["active_group_title"].AsString();
638
639 if (args.ContainsKey("groups") && (args["groups"] != null) && (args["groups"]).Type == OSDType.Array)
669 { 640 {
670 OSDArray groups = (OSDArray)(args["groups"]); 641 OSDArray groups = (OSDArray)(args["groups"]);
671 Groups = new AgentGroupData[groups.Count]; 642 Groups = new AgentGroupData[groups.Count];
diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs
index da3690c..53d98db 100644
--- a/OpenSim/Framework/GridInstantMessage.cs
+++ b/OpenSim/Framework/GridInstantMessage.cs
@@ -47,6 +47,7 @@ namespace OpenSim.Framework
47 public uint ParentEstateID; 47 public uint ParentEstateID;
48 public Guid RegionID; 48 public Guid RegionID;
49 public uint timestamp; 49 public uint timestamp;
50 public Guid ID;
50 51
51 public GridInstantMessage() 52 public GridInstantMessage()
52 { 53 {
@@ -66,6 +67,8 @@ namespace OpenSim.Framework
66 Position = im.Position; 67 Position = im.Position;
67 binaryBucket = im.binaryBucket; 68 binaryBucket = im.binaryBucket;
68 RegionID = im.RegionID; 69 RegionID = im.RegionID;
70 ParentEstateID = im.ParentEstateID;
71 ID = im.ID;
69 72
70 if (addTimestamp) 73 if (addTimestamp)
71 timestamp = (uint)Util.UnixTimeSinceEpoch(); 74 timestamp = (uint)Util.UnixTimeSinceEpoch();
@@ -75,7 +78,7 @@ namespace OpenSim.Framework
75 string _fromAgentName, UUID _toAgentID, 78 string _fromAgentName, UUID _toAgentID,
76 byte _dialog, bool _fromGroup, string _message, 79 byte _dialog, bool _fromGroup, string _message,
77 UUID _imSessionID, bool _offline, Vector3 _position, 80 UUID _imSessionID, bool _offline, Vector3 _position,
78 byte[] _binaryBucket, bool addTimestamp) 81 byte[] _binaryBucket, UUID _ID, bool addTimestamp)
79 { 82 {
80 fromAgentID = _fromAgentID.Guid; 83 fromAgentID = _fromAgentID.Guid;
81 fromAgentName = _fromAgentName; 84 fromAgentName = _fromAgentName;
@@ -84,6 +87,8 @@ namespace OpenSim.Framework
84 fromGroup = _fromGroup; 87 fromGroup = _fromGroup;
85 message = _message; 88 message = _message;
86 imSessionID = _imSessionID.Guid; 89 imSessionID = _imSessionID.Guid;
90 ID = _ID.Guid;
91
87 if (_offline) 92 if (_offline)
88 offline = 1; 93 offline = 1;
89 else 94 else
@@ -102,11 +107,21 @@ namespace OpenSim.Framework
102 } 107 }
103 108
104 public GridInstantMessage(IScene scene, UUID _fromAgentID, 109 public GridInstantMessage(IScene scene, UUID _fromAgentID,
110 string _fromAgentName, UUID _toAgentID,
111 byte _dialog, bool _fromGroup, string _message,
112 UUID _imSessionID, bool _offline, Vector3 _position,
113 byte[] _binaryBucket, bool addTimestamp) : this (scene, _fromAgentID,
114 _fromAgentName, _toAgentID, _dialog, _fromGroup, _message,
115 _imSessionID, _offline, _position, _binaryBucket, UUID.Zero, addTimestamp)
116 {
117 }
118
119 public GridInstantMessage(IScene scene, UUID _fromAgentID,
105 string _fromAgentName, UUID _toAgentID, byte _dialog, 120 string _fromAgentName, UUID _toAgentID, byte _dialog,
106 string _message, bool _offline, 121 string _message, bool _offline,
107 Vector3 _position) : this(scene, _fromAgentID, _fromAgentName, 122 Vector3 _position) : this(scene, _fromAgentID, _fromAgentName,
108 _toAgentID, _dialog, false, _message, 123 _toAgentID, _dialog, false, _message,
109 _fromAgentID ^ _toAgentID, _offline, _position, new byte[0], true) 124 _fromAgentID ^ _toAgentID, _offline, _position, new byte[0], UUID.Zero, true)
110 { 125 {
111 } 126 }
112 } 127 }
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index d9932eb..9bf51f8 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -727,11 +727,15 @@ namespace OpenSim.Framework
727 727
728 UUID SecureSessionId { get; } 728 UUID SecureSessionId { get; }
729 729
730 UUID ActiveGroupId { get; } 730 UUID ActiveGroupId { get; set; }
731 731
732 string ActiveGroupName { get; } 732 string ActiveGroupName { get; set;}
733 733
734 ulong ActiveGroupPowers { get; } 734 ulong ActiveGroupPowers { get; set;}
735
736 Dictionary<UUID, ulong> GetGroupPowers();
737
738 void SetGroupPowers(Dictionary<UUID, ulong> powers);
735 739
736 ulong GetGroupPowers(UUID groupID); 740 ulong GetGroupPowers(UUID groupID);
737 741
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs
index 55c9613..be45438 100644
--- a/OpenSim/Framework/IMoneyModule.cs
+++ b/OpenSim/Framework/IMoneyModule.cs
@@ -32,14 +32,13 @@ namespace OpenSim.Framework
32 public delegate void ObjectPaid(UUID objectID, UUID agentID, int amount); 32 public delegate void ObjectPaid(UUID objectID, UUID agentID, int amount);
33 public interface IMoneyModule 33 public interface IMoneyModule
34 { 34 {
35 bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, 35 bool ObjectGiveMoney(UUID objectID, UUID fromID,
36 int amount, UUID txn, out string reason); 36 UUID toID, int amount, UUID txn, out string reason);
37 37
38 int GetBalance(UUID agentID); 38 int GetBalance(UUID agentID);
39 bool UploadCovered(UUID agentID, int amount); 39 bool UploadCovered(UUID agentID, int amount);
40 bool AmountCovered(UUID agentID, int amount); 40 bool AmountCovered(UUID agentID, int amount);
41 void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type); 41 void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData = "");
42 void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData);
43 void ApplyUploadCharge(UUID agentID, int amount, string text); 42 void ApplyUploadCharge(UUID agentID, int amount, string text);
44 void MoveMoney(UUID fromUser, UUID toUser, int amount, string text); 43 void MoveMoney(UUID fromUser, UUID toUser, int amount, string text);
45 44
diff --git a/OpenSim/Framework/ISceneAgent.cs b/OpenSim/Framework/ISceneAgent.cs
index be11931..1848b17 100644
--- a/OpenSim/Framework/ISceneAgent.cs
+++ b/OpenSim/Framework/ISceneAgent.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Framework
55 /// </summary> 55 /// </summary>
56 bool IsChildAgent { get; } 56 bool IsChildAgent { get; }
57 57
58 bool Invulnerable { get; set; }
58 /// <summary> 59 /// <summary>
59 /// Avatar appearance data. 60 /// Avatar appearance data.
60 /// </summary> 61 /// </summary>
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 3426d10..1d4deac 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -157,7 +157,16 @@ namespace OpenSim.Framework.Servers
157 "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n", 157 "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n",
158 Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32"); 158 Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32");
159 159
160 StartupSpecific(); 160 try
161 {
162 StartupSpecific();
163 }
164 catch(Exception e)
165 {
166 m_log.FatalFormat("Fatal error: {0}",
167 (e.Message == null || e.Message == String.Empty) ? "Unknown reason":e.Message );
168 Environment.Exit(1);
169 }
161 170
162 TimeSpan timeTaken = DateTime.Now - m_startuptime; 171 TimeSpan timeTaken = DateTime.Now - m_startuptime;
163 172
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 41966ff..52ded3d 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -218,6 +218,13 @@ namespace OpenSim
218 IConfig startupConfig = Config.Configs["Startup"]; 218 IConfig startupConfig = Config.Configs["Startup"];
219 if (startupConfig != null) 219 if (startupConfig != null)
220 { 220 {
221 // refuse to run MegaRegions
222 if(startupConfig.GetBoolean("CombineContiguousRegions", false))
223 {
224 m_log.Fatal("CombineContiguousRegions (MegaRegions) option is no longer suported. Use a older version to save region contents as OAR, then import into a fresh install of this new version");
225 throw new Exception("CombineContiguousRegions not suported");
226 }
227
221 string pidFile = startupConfig.GetString("PIDFile", String.Empty); 228 string pidFile = startupConfig.GetString("PIDFile", String.Empty);
222 if (pidFile != String.Empty) 229 if (pidFile != String.Empty)
223 CreatePIDFile(pidFile); 230 CreatePIDFile(pidFile);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 18670f5..f3acacd 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -568,12 +568,12 @@ namespace OpenSim.Region.ClientStack.Linden
568 568
569 } 569 }
570 570
571 public void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID anotherAgent, bool canVoiceChat, 571 public void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat,
572 bool isModerator, bool textMute) 572 bool isModerator, bool textMute, bool isEnterorLeave)
573 { 573 {
574 OSD item = EventQueueHelper.ChatterBoxSessionAgentListUpdates(sessionID, fromAgent, canVoiceChat, 574 OSD item = EventQueueHelper.ChatterBoxSessionAgentListUpdates(sessionID, fromAgent, canVoiceChat,
575 isModerator, textMute); 575 isModerator, textMute, isEnterorLeave);
576 Enqueue(item, fromAgent); 576 Enqueue(item, toAgent);
577 //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item); 577 //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item);
578 } 578 }
579 579
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
index 8beeb95..d552914 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
@@ -308,20 +308,29 @@ namespace OpenSim.Region.ClientStack.Linden
308 } 308 }
309 309
310 public static OSD ChatterBoxSessionAgentListUpdates(UUID sessionID, 310 public static OSD ChatterBoxSessionAgentListUpdates(UUID sessionID,
311 UUID agentID, bool canVoiceChat, bool isModerator, bool textMute) 311 UUID agentID, bool canVoiceChat, bool isModerator, bool textMute, bool isEnterorLeave)
312 { 312 {
313 OSDMap body = new OSDMap(); 313 OSDMap body = new OSDMap();
314 OSDMap agentUpdates = new OSDMap(); 314 OSDMap agentUpdates = new OSDMap();
315 OSDMap infoDetail = new OSDMap(); 315 OSDMap infoDetail = new OSDMap();
316 OSDMap mutes = new OSDMap(); 316 OSDMap mutes = new OSDMap();
317 317
318 // this should be a list of agents and parameters
319 // foreach agent
318 mutes.Add("text", OSD.FromBoolean(textMute)); 320 mutes.Add("text", OSD.FromBoolean(textMute));
319 infoDetail.Add("can_voice_chat", OSD.FromBoolean(canVoiceChat)); 321 infoDetail.Add("can_voice_chat", OSD.FromBoolean(canVoiceChat));
320 infoDetail.Add("is_moderator", OSD.FromBoolean(isModerator)); 322 infoDetail.Add("is_moderator", OSD.FromBoolean(isModerator));
321 infoDetail.Add("mutes", mutes); 323 infoDetail.Add("mutes", mutes);
322 OSDMap info = new OSDMap(); 324 OSDMap info = new OSDMap();
323 info.Add("info", infoDetail); 325 info.Add("info", infoDetail);
326 if(isEnterorLeave)
327 info.Add("transition",OSD.FromString("ENTER"));
328 else
329 info.Add("transition",OSD.FromString("LEAVE"));
324 agentUpdates.Add(agentID.ToString(), info); 330 agentUpdates.Add(agentID.ToString(), info);
331
332 // foreach end
333
325 body.Add("agent_updates", agentUpdates); 334 body.Add("agent_updates", agentUpdates);
326 body.Add("session_id", OSD.FromUUID(sessionID)); 335 body.Add("session_id", OSD.FromUUID(sessionID));
327 body.Add("updates", new OSD()); 336 body.Add("updates", new OSD());
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 6dd2ffd..0bb5dc6 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -421,9 +421,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
421 } 421 }
422 public UUID AgentId { get { return m_agentId; } } 422 public UUID AgentId { get { return m_agentId; } }
423 public ISceneAgent SceneAgent { get; set; } 423 public ISceneAgent SceneAgent { get; set; }
424 public UUID ActiveGroupId { get { return m_activeGroupID; } private set { m_activeGroupID = value; } } 424 public UUID ActiveGroupId { get { return m_activeGroupID; } set { m_activeGroupID = value; } }
425 public string ActiveGroupName { get { return m_activeGroupName; } private set { m_activeGroupName = value; } } 425 public string ActiveGroupName { get { return m_activeGroupName; } set { m_activeGroupName = value; } }
426 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } private set { m_activeGroupPowers = value; } } 426 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } set { m_activeGroupPowers = value; } }
427 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } 427 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
428 428
429 public int PingTimeMS 429 public int PingTimeMS
@@ -953,7 +953,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
953 /// Send an instant message to this client 953 /// Send an instant message to this client
954 /// </summary> 954 /// </summary>
955 // 955 //
956 // Don't remove transaction ID! Groups and item gives need to set it!
957 public void SendInstantMessage(GridInstantMessage im) 956 public void SendInstantMessage(GridInstantMessage im)
958 { 957 {
959 if (((Scene)(m_scene)).Permissions.CanInstantMessage(new UUID(im.fromAgentID), new UUID(im.toAgentID))) 958 if (((Scene)(m_scene)).Permissions.CanInstantMessage(new UUID(im.fromAgentID), new UUID(im.toAgentID)))
@@ -962,14 +961,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
962 = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); 961 = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage);
963 962
964 msg.AgentData.AgentID = new UUID(im.fromAgentID); 963 msg.AgentData.AgentID = new UUID(im.fromAgentID);
965 msg.AgentData.SessionID = UUID.Zero; 964 msg.AgentData.SessionID = new UUID(im.imSessionID);
966 msg.MessageBlock.FromAgentName = Util.StringToBytes256(im.fromAgentName); 965 msg.MessageBlock.FromAgentName = Util.StringToBytes256(im.fromAgentName);
967 msg.MessageBlock.Dialog = im.dialog; 966 msg.MessageBlock.Dialog = im.dialog;
968 msg.MessageBlock.FromGroup = im.fromGroup; 967 msg.MessageBlock.FromGroup = im.fromGroup;
969 if (im.imSessionID == UUID.Zero.Guid) 968 msg.MessageBlock.ID = new UUID(im.ID);
970 msg.MessageBlock.ID = new UUID(im.fromAgentID) ^ new UUID(im.toAgentID);
971 else
972 msg.MessageBlock.ID = new UUID(im.imSessionID);
973 msg.MessageBlock.Offline = im.offline; 969 msg.MessageBlock.Offline = im.offline;
974 msg.MessageBlock.ParentEstateID = im.ParentEstateID; 970 msg.MessageBlock.ParentEstateID = im.ParentEstateID;
975 msg.MessageBlock.Position = im.Position; 971 msg.MessageBlock.Position = im.Position;
@@ -5786,6 +5782,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5786 OutPacket(packet, ThrottleOutPacketType.Task); 5782 OutPacket(packet, ThrottleOutPacketType.Task);
5787 } 5783 }
5788 5784
5785 public Dictionary<UUID, ulong> GetGroupPowers()
5786 {
5787 lock(m_groupPowers)
5788 {
5789 return new Dictionary<UUID, ulong>(m_groupPowers);
5790 }
5791 }
5792
5793 public void SetGroupPowers(Dictionary<UUID, ulong> powers)
5794 {
5795 lock(m_groupPowers)
5796 {
5797 m_groupPowers.Clear();
5798 m_groupPowers = powers;
5799 }
5800 }
5801
5789 public ulong GetGroupPowers(UUID groupID) 5802 public ulong GetGroupPowers(UUID groupID)
5790 { 5803 {
5791 if (groupID == ActiveGroupId) 5804 if (groupID == ActiveGroupId)
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index d6c4d5b..c88142a 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
@@ -255,6 +255,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
255 return 0; 255 return 0;
256 } 256 }
257 257
258 private void OnMakeRootAgent(ScenePresence sp)
259 {
260 if(sp.gotCrossUpdate)
261 return;
262
263 RecacheFriends(sp.ControllingClient);
264
265 lock (m_NeedsToNotifyStatus)
266 {
267 if (m_NeedsToNotifyStatus.Remove(sp.UUID))
268 {
269 // Inform the friends that this user is online. This can only be done once the client is a Root Agent.
270 StatusChange(sp.UUID, true);
271 }
272 }
273 }
274
258 private void OnNewClient(IClientAPI client) 275 private void OnNewClient(IClientAPI client)
259 { 276 {
260 client.OnInstantMessage += OnInstantMessage; 277 client.OnInstantMessage += OnInstantMessage;
@@ -327,20 +344,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
327 } 344 }
328 } 345 }
329 346
330 private void OnMakeRootAgent(ScenePresence sp)
331 {
332 RecacheFriends(sp.ControllingClient);
333
334 lock (m_NeedsToNotifyStatus)
335 {
336 if (m_NeedsToNotifyStatus.Remove(sp.UUID))
337 {
338 // Inform the friends that this user is online. This can only be done once the client is a Root Agent.
339 StatusChange(sp.UUID, true);
340 }
341 }
342 }
343
344 private void OnClientLogin(IClientAPI client) 347 private void OnClientLogin(IClientAPI client)
345 { 348 {
346 UUID agentID = client.AgentId; 349 UUID agentID = client.AgentId;
@@ -359,6 +362,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
359 m_NeedsListOfOnlineFriends.Add(agentID); 362 m_NeedsListOfOnlineFriends.Add(agentID);
360 } 363 }
361 364
365 public void IsNpwRoot(ScenePresence sp)
366 {
367 RecacheFriends(sp.ControllingClient);
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 }
378
362 public virtual bool SendFriendsOnlineIfNeeded(IClientAPI client) 379 public virtual bool SendFriendsOnlineIfNeeded(IClientAPI client)
363 { 380 {
364 UUID agentID = client.AgentId; 381 UUID agentID = client.AgentId;
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
index a1b918a..63b3dba 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
147// "[HG INSTANT MESSAGE]: Looking for root agent {0} in {1}", 147// "[HG INSTANT MESSAGE]: Looking for root agent {0} in {1}",
148// toAgentID.ToString(), scene.RegionInfo.RegionName); 148// toAgentID.ToString(), scene.RegionInfo.RegionName);
149 ScenePresence sp = scene.GetScenePresence(toAgentID); 149 ScenePresence sp = scene.GetScenePresence(toAgentID);
150 if (sp != null && !sp.IsChildAgent) 150 if (sp != null && !sp.IsChildAgent && !sp.IsDeleted)
151 { 151 {
152 // Local message 152 // Local message
153// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); 153// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
@@ -159,25 +159,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
159 } 159 }
160 } 160 }
161 161
162 // try child avatar second
163 foreach (Scene scene in m_Scenes)
164 {
165// m_log.DebugFormat(
166// "[HG INSTANT MESSAGE]: Looking for child of {0} in {1}",
167// toAgentID, scene.RegionInfo.RegionName);
168 ScenePresence sp = scene.GetScenePresence(toAgentID);
169 if (sp != null)
170 {
171 // Local message
172// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID);
173 sp.ControllingClient.SendInstantMessage(im);
174
175 // Message sent
176 result(true);
177 return;
178 }
179 }
180
181// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); 162// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
182 // Is the user a local user? 163 // Is the user a local user?
183 string url = string.Empty; 164 string url = string.Empty;
@@ -224,7 +205,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
224 foreach (Scene scene in m_Scenes) 205 foreach (Scene scene in m_Scenes)
225 { 206 {
226 ScenePresence sp = scene.GetScenePresence(toAgentID); 207 ScenePresence sp = scene.GetScenePresence(toAgentID);
227 if(sp != null && !sp.IsChildAgent) 208 if(sp != null && !sp.IsChildAgent && !sp.IsDeleted)
228 { 209 {
229 scene.EventManager.TriggerIncomingInstantMessage(gim); 210 scene.EventManager.TriggerIncomingInstantMessage(gim);
230 successful = true; 211 successful = true;
@@ -310,7 +291,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
310 foreach (Scene scene in m_Scenes) 291 foreach (Scene scene in m_Scenes)
311 { 292 {
312 ScenePresence presence = scene.GetScenePresence(agentID); 293 ScenePresence presence = scene.GetScenePresence(agentID);
313 if (presence != null && !presence.IsChildAgent) 294 if (presence != null && !presence.IsChildAgent && !presence.IsDeleted)
314 return presence.ControllingClient; 295 return presence.ControllingClient;
315 } 296 }
316 } 297 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 3c82fd9..1366103 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -142,47 +142,36 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
142 if (toAgentID == UUID.Zero) 142 if (toAgentID == UUID.Zero)
143 return; 143 return;
144 144
145 IClientAPI client = null;
146
145 // Try root avatar only first 147 // Try root avatar only first
146 foreach (Scene scene in m_Scenes) 148 foreach (Scene scene in m_Scenes)
147 { 149 {
148// m_log.DebugFormat(
149// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
150// toAgentID.ToString(), scene.RegionInfo.RegionName);
151
152 ScenePresence sp = scene.GetScenePresence(toAgentID); 150 ScenePresence sp = scene.GetScenePresence(toAgentID);
153 if (sp != null && !sp.IsChildAgent) 151 if (sp != null && !sp.IsDeleted && sp.ControllingClient.IsActive)
154 { 152 {
155 // Local message 153 // actualy don't send via child agents
156// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", sp.Name, toAgentID); 154 // ims can be complex things, and not sure viewers will not mess up
157 155 if(sp.IsChildAgent)
158 sp.ControllingClient.SendInstantMessage(im); 156 continue;
159 157
160 // Message sent 158 client = sp.ControllingClient;
161 result(true); 159 if(!sp.IsChildAgent)
162 return; 160 break;
163 } 161 }
164 } 162 }
165 163
166 // try child avatar second 164 if(client != null)
167 foreach (Scene scene in m_Scenes)
168 { 165 {
169// m_log.DebugFormat( 166 // Local message
170// "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); 167// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", sp.Name, toAgentID);
171
172 ScenePresence sp = scene.GetScenePresence(toAgentID);
173 if (sp != null)
174 {
175 // Local message
176// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", sp.Name, toAgentID);
177 168
178 sp.ControllingClient.SendInstantMessage(im); 169 client.SendInstantMessage(im);
179 170
180 // Message sent 171 // Message sent
181 result(true); 172 result(true);
182 return; 173 return;
183 }
184 } 174 }
185
186// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); 175// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
187 176
188 SendGridInstantMessageViaXMLRPC(im, result); 177 SendGridInstantMessageViaXMLRPC(im, result);
@@ -227,6 +216,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
227 UUID fromAgentID = UUID.Zero; 216 UUID fromAgentID = UUID.Zero;
228 UUID toAgentID = UUID.Zero; 217 UUID toAgentID = UUID.Zero;
229 UUID imSessionID = UUID.Zero; 218 UUID imSessionID = UUID.Zero;
219 UUID imID = UUID.Zero;
230 uint timestamp = 0; 220 uint timestamp = 0;
231 string fromAgentName = ""; 221 string fromAgentName = "";
232 string message = ""; 222 string message = "";
@@ -243,7 +233,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
243 float pos_z = 0; 233 float pos_z = 0;
244 //m_log.Info("Processing IM"); 234 //m_log.Info("Processing IM");
245 235
246
247 Hashtable requestData = (Hashtable)request.Params[0]; 236 Hashtable requestData = (Hashtable)request.Params[0];
248 // Check if it's got all the data 237 // Check if it's got all the data
249 if (requestData.ContainsKey("from_agent_id") 238 if (requestData.ContainsKey("from_agent_id")
@@ -274,6 +263,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
274 UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); 263 UUID.TryParse((string)requestData["to_agent_id"], out toAgentID);
275 UUID.TryParse((string)requestData["im_session_id"], out imSessionID); 264 UUID.TryParse((string)requestData["im_session_id"], out imSessionID);
276 UUID.TryParse((string)requestData["region_id"], out RegionID); 265 UUID.TryParse((string)requestData["region_id"], out RegionID);
266 UUID.TryParse((string)requestData["id"], out imID);
277 267
278 try 268 try
279 { 269 {
@@ -401,6 +391,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
401 gim.ParentEstateID = ParentEstateID; 391 gim.ParentEstateID = ParentEstateID;
402 gim.Position = Position; 392 gim.Position = Position;
403 gim.binaryBucket = binaryBucket; 393 gim.binaryBucket = binaryBucket;
394 gim.ID = imID.Guid;
404 395
405 396
406 // Trigger the Instant message in the scene. 397 // Trigger the Instant message in the scene.
@@ -519,7 +510,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
519 510
520 UUID toAgentID = new UUID(im.toAgentID); 511 UUID toAgentID = new UUID(im.toAgentID);
521 PresenceInfo upd = null; 512 PresenceInfo upd = null;
522 UUID regionID;
523 bool lookupAgent = false; 513 bool lookupAgent = false;
524 514
525 lock (m_UserRegionMap) 515 lock (m_UserRegionMap)
@@ -712,6 +702,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
712 gim["from_agent_session"] = UUID.Zero.ToString(); 702 gim["from_agent_session"] = UUID.Zero.ToString();
713 gim["to_agent_id"] = msg.toAgentID.ToString(); 703 gim["to_agent_id"] = msg.toAgentID.ToString();
714 gim["im_session_id"] = msg.imSessionID.ToString(); 704 gim["im_session_id"] = msg.imSessionID.ToString();
705 if(msg.ID != Guid.Empty)
706 gim["id"] = msg.ID.ToString();
715 gim["timestamp"] = msg.timestamp.ToString(); 707 gim["timestamp"] = msg.timestamp.ToString();
716 gim["from_agent_name"] = msg.fromAgentName; 708 gim["from_agent_name"] = msg.fromAgentName;
717 gim["message"] = msg.message; 709 gim["message"] = msg.message;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 696d1dd..fbb99b0 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -922,7 +922,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
922 922
923 // Let's send a full update of the agent. This is a synchronous call. 923 // Let's send a full update of the agent. This is a synchronous call.
924 AgentData agent = new AgentData(); 924 AgentData agent = new AgentData();
925 sp.CopyTo(agent); 925 sp.CopyTo(agent,false);
926 926
927 if ((teleportFlags & (uint)TeleportFlags.IsFlying) != 0) 927 if ((teleportFlags & (uint)TeleportFlags.IsFlying) != 0)
928 agent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 928 agent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
@@ -1142,7 +1142,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1142 1142
1143 // Let's send a full update of the agent. 1143 // Let's send a full update of the agent.
1144 AgentData agent = new AgentData(); 1144 AgentData agent = new AgentData();
1145 sp.CopyTo(agent); 1145 sp.CopyTo(agent,false);
1146 agent.Position = agentCircuit.startpos; 1146 agent.Position = agentCircuit.startpos;
1147 1147
1148 if ((teleportFlags & (uint)TeleportFlags.IsFlying) != 0) 1148 if ((teleportFlags & (uint)TeleportFlags.IsFlying) != 0)
@@ -1560,7 +1560,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1560 // We need this because of decimal number parsing of the protocols. 1560 // We need this because of decimal number parsing of the protocols.
1561 Culture.SetCurrentCulture(); 1561 Culture.SetCurrentCulture();
1562 1562
1563 Vector3 pos = agent.AbsolutePosition + agent.Velocity; 1563 Vector3 pos = agent.AbsolutePosition + agent.Velocity * 0.2f;
1564 1564
1565 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos, 1565 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos,
1566 ctx, out newpos, out failureReason); 1566 ctx, out newpos, out failureReason);
@@ -1648,17 +1648,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1648 icon.EndInvoke(iar); 1648 icon.EndInvoke(iar);
1649 } 1649 }
1650 1650
1651 public bool CrossAgentToNewRegionPrep(ScenePresence agent, GridRegion neighbourRegion) 1651
1652 {
1653 if (neighbourRegion == null)
1654 return false;
1655
1656 m_entityTransferStateMachine.SetInTransit(agent.UUID);
1657
1658 agent.RemoveFromPhysicalScene();
1659
1660 return true;
1661 }
1662 1652
1663 /// <summary> 1653 /// <summary>
1664 /// This Closes child agents on neighbouring regions 1654 /// This Closes child agents on neighbouring regions
@@ -1673,16 +1663,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1673 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: new region={1} at <{2},{3}>. newpos={4}", 1663 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: new region={1} at <{2},{3}>. newpos={4}",
1674 LogHeader, neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, pos); 1664 LogHeader, neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, pos);
1675 1665
1676 if (!CrossAgentToNewRegionPrep(agent, neighbourRegion)) 1666 if (neighbourRegion == null)
1677 { 1667 {
1678 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: prep failed. Resetting transfer state", LogHeader); 1668 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: invalid destiny", LogHeader);
1679 m_entityTransferStateMachine.ResetFromTransit(agent.UUID); 1669 return agent;
1680 } 1670 }
1681 1671
1672 m_entityTransferStateMachine.SetInTransit(agent.UUID);
1673 agent.RemoveFromPhysicalScene();
1674
1682 if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying, ctx)) 1675 if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying, ctx))
1683 { 1676 {
1684 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader); 1677 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader);
1685 m_entityTransferStateMachine.ResetFromTransit(agent.UUID); 1678 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
1679 return agent;
1686 } 1680 }
1687 1681
1688 CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, ctx); 1682 CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, ctx);
@@ -1701,12 +1695,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1701 try 1695 try
1702 { 1696 {
1703 AgentData cAgent = new AgentData(); 1697 AgentData cAgent = new AgentData();
1704 agent.CopyTo(cAgent); 1698 agent.CopyTo(cAgent,true);
1705 1699
1706// agent.Appearance.WearableCacheItems = null; 1700// agent.Appearance.WearableCacheItems = null;
1707 1701
1708 cAgent.Position = pos; 1702 cAgent.Position = pos;
1709
1710 cAgent.ChildrenCapSeeds = agent.KnownRegions; 1703 cAgent.ChildrenCapSeeds = agent.KnownRegions;
1711 1704
1712 if (isFlying) 1705 if (isFlying)
@@ -1787,15 +1780,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1787 capsPath); 1780 capsPath);
1788 } 1781 }
1789 1782
1790/*
1791 // Backwards compatibility. Best effort
1792 if (version == 0f)
1793 {
1794 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one...");
1795 Thread.Sleep(3000); // wait a little now that we're not waiting for the callback
1796 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1797 }
1798*/
1799 // SUCCESS! 1783 // SUCCESS!
1800 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); 1784 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination);
1801 1785
@@ -1814,18 +1798,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1814 // but not sure yet what the side effects would be. 1798 // but not sure yet what the side effects would be.
1815 m_entityTransferStateMachine.ResetFromTransit(agent.UUID); 1799 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
1816 1800
1817
1818 // TODO: Check since what version this wasn't needed anymore. May be as old as 0.6
1819/*
1820 // Backwards compatibility. Best effort
1821 if (version == 0f)
1822 {
1823 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one...");
1824 Thread.Sleep(3000); // wait a little now that we're not waiting for the callback
1825 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1826 }
1827*/
1828
1829 // the user may change their profile information in other region, 1801 // the user may change their profile information in other region,
1830 // so the userinfo in UserProfileCache is not reliable any more, delete it 1802 // so the userinfo in UserProfileCache is not reliable any more, delete it
1831 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! 1803 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
@@ -2080,66 +2052,63 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2080 sp.KnownRegions = seeds; 2052 sp.KnownRegions = seeds;
2081 sp.SetNeighbourRegionSizeInfo(neighbours); 2053 sp.SetNeighbourRegionSizeInfo(neighbours);
2082 2054
2083 AgentPosition agentpos = new AgentPosition(); 2055 if(newneighbours.Count > 0 || previousRegionNeighbourHandles.Count > 0)
2084 agentpos.AgentID = new UUID(sp.UUID.Guid);
2085 agentpos.SessionID = spClient.SessionId;
2086 agentpos.Size = sp.Appearance.AvatarSize;
2087 agentpos.Center = sp.CameraPosition;
2088 agentpos.Far = sp.DrawDistance;
2089 agentpos.Position = sp.AbsolutePosition;
2090 agentpos.Velocity = sp.Velocity;
2091 agentpos.RegionHandle = currentRegionHandler;
2092 agentpos.Throttles = spClient.GetThrottlesPacked(1);
2093 // agentpos.ChildrenCapSeeds = seeds;
2094
2095 Util.FireAndForget(delegate
2096 { 2056 {
2097 Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start 2057 AgentPosition agentpos = new AgentPosition();
2098 int count = 0; 2058 agentpos.AgentID = new UUID(sp.UUID.Guid);
2059 agentpos.SessionID = spClient.SessionId;
2060 agentpos.Size = sp.Appearance.AvatarSize;
2061 agentpos.Center = sp.CameraPosition;
2062 agentpos.Far = sp.DrawDistance;
2063 agentpos.Position = sp.AbsolutePosition;
2064 agentpos.Velocity = sp.Velocity;
2065 agentpos.RegionHandle = currentRegionHandler;
2066 agentpos.Throttles = spClient.GetThrottlesPacked(1);
2067 // agentpos.ChildrenCapSeeds = seeds;
2099 2068
2100 foreach (GridRegion neighbour in neighbours) 2069 Util.FireAndForget(delegate
2101 { 2070 {
2102 ulong handler = neighbour.RegionHandle; 2071 Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start
2103 try 2072 int count = 0;
2073
2074 foreach (GridRegion neighbour in neighbours)
2104 { 2075 {
2105 if (newneighbours.Contains(handler)) 2076 ulong handler = neighbour.RegionHandle;
2077 try
2106 { 2078 {
2107 InformClientOfNeighbourAsync(sp, cagents[count], neighbour, 2079 if (newneighbours.Contains(handler))
2108 neighbour.ExternalEndPoint, true); 2080 {
2109 count++; 2081 InformClientOfNeighbourAsync(sp, cagents[count], neighbour,
2082 neighbour.ExternalEndPoint, true);
2083 count++;
2084 }
2085 else if (!previousRegionNeighbourHandles.Contains(handler))
2086 {
2087 spScene.SimulationService.UpdateAgent(neighbour, agentpos);
2088 }
2110 } 2089 }
2111 else if (!previousRegionNeighbourHandles.Contains(handler)) 2090 catch (ArgumentOutOfRangeException)
2112 { 2091 {
2113 spScene.SimulationService.UpdateAgent(neighbour, agentpos); 2092 m_log.ErrorFormat(
2093 "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).",
2094 neighbour.ExternalHostName,
2095 neighbour.RegionHandle,
2096 neighbour.RegionLocX,
2097 neighbour.RegionLocY);
2098 }
2099 catch (Exception e)
2100 {
2101 m_log.ErrorFormat(
2102 "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}",
2103 neighbour.ExternalHostName,
2104 neighbour.RegionHandle,
2105 neighbour.RegionLocX,
2106 neighbour.RegionLocY,
2107 e);
2114 } 2108 }
2115 } 2109 }
2116 catch (ArgumentOutOfRangeException) 2110 });
2117 { 2111 }
2118 m_log.ErrorFormat(
2119 "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).",
2120 neighbour.ExternalHostName,
2121 neighbour.RegionHandle,
2122 neighbour.RegionLocX,
2123 neighbour.RegionLocY);
2124 }
2125 catch (Exception e)
2126 {
2127 m_log.ErrorFormat(
2128 "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}",
2129 neighbour.ExternalHostName,
2130 neighbour.RegionHandle,
2131 neighbour.RegionLocX,
2132 neighbour.RegionLocY,
2133 e);
2134
2135 // FIXME: Okay, even though we've failed, we're still going to throw the exception on,
2136 // since I don't know what will happen if we just let the client continue
2137
2138 // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes.
2139 // throw e;
2140 }
2141 }
2142 });
2143 } 2112 }
2144 2113
2145 // Computes the difference between two region bases. 2114 // Computes the difference between two region bases.
@@ -2534,11 +2503,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2534 if (newRegionSizeY == 0) 2503 if (newRegionSizeY == 0)
2535 newRegionSizeY = Constants.RegionSize; 2504 newRegionSizeY = Constants.RegionSize;
2536 2505
2537
2538 newpos.X = targetPosition.X - (neighbourRegion.RegionLocX - (int)scene.RegionInfo.WorldLocX); 2506 newpos.X = targetPosition.X - (neighbourRegion.RegionLocX - (int)scene.RegionInfo.WorldLocX);
2539 newpos.Y = targetPosition.Y - (neighbourRegion.RegionLocY - (int)scene.RegionInfo.WorldLocY); 2507 newpos.Y = targetPosition.Y - (neighbourRegion.RegionLocY - (int)scene.RegionInfo.WorldLocY);
2540 2508
2541
2542 const float enterDistance = 0.2f; 2509 const float enterDistance = 0.2f;
2543 newpos.X = Util.Clamp(newpos.X, enterDistance, newRegionSizeX - enterDistance); 2510 newpos.X = Util.Clamp(newpos.X, enterDistance, newRegionSizeX - enterDistance);
2544 newpos.Y = Util.Clamp(newpos.Y, enterDistance, newRegionSizeY - enterDistance); 2511 newpos.Y = Util.Clamp(newpos.Y, enterDistance, newRegionSizeY - enterDistance);
@@ -2546,72 +2513,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2546 return neighbourRegion; 2513 return neighbourRegion;
2547 } 2514 }
2548 2515
2549/* not in use. -> CrossPrimGroupIntoNewRegion
2550 /// <summary>
2551 /// Move the given scene object into a new region depending on which region its absolute position has moved
2552 /// into.
2553 ///
2554 /// Using the objects new world location, ask the grid service for a the new region and adjust the prim
2555 /// position to be relative to the new region.
2556 /// </summary>
2557 /// <param name="grp">the scene object that we're crossing</param>
2558 /// <param name="attemptedPosition">the attempted out of region position of the scene object. This position is
2559 /// relative to the region the object currently is in.</param>
2560 /// <param name="silent">if 'true', the deletion of the client from the region is not broadcast to the clients</param>
2561 public void Cross(SceneObjectGroup grp, Vector3 attemptedPosition, bool silent)
2562 {
2563 if (grp == null)
2564 return;
2565 if (grp.IsDeleted)
2566 return;
2567
2568 Scene scene = grp.Scene;
2569 if (scene == null)
2570 return;
2571
2572 // Remember the old group position in case the region lookup fails so position can be restored.
2573 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
2574
2575 // Compute the absolute position of the object.
2576 double objectWorldLocX = (double)scene.RegionInfo.WorldLocX + attemptedPosition.X;
2577 double objectWorldLocY = (double)scene.RegionInfo.WorldLocY + attemptedPosition.Y;
2578
2579 // Ask the grid service for the region that contains the passed address
2580 GridRegion destination = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID,
2581 objectWorldLocX, objectWorldLocY);
2582
2583 Vector3 pos = Vector3.Zero;
2584 if (destination != null)
2585 {
2586 // Adjust the object's relative position from the old region (attemptedPosition)
2587 // to be relative to the new region (pos).
2588 pos = new Vector3( (float)(objectWorldLocX - (double)destination.RegionLocX),
2589 (float)(objectWorldLocY - (double)destination.RegionLocY),
2590 attemptedPosition.Z);
2591 }
2592
2593 if (destination == null || !CrossPrimGroupIntoNewRegion(destination, pos, grp, silent))
2594 {
2595 m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}", grp.UUID);
2596
2597 // We are going to move the object back to the old position so long as the old position
2598 // is in the region
2599 oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X, 1.0f, (float)(scene.RegionInfo.RegionSizeX - 1));
2600 oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y, 1.0f, (float)(scene.RegionInfo.RegionSizeY - 1));
2601 oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z, 1.0f, Constants.RegionHeight);
2602
2603 grp.AbsolutePosition = oldGroupPosition;
2604 grp.Velocity = Vector3.Zero;
2605 if (grp.RootPart.PhysActor != null)
2606 grp.RootPart.PhysActor.CrossingFailure();
2607
2608 if (grp.RootPart.KeyframeMotion != null)
2609 grp.RootPart.KeyframeMotion.CrossingFailure();
2610
2611 grp.ScheduleGroupForFullUpdate();
2612 }
2613 }
2614*/
2615 /// <summary> 2516 /// <summary>
2616 /// Move the given scene object into a new region 2517 /// Move the given scene object into a new region
2617 /// </summary> 2518 /// </summary>
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 781b9ff..8c560e5 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -867,6 +867,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
867 return null; 867 return null;
868 } 868 }
869 869
870 if(rezAsset.Data == null || rezAsset.Data.Length == 0)
871 {
872 m_log.WarnFormat(
873 "[INVENTORY ACCESS MODULE]: missing data in asset {0} to RezObject()",
874 assetID, remoteClient.Name);
875 remoteClient.SendAgentAlertMessage(string.Format("Unable to rez: missing data in asset {0} ", assetID), false);
876 return null;
877 }
878
870 SceneObjectGroup group = null; 879 SceneObjectGroup group = null;
871 880
872 List<SceneObjectGroup> objlist; 881 List<SceneObjectGroup> objlist;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
index 2238c90..98ccc95 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
@@ -63,18 +63,31 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
63 scene.EventManager.OnNewClient -= OnNewClient; 63 scene.EventManager.OnNewClient -= OnNewClient;
64 } 64 }
65 65
66 public void OnMakeRootAgent(ScenePresence sp) 66 public void OnMakeRootAgent(ScenePresence sp)
67 { 67 {
68 if (sp.PresenceType != PresenceType.Npc) 68 if (sp.isNPC)
69 return;
70
71 if(sp.gotCrossUpdate)
69 { 72 {
70 string userid; 73 Util.FireAndForget(delegate
71 //m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", userid, sp.Scene.RegionInfo.RegionName);
72 if (sp.Scene.UserManagementModule.GetUserUUI(sp.UUID, out userid))
73 { 74 {
74 /* we only setposition on known agents that have a valid lookup */ 75 DoOnMakeRootAgent(sp);
75 m_GridUserService.SetLastPosition( 76 }, null, "ActivityDetector_MakeRoot");
76 userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 77 }
77 } 78 else
79 DoOnMakeRootAgent(sp);
80 }
81
82 public void DoOnMakeRootAgent(ScenePresence sp)
83 {
84 string userid;
85 //m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", userid, sp.Scene.RegionInfo.RegionName);
86 if (sp.Scene.UserManagementModule.GetUserUUI(sp.UUID, out userid))
87 {
88 /* we only setposition on known agents that have a valid lookup */
89 m_GridUserService.SetLastPosition(
90 userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
78 } 91 }
79 } 92 }
80 93
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
index 50c252c..117f02c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
@@ -68,6 +68,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
68 68
69 public void OnMakeRootAgent(ScenePresence sp) 69 public void OnMakeRootAgent(ScenePresence sp)
70 { 70 {
71 if (sp.isNPC)
72 return;
73
74 if(sp.gotCrossUpdate)
75 {
76 Util.FireAndForget(delegate
77 {
78 DoOnMakeRootAgent(sp);
79 }, null, "PresenceDetector_MakeRoot");
80 }
81 else
82 DoOnMakeRootAgent(sp);
83 }
84
85 public void DoOnMakeRootAgent(ScenePresence sp)
86 {
71// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); 87// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
72 if (sp.PresenceType != PresenceType.Npc) 88 if (sp.PresenceType != PresenceType.Npc)
73 m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID); 89 m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID);
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 95b576f..4324ddc 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1289,35 +1289,34 @@ namespace OpenSim.Region.CoreModules.World.Land
1289 bool needOverlay = false; 1289 bool needOverlay = false;
1290 if (land.UpdateLandProperties(args, remote_client, out snap_selection, out needOverlay)) 1290 if (land.UpdateLandProperties(args, remote_client, out snap_selection, out needOverlay))
1291 { 1291 {
1292 //the proprieties to who changed them
1293 ScenePresence av = m_scene.GetScenePresence(remote_client.AgentId);
1294 if(av.IsChildAgent || land != GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y))
1295 land.SendLandProperties(-10000, false, LandChannel.LAND_RESULT_SINGLE, remote_client);
1296 else
1297 land.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, remote_client);
1298
1299 UUID parcelID = land.LandData.GlobalID; 1292 UUID parcelID = land.LandData.GlobalID;
1300 m_scene.ForEachScenePresence(delegate(ScenePresence avatar) 1293 m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
1301 { 1294 {
1302 if (avatar.IsDeleted || avatar.isNPC) 1295 if (avatar.IsDeleted || avatar.isNPC)
1303 return; 1296 return;
1304 1297
1305 IClientAPI client = avatar.ControllingClient; 1298 IClientAPI client = avatar.ControllingClient;
1306 if (needOverlay) 1299 if (needOverlay)
1307 SendParcelOverlay(client); 1300 SendParcelOverlay(client);
1308 1301
1309 if (avatar.IsChildAgent) 1302 if (avatar.IsChildAgent)
1310 return; 1303 {
1304 if(client == remote_client)
1305 land.SendLandProperties(-10000, false, LandChannel.LAND_RESULT_SINGLE, client);
1306 return;
1307 }
1311 1308
1312 ILandObject aland = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 1309 ILandObject aland = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
1313 if (aland != null) 1310 if (aland != null)
1314 { 1311 {
1315 if (client != remote_client && land == aland) 1312 if(client == remote_client && land != aland)
1313 land.SendLandProperties(-10000, false, LandChannel.LAND_RESULT_SINGLE, client);
1314 else if (land == aland)
1316 aland.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, client); 1315 aland.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, client);
1317 } 1316 }
1318 if (avatar.currentParcelUUID == parcelID) 1317 if (avatar.currentParcelUUID == parcelID)
1319 avatar.currentParcelUUID = parcelID; // force parcel flags review 1318 avatar.currentParcelUUID = parcelID; // force parcel flags review
1320 }); 1319 });
1321 } 1320 }
1322 } 1321 }
1323 1322
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 4cea7bb..b00f2b0 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -374,6 +374,10 @@ namespace OpenSim.Region.CoreModules.World.Land
374 374
375 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) 375 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
376 { 376 {
377 remote_client.SceneAgent.Invulnerable =
378 !m_scene.RegionInfo.RegionSettings.AllowDamage ||
379 (m_landData.Flags & (uint)ParcelFlags.AllowDamage) == 0;
380
377 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) 381 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc)
378 return; 382 return;
379 383
diff --git a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs
index 4361310..b525769 100644
--- a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Interfaces
56 uint timeStamp, bool offline, int parentEstateID, Vector3 position, 56 uint timeStamp, bool offline, int parentEstateID, Vector3 position,
57 uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket); 57 uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket);
58 void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID anotherAgent, bool canVoiceChat, 58 void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID anotherAgent, bool canVoiceChat,
59 bool isModerator, bool textMute); 59 bool isModerator, bool textMute, bool isEnterorLeave);
60 void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID); 60 void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID);
61 void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data); 61 void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data);
62 OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono); 62 OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono);
diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
index 7e87006..5c43b36 100644
--- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
@@ -28,6 +28,7 @@
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenMetaverse; 29using OpenMetaverse;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes;
31using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 32using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
32 33
33namespace OpenSim.Region.Framework.Interfaces 34namespace OpenSim.Region.Framework.Interfaces
@@ -93,6 +94,7 @@ namespace OpenSim.Region.Framework.Interfaces
93 /// <param name="perms">These come from the FriendRights enum.</param> 94 /// <param name="perms">These come from the FriendRights enum.</param>
94 void GrantRights(IClientAPI remoteClient, UUID friendID, int perms); 95 void GrantRights(IClientAPI remoteClient, UUID friendID, int perms);
95 96
97 void IsNpwRoot(ScenePresence sp);
96 bool SendFriendsOnlineIfNeeded(IClientAPI client); 98 bool SendFriendsOnlineIfNeeded(IClientAPI client);
97 } 99 }
98} \ No newline at end of file 100} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index d556fd1..efc1413 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -346,9 +346,6 @@ namespace OpenSim.Region.Framework.Scenes
346 get { return RootPart.VolumeDetectActive; } 346 get { return RootPart.VolumeDetectActive; }
347 } 347 }
348 348
349 private Vector3 lastPhysGroupPos;
350 private Quaternion lastPhysGroupRot;
351
352 /// <summary> 349 /// <summary>
353 /// Is this entity set to be saved in persistent storage? 350 /// Is this entity set to be saved in persistent storage?
354 /// </summary> 351 /// </summary>
@@ -702,10 +699,23 @@ namespace OpenSim.Region.Framework.Scenes
702 699
703 foreach (ScenePresence av in sog.m_sittingAvatars) 700 foreach (ScenePresence av in sog.m_sittingAvatars)
704 { 701 {
702 byte cflags = 1;
703
705 avtocrossInfo avinfo = new avtocrossInfo(); 704 avtocrossInfo avinfo = new avtocrossInfo();
706 SceneObjectPart parentPart = sogScene.GetSceneObjectPart(av.ParentID); 705 SceneObjectPart parentPart = sogScene.GetSceneObjectPart(av.ParentID);
707 if (parentPart != null) 706 if (parentPart != null)
707 {
708 av.ParentUUID = parentPart.UUID; 708 av.ParentUUID = parentPart.UUID;
709 if(parentPart.SitTargetAvatar == av.UUID)
710 cflags = 7; // low 3 bits set
711 else
712 cflags = 3;
713 }
714
715 // 1 is crossing
716 // 2 is sitting
717 // 4 is sitting at sittarget
718 av.crossingFlags = cflags;
709 719
710 avinfo.av = av; 720 avinfo.av = av;
711 avinfo.ParentID = av.ParentID; 721 avinfo.ParentID = av.ParentID;
@@ -750,7 +760,7 @@ namespace OpenSim.Region.Framework.Scenes
750 av.ParentUUID = UUID.Zero; 760 av.ParentUUID = UUID.Zero;
751 // In any case 761 // In any case
752 av.IsInTransit = false; 762 av.IsInTransit = false;
753 763 av.crossingFlags = 0;
754 m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); 764 m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname);
755 } 765 }
756 else 766 else
@@ -768,6 +778,7 @@ namespace OpenSim.Region.Framework.Scenes
768 ScenePresence av = avinfo.av; 778 ScenePresence av = avinfo.av;
769 av.ParentUUID = UUID.Zero; 779 av.ParentUUID = UUID.Zero;
770 av.ParentID = avinfo.ParentID; 780 av.ParentID = avinfo.ParentID;
781 av.crossingFlags = 0;
771 } 782 }
772 } 783 }
773 avsToCross.Clear(); 784 avsToCross.Clear();
@@ -1228,13 +1239,6 @@ namespace OpenSim.Region.Framework.Scenes
1228 1239
1229 ApplyPhysics(); 1240 ApplyPhysics();
1230 1241
1231 if (RootPart.PhysActor != null)
1232 RootPart.Force = RootPart.Force;
1233 if (RootPart.PhysActor != null)
1234 RootPart.Torque = RootPart.Torque;
1235 if (RootPart.PhysActor != null)
1236 RootPart.Buoyancy = RootPart.Buoyancy;
1237
1238 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled 1242 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
1239 // for the same object with very different properties. The caller must schedule the update. 1243 // for the same object with very different properties. The caller must schedule the update.
1240 //ScheduleGroupForFullUpdate(); 1244 //ScheduleGroupForFullUpdate();
@@ -2166,10 +2170,9 @@ namespace OpenSim.Region.Framework.Scenes
2166 } 2170 }
2167 // Hack to get the physics scene geometries in the right spot 2171 // Hack to get the physics scene geometries in the right spot
2168// ResetChildPrimPhysicsPositions(); 2172// ResetChildPrimPhysicsPositions();
2173
2169 if (m_rootPart.PhysActor != null) 2174 if (m_rootPart.PhysActor != null)
2170 {
2171 m_rootPart.PhysActor.Building = false; 2175 m_rootPart.PhysActor.Building = false;
2172 }
2173 } 2176 }
2174 else 2177 else
2175 { 2178 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index a46232c..0b8076a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2213,7 +2213,7 @@ namespace OpenSim.Region.Framework.Scenes
2213 dupe.Shape.ExtraParams = extraP; 2213 dupe.Shape.ExtraParams = extraP;
2214 2214
2215 dupe.m_sittingAvatars = new HashSet<ScenePresence>(); 2215 dupe.m_sittingAvatars = new HashSet<ScenePresence>();
2216 2216 dupe.SitTargetAvatar = UUID.Zero;
2217 // safeguard actual copy is done in sog.copy 2217 // safeguard actual copy is done in sog.copy
2218 dupe.KeyframeMotion = null; 2218 dupe.KeyframeMotion = null;
2219 dupe.PayPrice = (int[])PayPrice.Clone(); 2219 dupe.PayPrice = (int[])PayPrice.Clone();
@@ -4883,6 +4883,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4883 pa.GravModifier = GravityModifier; 4883 pa.GravModifier = GravityModifier;
4884 pa.Friction = Friction; 4884 pa.Friction = Friction;
4885 pa.Restitution = Restitution; 4885 pa.Restitution = Restitution;
4886 pa.Buoyancy = Buoyancy;
4886 4887
4887 if(LocalId == ParentGroup.RootPart.LocalId) 4888 if(LocalId == ParentGroup.RootPart.LocalId)
4888 { 4889 {
@@ -4927,7 +4928,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4927 { 4928 {
4928 Velocity = velocity; 4929 Velocity = velocity;
4929 AngularVelocity = rotationalVelocity; 4930 AngularVelocity = rotationalVelocity;
4930 pa.RotationalVelocity = rotationalVelocity;
4931 4931
4932 // if not vehicle and root part apply force and torque 4932 // if not vehicle and root part apply force and torque
4933 if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE)) 4933 if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE))
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f20d065..3167282 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -277,6 +277,7 @@ namespace OpenSim.Region.Framework.Scenes
277 private Quaternion m_lastRotation; 277 private Quaternion m_lastRotation;
278 private Vector3 m_lastVelocity; 278 private Vector3 m_lastVelocity;
279 private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); 279 private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f);
280 private bool SentInitialData = false;
280 281
281 private bool m_followCamAuto = false; 282 private bool m_followCamAuto = false;
282 283
@@ -342,8 +343,10 @@ namespace OpenSim.Region.Framework.Scenes
342 private const float FLY_ROLL_RESET_RADIANS_PER_UPDATE = 0.02f; 343 private const float FLY_ROLL_RESET_RADIANS_PER_UPDATE = 0.02f;
343 344
344 private float m_health = 100f; 345 private float m_health = 100f;
346 private float m_healRate = 1f;
347 private float m_healRatePerFrame = 0.05f;
345 348
346 protected ulong crossingFromRegion; 349// protected ulong crossingFromRegion;
347 350
348 private readonly Vector3[] Dir_Vectors = new Vector3[12]; 351 private readonly Vector3[] Dir_Vectors = new Vector3[12];
349 352
@@ -565,19 +568,17 @@ namespace OpenSim.Region.Framework.Scenes
565 public string Firstname { get; private set; } 568 public string Firstname { get; private set; }
566 public string Lastname { get; private set; } 569 public string Lastname { get; private set; }
567 570
571 public bool haveGroupInformation;
572 public bool gotCrossUpdate;
573 public byte crossingFlags;
574
568 public string Grouptitle 575 public string Grouptitle
569 { 576 {
570 get { return UseFakeGroupTitle ? "(Loading)" : m_groupTitle; } 577 get { return m_groupTitle; }
571 set { m_groupTitle = value; } 578 set { m_groupTitle = value; }
572 } 579 }
573 private string m_groupTitle; 580 private string m_groupTitle;
574 581
575 /// <summary>
576 /// When this is 'true', return a dummy group title instead of the real group title. This is
577 /// used as part of a hack to force viewers to update the displayed avatar name.
578 /// </summary>
579 public bool UseFakeGroupTitle { get; set; }
580
581 // Agent's Draw distance. 582 // Agent's Draw distance.
582 private float m_drawDistance = 255f; 583 private float m_drawDistance = 255f;
583 public float DrawDistance 584 public float DrawDistance
@@ -860,6 +861,26 @@ namespace OpenSim.Region.Framework.Scenes
860 set { m_health = value; } 861 set { m_health = value; }
861 } 862 }
862 863
864 public float HealRate
865 {
866 get { return m_healRate; }
867 set
868 {
869 if(value > 100.0f)
870 m_healRate = 100.0f;
871 else if (value <= 0.0)
872 m_healRate = 0.0f;
873 else
874 m_healRate = value;
875
876 if(Scene != null)
877 m_healRatePerFrame = m_healRate * Scene.FrameTime;
878 else
879 m_healRatePerFrame = 0.05f;
880 }
881 }
882
883
863 /// <summary> 884 /// <summary>
864 /// Gets the world rotation of this presence. 885 /// Gets the world rotation of this presence.
865 /// </summary> 886 /// </summary>
@@ -1039,9 +1060,9 @@ namespace OpenSim.Region.Framework.Scenes
1039 if (account != null) 1060 if (account != null)
1040 UserLevel = account.UserLevel; 1061 UserLevel = account.UserLevel;
1041 1062
1042 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 1063 // IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
1043 if (gm != null) 1064 // if (gm != null)
1044 Grouptitle = gm.GetGroupTitle(m_uuid); 1065 // Grouptitle = gm.GetGroupTitle(m_uuid);
1045 1066
1046 m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); 1067 m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>();
1047 1068
@@ -1063,6 +1084,8 @@ namespace OpenSim.Region.Framework.Scenes
1063 1084
1064 m_stateMachine = new ScenePresenceStateMachine(this); 1085 m_stateMachine = new ScenePresenceStateMachine(this);
1065 1086
1087 HealRate = 0.5f;
1088
1066 IConfig sconfig = m_scene.Config.Configs["EntityTransfer"]; 1089 IConfig sconfig = m_scene.Config.Configs["EntityTransfer"];
1067 if (sconfig != null) 1090 if (sconfig != null)
1068 { 1091 {
@@ -1073,6 +1096,8 @@ namespace OpenSim.Region.Framework.Scenes
1073 1096
1074 } 1097 }
1075 1098
1099 private float lastHealthSent = 0;
1100
1076 private void RegionHeartbeatEnd(Scene scene) 1101 private void RegionHeartbeatEnd(Scene scene)
1077 { 1102 {
1078 if (IsChildAgent) 1103 if (IsChildAgent)
@@ -1095,7 +1120,24 @@ namespace OpenSim.Region.Framework.Scenes
1095 } 1120 }
1096 else 1121 else
1097 { 1122 {
1098 m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; 1123// m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd;
1124 }
1125 }
1126
1127 if(m_healRatePerFrame != 0f && Health != 100.0f)
1128 {
1129 float last = Health;
1130 Health += m_healRatePerFrame;
1131 if(Health > 100.0f)
1132 {
1133 Health = 100.0f;
1134 lastHealthSent = Health;
1135 ControllingClient.SendHealth(Health);
1136 }
1137 else if(Math.Abs(Health - lastHealthSent) > 1.0)
1138 {
1139 lastHealthSent = Health;
1140 ControllingClient.SendHealth(Health);
1099 } 1141 }
1100 } 1142 }
1101 } 1143 }
@@ -1190,8 +1232,10 @@ namespace OpenSim.Region.Framework.Scenes
1190 else 1232 else
1191 { 1233 {
1192 part.AddSittingAvatar(this); 1234 part.AddSittingAvatar(this);
1193 if (part.SitTargetPosition != Vector3.Zero) 1235 // if not actually on the target invalidate it
1194 part.SitTargetAvatar = UUID; 1236 if(gotCrossUpdate && (crossingFlags & 0x04) == 0)
1237 part.SitTargetAvatar = UUID.Zero;
1238
1195 ParentID = part.LocalId; 1239 ParentID = part.LocalId;
1196 ParentPart = part; 1240 ParentPart = part;
1197 m_pos = PrevSitOffset; 1241 m_pos = PrevSitOffset;
@@ -1214,11 +1258,6 @@ namespace OpenSim.Region.Framework.Scenes
1214 // Should not be needed if we are not trying to tell this region to close 1258 // Should not be needed if we are not trying to tell this region to close
1215 // DoNotCloseAfterTeleport = false; 1259 // DoNotCloseAfterTeleport = false;
1216 1260
1217 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
1218 if (gm != null)
1219 Grouptitle = gm.GetGroupTitle(m_uuid);
1220
1221 m_log.DebugFormat("[MakeRootAgent] Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1222 1261
1223 RegionHandle = m_scene.RegionInfo.RegionHandle; 1262 RegionHandle = m_scene.RegionInfo.RegionHandle;
1224 1263
@@ -1467,6 +1506,9 @@ namespace OpenSim.Region.Framework.Scenes
1467 /// </remarks> 1506 /// </remarks>
1468 public void MakeChildAgent(ulong newRegionHandle) 1507 public void MakeChildAgent(ulong newRegionHandle)
1469 { 1508 {
1509 haveGroupInformation = false;
1510 gotCrossUpdate = false;
1511 crossingFlags = 0;
1470 m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; 1512 m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd;
1471 1513
1472 RegionHandle = newRegionHandle; 1514 RegionHandle = newRegionHandle;
@@ -1934,25 +1976,29 @@ namespace OpenSim.Region.Framework.Scenes
1934 1976
1935 m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1977 m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1936 1978
1979 if(!haveGroupInformation && !IsChildAgent && !isNPC)
1980 {
1981 // oh crap.. lets retry it directly
1982 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
1983 if (gm != null)
1984 Grouptitle = gm.GetGroupTitle(m_uuid);
1937 1985
1938// start sending terrain patchs 1986 m_log.DebugFormat("[CompleteMovement] Missing Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1939 if (!isNPC)
1940 Scene.SendLayerData(ControllingClient);
1941 1987
1942 if (!IsChildAgent && !isNPC)
1943 {
1944 InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); 1988 InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46);
1945 if (cof == null) 1989 if (cof == null)
1946 COF = UUID.Zero; 1990 COF = UUID.Zero;
1947 else 1991 else
1948 COF = cof.ID; 1992 COF = cof.ID;
1949 1993
1950 m_log.DebugFormat("[ScenePresence]: CompleteMovement COF for {0} is {1}", client.AgentId, COF); 1994 m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF);
1951 } 1995 }
1952 1996
1997
1953 // Tell the client that we're totally ready 1998 // Tell the client that we're totally ready
1954 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1999 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1955 2000
2001
1956 m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2002 m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1957 2003
1958 if (!string.IsNullOrEmpty(m_callbackURI)) 2004 if (!string.IsNullOrEmpty(m_callbackURI))
@@ -1985,6 +2031,10 @@ namespace OpenSim.Region.Framework.Scenes
1985 2031
1986 m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2032 m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1987 2033
2034// start sending terrain patchs
2035 if (!gotCrossUpdate && !isNPC)
2036 Scene.SendLayerData(ControllingClient);
2037
1988 m_previusParcelHide = false; 2038 m_previusParcelHide = false;
1989 m_previusParcelUUID = UUID.Zero; 2039 m_previusParcelUUID = UUID.Zero;
1990 m_currentParcelHide = false; 2040 m_currentParcelHide = false;
@@ -2143,8 +2193,12 @@ namespace OpenSim.Region.Framework.Scenes
2143 { 2193 {
2144 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); 2194 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
2145 if (friendsModule != null) 2195 if (friendsModule != null)
2146 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 2196 {
2147 2197 if(gotCrossUpdate)
2198 friendsModule.IsNpwRoot(this);
2199 else
2200 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
2201 }
2148 m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2202 m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2149 2203
2150 } 2204 }
@@ -2160,6 +2214,10 @@ namespace OpenSim.Region.Framework.Scenes
2160 // m_currentParcelHide = newhide; 2214 // m_currentParcelHide = newhide;
2161 // } 2215 // }
2162 2216
2217 haveGroupInformation = true;
2218 gotCrossUpdate = false;
2219 crossingFlags = 0;
2220
2163 m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd; 2221 m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd;
2164 2222
2165 m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2223 m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@@ -3114,6 +3172,7 @@ namespace OpenSim.Region.Framework.Scenes
3114 ResetMoveToTarget(); 3172 ResetMoveToTarget();
3115 3173
3116 Velocity = Vector3.Zero; 3174 Velocity = Vector3.Zero;
3175 m_AngularVelocity = Vector3.Zero;
3117 3176
3118 part.AddSittingAvatar(this); 3177 part.AddSittingAvatar(this);
3119 3178
@@ -3439,9 +3498,10 @@ namespace OpenSim.Region.Framework.Scenes
3439 part.AddSittingAvatar(this); 3498 part.AddSittingAvatar(this);
3440 ParentPart = part; 3499 ParentPart = part;
3441 ParentID = m_requestedSitTargetID; 3500 ParentID = m_requestedSitTargetID;
3501
3502 RemoveFromPhysicalScene();
3442 m_AngularVelocity = Vector3.Zero; 3503 m_AngularVelocity = Vector3.Zero;
3443 Velocity = Vector3.Zero; 3504 Velocity = Vector3.Zero;
3444 RemoveFromPhysicalScene();
3445 3505
3446 m_requestedSitTargetID = 0; 3506 m_requestedSitTargetID = 0;
3447 3507
@@ -3464,13 +3524,15 @@ namespace OpenSim.Region.Framework.Scenes
3464 return; 3524 return;
3465 3525
3466// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. 3526// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick..
3467 m_AngularVelocity = Vector3.Zero;
3468 sitAnimation = "SIT_GROUND_CONSTRAINED"; 3527 sitAnimation = "SIT_GROUND_CONSTRAINED";
3469// Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); 3528// Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
3470// TriggerScenePresenceUpdated(); 3529// TriggerScenePresenceUpdated();
3471 SitGround = true; 3530 SitGround = true;
3472 RemoveFromPhysicalScene(); 3531 RemoveFromPhysicalScene();
3473 3532
3533 m_AngularVelocity = Vector3.Zero;
3534 Velocity = Vector3.Zero;
3535
3474 Animator.SetMovementAnimations("SITGROUND"); 3536 Animator.SetMovementAnimations("SITGROUND");
3475 TriggerScenePresenceUpdated(); 3537 TriggerScenePresenceUpdated();
3476 } 3538 }
@@ -3758,6 +3820,7 @@ namespace OpenSim.Region.Framework.Scenes
3758 public void SendInitialDataToMe() 3820 public void SendInitialDataToMe()
3759 { 3821 {
3760 // Send all scene object to the new client 3822 // Send all scene object to the new client
3823 SentInitialData = true;
3761 Util.FireAndForget(delegate 3824 Util.FireAndForget(delegate
3762 { 3825 {
3763 // we created a new ScenePresence (a new child agent) in a fresh region. 3826 // we created a new ScenePresence (a new child agent) in a fresh region.
@@ -3993,6 +4056,12 @@ namespace OpenSim.Region.Framework.Scenes
3993 if(IsDeleted || !ControllingClient.IsActive) 4056 if(IsDeleted || !ControllingClient.IsActive)
3994 return; 4057 return;
3995 4058
4059 if(!SentInitialData)
4060 {
4061 SendInitialDataToMe();
4062 return;
4063 }
4064
3996 if(m_reprioritizationBusy) 4065 if(m_reprioritizationBusy)
3997 return; 4066 return;
3998 4067
@@ -4142,19 +4211,21 @@ namespace OpenSim.Region.Framework.Scenes
4142 { 4211 {
4143 // we don't have entity transfer module 4212 // we don't have entity transfer module
4144 Vector3 pos = AbsolutePosition; 4213 Vector3 pos = AbsolutePosition;
4214 vel = Velocity;
4145 float px = pos.X; 4215 float px = pos.X;
4146 if (px < 0) 4216 if (px < 0)
4147 pos.X += Velocity.X * 2; 4217 pos.X += vel.X * 2;
4148 else if (px > m_scene.RegionInfo.RegionSizeX) 4218 else if (px > m_scene.RegionInfo.RegionSizeX)
4149 pos.X -= Velocity.X * 2; 4219 pos.X -= vel.X * 2;
4150 4220
4151 float py = pos.Y; 4221 float py = pos.Y;
4152 if (py < 0) 4222 if (py < 0)
4153 pos.Y += Velocity.Y * 2; 4223 pos.Y += vel.Y * 2;
4154 else if (py > m_scene.RegionInfo.RegionSizeY) 4224 else if (py > m_scene.RegionInfo.RegionSizeY)
4155 pos.Y -= Velocity.Y * 2; 4225 pos.Y -= vel.Y * 2;
4156 4226
4157 Velocity = Vector3.Zero; 4227 Velocity = Vector3.Zero;
4228 m_AngularVelocity = Vector3.Zero;
4158 AbsolutePosition = pos; 4229 AbsolutePosition = pos;
4159 } 4230 }
4160 } 4231 }
@@ -4167,19 +4238,21 @@ namespace OpenSim.Region.Framework.Scenes
4167 RemoveFromPhysicalScene(); 4238 RemoveFromPhysicalScene();
4168 4239
4169 Vector3 pos = AbsolutePosition; 4240 Vector3 pos = AbsolutePosition;
4241 Vector3 vel = Velocity;
4170 float px = pos.X; 4242 float px = pos.X;
4171 if (px < 0) 4243 if (px < 0)
4172 pos.X += Velocity.X * 2; 4244 pos.X += vel.X * 2;
4173 else if (px > m_scene.RegionInfo.RegionSizeX) 4245 else if (px > m_scene.RegionInfo.RegionSizeX)
4174 pos.X -= Velocity.X * 2; 4246 pos.X -= vel.X * 2;
4175 4247
4176 float py = pos.Y; 4248 float py = pos.Y;
4177 if (py < 0) 4249 if (py < 0)
4178 pos.Y += Velocity.Y * 2; 4250 pos.Y += vel.Y * 2;
4179 else if (py > m_scene.RegionInfo.RegionSizeY) 4251 else if (py > m_scene.RegionInfo.RegionSizeY)
4180 pos.Y -= Velocity.Y * 2; 4252 pos.Y -= vel.Y * 2;
4181 4253
4182 Velocity = Vector3.Zero; 4254 Velocity = Vector3.Zero;
4255 m_AngularVelocity = Vector3.Zero;
4183 AbsolutePosition = pos; 4256 AbsolutePosition = pos;
4184 4257
4185 AddToPhysicalScene(isFlying); 4258 AddToPhysicalScene(isFlying);
@@ -4419,7 +4492,7 @@ namespace OpenSim.Region.Framework.Scenes
4419 checkRePrioritization(); 4492 checkRePrioritization();
4420 } 4493 }
4421 4494
4422 public void CopyTo(AgentData cAgent) 4495 public void CopyTo(AgentData cAgent, bool isCrossUpdate)
4423 { 4496 {
4424 cAgent.CallbackURI = m_callbackURI; 4497 cAgent.CallbackURI = m_callbackURI;
4425 4498
@@ -4483,6 +4556,28 @@ namespace OpenSim.Region.Framework.Scenes
4483 4556
4484 if (Scene.AttachmentsModule != null) 4557 if (Scene.AttachmentsModule != null)
4485 Scene.AttachmentsModule.CopyAttachments(this, cAgent); 4558 Scene.AttachmentsModule.CopyAttachments(this, cAgent);
4559
4560 cAgent.CrossingFlags = isCrossUpdate ? crossingFlags : (byte)0;
4561
4562 if(isCrossUpdate && haveGroupInformation)
4563 {
4564 cAgent.agentCOF = COF;
4565 cAgent.ActiveGroupID = ControllingClient.ActiveGroupId;
4566 cAgent.ActiveGroupName = ControllingClient.ActiveGroupName;
4567 cAgent.ActiveGroupTitle = Grouptitle;
4568 Dictionary<UUID, ulong> gpowers = ControllingClient.GetGroupPowers();
4569 if(gpowers.Count >0)
4570 {
4571 cAgent.Groups = new AgentGroupData[gpowers.Count];
4572 int i = 0;
4573 foreach (UUID gid in gpowers.Keys)
4574 {
4575 // WARNING we dont' have AcceptNotices in cache.. sending as true mb no one notices ;)
4576 AgentGroupData agd = new AgentGroupData(gid,gpowers[gid],true);
4577 cAgent.Groups[i++] = agd;
4578 }
4579 }
4580 }
4486 } 4581 }
4487 4582
4488 private void CopyFrom(AgentData cAgent) 4583 private void CopyFrom(AgentData cAgent)
@@ -4578,6 +4673,45 @@ namespace OpenSim.Region.Framework.Scenes
4578 if (Scene.AttachmentsModule != null) 4673 if (Scene.AttachmentsModule != null)
4579 Scene.AttachmentsModule.CopyAttachments(cAgent, this); 4674 Scene.AttachmentsModule.CopyAttachments(cAgent, this);
4580 4675
4676 haveGroupInformation = false;
4677
4678 // using this as protocol detection don't want to mess with the numbers for now
4679 if(cAgent.ActiveGroupTitle != null)
4680 {
4681 COF = cAgent.agentCOF;
4682 ControllingClient.ActiveGroupId = cAgent.ActiveGroupID;
4683 ControllingClient.ActiveGroupName = cAgent.ActiveGroupName;
4684 ControllingClient.ActiveGroupPowers = 0;
4685 Grouptitle = cAgent.ActiveGroupTitle;
4686 int ngroups = cAgent.Groups.Length;
4687 if(ngroups > 0)
4688 {
4689 Dictionary<UUID, ulong> gpowers = new Dictionary<UUID, ulong>(ngroups);
4690 for(int i = 0 ; i < ngroups; i++)
4691 {
4692 AgentGroupData agd = cAgent.Groups[i];
4693 gpowers[agd.GroupID] = agd.GroupPowers;
4694 }
4695
4696 ControllingClient.SetGroupPowers(gpowers);
4697
4698 if(cAgent.ActiveGroupID == UUID.Zero)
4699 haveGroupInformation = true;
4700 else if(gpowers.ContainsKey(cAgent.ActiveGroupID))
4701 {
4702 ControllingClient.ActiveGroupPowers = gpowers[cAgent.ActiveGroupID];
4703 haveGroupInformation = true;
4704 }
4705 }
4706 else if(cAgent.ActiveGroupID == UUID.Zero)
4707 {
4708 haveGroupInformation = true;
4709 }
4710 }
4711
4712 crossingFlags = cAgent.CrossingFlags;
4713 gotCrossUpdate = (crossingFlags != 0);
4714
4581 lock (m_originRegionIDAccessLock) 4715 lock (m_originRegionIDAccessLock)
4582 m_originRegionID = cAgent.RegionID; 4716 m_originRegionID = cAgent.RegionID;
4583 } 4717 }
@@ -4585,7 +4719,7 @@ namespace OpenSim.Region.Framework.Scenes
4585 public bool CopyAgent(out IAgentData agent) 4719 public bool CopyAgent(out IAgentData agent)
4586 { 4720 {
4587 agent = new CompleteAgentData(); 4721 agent = new CompleteAgentData();
4588 CopyTo((AgentData)agent); 4722 CopyTo((AgentData)agent, false);
4589 return true; 4723 return true;
4590 } 4724 }
4591 4725
@@ -4667,18 +4801,19 @@ namespace OpenSim.Region.Framework.Scenes
4667 /// <param name="e"></param> 4801 /// <param name="e"></param>
4668 public void PhysicsCollisionUpdate(EventArgs e) 4802 public void PhysicsCollisionUpdate(EventArgs e)
4669 { 4803 {
4670 if (IsChildAgent || Animator == null) 4804 if (IsChildAgent)
4671 return; 4805 return;
4672 4806
4673 if(IsInTransit) 4807 if(IsInTransit)
4674 return; 4808 return;
4809
4675 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) 4810 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
4676 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( 4811 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
4677 // as of this comment the interval is set in AddToPhysicalScene 4812 // as of this comment the interval is set in AddToPhysicalScene
4678 4813
4679// if (m_updateCount > 0) 4814// if (m_updateCount > 0)
4680// { 4815// {
4681 if (Animator.UpdateMovementAnimations()) 4816 if (Animator != null && Animator.UpdateMovementAnimations())
4682 TriggerScenePresenceUpdated(); 4817 TriggerScenePresenceUpdated();
4683// m_updateCount--; 4818// m_updateCount--;
4684// } 4819// }
@@ -4686,7 +4821,6 @@ namespace OpenSim.Region.Framework.Scenes
4686 CollisionEventUpdate collisionData = (CollisionEventUpdate)e; 4821 CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
4687 Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; 4822 Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList;
4688 4823
4689
4690// // No collisions at all means we may be flying. Update always 4824// // No collisions at all means we may be flying. Update always
4691// // to make falling work 4825// // to make falling work
4692// if (m_lastColCount != coldata.Count || coldata.Count == 0) 4826// if (m_lastColCount != coldata.Count || coldata.Count == 0)
@@ -4697,42 +4831,24 @@ namespace OpenSim.Region.Framework.Scenes
4697 4831
4698 if (coldata.Count != 0) 4832 if (coldata.Count != 0)
4699 { 4833 {
4700/* 4834 ContactPoint lowest;
4701 switch (Animator.CurrentMovementAnimation) 4835 lowest.SurfaceNormal = Vector3.Zero;
4702 { 4836 lowest.Position = Vector3.Zero;
4703 case "STAND": 4837 lowest.Position.Z = float.MaxValue;
4704 case "WALK":
4705 case "RUN":
4706 case "CROUCH":
4707 case "CROUCHWALK":
4708 {
4709 */
4710 ContactPoint lowest;
4711 lowest.SurfaceNormal = Vector3.Zero;
4712 lowest.Position = Vector3.Zero;
4713 lowest.Position.Z = float.MaxValue;
4714 4838
4715 foreach (ContactPoint contact in coldata.Values) 4839 foreach (ContactPoint contact in coldata.Values)
4716 { 4840 {
4717 4841 if (contact.CharacterFeet && contact.Position.Z < lowest.Position.Z)
4718 if (contact.CharacterFeet && contact.Position.Z < lowest.Position.Z) 4842 lowest = contact;
4719 { 4843 }
4720 lowest = contact;
4721 }
4722 }
4723 4844
4724 if (lowest.Position.Z != float.MaxValue) 4845 if (lowest.Position.Z != float.MaxValue)
4725 { 4846 {
4726 lowest.SurfaceNormal = -lowest.SurfaceNormal; 4847 lowest.SurfaceNormal = -lowest.SurfaceNormal;
4727 CollisionPlane = new Vector4(lowest.SurfaceNormal, Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); 4848 CollisionPlane = new Vector4(lowest.SurfaceNormal, Vector3.Dot(lowest.Position, lowest.SurfaceNormal));
4728 }
4729 else
4730 CollisionPlane = Vector4.UnitW;
4731/*
4732 }
4733 break;
4734 } 4849 }
4735*/ 4850 else
4851 CollisionPlane = Vector4.UnitW;
4736 } 4852 }
4737 else 4853 else
4738 CollisionPlane = Vector4.UnitW; 4854 CollisionPlane = Vector4.UnitW;
@@ -4745,73 +4861,66 @@ namespace OpenSim.Region.Framework.Scenes
4745 4861
4746 // The following may be better in the ICombatModule 4862 // The following may be better in the ICombatModule
4747 // probably tweaking of the values for ground and normal prim collisions will be needed 4863 // probably tweaking of the values for ground and normal prim collisions will be needed
4748 float starthealth = Health; 4864 float startHealth = Health;
4749 uint killerObj = 0; 4865 if(coldata.Count > 0)
4750 SceneObjectPart part = null;
4751 foreach (uint localid in coldata.Keys)
4752 { 4866 {
4753 if (localid == 0) 4867 uint killerObj = 0;
4754 { 4868 SceneObjectPart part = null;
4755 part = null; 4869 float rvel; // relative velocity, negative on approch
4756 } 4870 foreach (uint localid in coldata.Keys)
4757 else
4758 { 4871 {
4759 part = Scene.GetSceneObjectPart(localid); 4872 if (localid == 0)
4760 } 4873 {
4761 if (part != null) 4874 // 0 is the ground
4762 { 4875 rvel = coldata[0].RelativeSpeed;
4763 // Ignore if it has been deleted or volume detect 4876 if(rvel < -5.0f)
4764 if (!part.ParentGroup.IsDeleted && !part.ParentGroup.IsVolumeDetect) 4877 Health -= 0.01f * rvel * rvel;
4878 }
4879 else
4765 { 4880 {
4766 if (part.ParentGroup.Damage > 0.0f) 4881 part = Scene.GetSceneObjectPart(localid);
4882
4883 if(part != null && !part.ParentGroup.IsVolumeDetect)
4767 { 4884 {
4768 // Something with damage... 4885 if (part.ParentGroup.Damage > 0.0f)
4769 Health -= part.ParentGroup.Damage; 4886 {
4770 part.ParentGroup.Scene.DeleteSceneObject(part.ParentGroup, false); 4887 // Something with damage...
4888 Health -= part.ParentGroup.Damage;
4889 part.ParentGroup.Scene.DeleteSceneObject(part.ParentGroup, false);
4890 }
4891 else
4892 {
4893 // An ordinary prim
4894 rvel = coldata[localid].RelativeSpeed;
4895 if(rvel < -5.0f)
4896 {
4897 Health -= 0.005f * rvel * rvel;
4898 }
4899 }
4771 } 4900 }
4772 else 4901 else
4773 { 4902 {
4774 // An ordinary prim 4903
4775 if (coldata[localid].PenetrationDepth >= 0.10f)
4776 Health -= coldata[localid].PenetrationDepth * 5.0f;
4777 } 4904 }
4778 } 4905 }
4779 }
4780 else
4781 {
4782 // 0 is the ground
4783 // what about collisions with other avatars?
4784 if (localid == 0 && coldata[localid].PenetrationDepth >= 0.10f)
4785 Health -= coldata[localid].PenetrationDepth * 5.0f;
4786 }
4787
4788 4906
4789 if (Health <= 0.0f) 4907 if (Health <= 0.0f)
4790 { 4908 {
4791 if (localid != 0) 4909 if (localid != 0)
4792 killerObj = localid; 4910 killerObj = localid;
4793 } 4911 }
4794 //m_log.Debug("[AVATAR]: Collision with localid: " + localid.ToString() + " at depth: " + coldata[localid].ToString());
4795 }
4796 //Health = 100;
4797 if (!Invulnerable)
4798 {
4799 if (starthealth != Health)
4800 {
4801 ControllingClient.SendHealth(Health);
4802 } 4912 }
4913
4803 if (Health <= 0) 4914 if (Health <= 0)
4804 { 4915 {
4805 m_scene.EventManager.TriggerAvatarKill(killerObj, this);
4806 }
4807 if (starthealth == Health && Health < 100.0f)
4808 {
4809 Health += 0.03f;
4810 if (Health > 100.0f)
4811 Health = 100.0f;
4812 ControllingClient.SendHealth(Health); 4916 ControllingClient.SendHealth(Health);
4917 m_scene.EventManager.TriggerAvatarKill(killerObj, this);
4918 return;
4813 } 4919 }
4814 } 4920 }
4921
4922 if(Math.Abs(Health - startHealth) > 1.0)
4923 ControllingClient.SendHealth(Health);
4815 } 4924 }
4816 4925
4817 public void setHealthWithUpdate(float health) 4926 public void setHealthWithUpdate(float health)
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index f34dbe8..50be3ac 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -570,18 +570,28 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
570 public UUID ActiveGroupId 570 public UUID ActiveGroupId
571 { 571 {
572 get { return UUID.Zero; } 572 get { return UUID.Zero; }
573 set {}
573 } 574 }
574 575
575 public string ActiveGroupName 576 public string ActiveGroupName
576 { 577 {
577 get { return "IRCd User"; } 578 get { return "IRCd User"; }
579 set {}
578 } 580 }
579 581
580 public ulong ActiveGroupPowers 582 public ulong ActiveGroupPowers
581 { 583 {
582 get { return 0; } 584 get { return 0; }
585 set {}
583 } 586 }
584 587
588 public Dictionary<UUID, ulong> GetGroupPowers()
589 {
590 return new Dictionary<UUID, ulong>();
591 }
592
593 public void SetGroupPowers(Dictionary<UUID, ulong> powers) { }
594
585 public ulong GetGroupPowers(UUID groupID) 595 public ulong GetGroupPowers(UUID groupID)
586 { 596 {
587 return 0; 597 return 0;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index e1b6abb..0aaf95c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -296,15 +296,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
296 296
297 attemptDeliveryUuidSet 297 attemptDeliveryUuidSet
298 = new HashSet<string>(Array.ConvertAll<PresenceInfo, string>(onlineAgents, pi => pi.UserID)); 298 = new HashSet<string>(Array.ConvertAll<PresenceInfo, string>(onlineAgents, pi => pi.UserID));
299
300 //Array.ForEach<PresenceInfo>(onlineAgents, pi => attemptDeliveryUuidSet.Add(pi.UserID));
301
302 //groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList();
303
304 // if (m_debugEnabled)
305// m_log.DebugFormat(
306// "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members, {2} online",
307// groupID, groupMembersCount, groupMembers.Count());
308 } 299 }
309 else 300 else
310 { 301 {
@@ -387,7 +378,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
387 member.AgentID, Environment.TickCount - startTick); 378 member.AgentID, Environment.TickCount - startTick);
388 } 379 }
389 } 380 }
390 else 381 else if(im.dialog != (byte)InstantMessageDialog.SessionAdd &&
382 im.dialog != (byte)InstantMessageDialog.SessionDrop)
391 { 383 {
392 int startTick = Environment.TickCount; 384 int startTick = Environment.TickCount;
393 385
@@ -443,21 +435,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
443 { 435 {
444 IClientAPI client = null; 436 IClientAPI client = null;
445 437
446 if (msg.dialog == (byte)InstantMessageDialog.SessionSend) 438 client = GetActiveClient(new UUID(msg.toAgentID));
447 {
448 client = GetActiveClient(new UUID(msg.toAgentID));
449 439
450 if (client != null) 440 if (client == null)
451 { 441 {
452 if (m_debugEnabled) 442 m_log.WarnFormat("[GROUPS-MESSAGING]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID);
453 m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} locally", client.Name);
454 }
455 else
456 {
457 m_log.WarnFormat("[GROUPS-MESSAGING]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID);
458 443
459 return; 444 return;
460 }
461 } 445 }
462 446
463 ProcessMessageFromGroupSession(msg, client); 447 ProcessMessageFromGroupSession(msg, client);
@@ -471,78 +455,96 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
471 "[GROUPS-MESSAGING]: Session message from {0} going to agent {1}, sessionID {2}, type {3}", 455 "[GROUPS-MESSAGING]: Session message from {0} going to agent {1}, sessionID {2}, type {3}",
472 msg.fromAgentName, msg.toAgentID, msg.imSessionID, (InstantMessageDialog)msg.dialog); 456 msg.fromAgentName, msg.toAgentID, msg.imSessionID, (InstantMessageDialog)msg.dialog);
473 457
474 UUID AgentID = new UUID(msg.fromAgentID); 458 UUID fromAgentID = new UUID(msg.fromAgentID);
475 UUID GroupID = new UUID(msg.imSessionID); 459 UUID GroupID = new UUID(msg.imSessionID);
460 IEventQueue eq = client.Scene.RequestModuleInterface<IEventQueue>();
476 461
477 switch (msg.dialog) 462 switch (msg.dialog)
478 { 463 {
479 case (byte)InstantMessageDialog.SessionAdd: 464 case (byte)InstantMessageDialog.SessionAdd:
480 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); 465 m_groupData.AgentInvitedToGroupChatSession(fromAgentID, GroupID);
466 if(eq != null)
467 eq.ChatterBoxSessionAgentListUpdates(
468 GroupID
469 , fromAgentID
470 , client.AgentId
471 , false //canVoiceChat
472 , false //isModerator
473 , false //text mute
474 , true // enter
475 );
481 break; 476 break;
482 477
483 case (byte)InstantMessageDialog.SessionDrop: 478 case (byte)InstantMessageDialog.SessionDrop:
484 m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID); 479 m_groupData.AgentDroppedFromGroupChatSession(fromAgentID, GroupID);
480 if(eq != null)
481 eq.ChatterBoxSessionAgentListUpdates(
482 GroupID
483 , fromAgentID
484 , client.AgentId
485 , false //canVoiceChat
486 , false //isModerator
487 , false //text mute
488 , false // leave
489 );
485 break; 490 break;
486 491
487 case (byte)InstantMessageDialog.SessionSend: 492 case (byte)InstantMessageDialog.SessionSend:
488 if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID) 493 if (!m_groupData.hasAgentDroppedGroupChatSession(client.AgentId, GroupID))
489 && !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID, GroupID)
490 )
491 { 494 {
492 // Agent not in session and hasn't dropped from session 495 if(!m_groupData.hasAgentBeenInvitedToGroupChatSession(client.AgentId, GroupID))
493 // Add them to the session for now, and Invite them
494 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
495
496 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
497 if (groupInfo != null)
498 { 496 {
499 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message");
500 497
501 // Force? open the group session dialog??? 498 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
502 // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg); 499 if (groupInfo != null)
503 IEventQueue eq = client.Scene.RequestModuleInterface<IEventQueue>(); 500 {
504 eq.ChatterboxInvitation( 501 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message");
505 GroupID 502
506 , groupInfo.GroupName 503 if(eq != null)
507 , new UUID(msg.fromAgentID) 504 {
508 , msg.message 505 eq.ChatterboxInvitation(
509 , new UUID(msg.toAgentID) 506 GroupID
510 , msg.fromAgentName 507 , groupInfo.GroupName
511 , msg.dialog 508 , fromAgentID
512 , msg.timestamp 509 , msg.message
513 , msg.offline == 1 510 , client.AgentId
514 , (int)msg.ParentEstateID 511 , msg.fromAgentName
515 , msg.Position 512 , msg.dialog
516 , 1 513 , msg.timestamp
517 , new UUID(msg.imSessionID) 514 , msg.offline == 1
518 , msg.fromGroup 515 , (int)msg.ParentEstateID
519 , Utils.StringToBytes(groupInfo.GroupName) 516 , msg.Position
520 ); 517 , 1
521 518 , new UUID(msg.imSessionID)
522 eq.ChatterBoxSessionAgentListUpdates( 519 , msg.fromGroup
523 new UUID(GroupID) 520 , Utils.StringToBytes(groupInfo.GroupName)
524 , new UUID(msg.fromAgentID) 521 );
525 , new UUID(msg.toAgentID) 522 }
526 , false //canVoiceChat 523 }
527 , false //isModerator 524 }
528 , false //text mute 525 else
529 ); 526 {
527 client.SendInstantMessage(msg);
530 } 528 }
531 529
532 break; 530// if (!m_groupData.hasAgentBeenInvitedToGroupChatSession(fromAgentID, GroupID))
533 } 531 {
534 else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)) 532 m_groupData.AgentInvitedToGroupChatSession(fromAgentID, GroupID);
535 { 533 eq.ChatterBoxSessionAgentListUpdates(
536 // User hasn't dropped, so they're in the session, 534 GroupID
537 // maybe we should deliver it. 535 , fromAgentID
538 client.SendInstantMessage(msg); 536 , client.AgentId
537 , false //canVoiceChat
538 , false //isModerator
539 , false //text mute
540 , true // enter
541 );
542 }
539 } 543 }
540
541 break; 544 break;
542 545
543 default: 546 default:
544 client.SendInstantMessage(msg); 547 client.SendInstantMessage(msg);
545
546 break;; 548 break;;
547 } 549 }
548 } 550 }
@@ -559,14 +561,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
559 DebugGridInstantMessage(im); 561 DebugGridInstantMessage(im);
560 } 562 }
561 563
564 UUID GroupID = new UUID(im.imSessionID);
565 UUID AgentID = new UUID(im.fromAgentID);
566
562 // Start group IM session 567 // Start group IM session
563 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) 568 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart))
564 { 569 {
565 if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID); 570 if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID);
566 571
567 UUID GroupID = new UUID(im.imSessionID);
568 UUID AgentID = new UUID(im.fromAgentID);
569
570 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); 572 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
571 573
572 if (groupInfo != null) 574 if (groupInfo != null)
@@ -575,24 +577,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
575 577
576 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); 578 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
577 579
578 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); 580 // we need to send here a list of known participants.
579 queue.ChatterBoxSessionAgentListUpdates( 581 im.dialog = (byte)InstantMessageDialog.SessionAdd;
580 GroupID 582 SendMessageToGroup(im, GroupID);
581 , AgentID
582 , new UUID(im.toAgentID)
583 , false //canVoiceChat
584 , false //isModerator
585 , false //text mute
586 );
587 } 583 }
588 } 584 }
589 585
590 // Send a message from locally connected client to a group 586 // Send a message from locally connected client to a group
591 if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) 587 if ((im.dialog == (byte)InstantMessageDialog.SessionSend))
592 { 588 {
593 UUID GroupID = new UUID(im.imSessionID);
594 UUID AgentID = new UUID(im.fromAgentID);
595
596 if (m_debugEnabled) 589 if (m_debugEnabled)
597 m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString()); 590 m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
598 591
@@ -601,6 +594,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
601 594
602 SendMessageToGroup(im, GroupID); 595 SendMessageToGroup(im, GroupID);
603 } 596 }
597
598 if ((im.dialog == (byte)InstantMessageDialog.SessionDrop))
599 {
600 if (m_debugEnabled)
601 m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
602
603 m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID);
604
605 SendMessageToGroup(im, GroupID);
606 }
604 } 607 }
605 608
606 #endregion 609 #endregion
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index ddeac66..5205eae 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -278,7 +278,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
278 // There might be some problem with the thread we're generating this on but not 278 // There might be some problem with the thread we're generating this on but not
279 // doing the update at this time causes problems (Mantis #7920 and #7915) 279 // doing the update at this time causes problems (Mantis #7920 and #7915)
280 // TODO: move sending this update to a later time in the rootification of the client. 280 // TODO: move sending this update to a later time in the rootification of the client.
281 SendAgentGroupDataUpdate(sp.ControllingClient, false); 281 if(!sp.haveGroupInformation)
282 SendAgentGroupDataUpdate(sp.ControllingClient, false);
282 } 283 }
283 284
284 private void OnMakeChild(ScenePresence sp) 285 private void OnMakeChild(ScenePresence sp)
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 2dda3a1..83f08e0 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -803,11 +803,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
803 { 803 {
804 if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) 804 if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
805 { 805 {
806 if (m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID))
807 m_groupsAgentsInvitedToChatSession[groupID].Remove(agentID);
808
806 // If not in dropped list, add 809 // If not in dropped list, add
807 if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) 810 if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
808 {
809 m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID); 811 m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID);
810 }
811 } 812 }
812 } 813 }
813 814
@@ -818,10 +819,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
818 819
819 // If nessesary, remove from dropped list 820 // If nessesary, remove from dropped list
820 if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) 821 if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
821 {
822 m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID); 822 m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID);
823 } 823
824 } 824 if (!m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID))
825 m_groupsAgentsInvitedToChatSession[groupID].Add(agentID);
826 }
825 827
826 private void CreateGroupChatSessionTracking(UUID groupID) 828 private void CreateGroupChatSessionTracking(UUID groupID)
827 { 829 {
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index bdac6aa..4275192 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -591,11 +591,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
591 public string ActiveGroupName 591 public string ActiveGroupName
592 { 592 {
593 get { return String.Empty; } 593 get { return String.Empty; }
594 set { }
594 } 595 }
595 596
596 public ulong ActiveGroupPowers 597 public ulong ActiveGroupPowers
597 { 598 {
598 get { return 0; } 599 get { return 0; }
600 set { }
599 } 601 }
600 602
601 public bool IsGroupMember(UUID groupID) 603 public bool IsGroupMember(UUID groupID)
@@ -603,6 +605,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
603 return (m_hostGroupID == groupID); 605 return (m_hostGroupID == groupID);
604 } 606 }
605 607
608 public Dictionary<UUID, ulong> GetGroupPowers()
609 {
610 return new Dictionary<UUID, ulong>();
611 }
612
613 public void SetGroupPowers(Dictionary<UUID, ulong> powers) { }
614
606 public ulong GetGroupPowers(UUID groupID) 615 public ulong GetGroupPowers(UUID groupID)
607 { 616 {
608 return 0; 617 return 0;
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
index a70d1b8..bb21f0c 100755
--- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
@@ -508,7 +508,7 @@ public abstract class BSPhysObject : PhysicsActor
508 relvel = RawVelocity; 508 relvel = RawVelocity;
509 if (collidee != null && collidee.IsPhysical) 509 if (collidee != null && collidee.IsPhysical)
510 relvel -= collidee.RawVelocity; 510 relvel -= collidee.RawVelocity;
511 newContact.RelativeSpeed = OMV.Vector3.Dot(relvel, contactNormal); 511 newContact.RelativeSpeed = -OMV.Vector3.Dot(relvel, contactNormal);
512 // DetailLog("{0},{1}.Collision.AddCollider,vel={2},contee.vel={3},relvel={4},relspeed={5}", 512 // DetailLog("{0},{1}.Collision.AddCollider,vel={2},contee.vel={3},relvel={4},relspeed={5}",
513 // LocalID, TypeName, RawVelocity, (collidee == null ? OMV.Vector3.Zero : collidee.RawVelocity), relvel, newContact.RelativeSpeed); 513 // LocalID, TypeName, RawVelocity, (collidee == null ? OMV.Vector3.Zero : collidee.RawVelocity), relvel, newContact.RelativeSpeed);
514 514
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
index 393afae..04ccbf0 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
@@ -126,9 +126,20 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
126 m_objCollisionList.Add(localID, contact); 126 m_objCollisionList.Add(localID, contact);
127 } 127 }
128 else 128 else
129 { 129 {
130 float lastVel = m_objCollisionList[localID].RelativeSpeed;
130 if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth) 131 if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth)
132 {
133 if(Math.Abs(lastVel) > Math.Abs(contact.RelativeSpeed))
134 contact.RelativeSpeed = lastVel;
131 m_objCollisionList[localID] = contact; 135 m_objCollisionList[localID] = contact;
136 }
137 else if(Math.Abs(lastVel) < Math.Abs(contact.RelativeSpeed))
138 {
139 ContactPoint tmp = m_objCollisionList[localID];
140 tmp.RelativeSpeed = contact.RelativeSpeed;
141 m_objCollisionList[localID] = tmp;
142 }
132 } 143 }
133 } 144 }
134 145
@@ -385,6 +396,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
385 } 396 }
386 397
387 public abstract Vector3 Velocity { get; set; } 398 public abstract Vector3 Velocity { get; set; }
399 public virtual Vector3 rootVelocity { get { return Vector3.Zero; } }
388 400
389 public abstract Vector3 Torque { get; set; } 401 public abstract Vector3 Torque { get; set; }
390 public abstract float CollisionScore { get; set;} 402 public abstract float CollisionScore { get; set;}
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
index 55619c0..7d855f1 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
@@ -80,6 +80,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
80 private Vector3 m_rotationalVelocity; 80 private Vector3 m_rotationalVelocity;
81 private Vector3 m_size; 81 private Vector3 m_size;
82 private Vector3 m_collideNormal; 82 private Vector3 m_collideNormal;
83 private Vector3 m_lastFallVel;
83 private Quaternion m_orientation; 84 private Quaternion m_orientation;
84 private Quaternion m_orientation2D; 85 private Quaternion m_orientation2D;
85 private float m_mass = 80f; 86 private float m_mass = 80f;
@@ -109,6 +110,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
109 private bool m_alwaysRun = false; 110 private bool m_alwaysRun = false;
110 111
111 private bool _zeroFlag = false; 112 private bool _zeroFlag = false;
113 private bool m_haveLastFallVel = false;
112 114
113 115
114 private uint m_localID = 0; 116 private uint m_localID = 0;
@@ -605,6 +607,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
605 set { return; } 607 set { return; }
606 } 608 }
607 609
610 public override Vector3 rootVelocity
611 {
612 get
613 {
614 return _velocity;
615 }
616 }
617
608 public override Vector3 Velocity 618 public override Vector3 Velocity
609 { 619 {
610 get 620 get
@@ -1086,6 +1096,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1086 if (ctz.Z < 0) 1096 if (ctz.Z < 0)
1087 ctz.Z = 0; 1097 ctz.Z = 0;
1088 1098
1099 if(!m_haveLastFallVel)
1100 {
1101 m_lastFallVel = vel;
1102 m_haveLastFallVel = true;
1103 }
1104
1089 Vector3 n = _parent_scene.GetTerrainNormalAtXY(posch.X, posch.Y); 1105 Vector3 n = _parent_scene.GetTerrainNormalAtXY(posch.X, posch.Y);
1090 float depth = terrainheight - chrminZ; 1106 float depth = terrainheight - chrminZ;
1091 1107
@@ -1114,7 +1130,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1114 1130
1115 m_iscollidingGround = true; 1131 m_iscollidingGround = true;
1116 1132
1117
1118 ContactPoint contact = new ContactPoint(); 1133 ContactPoint contact = new ContactPoint();
1119 contact.PenetrationDepth = depth; 1134 contact.PenetrationDepth = depth;
1120 contact.Position.X = localpos.X; 1135 contact.Position.X = localpos.X;
@@ -1123,9 +1138,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1123 contact.SurfaceNormal.X = -n.X; 1138 contact.SurfaceNormal.X = -n.X;
1124 contact.SurfaceNormal.Y = -n.Y; 1139 contact.SurfaceNormal.Y = -n.Y;
1125 contact.SurfaceNormal.Z = -n.Z; 1140 contact.SurfaceNormal.Z = -n.Z;
1126 contact.RelativeSpeed = -vel.Z; 1141 contact.RelativeSpeed = Vector3.Dot(m_lastFallVel, n);
1127 contact.CharacterFeet = true; 1142 contact.CharacterFeet = true;
1128 AddCollisionEvent(0, contact); 1143 AddCollisionEvent(0, contact);
1144 m_lastFallVel = vel;
1129 1145
1130// vec.Z *= 0.5f; 1146// vec.Z *= 0.5f;
1131 } 1147 }
@@ -1143,6 +1159,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1143 } 1159 }
1144 else 1160 else
1145 { 1161 {
1162 m_haveLastFallVel = false;
1146 m_colliderGroundfilter -= 5; 1163 m_colliderGroundfilter -= 5;
1147 if (m_colliderGroundfilter <= 0) 1164 if (m_colliderGroundfilter <= 0)
1148 { 1165 {
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index 6ed42d9..aaa2203 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -542,6 +542,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
542 } 542 }
543 } 543 }
544 544
545 public override Vector3 rootVelocity
546 {
547 get
548 {
549 if(_parent != null)
550 return ((OdePrim)_parent).Velocity;
551 return Velocity;
552 }
553 }
554
545 public override Vector3 Velocity 555 public override Vector3 Velocity
546 { 556 {
547 get 557 get
@@ -560,7 +570,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
560 { 570 {
561 m_log.WarnFormat("[PHYSICS]: Got NaN Velocity in Object {0}", Name); 571 m_log.WarnFormat("[PHYSICS]: Got NaN Velocity in Object {0}", Name);
562 } 572 }
563
564 } 573 }
565 } 574 }
566 575
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index e0644e3..8d87c30 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -874,7 +874,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
874 break; 874 break;
875 875
876 case (int)ActorTypes.Prim: 876 case (int)ActorTypes.Prim:
877 Vector3 relV = p1.Velocity - p2.Velocity; 877 Vector3 relV = p1.rootVelocity - p2.rootVelocity;
878 float relVlenSQ = relV.LengthSquared(); 878 float relVlenSQ = relV.LengthSquared();
879 if (relVlenSQ > 0.0001f) 879 if (relVlenSQ > 0.0001f)
880 { 880 {
@@ -899,7 +899,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
899 bounce = contactdata1.bounce * TerrainBounce; 899 bounce = contactdata1.bounce * TerrainBounce;
900 mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); 900 mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction);
901 901
902 if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f) 902 Vector3 v1 = p1.rootVelocity;
903 if (Math.Abs(v1.X) > 0.1f || Math.Abs(v1.Y) > 0.1f)
903 mu *= frictionMovementMult; 904 mu *= frictionMovementMult;
904 p1.CollidingGround = true; 905 p1.CollidingGround = true;
905 906
@@ -925,8 +926,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
925 926
926// if (curContact.side1 > 0) // should be 2 ? 927// if (curContact.side1 > 0) // should be 2 ?
927// IgnoreNegSides = true; 928// IgnoreNegSides = true;
928 929 Vector3 v2 = p2.rootVelocity;
929 if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f) 930 if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f)
930 mu *= frictionMovementMult; 931 mu *= frictionMovementMult;
931 932
932 if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass) 933 if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass)
@@ -980,7 +981,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
980 p1.CollidingObj = true; 981 p1.CollidingObj = true;
981 p2.CollidingObj = true; 982 p2.CollidingObj = true;
982 } 983 }
983 else if (p2.Velocity.LengthSquared() > 0.0f) 984 else if (p2.rootVelocity.LengthSquared() > 0.0f)
984 p2.CollidingObj = true; 985 p2.CollidingObj = true;
985 } 986 }
986 else 987 else
@@ -995,7 +996,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
995 p1.CollidingObj = true; 996 p1.CollidingObj = true;
996 p2.CollidingObj = true; 997 p2.CollidingObj = true;
997 } 998 }
998 else if (p2.Velocity.LengthSquared() > 0.0f) 999 else if (p1.rootVelocity.LengthSquared() > 0.0f)
999 p1.CollidingObj = true; 1000 p1.CollidingObj = true;
1000 } 1001 }
1001 else 1002 else
@@ -1068,10 +1069,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1068 1069
1069 Vector3 vel = Vector3.Zero; 1070 Vector3 vel = Vector3.Zero;
1070 if (p2 != null && p2.IsPhysical) 1071 if (p2 != null && p2.IsPhysical)
1071 vel = p2.Velocity; 1072 vel = p2.rootVelocity;
1072 1073
1073 if (p1 != null && p1.IsPhysical) 1074 if (p1 != null && p1.IsPhysical)
1074 vel -= p1.Velocity; 1075 vel -= p1.rootVelocity;
1075 1076
1076 contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal); 1077 contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal);
1077 1078
@@ -1079,44 +1080,45 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1079 { 1080 {
1080 case ActorTypes.Agent: 1081 case ActorTypes.Agent:
1081 case ActorTypes.Prim: 1082 case ActorTypes.Prim:
1083 {
1084 switch ((ActorTypes)p2.PhysicsActorType)
1082 { 1085 {
1083 switch ((ActorTypes)p2.PhysicsActorType) 1086 case ActorTypes.Agent:
1084 { 1087 case ActorTypes.Prim:
1085 case ActorTypes.Agent: 1088 if (p2events)
1086 case ActorTypes.Prim: 1089 {
1087 if (p2events) 1090 AddCollisionEventReporting(p2);
1088 { 1091 p2.AddCollisionEvent(p1.ParentActor.LocalID, contact);
1089 AddCollisionEventReporting(p2); 1092 }
1090 p2.AddCollisionEvent(p1.ParentActor.LocalID, contact); 1093 obj2LocalID = p2.ParentActor.LocalID;
1091 } 1094 break;
1092 obj2LocalID = p2.ParentActor.LocalID;
1093 break;
1094 1095
1095 case ActorTypes.Ground: 1096 case ActorTypes.Ground:
1096 case ActorTypes.Unknown: 1097 case ActorTypes.Unknown:
1097 default: 1098 default:
1098 obj2LocalID = 0; 1099 obj2LocalID = 0;
1099 break; 1100 break;
1100 }
1101 if (p1events)
1102 {
1103 contact.SurfaceNormal = -contact.SurfaceNormal;
1104 AddCollisionEventReporting(p1);
1105 p1.AddCollisionEvent(obj2LocalID, contact);
1106 }
1107 break;
1108 } 1101 }
1102 if (p1events)
1103 {
1104 contact.SurfaceNormal = -contact.SurfaceNormal;
1105 contact.RelativeSpeed = -contact.RelativeSpeed;
1106 AddCollisionEventReporting(p1);
1107 p1.AddCollisionEvent(obj2LocalID, contact);
1108 }
1109 break;
1110 }
1109 case ActorTypes.Ground: 1111 case ActorTypes.Ground:
1110 case ActorTypes.Unknown: 1112 case ActorTypes.Unknown:
1111 default: 1113 default:
1114 {
1115 if (p2events && !p2.IsVolumeDtc)
1112 { 1116 {
1113 if (p2events && !p2.IsVolumeDtc) 1117 AddCollisionEventReporting(p2);
1114 { 1118 p2.AddCollisionEvent(0, contact);
1115 AddCollisionEventReporting(p2);
1116 p2.AddCollisionEvent(0, contact);
1117 }
1118 break;
1119 } 1119 }
1120 break;
1121 }
1120 } 1122 }
1121 } 1123 }
1122 1124
@@ -1722,8 +1724,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1722 1724
1723 case ActorTypes.Prim: 1725 case ActorTypes.Prim:
1724 OdePrim pobj = (OdePrim)obj; 1726 OdePrim pobj = (OdePrim)obj;
1725 if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) 1727 if (!pobj.m_outbounds && (pobj.Body == IntPtr.Zero || d.BodyIsEnabled(pobj.Body)))
1726 if (!pobj.m_outbounds)
1727 { 1728 {
1728 pobj.AddCollisionFrameTime((int)(odetimestepMS)); 1729 pobj.AddCollisionFrameTime((int)(odetimestepMS));
1729 pobj.SendCollisions(); 1730 pobj.SendCollisions();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 064eb0a..6d2e2c8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -15678,6 +15678,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15678 15678
15679 try 15679 try
15680 { 15680 {
15681 if (amount <= 0)
15682 {
15683 replydata = "INVALID_AMOUNT";
15684 return;
15685 }
15686
15681 TaskInventoryItem item = m_item; 15687 TaskInventoryItem item = m_item;
15682 if (item == null) 15688 if (item == null)
15683 { 15689 {
@@ -15685,6 +15691,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15685 return; 15691 return;
15686 } 15692 }
15687 15693
15694 if (m_host.OwnerID == m_host.GroupID)
15695 {
15696 replydata = "GROUP_OWNED";
15697 return;
15698 }
15699
15688 m_host.AddScriptLPS(1); 15700 m_host.AddScriptLPS(1);
15689 15701
15690 if (item.PermsGranter == UUID.Zero) 15702 if (item.PermsGranter == UUID.Zero)
@@ -15707,6 +15719,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15707 return; 15719 return;
15708 } 15720 }
15709 15721
15722 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, toID);
15723 if (account == null)
15724 {
15725 replydata = "LINDENDOLLAR_ENTITYDOESNOTEXIST";
15726 return;
15727 }
15728
15710 IMoneyModule money = World.RequestModuleInterface<IMoneyModule>(); 15729 IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
15711 15730
15712 if (money == null) 15731 if (money == null)
@@ -15716,8 +15735,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15716 } 15735 }
15717 15736
15718 string reason; 15737 string reason;
15719 bool result = money.ObjectGiveMoney( 15738 bool result = money.ObjectGiveMoney( m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn, out reason);
15720 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn, out reason);
15721 15739
15722 if (result) 15740 if (result)
15723 { 15741 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 204f73e..7a2b24f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3469,6 +3469,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3469 } 3469 }
3470 } 3470 }
3471 3471
3472 public void osSetHealth(string avatar, double health)
3473 {
3474 CheckThreatLevel(ThreatLevel.High, "osSetHealth");
3475 m_host.AddScriptLPS(1);
3476
3477 UUID avatarId = new UUID(avatar);
3478 ScenePresence presence = World.GetScenePresence(avatarId);
3479
3480 if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
3481 {
3482 if (health > 100.0)
3483 health = 100.0;
3484 else if (health < 1.0)
3485 health = 1.0;
3486
3487 presence.setHealthWithUpdate((float)health);
3488 }
3489 }
3490
3491 public void osSetHealRate(string avatar, double healrate)
3492 {
3493 CheckThreatLevel(ThreatLevel.High, "osSetHealRate");
3494 m_host.AddScriptLPS(1);
3495
3496 UUID avatarId = new UUID(avatar);
3497 ScenePresence presence = World.GetScenePresence(avatarId);
3498
3499 if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
3500 presence.HealRate = (float)healrate;
3501 }
3502
3503 public LSL_Float osGetHealRate(string avatar)
3504 {
3505 CheckThreatLevel(ThreatLevel.None, "osGetHealRate");
3506 m_host.AddScriptLPS(1);
3507
3508 LSL_Float rate = new LSL_Float(0);
3509 ScenePresence presence = World.GetScenePresence(new UUID(avatar));
3510 if (presence != null)
3511 rate = presence.HealRate;
3512 return rate;
3513 }
3514
3472 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) 3515 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
3473 { 3516 {
3474 CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); 3517 CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index c1a177a..c99679e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -368,6 +368,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
368 void osSetSpeed(string UUID, LSL_Float SpeedModifier); 368 void osSetSpeed(string UUID, LSL_Float SpeedModifier);
369 LSL_Float osGetHealth(string avatar); 369 LSL_Float osGetHealth(string avatar);
370 void osCauseHealing(string avatar, double healing); 370 void osCauseHealing(string avatar, double healing);
371 void osSetHealth(string avatar, double health);
372 void osSetHealRate(string avatar, double health);
373 LSL_Float osGetHealRate(string avatar);
371 void osCauseDamage(string avatar, double damage); 374 void osCauseDamage(string avatar, double damage);
372 void osForceOtherSit(string avatar); 375 void osForceOtherSit(string avatar);
373 void osForceOtherSit(string avatar, string target); 376 void osForceOtherSit(string avatar, string target);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index d586290..35eee59 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -945,6 +945,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
945 m_OSSL_Functions.osCauseHealing(avatar, healing); 945 m_OSSL_Functions.osCauseHealing(avatar, healing);
946 } 946 }
947 947
948 public void osSetHealth(string avatar, double health)
949 {
950 m_OSSL_Functions.osSetHealth(avatar, health);
951 }
952
953 public void osSetHealRate(string avatar, double health)
954 {
955 m_OSSL_Functions.osSetHealRate(avatar, health);
956 }
957
958 public LSL_Float osGetHealRate(string avatar)
959 {
960 return m_OSSL_Functions.osGetHealRate(avatar);
961 }
962
948 public void osForceOtherSit(string avatar) 963 public void osForceOtherSit(string avatar)
949 { 964 {
950 m_OSSL_Functions.osForceOtherSit(avatar); 965 m_OSSL_Functions.osForceOtherSit(avatar);
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 98a98c0..4f8e986 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -404,16 +404,19 @@ namespace OpenSim.Tests.Common
404 public UUID ActiveGroupId 404 public UUID ActiveGroupId
405 { 405 {
406 get { return UUID.Zero; } 406 get { return UUID.Zero; }
407 set { }
407 } 408 }
408 409
409 public string ActiveGroupName 410 public string ActiveGroupName
410 { 411 {
411 get { return String.Empty; } 412 get { return String.Empty; }
413 set { }
412 } 414 }
413 415
414 public ulong ActiveGroupPowers 416 public ulong ActiveGroupPowers
415 { 417 {
416 get { return 0; } 418 get { return 0; }
419 set { }
417 } 420 }
418 421
419 public bool IsGroupMember(UUID groupID) 422 public bool IsGroupMember(UUID groupID)
@@ -421,6 +424,13 @@ namespace OpenSim.Tests.Common
421 return false; 424 return false;
422 } 425 }
423 426
427 public Dictionary<UUID, ulong> GetGroupPowers()
428 {
429 return new Dictionary<UUID, ulong>();
430 }
431
432 public void SetGroupPowers(Dictionary<UUID, ulong> powers) { }
433
424 public ulong GetGroupPowers(UUID groupID) 434 public ulong GetGroupPowers(UUID groupID)
425 { 435 {
426 return 0; 436 return 0;
diff --git a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs
index 6ed9a16..417efce 100644
--- a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs
+++ b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs
@@ -147,9 +147,9 @@ namespace OpenSim.Tests.Common
147 timeStamp, offline, parentEstateID, position, ttl, transactionID, fromGroup, binaryBucket); 147 timeStamp, offline, parentEstateID, position, ttl, transactionID, fromGroup, binaryBucket);
148 } 148 }
149 149
150 public void ChatterBoxSessionAgentListUpdates (UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, bool isModerator, bool textMute) 150 public void ChatterBoxSessionAgentListUpdates (UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, bool isModerator, bool textMute , bool isEnterorLeave)
151 { 151 {
152 AddEvent(toAgent, "ChatterBoxSessionAgentListUpdates", sessionID, fromAgent, canVoiceChat, isModerator, textMute); 152 AddEvent(toAgent, "ChatterBoxSessionAgentListUpdates", sessionID, fromAgent, canVoiceChat, isModerator, textMute, isEnterorLeave);
153 } 153 }
154 154
155 public void ParcelProperties (OpenMetaverse.Messages.Linden.ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) 155 public void ParcelProperties (OpenMetaverse.Messages.Linden.ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)