From 9b4e83caa0d9081229707b1f12e1b94aad6c2509 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Jul 2016 16:21:37 +0100 Subject: [PATCH 01/45] dont try dequeues if didnt reacquired lock --- OpenSim/Framework/BlockingQueue.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs index daf99a8fbd..f6861e49d2 100644 --- a/OpenSim/Framework/BlockingQueue.cs +++ b/OpenSim/Framework/BlockingQueue.cs @@ -78,7 +78,8 @@ namespace OpenSim.Framework { if (m_queue.Count < 1 && m_pqueue.Count < 1) { - Monitor.Wait(m_queueSync, msTimeout); + if(!Monitor.Wait(m_queueSync, msTimeout)) + return default(T); } if (m_pqueue.Count > 0) From 2cffa71be20fe6d35d7ba4d54d4fd3476dd68cda Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 18 Jul 2016 11:12:14 +0100 Subject: [PATCH 02/45] Add some additional checks to llTransferLindenDollars. --- OpenSim/Framework/IMoneyModule.cs | 7 +++--- .../Shared/Api/Implementation/LSL_Api.cs | 22 +++++++++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 55c9613b6a..be454385db 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs @@ -32,14 +32,13 @@ namespace OpenSim.Framework public delegate void ObjectPaid(UUID objectID, UUID agentID, int amount); public interface IMoneyModule { - bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, - int amount, UUID txn, out string reason); + bool ObjectGiveMoney(UUID objectID, UUID fromID, + UUID toID, int amount, UUID txn, out string reason); int GetBalance(UUID agentID); bool UploadCovered(UUID agentID, int amount); bool AmountCovered(UUID agentID, int amount); - void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type); - void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData); + void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData = ""); void ApplyUploadCharge(UUID agentID, int amount, string text); void MoveMoney(UUID fromUser, UUID toUser, int amount, string text); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 064eb0a993..6d2e2c8b94 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 try { + if (amount <= 0) + { + replydata = "INVALID_AMOUNT"; + return; + } + TaskInventoryItem item = m_item; if (item == null) { @@ -15685,6 +15691,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } + if (m_host.OwnerID == m_host.GroupID) + { + replydata = "GROUP_OWNED"; + return; + } + m_host.AddScriptLPS(1); if (item.PermsGranter == UUID.Zero) @@ -15707,6 +15719,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } + UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, toID); + if (account == null) + { + replydata = "LINDENDOLLAR_ENTITYDOESNOTEXIST"; + return; + } + IMoneyModule money = World.RequestModuleInterface(); if (money == null) @@ -15716,8 +15735,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } string reason; - bool result = money.ObjectGiveMoney( - m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn, out reason); + bool result = money.ObjectGiveMoney( m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn, out reason); if (result) { From 504ee6e21ca84b7af9a44b6715fb4e65126f3985 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 22 Jul 2016 16:41:41 +0100 Subject: [PATCH 03/45] don't try to rez a object from a asset with empty data and Let user know about it --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 781b9ffcbd..8c560e57fa 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 return null; } + if(rezAsset.Data == null || rezAsset.Data.Length == 0) + { + m_log.WarnFormat( + "[INVENTORY ACCESS MODULE]: missing data in asset {0} to RezObject()", + assetID, remoteClient.Name); + remoteClient.SendAgentAlertMessage(string.Format("Unable to rez: missing data in asset {0} ", assetID), false); + return null; + } + SceneObjectGroup group = null; List objlist; From cdf215f6130b88a0fce9b56075947b539f1043a7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Jul 2016 01:28:47 +0100 Subject: [PATCH 04/45] add a missing field to ChatterBoxSessionAgentListUpdates. it is still wrong, and its use even worse --- OpenSim/Addons/Groups/GroupsMessagingModule.cs | 2 ++ .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 14 +++++++++----- .../Linden/Caps/EventQueue/EventQueueHelper.cs | 8 +++++++- OpenSim/Region/Framework/Interfaces/IEventQueue.cs | 2 +- .../Avatar/XmlRpcGroups/GroupsMessagingModule.cs | 5 ++++- .../Tests/Common/Mock/TestEventQueueGetModule.cs | 4 ++-- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/OpenSim/Addons/Groups/GroupsMessagingModule.cs b/OpenSim/Addons/Groups/GroupsMessagingModule.cs index e95db4120d..2ec9652b8a 100644 --- a/OpenSim/Addons/Groups/GroupsMessagingModule.cs +++ b/OpenSim/Addons/Groups/GroupsMessagingModule.cs @@ -627,6 +627,7 @@ namespace OpenSim.Groups , false //canVoiceChat , false //isModerator , false //text mute + , true // Enter ); } } @@ -669,6 +670,7 @@ namespace OpenSim.Groups , false //canVoiceChat , false //isModerator , false //text mute + , true ); } } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index cc614f3297..f3acacd649 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -372,7 +372,7 @@ namespace OpenSim.Region.ClientStack.Linden caps.RegisterPollHandler( "EventQueueGet", - new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS)); + new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, Drop, agentID, SERVER_EQ_TIME_NO_EVENTS)); } public bool HasEvents(UUID requestID, UUID agentID) @@ -403,6 +403,10 @@ namespace OpenSim.Region.ClientStack.Linden ev["message"], m_scene.GetScenePresence(agentId).Name, m_scene.Name); } } + public void Drop(UUID requestID, UUID pAgentId) + { + // do nothing for now, hope client close will do it + } public Hashtable GetEvents(UUID requestID, UUID pAgentId) { @@ -564,12 +568,12 @@ namespace OpenSim.Region.ClientStack.Linden } - public void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID anotherAgent, bool canVoiceChat, - bool isModerator, bool textMute) + public void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, + bool isModerator, bool textMute, bool isEnterorLeave) { OSD item = EventQueueHelper.ChatterBoxSessionAgentListUpdates(sessionID, fromAgent, canVoiceChat, - isModerator, textMute); - Enqueue(item, fromAgent); + isModerator, textMute, isEnterorLeave); + Enqueue(item, toAgent); //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index 8beeb95b09..f1c29f6c23 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs @@ -308,7 +308,7 @@ namespace OpenSim.Region.ClientStack.Linden } public static OSD ChatterBoxSessionAgentListUpdates(UUID sessionID, - UUID agentID, bool canVoiceChat, bool isModerator, bool textMute) + UUID agentID, bool canVoiceChat, bool isModerator, bool textMute, bool isEnterorLeave) { OSDMap body = new OSDMap(); OSDMap agentUpdates = new OSDMap(); @@ -321,7 +321,13 @@ namespace OpenSim.Region.ClientStack.Linden infoDetail.Add("mutes", mutes); OSDMap info = new OSDMap(); info.Add("info", infoDetail); + if(isEnterorLeave) + info.Add("transition",OSD.FromString("ENTER")); + else + info.Add("transition",OSD.FromString("LEAVE")); agentUpdates.Add(agentID.ToString(), info); + + body.Add("agent_updates", agentUpdates); body.Add("session_id", OSD.FromUUID(sessionID)); body.Add("updates", new OSD()); diff --git a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs index 4361310f34..b52576984a 100644 --- a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs +++ b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Interfaces uint timeStamp, bool offline, int parentEstateID, Vector3 position, uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket); void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID anotherAgent, bool canVoiceChat, - bool isModerator, bool textMute); + bool isModerator, bool textMute, bool isEnterorLeave); void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID); void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data); OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index e1b6abb3ae..3d9175c0f2 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -526,6 +526,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups , false //canVoiceChat , false //isModerator , false //text mute + , true // enter ); } @@ -574,7 +575,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); - +/* this seems wrong IEventQueue queue = remoteClient.Scene.RequestModuleInterface(); queue.ChatterBoxSessionAgentListUpdates( GroupID @@ -583,7 +584,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups , false //canVoiceChat , false //isModerator , false //text mute + , true ); +*/ } } diff --git a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs index 6ed9a16c5b..417efce63c 100644 --- a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs +++ b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs @@ -147,9 +147,9 @@ namespace OpenSim.Tests.Common timeStamp, offline, parentEstateID, position, ttl, transactionID, fromGroup, binaryBucket); } - public void ChatterBoxSessionAgentListUpdates (UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, bool isModerator, bool textMute) + public void ChatterBoxSessionAgentListUpdates (UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, bool isModerator, bool textMute , bool isEnterorLeave) { - AddEvent(toAgent, "ChatterBoxSessionAgentListUpdates", sessionID, fromAgent, canVoiceChat, isModerator, textMute); + AddEvent(toAgent, "ChatterBoxSessionAgentListUpdates", sessionID, fromAgent, canVoiceChat, isModerator, textMute, isEnterorLeave); } public void ParcelProperties (OpenMetaverse.Messages.Linden.ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) From bdab44ef7ed8046fc42f2e01878607e2485f84f6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Jul 2016 01:34:40 +0100 Subject: [PATCH 05/45] remove code from httptests branch --- .../ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index f3acacd649..6d548ada23 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -372,7 +372,7 @@ namespace OpenSim.Region.ClientStack.Linden caps.RegisterPollHandler( "EventQueueGet", - new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, Drop, agentID, SERVER_EQ_TIME_NO_EVENTS)); + new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS)); } public bool HasEvents(UUID requestID, UUID agentID) From c4db0dd6acadf220bc2408617e4c38deabd1b633 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Jul 2016 21:09:34 +0100 Subject: [PATCH 06/45] change group lists control so it does show something (only xmlrpcgroups for now). This will never work without a centralized dispatcher/controler, or more complex information exchange. --- .../XmlRpcGroups/GroupsMessagingModule.cs | 188 +++++++++--------- .../XmlRpcGroupsServicesConnectorModule.cs | 12 +- 2 files changed, 101 insertions(+), 99 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 3d9175c0f2..0aaf95c78c 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 attemptDeliveryUuidSet = new HashSet(Array.ConvertAll(onlineAgents, pi => pi.UserID)); - - //Array.ForEach(onlineAgents, pi => attemptDeliveryUuidSet.Add(pi.UserID)); - - //groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList(); - - // if (m_debugEnabled) -// m_log.DebugFormat( -// "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members, {2} online", -// groupID, groupMembersCount, groupMembers.Count()); } else { @@ -387,7 +378,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups member.AgentID, Environment.TickCount - startTick); } } - else + else if(im.dialog != (byte)InstantMessageDialog.SessionAdd && + im.dialog != (byte)InstantMessageDialog.SessionDrop) { int startTick = Environment.TickCount; @@ -443,21 +435,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { IClientAPI client = null; - if (msg.dialog == (byte)InstantMessageDialog.SessionSend) + client = GetActiveClient(new UUID(msg.toAgentID)); + + if (client == null) { - client = GetActiveClient(new UUID(msg.toAgentID)); + m_log.WarnFormat("[GROUPS-MESSAGING]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID); - if (client != null) - { - if (m_debugEnabled) - m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} locally", client.Name); - } - else - { - m_log.WarnFormat("[GROUPS-MESSAGING]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID); - - return; - } + return; } ProcessMessageFromGroupSession(msg, client); @@ -471,79 +455,96 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups "[GROUPS-MESSAGING]: Session message from {0} going to agent {1}, sessionID {2}, type {3}", msg.fromAgentName, msg.toAgentID, msg.imSessionID, (InstantMessageDialog)msg.dialog); - UUID AgentID = new UUID(msg.fromAgentID); + UUID fromAgentID = new UUID(msg.fromAgentID); UUID GroupID = new UUID(msg.imSessionID); + IEventQueue eq = client.Scene.RequestModuleInterface(); switch (msg.dialog) { case (byte)InstantMessageDialog.SessionAdd: - m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); + m_groupData.AgentInvitedToGroupChatSession(fromAgentID, GroupID); + if(eq != null) + eq.ChatterBoxSessionAgentListUpdates( + GroupID + , fromAgentID + , client.AgentId + , false //canVoiceChat + , false //isModerator + , false //text mute + , true // enter + ); break; case (byte)InstantMessageDialog.SessionDrop: - m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID); - break; - - case (byte)InstantMessageDialog.SessionSend: - if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID) - && !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID, GroupID) - ) - { - // Agent not in session and hasn't dropped from session - // Add them to the session for now, and Invite them - m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); - - GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); - if (groupInfo != null) - { - if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message"); - - // Force? open the group session dialog??? - // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg); - IEventQueue eq = client.Scene.RequestModuleInterface(); - eq.ChatterboxInvitation( + m_groupData.AgentDroppedFromGroupChatSession(fromAgentID, GroupID); + if(eq != null) + eq.ChatterBoxSessionAgentListUpdates( GroupID - , groupInfo.GroupName - , new UUID(msg.fromAgentID) - , msg.message - , new UUID(msg.toAgentID) - , msg.fromAgentName - , msg.dialog - , msg.timestamp - , msg.offline == 1 - , (int)msg.ParentEstateID - , msg.Position - , 1 - , new UUID(msg.imSessionID) - , msg.fromGroup - , Utils.StringToBytes(groupInfo.GroupName) - ); - - eq.ChatterBoxSessionAgentListUpdates( - new UUID(GroupID) - , new UUID(msg.fromAgentID) - , new UUID(msg.toAgentID) + , fromAgentID + , client.AgentId , false //canVoiceChat , false //isModerator , false //text mute - , true // enter + , false // leave ); + break; + + case (byte)InstantMessageDialog.SessionSend: + if (!m_groupData.hasAgentDroppedGroupChatSession(client.AgentId, GroupID)) + { + if(!m_groupData.hasAgentBeenInvitedToGroupChatSession(client.AgentId, GroupID)) + { + + GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); + if (groupInfo != null) + { + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message"); + + if(eq != null) + { + eq.ChatterboxInvitation( + GroupID + , groupInfo.GroupName + , fromAgentID + , msg.message + , client.AgentId + , msg.fromAgentName + , msg.dialog + , msg.timestamp + , msg.offline == 1 + , (int)msg.ParentEstateID + , msg.Position + , 1 + , new UUID(msg.imSessionID) + , msg.fromGroup + , Utils.StringToBytes(groupInfo.GroupName) + ); + } + } + } + else + { + client.SendInstantMessage(msg); } - break; +// if (!m_groupData.hasAgentBeenInvitedToGroupChatSession(fromAgentID, GroupID)) + { + m_groupData.AgentInvitedToGroupChatSession(fromAgentID, GroupID); + eq.ChatterBoxSessionAgentListUpdates( + GroupID + , fromAgentID + , client.AgentId + , false //canVoiceChat + , false //isModerator + , false //text mute + , true // enter + ); + } } - else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)) - { - // User hasn't dropped, so they're in the session, - // maybe we should deliver it. - client.SendInstantMessage(msg); - } - break; default: client.SendInstantMessage(msg); - break;; } } @@ -560,14 +561,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups DebugGridInstantMessage(im); } + UUID GroupID = new UUID(im.imSessionID); + UUID AgentID = new UUID(im.fromAgentID); + // Start group IM session if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) { if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID); - UUID GroupID = new UUID(im.imSessionID); - UUID AgentID = new UUID(im.fromAgentID); - GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); if (groupInfo != null) @@ -575,27 +576,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); -/* this seems wrong - IEventQueue queue = remoteClient.Scene.RequestModuleInterface(); - queue.ChatterBoxSessionAgentListUpdates( - GroupID - , AgentID - , new UUID(im.toAgentID) - , false //canVoiceChat - , false //isModerator - , false //text mute - , true - ); -*/ + + // we need to send here a list of known participants. + im.dialog = (byte)InstantMessageDialog.SessionAdd; + SendMessageToGroup(im, GroupID); } } // Send a message from locally connected client to a group if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) { - UUID GroupID = new UUID(im.imSessionID); - UUID AgentID = new UUID(im.fromAgentID); - if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString()); @@ -604,6 +594,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups SendMessageToGroup(im, GroupID); } + + if ((im.dialog == (byte)InstantMessageDialog.SessionDrop)) + { + if (m_debugEnabled) + m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString()); + + m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID); + + SendMessageToGroup(im, GroupID); + } } #endregion diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 2dda3a18bc..83f08e0e4b 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 { if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) { + if (m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID)) + m_groupsAgentsInvitedToChatSession[groupID].Remove(agentID); + // If not in dropped list, add if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) - { m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID); - } } } @@ -818,10 +819,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // If nessesary, remove from dropped list if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) - { m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID); - } - } + + if (!m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID)) + m_groupsAgentsInvitedToChatSession[groupID].Add(agentID); + } private void CreateGroupChatSessionTracking(UUID groupID) { From f4eb1a8e1daafa0198606b918a74e9b76b253c4d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Jul 2016 21:20:36 +0100 Subject: [PATCH 07/45] add a coment for improvement of ChatterBoxSessionAgentListUpdates closer to viewers protocol. Not necessary on current groups chat lists defecient implementation --- .../ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index f1c29f6c23..d552914e81 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs @@ -315,6 +315,8 @@ namespace OpenSim.Region.ClientStack.Linden OSDMap infoDetail = new OSDMap(); OSDMap mutes = new OSDMap(); + // this should be a list of agents and parameters + // foreach agent mutes.Add("text", OSD.FromBoolean(textMute)); infoDetail.Add("can_voice_chat", OSD.FromBoolean(canVoiceChat)); infoDetail.Add("is_moderator", OSD.FromBoolean(isModerator)); @@ -327,6 +329,7 @@ namespace OpenSim.Region.ClientStack.Linden info.Add("transition",OSD.FromString("LEAVE")); agentUpdates.Add(agentID.ToString(), info); + // foreach end body.Add("agent_updates", agentUpdates); body.Add("session_id", OSD.FromUUID(sessionID)); From 96a5a053ef2983b0fa2cf248b8e270a7db3d978e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Jul 2016 14:44:40 +0100 Subject: [PATCH 08/45] do not send IMs via child agents --- .../InstantMessage/HGMessageTransferModule.cs | 25 ++------- .../InstantMessage/MessageTransferModule.cs | 51 ++++++++----------- 2 files changed, 23 insertions(+), 53 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index a1b918a3b6..63b3dba544 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 // "[HG INSTANT MESSAGE]: Looking for root agent {0} in {1}", // toAgentID.ToString(), scene.RegionInfo.RegionName); ScenePresence sp = scene.GetScenePresence(toAgentID); - if (sp != null && !sp.IsChildAgent) + if (sp != null && !sp.IsChildAgent && !sp.IsDeleted) { // Local message // 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 } } - // try child avatar second - foreach (Scene scene in m_Scenes) - { -// m_log.DebugFormat( -// "[HG INSTANT MESSAGE]: Looking for child of {0} in {1}", -// toAgentID, scene.RegionInfo.RegionName); - ScenePresence sp = scene.GetScenePresence(toAgentID); - if (sp != null) - { - // Local message -// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); - sp.ControllingClient.SendInstantMessage(im); - - // Message sent - result(true); - return; - } - } - // m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); // Is the user a local user? string url = string.Empty; @@ -224,7 +205,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage foreach (Scene scene in m_Scenes) { ScenePresence sp = scene.GetScenePresence(toAgentID); - if(sp != null && !sp.IsChildAgent) + if(sp != null && !sp.IsChildAgent && !sp.IsDeleted) { scene.EventManager.TriggerIncomingInstantMessage(gim); successful = true; @@ -310,7 +291,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage foreach (Scene scene in m_Scenes) { ScenePresence presence = scene.GetScenePresence(agentID); - if (presence != null && !presence.IsChildAgent) + if (presence != null && !presence.IsChildAgent && !presence.IsDeleted) return presence.ControllingClient; } } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 3c82fd9145..6958905980 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 if (toAgentID == UUID.Zero) return; + IClientAPI client = null; + // Try root avatar only first foreach (Scene scene in m_Scenes) { -// m_log.DebugFormat( -// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", -// toAgentID.ToString(), scene.RegionInfo.RegionName); - ScenePresence sp = scene.GetScenePresence(toAgentID); - if (sp != null && !sp.IsChildAgent) + if (sp != null && !sp.IsDeleted && sp.ControllingClient.IsActive) { - // Local message + // actualy don't send via child agents + // ims can be complex things, and not sure viewers will not mess up + if(sp.IsChildAgent) + continue; + + client = sp.ControllingClient; + if(!sp.IsChildAgent) + break; + } + } + + if(client != null) + { + // Local message // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", sp.Name, toAgentID); - sp.ControllingClient.SendInstantMessage(im); + client.SendInstantMessage(im); // Message sent - result(true); - return; - } + result(true); + return; } - - // try child avatar second - foreach (Scene scene in m_Scenes) - { -// m_log.DebugFormat( -// "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); - - ScenePresence sp = scene.GetScenePresence(toAgentID); - if (sp != null) - { - // Local message -// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", sp.Name, toAgentID); - - sp.ControllingClient.SendInstantMessage(im); - - // Message sent - result(true); - return; - } - } - // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); SendGridInstantMessageViaXMLRPC(im, result); From bf604c85c66dd3bed06e3103cdf210ede02c151f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Jul 2016 15:17:25 +0100 Subject: [PATCH 09/45] add missing IM parameter ( needs fix where it is really relevant ) --- OpenSim/Framework/GridInstantMessage.cs | 19 +++++++++++++++++-- .../ClientStack/Linden/UDP/LLClientView.cs | 8 ++------ .../InstantMessage/MessageTransferModule.cs | 7 +++++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs index da3690c93b..d856173962 100644 --- a/OpenSim/Framework/GridInstantMessage.cs +++ b/OpenSim/Framework/GridInstantMessage.cs @@ -47,6 +47,7 @@ namespace OpenSim.Framework public uint ParentEstateID; public Guid RegionID; public uint timestamp; + public Guid ID; public GridInstantMessage() { @@ -66,6 +67,8 @@ namespace OpenSim.Framework Position = im.Position; binaryBucket = im.binaryBucket; RegionID = im.RegionID; + ParentEstateID = im.ParentEstateID; + ID = im.ID; if (addTimestamp) timestamp = (uint)Util.UnixTimeSinceEpoch(); @@ -75,7 +78,7 @@ namespace OpenSim.Framework string _fromAgentName, UUID _toAgentID, byte _dialog, bool _fromGroup, string _message, UUID _imSessionID, bool _offline, Vector3 _position, - byte[] _binaryBucket, bool addTimestamp) + byte[] _binaryBucket, UUID _ID, bool addTimestamp) { fromAgentID = _fromAgentID.Guid; fromAgentName = _fromAgentName; @@ -84,6 +87,8 @@ namespace OpenSim.Framework fromGroup = _fromGroup; message = _message; imSessionID = _imSessionID.Guid; + ID = _ID.Guid; + if (_offline) offline = 1; else @@ -101,12 +106,22 @@ namespace OpenSim.Framework timestamp = (uint)Util.UnixTimeSinceEpoch(); } + public GridInstantMessage(IScene scene, UUID _fromAgentID, + string _fromAgentName, UUID _toAgentID, + byte _dialog, bool _fromGroup, string _message, + UUID _imSessionID, bool _offline, Vector3 _position, + byte[] _binaryBucket, bool addTimestamp) : this(scene, _fromAgentID, _fromAgentName, + _toAgentID, _dialog, false, _message, + _fromAgentID ^ _toAgentID, _offline, _position, new byte[0], UUID.Zero, true) + { + } + public GridInstantMessage(IScene scene, UUID _fromAgentID, string _fromAgentName, UUID _toAgentID, byte _dialog, string _message, bool _offline, Vector3 _position) : this(scene, _fromAgentID, _fromAgentName, _toAgentID, _dialog, false, _message, - _fromAgentID ^ _toAgentID, _offline, _position, new byte[0], true) + _fromAgentID ^ _toAgentID, _offline, _position, new byte[0], UUID.Zero, true) { } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6dd2ffd15b..68fe8d96b2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -953,7 +953,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Send an instant message to this client /// // - // Don't remove transaction ID! Groups and item gives need to set it! public void SendInstantMessage(GridInstantMessage im) { if (((Scene)(m_scene)).Permissions.CanInstantMessage(new UUID(im.fromAgentID), new UUID(im.toAgentID))) @@ -962,14 +961,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); msg.AgentData.AgentID = new UUID(im.fromAgentID); - msg.AgentData.SessionID = UUID.Zero; + msg.AgentData.SessionID = new UUID(im.imSessionID); msg.MessageBlock.FromAgentName = Util.StringToBytes256(im.fromAgentName); msg.MessageBlock.Dialog = im.dialog; msg.MessageBlock.FromGroup = im.fromGroup; - if (im.imSessionID == UUID.Zero.Guid) - msg.MessageBlock.ID = new UUID(im.fromAgentID) ^ new UUID(im.toAgentID); - else - msg.MessageBlock.ID = new UUID(im.imSessionID); + msg.MessageBlock.ID = new UUID(im.ID); msg.MessageBlock.Offline = im.offline; msg.MessageBlock.ParentEstateID = im.ParentEstateID; msg.MessageBlock.Position = im.Position; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 6958905980..1366103328 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -216,6 +216,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage UUID fromAgentID = UUID.Zero; UUID toAgentID = UUID.Zero; UUID imSessionID = UUID.Zero; + UUID imID = UUID.Zero; uint timestamp = 0; string fromAgentName = ""; string message = ""; @@ -232,7 +233,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage float pos_z = 0; //m_log.Info("Processing IM"); - Hashtable requestData = (Hashtable)request.Params[0]; // Check if it's got all the data if (requestData.ContainsKey("from_agent_id") @@ -263,6 +263,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); UUID.TryParse((string)requestData["im_session_id"], out imSessionID); UUID.TryParse((string)requestData["region_id"], out RegionID); + UUID.TryParse((string)requestData["id"], out imID); try { @@ -390,6 +391,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage gim.ParentEstateID = ParentEstateID; gim.Position = Position; gim.binaryBucket = binaryBucket; + gim.ID = imID.Guid; // Trigger the Instant message in the scene. @@ -508,7 +510,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage UUID toAgentID = new UUID(im.toAgentID); PresenceInfo upd = null; - UUID regionID; bool lookupAgent = false; lock (m_UserRegionMap) @@ -701,6 +702,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage gim["from_agent_session"] = UUID.Zero.ToString(); gim["to_agent_id"] = msg.toAgentID.ToString(); gim["im_session_id"] = msg.imSessionID.ToString(); + if(msg.ID != Guid.Empty) + gim["id"] = msg.ID.ToString(); gim["timestamp"] = msg.timestamp.ToString(); gim["from_agent_name"] = msg.fromAgentName; gim["message"] = msg.message; From 4fa8debde535a3b1f972c875d146648f358c7498 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Jul 2016 15:43:35 +0100 Subject: [PATCH 10/45] Ooops ... --- OpenSim/Framework/GridInstantMessage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs index d856173962..a9fefcbd7c 100644 --- a/OpenSim/Framework/GridInstantMessage.cs +++ b/OpenSim/Framework/GridInstantMessage.cs @@ -112,7 +112,7 @@ namespace OpenSim.Framework UUID _imSessionID, bool _offline, Vector3 _position, byte[] _binaryBucket, bool addTimestamp) : this(scene, _fromAgentID, _fromAgentName, _toAgentID, _dialog, false, _message, - _fromAgentID ^ _toAgentID, _offline, _position, new byte[0], UUID.Zero, true) + _fromAgentID ^ _toAgentID, _offline, _position, _binaryBucket, UUID.Zero, true) { } From 37936550f0879605721fb161e60b4e1add06f5e7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Jul 2016 15:55:31 +0100 Subject: [PATCH 11/45] reOoops ... --- OpenSim/Framework/GridInstantMessage.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs index a9fefcbd7c..53d98db236 100644 --- a/OpenSim/Framework/GridInstantMessage.cs +++ b/OpenSim/Framework/GridInstantMessage.cs @@ -110,9 +110,9 @@ namespace OpenSim.Framework string _fromAgentName, UUID _toAgentID, byte _dialog, bool _fromGroup, string _message, UUID _imSessionID, bool _offline, Vector3 _position, - byte[] _binaryBucket, bool addTimestamp) : this(scene, _fromAgentID, _fromAgentName, - _toAgentID, _dialog, false, _message, - _fromAgentID ^ _toAgentID, _offline, _position, _binaryBucket, UUID.Zero, true) + byte[] _binaryBucket, bool addTimestamp) : this (scene, _fromAgentID, + _fromAgentName, _toAgentID, _dialog, _fromGroup, _message, + _imSessionID, _offline, _position, _binaryBucket, UUID.Zero, addTimestamp) { } From 2bb467e358c0e9e1055a077e9da8c4ddf773707d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Jul 2016 16:31:29 +0100 Subject: [PATCH 12/45] add osSetHealth() value from 1 to 100; (mantis 7973) --- .../Shared/Api/Implementation/OSSL_Api.cs | 19 +++++++++++++++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ bin/config-include/osslEnable.ini | 1 + 4 files changed, 26 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 204f73e318..072d10dbe3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3469,6 +3469,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public void osSetHealth(string avatar, double health) + { + CheckThreatLevel(ThreatLevel.High, "osSetHealth"); + m_host.AddScriptLPS(1); + + UUID avatarId = new UUID(avatar); + ScenePresence presence = World.GetScenePresence(avatarId); + + if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) + { + if (health > 100.0) + health = 100.0; + else if (health < 1.0) + health = 1.0; + + presence.setHealthWithUpdate((float)health); + } + } + public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) { 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 c1a177a1a9..a018bac47a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -368,6 +368,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osSetSpeed(string UUID, LSL_Float SpeedModifier); LSL_Float osGetHealth(string avatar); void osCauseHealing(string avatar, double healing); + void osSetHealth(string avatar, double health); void osCauseDamage(string avatar, double damage); void osForceOtherSit(string avatar); 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 d58629081f..c55ff8e305 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -945,6 +945,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osCauseHealing(avatar, healing); } + public void osSetHealth(string avatar, double health) + { + m_OSSL_Functions.osSetHealth(avatar, health); + } + public void osForceOtherSit(string avatar) { m_OSSL_Functions.osForceOtherSit(avatar); diff --git a/bin/config-include/osslEnable.ini b/bin/config-include/osslEnable.ini index 0a03d4c238..a31dd176e7 100644 --- a/bin/config-include/osslEnable.ini +++ b/bin/config-include/osslEnable.ini @@ -157,6 +157,7 @@ ; ThreatLevel High Allow_osCauseDamage = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osCauseHealing = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER + Allow_osSetHealth = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osForceAttachToAvatar = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osForceAttachToAvatarFromInventory = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osForceCreateLink = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER From d6d3e14f291d3217d1727dfb9ddfe2420c9a0a42 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Jul 2016 19:31:28 +0100 Subject: [PATCH 13/45] add a missing update to avatar damage Invulnerable --- OpenSim/Framework/ISceneAgent.cs | 1 + OpenSim/Region/CoreModules/World/Land/LandObject.cs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/OpenSim/Framework/ISceneAgent.cs b/OpenSim/Framework/ISceneAgent.cs index be11931109..1848b1757e 100644 --- a/OpenSim/Framework/ISceneAgent.cs +++ b/OpenSim/Framework/ISceneAgent.cs @@ -55,6 +55,7 @@ namespace OpenSim.Framework /// bool IsChildAgent { get; } + bool Invulnerable { get; set; } /// /// Avatar appearance data. /// diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 4cea7bb209..b00f2b0de3 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 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) { + remote_client.SceneAgent.Invulnerable = + !m_scene.RegionInfo.RegionSettings.AllowDamage || + (m_landData.Flags & (uint)ParcelFlags.AllowDamage) == 0; + if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) return; From 574b97d93d3118fb6f6bd0113711551fcc5712cb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Jul 2016 21:16:14 +0100 Subject: [PATCH 14/45] ubOde fix contact relative velocity sign --- .../Region/PhysicsModules/ubOde/ODEScene.cs | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index e0644e38ea..a49c44c969 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -1079,44 +1079,45 @@ namespace OpenSim.Region.PhysicsModule.ubOde { case ActorTypes.Agent: case ActorTypes.Prim: + { + switch ((ActorTypes)p2.PhysicsActorType) { - switch ((ActorTypes)p2.PhysicsActorType) - { - case ActorTypes.Agent: - case ActorTypes.Prim: - if (p2events) - { - AddCollisionEventReporting(p2); - p2.AddCollisionEvent(p1.ParentActor.LocalID, contact); - } - obj2LocalID = p2.ParentActor.LocalID; - break; + case ActorTypes.Agent: + case ActorTypes.Prim: + if (p2events) + { + AddCollisionEventReporting(p2); + p2.AddCollisionEvent(p1.ParentActor.LocalID, contact); + } + obj2LocalID = p2.ParentActor.LocalID; + break; - case ActorTypes.Ground: - case ActorTypes.Unknown: - default: - obj2LocalID = 0; - break; - } - if (p1events) - { - contact.SurfaceNormal = -contact.SurfaceNormal; - AddCollisionEventReporting(p1); - p1.AddCollisionEvent(obj2LocalID, contact); - } - break; + case ActorTypes.Ground: + case ActorTypes.Unknown: + default: + obj2LocalID = 0; + break; } + if (p1events) + { + contact.SurfaceNormal = -contact.SurfaceNormal; + contact.RelativeSpeed = -contact.RelativeSpeed; + AddCollisionEventReporting(p1); + p1.AddCollisionEvent(obj2LocalID, contact); + } + break; + } case ActorTypes.Ground: case ActorTypes.Unknown: default: + { + if (p2events && !p2.IsVolumeDtc) { - if (p2events && !p2.IsVolumeDtc) - { - AddCollisionEventReporting(p2); - p2.AddCollisionEvent(0, contact); - } - break; + AddCollisionEventReporting(p2); + p2.AddCollisionEvent(0, contact); } + break; + } } } From a572a22dd9fa6ae1b7fe8b3237decccc97af45fd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Jul 2016 21:29:34 +0100 Subject: [PATCH 15/45] ubOde try to improve contact velocity on first avatar collision with terrain --- OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 55619c00f6..ccaff5e9b9 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -80,6 +80,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private Vector3 m_rotationalVelocity; private Vector3 m_size; private Vector3 m_collideNormal; + private Vector3 m_lastFallVel; private Quaternion m_orientation; private Quaternion m_orientation2D; private float m_mass = 80f; @@ -1114,7 +1115,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_iscollidingGround = true; - ContactPoint contact = new ContactPoint(); contact.PenetrationDepth = depth; contact.Position.X = localpos.X; @@ -1123,9 +1123,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde contact.SurfaceNormal.X = -n.X; contact.SurfaceNormal.Y = -n.Y; contact.SurfaceNormal.Z = -n.Z; - contact.RelativeSpeed = -vel.Z; + contact.RelativeSpeed = -Vector3.Dot(m_lastFallVel, contact.SurfaceNormal);; contact.CharacterFeet = true; AddCollisionEvent(0, contact); + m_lastFallVel = vel; // vec.Z *= 0.5f; } @@ -1133,6 +1134,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde else { + m_lastFallVel = vel; m_colliderGroundfilter -= 5; if (m_colliderGroundfilter <= 0) { @@ -1143,6 +1145,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { + m_lastFallVel = vel; m_colliderGroundfilter -= 5; if (m_colliderGroundfilter <= 0) { From c303cf74125e3e3251d77fc0d4147c89014c120d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Jul 2016 22:28:45 +0100 Subject: [PATCH 16/45] ubOde still on relative velocity. Make ubOde report avatar empty collisions to tick events on core. Avn didn't require this, core should not require also (TODO) --- .../Region/PhysicsModules/ubOde/ODECharacter.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index ccaff5e9b9..98f2eacc5e 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -110,6 +110,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private bool m_alwaysRun = false; private bool _zeroFlag = false; + private bool m_haveLastFallVel = false; private uint m_localID = 0; @@ -1087,6 +1088,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (ctz.Z < 0) ctz.Z = 0; + if(!m_haveLastFallVel) + { + m_lastFallVel = vel; + m_haveLastFallVel = true; + } + Vector3 n = _parent_scene.GetTerrainNormalAtXY(posch.X, posch.Y); float depth = terrainheight - chrminZ; @@ -1123,7 +1130,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde contact.SurfaceNormal.X = -n.X; contact.SurfaceNormal.Y = -n.Y; contact.SurfaceNormal.Z = -n.Z; - contact.RelativeSpeed = -Vector3.Dot(m_lastFallVel, contact.SurfaceNormal);; + contact.RelativeSpeed = Vector3.Dot(m_lastFallVel, n); contact.CharacterFeet = true; AddCollisionEvent(0, contact); m_lastFallVel = vel; @@ -1134,7 +1141,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde else { - m_lastFallVel = vel; m_colliderGroundfilter -= 5; if (m_colliderGroundfilter <= 0) { @@ -1145,7 +1151,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { - m_lastFallVel = vel; + m_haveLastFallVel = false; m_colliderGroundfilter -= 5; if (m_colliderGroundfilter <= 0) { @@ -1574,14 +1580,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; - if (!SentEmptyCollisionsEvent || ncolisions > 0) +// if (!SentEmptyCollisionsEvent || ncolisions > 0) { base.SendCollisionUpdate(CollisionEventsThisFrame); if (ncolisions == 0) { SentEmptyCollisionsEvent = true; - _parent_scene.RemoveCollisionEventReporting(this); +// _parent_scene.RemoveCollisionEventReporting(this); } else { From 0a9f06fda77b4f23274b5804dca56e5b615dcc25 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Jul 2016 22:33:31 +0100 Subject: [PATCH 17/45] ubOde actually revert last change don't send unnecessary empty collisions, will patch it elsewhere --- OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 98f2eacc5e..1b03b3cf76 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -1580,14 +1580,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; -// if (!SentEmptyCollisionsEvent || ncolisions > 0) + if (!SentEmptyCollisionsEvent || ncolisions > 0) { base.SendCollisionUpdate(CollisionEventsThisFrame); if (ncolisions == 0) { SentEmptyCollisionsEvent = true; -// _parent_scene.RemoveCollisionEventReporting(this); + _parent_scene.RemoveCollisionEventReporting(this); } else { From 42a072d1814f68238cdbb4c977222bb5d620c827 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 00:47:43 +0100 Subject: [PATCH 18/45] preserve max relative velocity on a colision report time slice --- .../PhysicsModules/SharedBase/PhysicsActor.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs index 393afaeabd..f82e2899d7 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs @@ -126,9 +126,20 @@ namespace OpenSim.Region.PhysicsModules.SharedBase m_objCollisionList.Add(localID, contact); } else - { + { + float lastVel = m_objCollisionList[localID].RelativeSpeed; if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth) + { + if(Math.Abs(lastVel) > Math.Abs(contact.RelativeSpeed)) + contact.RelativeSpeed = lastVel; m_objCollisionList[localID] = contact; + } + else if(Math.Abs(lastVel) < Math.Abs(contact.RelativeSpeed)) + { + ContactPoint tmp = m_objCollisionList[localID]; + tmp.RelativeSpeed = contact.RelativeSpeed; + m_objCollisionList[localID] = tmp; + } } } From 76239602b48d660b8735d9f2a07ec01aa08584ee Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 00:51:37 +0100 Subject: [PATCH 19/45] change avatar Health, from bad penetration depth to relative velocity --- .../Region/Framework/Scenes/ScenePresence.cs | 182 +++++++++--------- 1 file changed, 90 insertions(+), 92 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f20d06523a..8618a664a8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -277,6 +277,7 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_lastRotation; private Vector3 m_lastVelocity; private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); + private bool SentInitialData = false; private bool m_followCamAuto = false; @@ -1073,6 +1074,8 @@ namespace OpenSim.Region.Framework.Scenes } + private float lastHealthSent = 0; + private void RegionHeartbeatEnd(Scene scene) { if (IsChildAgent) @@ -1095,7 +1098,24 @@ namespace OpenSim.Region.Framework.Scenes } else { - m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; +// m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; + } + } + + if(Health != 100.0f) + { + float last = Health; + Health += 0.05f; + if(Health > 100.0f) + { + Health = 100.0f; + lastHealthSent = Health; + ControllingClient.SendHealth(Health); + } + else if(Math.Abs(Health - lastHealthSent) > 1.0) + { + lastHealthSent = Health; + ControllingClient.SendHealth(Health); } } } @@ -3758,6 +3778,7 @@ namespace OpenSim.Region.Framework.Scenes public void SendInitialDataToMe() { // Send all scene object to the new client + SentInitialData = true; Util.FireAndForget(delegate { // we created a new ScenePresence (a new child agent) in a fresh region. @@ -3993,6 +4014,12 @@ namespace OpenSim.Region.Framework.Scenes if(IsDeleted || !ControllingClient.IsActive) return; + if(!SentInitialData) + { + SendInitialDataToMe(); + return; + } + if(m_reprioritizationBusy) return; @@ -4667,18 +4694,19 @@ namespace OpenSim.Region.Framework.Scenes /// public void PhysicsCollisionUpdate(EventArgs e) { - if (IsChildAgent || Animator == null) + if (IsChildAgent) return; if(IsInTransit) return; + //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( // as of this comment the interval is set in AddToPhysicalScene // if (m_updateCount > 0) // { - if (Animator.UpdateMovementAnimations()) + if (Animator != null && Animator.UpdateMovementAnimations()) TriggerScenePresenceUpdated(); // m_updateCount--; // } @@ -4686,7 +4714,6 @@ namespace OpenSim.Region.Framework.Scenes CollisionEventUpdate collisionData = (CollisionEventUpdate)e; Dictionary coldata = collisionData.m_objCollisionList; - // // No collisions at all means we may be flying. Update always // // to make falling work // if (m_lastColCount != coldata.Count || coldata.Count == 0) @@ -4697,42 +4724,24 @@ namespace OpenSim.Region.Framework.Scenes if (coldata.Count != 0) { -/* - switch (Animator.CurrentMovementAnimation) + ContactPoint lowest; + lowest.SurfaceNormal = Vector3.Zero; + lowest.Position = Vector3.Zero; + lowest.Position.Z = float.MaxValue; + + foreach (ContactPoint contact in coldata.Values) { - case "STAND": - case "WALK": - case "RUN": - case "CROUCH": - case "CROUCHWALK": - { - */ - ContactPoint lowest; - lowest.SurfaceNormal = Vector3.Zero; - lowest.Position = Vector3.Zero; - lowest.Position.Z = float.MaxValue; - - foreach (ContactPoint contact in coldata.Values) - { - - if (contact.CharacterFeet && contact.Position.Z < lowest.Position.Z) - { - lowest = contact; - } - } - - if (lowest.Position.Z != float.MaxValue) - { - lowest.SurfaceNormal = -lowest.SurfaceNormal; - CollisionPlane = new Vector4(lowest.SurfaceNormal, Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); - } - else - CollisionPlane = Vector4.UnitW; -/* - } - break; + if (contact.CharacterFeet && contact.Position.Z < lowest.Position.Z) + lowest = contact; } -*/ + + if (lowest.Position.Z != float.MaxValue) + { + lowest.SurfaceNormal = -lowest.SurfaceNormal; + CollisionPlane = new Vector4(lowest.SurfaceNormal, Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); + } + else + CollisionPlane = Vector4.UnitW; } else CollisionPlane = Vector4.UnitW; @@ -4745,73 +4754,62 @@ namespace OpenSim.Region.Framework.Scenes // The following may be better in the ICombatModule // probably tweaking of the values for ground and normal prim collisions will be needed - float starthealth = Health; - uint killerObj = 0; - SceneObjectPart part = null; - foreach (uint localid in coldata.Keys) + float startHealth = Health; + if(coldata.Count > 0) { - if (localid == 0) + uint killerObj = 0; + SceneObjectPart part = null; + float rvel; // relative velocity, negative on approch + foreach (uint localid in coldata.Keys) { - part = null; - } - else - { - part = Scene.GetSceneObjectPart(localid); - } - if (part != null) - { - // Ignore if it has been deleted or volume detect - if (!part.ParentGroup.IsDeleted && !part.ParentGroup.IsVolumeDetect) + if (localid == 0) { - if (part.ParentGroup.Damage > 0.0f) + // 0 is the ground + rvel = coldata[0].RelativeSpeed; + if(rvel < -5.0f) + Health -= 0.01f * rvel * rvel; + } + else + { + part = Scene.GetSceneObjectPart(localid); + + if(part != null && !part.ParentGroup.IsDeleted && !part.ParentGroup.IsVolumeDetect) { - // Something with damage... - Health -= part.ParentGroup.Damage; - part.ParentGroup.Scene.DeleteSceneObject(part.ParentGroup, false); - } - else - { - // An ordinary prim - if (coldata[localid].PenetrationDepth >= 0.10f) - Health -= coldata[localid].PenetrationDepth * 5.0f; + if (part.ParentGroup.Damage > 0.0f) + { + // Something with damage... + Health -= part.ParentGroup.Damage; + part.ParentGroup.Scene.DeleteSceneObject(part.ParentGroup, false); + } + else + { + // An ordinary prim + rvel = coldata[localid].RelativeSpeed; + if(rvel < -5.0f) + { + Health -= 0.005f * rvel * rvel;; + } + } } } - } - else - { - // 0 is the ground - // what about collisions with other avatars? - if (localid == 0 && coldata[localid].PenetrationDepth >= 0.10f) - Health -= coldata[localid].PenetrationDepth * 5.0f; + + if (Health <= 0.0f) + { + if (localid != 0) + killerObj = localid; + } } - - if (Health <= 0.0f) - { - if (localid != 0) - killerObj = localid; - } - //m_log.Debug("[AVATAR]: Collision with localid: " + localid.ToString() + " at depth: " + coldata[localid].ToString()); - } - //Health = 100; - if (!Invulnerable) - { - if (starthealth != Health) - { - ControllingClient.SendHealth(Health); - } if (Health <= 0) { - m_scene.EventManager.TriggerAvatarKill(killerObj, this); - } - if (starthealth == Health && Health < 100.0f) - { - Health += 0.03f; - if (Health > 100.0f) - Health = 100.0f; ControllingClient.SendHealth(Health); + m_scene.EventManager.TriggerAvatarKill(killerObj, this); + return; } } + + if(Math.Abs(Health - startHealth) > 1.0) + ControllingClient.SendHealth(Health); } public void setHealthWithUpdate(float health) From e60dc305a41443c25e842624595b89cf4dffcd85 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 01:07:19 +0100 Subject: [PATCH 20/45] change bullet relative velocity sign to match ubOde --- OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs index a70d1b80da..bb21f0cf78 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs @@ -508,7 +508,7 @@ public abstract class BSPhysObject : PhysicsActor relvel = RawVelocity; if (collidee != null && collidee.IsPhysical) relvel -= collidee.RawVelocity; - newContact.RelativeSpeed = OMV.Vector3.Dot(relvel, contactNormal); + newContact.RelativeSpeed = -OMV.Vector3.Dot(relvel, contactNormal); // DetailLog("{0},{1}.Collision.AddCollider,vel={2},contee.vel={3},relvel={4},relspeed={5}", // LocalID, TypeName, RawVelocity, (collidee == null ? OMV.Vector3.Zero : collidee.RawVelocity), relvel, newContact.RelativeSpeed); From 4b832f0f8e32bf265ee13989500fb0559d1a86f7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 02:05:53 +0100 Subject: [PATCH 21/45] add osGetHealRate(avatarkey) and osSetHealRate(avatarkey, healrate); healrate from 0 (disables auto heal) to 100 (maybe too fast) % per second. (untested) --- .../Shared/Api/Implementation/OSSL_Api.cs | 24 +++++++++++++++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 2 ++ .../Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++++++ bin/config-include/osslEnable.ini | 2 ++ 4 files changed, 38 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 072d10dbe3..7a2b24f251 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3488,6 +3488,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public void osSetHealRate(string avatar, double healrate) + { + CheckThreatLevel(ThreatLevel.High, "osSetHealRate"); + m_host.AddScriptLPS(1); + + UUID avatarId = new UUID(avatar); + ScenePresence presence = World.GetScenePresence(avatarId); + + if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) + presence.HealRate = (float)healrate; + } + + public LSL_Float osGetHealRate(string avatar) + { + CheckThreatLevel(ThreatLevel.None, "osGetHealRate"); + m_host.AddScriptLPS(1); + + LSL_Float rate = new LSL_Float(0); + ScenePresence presence = World.GetScenePresence(new UUID(avatar)); + if (presence != null) + rate = presence.HealRate; + return rate; + } + public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) { 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 a018bac47a..c99679e08d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -369,6 +369,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Float osGetHealth(string avatar); void osCauseHealing(string avatar, double healing); void osSetHealth(string avatar, double health); + void osSetHealRate(string avatar, double health); + LSL_Float osGetHealRate(string avatar); void osCauseDamage(string avatar, double damage); void osForceOtherSit(string avatar); 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 c55ff8e305..35eee5992e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -950,6 +950,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osSetHealth(avatar, health); } + public void osSetHealRate(string avatar, double health) + { + m_OSSL_Functions.osSetHealRate(avatar, health); + } + + public LSL_Float osGetHealRate(string avatar) + { + return m_OSSL_Functions.osGetHealRate(avatar); + } + public void osForceOtherSit(string avatar) { m_OSSL_Functions.osForceOtherSit(avatar); diff --git a/bin/config-include/osslEnable.ini b/bin/config-include/osslEnable.ini index a31dd176e7..8f9702dc12 100644 --- a/bin/config-include/osslEnable.ini +++ b/bin/config-include/osslEnable.ini @@ -158,6 +158,8 @@ Allow_osCauseDamage = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osCauseHealing = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osSetHealth = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER + Allow_osSetHealRate = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER + Allow_osGetHealRate = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osForceAttachToAvatar = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osForceAttachToAvatarFromInventory = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER Allow_osForceCreateLink = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER From c3b298f85e99176badab736079f67a7adac0f803 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 02:11:45 +0100 Subject: [PATCH 22/45] missing file --- .../Region/Framework/Scenes/ScenePresence.cs | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8618a664a8..5ea950d1e1 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -343,6 +343,8 @@ namespace OpenSim.Region.Framework.Scenes private const float FLY_ROLL_RESET_RADIANS_PER_UPDATE = 0.02f; private float m_health = 100f; + private float m_healRate = 1f; + private float m_healRatePerFrame = 0.05f; protected ulong crossingFromRegion; @@ -861,6 +863,26 @@ namespace OpenSim.Region.Framework.Scenes set { m_health = value; } } + public float HealRate + { + get { return m_healRate; } + set + { + if(value > 100.0f) + m_healRate = 100.0f; + else if (value <= 0.0) + m_healRate = 0.0f; + else + m_healRate = value; + + if(Scene != null) + m_healRatePerFrame = m_healRate * Scene.FrameTime; + else + m_healRatePerFrame = 0.05f; + } + } + + /// /// Gets the world rotation of this presence. /// @@ -1064,6 +1086,8 @@ namespace OpenSim.Region.Framework.Scenes m_stateMachine = new ScenePresenceStateMachine(this); + HealRate = 0.5f; + IConfig sconfig = m_scene.Config.Configs["EntityTransfer"]; if (sconfig != null) { @@ -1102,10 +1126,10 @@ namespace OpenSim.Region.Framework.Scenes } } - if(Health != 100.0f) + if(m_healRatePerFrame != 0f && Health != 100.0f) { float last = Health; - Health += 0.05f; + Health += m_healRatePerFrame; if(Health > 100.0f) { Health = 100.0f; From f661fdf2aade7b92c82bba9a5e216c796681c2fd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 06:07:06 +0100 Subject: [PATCH 23/45] ubOde bug fix --- OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 4 +++- OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 6ed42d927f..437440c508 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs @@ -546,6 +546,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde { get { + if (_parent != null) + return ((OdePrim)_parent).Velocity; + if (_zeroFlag) return Vector3.Zero; return _velocity; @@ -560,7 +563,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde { m_log.WarnFormat("[PHYSICS]: Got NaN Velocity in Object {0}", Name); } - } } diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index a49c44c969..e475d8494c 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -995,7 +995,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde p1.CollidingObj = true; p2.CollidingObj = true; } - else if (p2.Velocity.LengthSquared() > 0.0f) + else if (p1.Velocity.LengthSquared() > 0.0f) p1.CollidingObj = true; } else From aa9503ab8616f11f9c579631213663df8e20d143 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 07:06:36 +0100 Subject: [PATCH 24/45] revert bad last changes and fix the issue another way --- .../PhysicsModules/SharedBase/PhysicsActor.cs | 1 + .../Region/PhysicsModules/ubOde/ODECharacter.cs | 8 ++++++++ OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 13 ++++++++++--- OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 17 +++++++++-------- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs index f82e2899d7..a7c4e8d00c 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs @@ -396,6 +396,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase } public abstract Vector3 Velocity { get; set; } + public virtual Vector3 rootVelocity { get; } public abstract Vector3 Torque { get; set; } public abstract float CollisionScore { get; set;} diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 1b03b3cf76..fc018056f5 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -607,6 +607,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde set { return; } } + public Vector3 rootVelocity + { + get + { + return _velocity; + } + } + public override Vector3 Velocity { get diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 437440c508..21efa9708b 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs @@ -542,13 +542,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } + public Vector3 rootVelocity + { + get + { + if(_parent != null) + return ((OdePrim)_parent).Velocity; + return Velocity; + } + } + public override Vector3 Velocity { get { - if (_parent != null) - return ((OdePrim)_parent).Velocity; - if (_zeroFlag) return Vector3.Zero; return _velocity; diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index e475d8494c..ee80b10ed9 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -874,7 +874,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde break; case (int)ActorTypes.Prim: - Vector3 relV = p1.Velocity - p2.Velocity; + Vector3 relV = p1.rootVelocity - p2.rootVelocity; float relVlenSQ = relV.LengthSquared(); if (relVlenSQ > 0.0001f) { @@ -899,7 +899,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde bounce = contactdata1.bounce * TerrainBounce; mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); - if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f) + Vector3 v1 = p1.rootVelocity; + if (Math.Abs(v1.X) > 0.1f || Math.Abs(v1.Y) > 0.1f) mu *= frictionMovementMult; p1.CollidingGround = true; @@ -925,8 +926,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde // if (curContact.side1 > 0) // should be 2 ? // IgnoreNegSides = true; - - if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f) + Vector3 v2 = p2.rootVelocity; + if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f) mu *= frictionMovementMult; if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass) @@ -980,7 +981,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde p1.CollidingObj = true; p2.CollidingObj = true; } - else if (p2.Velocity.LengthSquared() > 0.0f) + else if (p2.rootVelocity.LengthSquared() > 0.0f) p2.CollidingObj = true; } else @@ -995,7 +996,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde p1.CollidingObj = true; p2.CollidingObj = true; } - else if (p1.Velocity.LengthSquared() > 0.0f) + else if (p1.rootVelocity.LengthSquared() > 0.0f) p1.CollidingObj = true; } else @@ -1068,10 +1069,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde Vector3 vel = Vector3.Zero; if (p2 != null && p2.IsPhysical) - vel = p2.Velocity; + vel = p2.rootVelocity; if (p1 != null && p1.IsPhysical) - vel -= p1.Velocity; + vel -= p1.rootVelocity; contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal); From 2548f240b5dde3572bc8dfa967dd7c5cdd5fbb07 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 07:18:23 +0100 Subject: [PATCH 25/45] add missing overrides --- OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | 2 +- OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index fc018056f5..7d855f1ce2 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -607,7 +607,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde set { return; } } - public Vector3 rootVelocity + public override Vector3 rootVelocity { get { diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 21efa9708b..aaa2203a70 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs @@ -542,7 +542,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - public Vector3 rootVelocity + public override Vector3 rootVelocity { get { From fcdf0b00b18861574ba6919425bd8857681b0c18 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 07:24:39 +0100 Subject: [PATCH 26/45] add give a body to default rootVelocity --- OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs index a7c4e8d00c..04ccbf03ed 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs @@ -396,7 +396,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase } public abstract Vector3 Velocity { get; set; } - public virtual Vector3 rootVelocity { get; } + public virtual Vector3 rootVelocity { get { return Vector3.Zero; } } public abstract Vector3 Torque { get; set; } public abstract float CollisionScore { get; set;} From 1d507f8073558c31031c20828ebaa296623fcdcd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 08:38:10 +0100 Subject: [PATCH 27/45] remove extra char --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5ea950d1e1..0ccdbf76de 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4797,7 +4797,7 @@ namespace OpenSim.Region.Framework.Scenes { part = Scene.GetSceneObjectPart(localid); - if(part != null && !part.ParentGroup.IsDeleted && !part.ParentGroup.IsVolumeDetect) + if(part != null && !part.ParentGroup.IsVolumeDetect) { if (part.ParentGroup.Damage > 0.0f) { @@ -4811,10 +4811,14 @@ namespace OpenSim.Region.Framework.Scenes rvel = coldata[localid].RelativeSpeed; if(rvel < -5.0f) { - Health -= 0.005f * rvel * rvel;; + Health -= 0.005f * rvel * rvel; } } } + else + { + + } } if (Health <= 0.0f) From 67a32c91bb640e15e7a551396a1aede778821244 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 08:45:15 +0100 Subject: [PATCH 28/45] remove redundant check --- OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index ee80b10ed9..8d87c30299 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -1724,8 +1724,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde case ActorTypes.Prim: OdePrim pobj = (OdePrim)obj; - if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) - if (!pobj.m_outbounds) + if (!pobj.m_outbounds && (pobj.Body == IntPtr.Zero || d.BodyIsEnabled(pobj.Body))) { pobj.AddCollisionFrameTime((int)(odetimestepMS)); pobj.SendCollisions(); From 3f0d84c28b99d789a362e2eacb19145d8144f548 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 19:49:40 +0100 Subject: [PATCH 29/45] cleanup some code --- .../World/Land/LandManagementModule.cs | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 95b576f9bd..4324ddc421 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 bool needOverlay = false; if (land.UpdateLandProperties(args, remote_client, out snap_selection, out needOverlay)) { - //the proprieties to who changed them - ScenePresence av = m_scene.GetScenePresence(remote_client.AgentId); - if(av.IsChildAgent || land != GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y)) - land.SendLandProperties(-10000, false, LandChannel.LAND_RESULT_SINGLE, remote_client); - else - land.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, remote_client); - UUID parcelID = land.LandData.GlobalID; m_scene.ForEachScenePresence(delegate(ScenePresence avatar) - { - if (avatar.IsDeleted || avatar.isNPC) - return; + { + if (avatar.IsDeleted || avatar.isNPC) + return; - IClientAPI client = avatar.ControllingClient; - if (needOverlay) - SendParcelOverlay(client); + IClientAPI client = avatar.ControllingClient; + if (needOverlay) + SendParcelOverlay(client); - if (avatar.IsChildAgent) - return; + if (avatar.IsChildAgent) + { + if(client == remote_client) + land.SendLandProperties(-10000, false, LandChannel.LAND_RESULT_SINGLE, client); + return; + } - ILandObject aland = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); - if (aland != null) - { - if (client != remote_client && land == aland) + ILandObject aland = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); + if (aland != null) + { + if(client == remote_client && land != aland) + land.SendLandProperties(-10000, false, LandChannel.LAND_RESULT_SINGLE, client); + else if (land == aland) aland.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, client); - } - if (avatar.currentParcelUUID == parcelID) - avatar.currentParcelUUID = parcelID; // force parcel flags review - }); + } + if (avatar.currentParcelUUID == parcelID) + avatar.currentParcelUUID = parcelID; // force parcel flags review + }); } } From e766f9d20f80425948f5cfe9204cdf85908e77fa Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Jul 2016 16:54:04 +0100 Subject: [PATCH 30/45] get a copy of current clientView group powers --- OpenSim/Framework/IClientAPI.cs | 2 ++ OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++++++ .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 5 +++++ OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 5 +++++ OpenSim/Tests/Common/Mock/TestClient.cs | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index d9932eb544..2495834e81 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -733,6 +733,8 @@ namespace OpenSim.Framework ulong ActiveGroupPowers { get; } + Dictionary GetGroupPowers(); + ulong GetGroupPowers(UUID groupID); bool IsGroupMember(UUID GroupID); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 68fe8d96b2..39f43eeeae 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5782,6 +5782,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task); } + public Dictionary GetGroupPowers() + { + lock(m_groupPowers) + { + return new Dictionary(m_groupPowers); + } + } + public ulong GetGroupPowers(UUID groupID) { if (groupID == ActiveGroupId) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index f34dbe8b0c..ade30a65c6 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -582,6 +582,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server get { return 0; } } + public Dictionary GetGroupPowers() + { + return new Dictionary(); + } + public ulong GetGroupPowers(UUID groupID) { return 0; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index bdac6aa6a1..7cfa360288 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -603,6 +603,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC return (m_hostGroupID == groupID); } + public Dictionary GetGroupPowers() + { + return new Dictionary(); + } + public ulong GetGroupPowers(UUID groupID) { return 0; diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 98a98c069c..cc87a5411c 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -421,6 +421,11 @@ namespace OpenSim.Tests.Common return false; } + public Dictionary GetGroupPowers() + { + return new Dictionary(); + } + public ulong GetGroupPowers(UUID groupID) { return 0; From 13ae6dff18a507791b3e05eaef74c2f2066cdfec Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Jul 2016 17:34:59 +0100 Subject: [PATCH 31/45] let some group related data to have a public set --- OpenSim/Framework/IClientAPI.cs | 6 +++--- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 +++--- .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 3 +++ OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 ++ OpenSim/Tests/Common/Mock/TestClient.cs | 3 +++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 2495834e81..0672014c0b 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -727,11 +727,11 @@ namespace OpenSim.Framework UUID SecureSessionId { get; } - UUID ActiveGroupId { get; } + UUID ActiveGroupId { get; set; } - string ActiveGroupName { get; } + string ActiveGroupName { get; set;} - ulong ActiveGroupPowers { get; } + ulong ActiveGroupPowers { get; set;} Dictionary GetGroupPowers(); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 39f43eeeae..2026f78d68 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 } public UUID AgentId { get { return m_agentId; } } public ISceneAgent SceneAgent { get; set; } - public UUID ActiveGroupId { get { return m_activeGroupID; } private set { m_activeGroupID = value; } } - public string ActiveGroupName { get { return m_activeGroupName; } private set { m_activeGroupName = value; } } - public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } private set { m_activeGroupPowers = value; } } + public UUID ActiveGroupId { get { return m_activeGroupID; } set { m_activeGroupID = value; } } + public string ActiveGroupName { get { return m_activeGroupName; } set { m_activeGroupName = value; } } + public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } set { m_activeGroupPowers = value; } } public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } public int PingTimeMS diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index ade30a65c6..7c08d0836c 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -570,16 +570,19 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public UUID ActiveGroupId { get { return UUID.Zero; } + set {} } public string ActiveGroupName { get { return "IRCd User"; } + set {} } public ulong ActiveGroupPowers { get { return 0; } + set {} } public Dictionary GetGroupPowers() diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 7cfa360288..a84520fe9b 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 public string ActiveGroupName { get { return String.Empty; } + set { } } public ulong ActiveGroupPowers { get { return 0; } + set { } } public bool IsGroupMember(UUID groupID) diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index cc87a5411c..83328c8c29 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -404,16 +404,19 @@ namespace OpenSim.Tests.Common public UUID ActiveGroupId { get { return UUID.Zero; } + set { } } public string ActiveGroupName { get { return String.Empty; } + set { } } public ulong ActiveGroupPowers { get { return 0; } + set { } } public bool IsGroupMember(UUID groupID) From 1a8a8e16efae4bdfc5cbd5108171737ceaaa4c67 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Jul 2016 17:57:14 +0100 Subject: [PATCH 32/45] add a public SetGroupPowers to clientView --- OpenSim/Framework/IClientAPI.cs | 2 ++ OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 9 +++++++++ .../InternetRelayClientView/Server/IRCClientView.cs | 4 +++- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 ++ OpenSim/Tests/Common/Mock/TestClient.cs | 2 ++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0672014c0b..9bf51f889c 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -735,6 +735,8 @@ namespace OpenSim.Framework Dictionary GetGroupPowers(); + void SetGroupPowers(Dictionary powers); + ulong GetGroupPowers(UUID groupID); bool IsGroupMember(UUID GroupID); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2026f78d68..0bb5dc68ea 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5790,6 +5790,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + public void SetGroupPowers(Dictionary powers) + { + lock(m_groupPowers) + { + m_groupPowers.Clear(); + m_groupPowers = powers; + } + } + public ulong GetGroupPowers(UUID groupID) { if (groupID == ActiveGroupId) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 7c08d0836c..50be3aced7 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -589,7 +589,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server { return new Dictionary(); } - + + public void SetGroupPowers(Dictionary powers) { } + public ulong GetGroupPowers(UUID groupID) { return 0; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index a84520fe9b..4275192a33 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -610,6 +610,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC return new Dictionary(); } + public void SetGroupPowers(Dictionary powers) { } + public ulong GetGroupPowers(UUID groupID) { return 0; diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 83328c8c29..4f8e986771 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -429,6 +429,8 @@ namespace OpenSim.Tests.Common return new Dictionary(); } + public void SetGroupPowers(Dictionary powers) { } + public ulong GetGroupPowers(UUID groupID) { return 0; From 52decfcc16bab0332798745d59c43277f1c034b6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Jul 2016 21:39:47 +0100 Subject: [PATCH 33/45] reduce some grid services calls on region crossings, sending more information on the agent update ( groups v2 needs change ) --- OpenSim/Framework/ChildAgentDataUpdate.cs | 78 ++++-------- .../EntityTransfer/EntityTransferModule.cs | 74 +---------- .../Region/Framework/Scenes/ScenePresence.cs | 117 ++++++++++++++---- .../Avatar/XmlRpcGroups/GroupsModule.cs | 3 +- 4 files changed, 122 insertions(+), 150 deletions(-) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 72c2c346d7..663d0ef6fc 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -353,6 +353,10 @@ namespace OpenSim.Framework public UUID PreyAgent; public Byte AgentAccess; public UUID ActiveGroupID; + public string ActiveGroupName; + public string ActiveGroupTitle = null; + public UUID agentCOF; + public bool isCrossingUpdate; public AgentGroupData[] Groups; public Dictionary ChildrenCapSeeds = null; @@ -374,12 +378,6 @@ namespace OpenSim.Framework MethodBase.GetCurrentMethod().DeclaringType); // DEBUG OFF -/* - public byte[] AgentTextures; - public byte[] VisualParams; - public UUID[] Wearables; - public AvatarAttachment[] Attachments; -*/ // Scripted public ControllerData[] Controllers; @@ -393,8 +391,6 @@ namespace OpenSim.Framework public virtual OSDMap Pack(EntityTransferContext ctx) { - int wearablesCount = -1; - // m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); OSDMap args = new OSDMap(); @@ -433,8 +429,14 @@ namespace OpenSim.Framework args["prey_agent"] = OSD.FromUUID(PreyAgent); args["agent_access"] = OSD.FromString(AgentAccess.ToString()); + args["agent_cof"] = OSD.FromUUID(agentCOF); + args["crossingupdate"] = OSD.FromBoolean(isCrossingUpdate); + args["active_group_id"] = OSD.FromUUID(ActiveGroupID); - + args["active_group_name"] = OSD.FromString(ActiveGroupName); + if(ActiveGroupTitle != null) + args["active_group_title"] = OSD.FromString(ActiveGroupTitle); + if ((Groups != null) && (Groups.Length > 0)) { OSDArray groups = new OSDArray(Groups.Length); @@ -497,48 +499,6 @@ namespace OpenSim.Framework if (Appearance != null) args["packed_appearance"] = Appearance.Pack(ctx); - //if ((AgentTextures != null) && (AgentTextures.Length > 0)) - //{ - // OSDArray textures = new OSDArray(AgentTextures.Length); - // foreach (UUID uuid in AgentTextures) - // textures.Add(OSD.FromUUID(uuid)); - // args["agent_textures"] = textures; - //} - - // The code to pack textures, visuals, wearables and attachments - // should be removed; packed appearance contains the full appearance - // This is retained for backward compatibility only - -/* then lets remove - if (Appearance.Texture != null) - { - byte[] rawtextures = Appearance.Texture.GetBytes(); - args["texture_entry"] = OSD.FromBinary(rawtextures); - } - - if ((Appearance.VisualParams != null) && (Appearance.VisualParams.Length > 0)) - args["visual_params"] = OSD.FromBinary(Appearance.VisualParams); - - // We might not pass this in all cases... - if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) - { - OSDArray wears = new OSDArray(Appearance.Wearables.Length); - foreach (AvatarWearable awear in Appearance.Wearables) - wears.Add(awear.Pack()); - - args["wearables"] = wears; - } - - List attachments = Appearance.GetAttachments(); - if ((attachments != null) && (attachments.Count > 0)) - { - OSDArray attachs = new OSDArray(attachments.Count); - foreach (AvatarAttachment att in attachments) - attachs.Add(att.Pack()); - args["attachments"] = attachs; - } - // End of code to remove -*/ if ((Controllers != null) && (Controllers.Length > 0)) { OSDArray controls = new OSDArray(Controllers.Length); @@ -662,10 +622,22 @@ namespace OpenSim.Framework if (args["agent_access"] != null) Byte.TryParse(args["agent_access"].AsString(), out AgentAccess); - if (args["active_group_id"] != null) + if (args.ContainsKey("agent_cof") && args["agent_cof"] != null) + agentCOF = args["agent_cof"].AsUUID(); + + if (args.ContainsKey("crossingupdate") && args["crossingupdate"] != null) + isCrossingUpdate = args["crossingupdate"].AsBoolean(); + + if (args.ContainsKey("active_group_id") && args["active_group_id"] != null) ActiveGroupID = args["active_group_id"].AsUUID(); - if ((args["groups"] != null) && (args["groups"]).Type == OSDType.Array) + if (args.ContainsKey("active_group_name") && args["active_group_name"] != null) + ActiveGroupName = args["active_group_name"].AsString(); + + if(args.ContainsKey("active_group_title") && args["active_group_title"] != null) + ActiveGroupTitle = args["active_group_title"].AsString(); + + if (args.ContainsKey("groups") && (args["groups"] != null) && (args["groups"]).Type == OSDType.Array) { OSDArray groups = (OSDArray)(args["groups"]); Groups = new AgentGroupData[groups.Count]; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 696d1dd6d8..a14fb25fbd 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 // Let's send a full update of the agent. This is a synchronous call. AgentData agent = new AgentData(); - sp.CopyTo(agent); + sp.CopyTo(agent,false); if ((teleportFlags & (uint)TeleportFlags.IsFlying) != 0) agent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; @@ -1142,7 +1142,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Let's send a full update of the agent. AgentData agent = new AgentData(); - sp.CopyTo(agent); + sp.CopyTo(agent,false); agent.Position = agentCircuit.startpos; if ((teleportFlags & (uint)TeleportFlags.IsFlying) != 0) @@ -1701,7 +1701,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer try { AgentData cAgent = new AgentData(); - agent.CopyTo(cAgent); + agent.CopyTo(cAgent,true); // agent.Appearance.WearableCacheItems = null; @@ -2534,11 +2534,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (newRegionSizeY == 0) newRegionSizeY = Constants.RegionSize; - newpos.X = targetPosition.X - (neighbourRegion.RegionLocX - (int)scene.RegionInfo.WorldLocX); newpos.Y = targetPosition.Y - (neighbourRegion.RegionLocY - (int)scene.RegionInfo.WorldLocY); - const float enterDistance = 0.2f; newpos.X = Util.Clamp(newpos.X, enterDistance, newRegionSizeX - enterDistance); newpos.Y = Util.Clamp(newpos.Y, enterDistance, newRegionSizeY - enterDistance); @@ -2546,72 +2544,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return neighbourRegion; } -/* not in use. -> CrossPrimGroupIntoNewRegion - /// - /// Move the given scene object into a new region depending on which region its absolute position has moved - /// into. - /// - /// Using the objects new world location, ask the grid service for a the new region and adjust the prim - /// position to be relative to the new region. - /// - /// the scene object that we're crossing - /// the attempted out of region position of the scene object. This position is - /// relative to the region the object currently is in. - /// if 'true', the deletion of the client from the region is not broadcast to the clients - public void Cross(SceneObjectGroup grp, Vector3 attemptedPosition, bool silent) - { - if (grp == null) - return; - if (grp.IsDeleted) - return; - - Scene scene = grp.Scene; - if (scene == null) - return; - - // Remember the old group position in case the region lookup fails so position can be restored. - Vector3 oldGroupPosition = grp.RootPart.GroupPosition; - - // Compute the absolute position of the object. - double objectWorldLocX = (double)scene.RegionInfo.WorldLocX + attemptedPosition.X; - double objectWorldLocY = (double)scene.RegionInfo.WorldLocY + attemptedPosition.Y; - - // Ask the grid service for the region that contains the passed address - GridRegion destination = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID, - objectWorldLocX, objectWorldLocY); - - Vector3 pos = Vector3.Zero; - if (destination != null) - { - // Adjust the object's relative position from the old region (attemptedPosition) - // to be relative to the new region (pos). - pos = new Vector3( (float)(objectWorldLocX - (double)destination.RegionLocX), - (float)(objectWorldLocY - (double)destination.RegionLocY), - attemptedPosition.Z); - } - - if (destination == null || !CrossPrimGroupIntoNewRegion(destination, pos, grp, silent)) - { - m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}", grp.UUID); - - // We are going to move the object back to the old position so long as the old position - // is in the region - oldGroupPosition.X = Util.Clamp(oldGroupPosition.X, 1.0f, (float)(scene.RegionInfo.RegionSizeX - 1)); - oldGroupPosition.Y = Util.Clamp(oldGroupPosition.Y, 1.0f, (float)(scene.RegionInfo.RegionSizeY - 1)); - oldGroupPosition.Z = Util.Clamp(oldGroupPosition.Z, 1.0f, Constants.RegionHeight); - - grp.AbsolutePosition = oldGroupPosition; - grp.Velocity = Vector3.Zero; - if (grp.RootPart.PhysActor != null) - grp.RootPart.PhysActor.CrossingFailure(); - - if (grp.RootPart.KeyframeMotion != null) - grp.RootPart.KeyframeMotion.CrossingFailure(); - - grp.ScheduleGroupForFullUpdate(); - } - } -*/ /// /// Move the given scene object into a new region /// diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0ccdbf76de..c925719d44 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -346,7 +346,7 @@ namespace OpenSim.Region.Framework.Scenes private float m_healRate = 1f; private float m_healRatePerFrame = 0.05f; - protected ulong crossingFromRegion; +// protected ulong crossingFromRegion; private readonly Vector3[] Dir_Vectors = new Vector3[12]; @@ -568,19 +568,16 @@ namespace OpenSim.Region.Framework.Scenes public string Firstname { get; private set; } public string Lastname { get; private set; } + public bool haveGroupInformation; + public bool gotCrossUpdate; + public string Grouptitle { - get { return UseFakeGroupTitle ? "(Loading)" : m_groupTitle; } + get { return m_groupTitle; } set { m_groupTitle = value; } } private string m_groupTitle; - /// - /// When this is 'true', return a dummy group title instead of the real group title. This is - /// used as part of a hack to force viewers to update the displayed avatar name. - /// - public bool UseFakeGroupTitle { get; set; } - // Agent's Draw distance. private float m_drawDistance = 255f; public float DrawDistance @@ -1062,9 +1059,9 @@ namespace OpenSim.Region.Framework.Scenes if (account != null) UserLevel = account.UserLevel; - IGroupsModule gm = m_scene.RequestModuleInterface(); - if (gm != null) - Grouptitle = gm.GetGroupTitle(m_uuid); + // IGroupsModule gm = m_scene.RequestModuleInterface(); + // if (gm != null) + // Grouptitle = gm.GetGroupTitle(m_uuid); m_scriptEngines = m_scene.RequestModuleInterfaces(); @@ -1258,11 +1255,6 @@ namespace OpenSim.Region.Framework.Scenes // Should not be needed if we are not trying to tell this region to close // DoNotCloseAfterTeleport = false; - IGroupsModule gm = m_scene.RequestModuleInterface(); - if (gm != null) - Grouptitle = gm.GetGroupTitle(m_uuid); - - m_log.DebugFormat("[MakeRootAgent] Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); RegionHandle = m_scene.RegionInfo.RegionHandle; @@ -1511,6 +1503,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void MakeChildAgent(ulong newRegionHandle) { + haveGroupInformation = false; + gotCrossUpdate = false; m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; RegionHandle = newRegionHandle; @@ -1978,25 +1972,29 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - -// start sending terrain patchs - if (!isNPC) - Scene.SendLayerData(ControllingClient); - - if (!IsChildAgent && !isNPC) + if(!haveGroupInformation && !IsChildAgent && !isNPC) { + // oh crap.. lets retry it directly + IGroupsModule gm = m_scene.RequestModuleInterface(); + if (gm != null) + Grouptitle = gm.GetGroupTitle(m_uuid); + + m_log.DebugFormat("[CompleteMovement] Missing Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); if (cof == null) COF = UUID.Zero; else COF = cof.ID; - m_log.DebugFormat("[ScenePresence]: CompleteMovement COF for {0} is {1}", client.AgentId, COF); + m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); } + // Tell the client that we're totally ready ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); + m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); if (!string.IsNullOrEmpty(m_callbackURI)) @@ -2029,6 +2027,10 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); +// start sending terrain patchs + if (!gotCrossUpdate && !isNPC) + Scene.SendLayerData(ControllingClient); + m_previusParcelHide = false; m_previusParcelUUID = UUID.Zero; m_currentParcelHide = false; @@ -2204,6 +2206,9 @@ namespace OpenSim.Region.Framework.Scenes // m_currentParcelHide = newhide; // } + haveGroupInformation = true; + gotCrossUpdate = false; + m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd; m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts)); @@ -4470,7 +4475,7 @@ namespace OpenSim.Region.Framework.Scenes checkRePrioritization(); } - public void CopyTo(AgentData cAgent) + public void CopyTo(AgentData cAgent, bool isCrossUpdate) { cAgent.CallbackURI = m_callbackURI; @@ -4534,6 +4539,29 @@ namespace OpenSim.Region.Framework.Scenes if (Scene.AttachmentsModule != null) Scene.AttachmentsModule.CopyAttachments(this, cAgent); + + cAgent.isCrossingUpdate = isCrossUpdate; + + if(isCrossUpdate && haveGroupInformation) + { + + cAgent.agentCOF = COF; + cAgent.ActiveGroupID = ControllingClient.ActiveGroupId; + cAgent.ActiveGroupName = ControllingClient.ActiveGroupName; + cAgent.ActiveGroupTitle = Grouptitle; + Dictionary gpowers = ControllingClient.GetGroupPowers(); + if(gpowers.Count >0) + { + cAgent.Groups = new AgentGroupData[gpowers.Count]; + int i = 0; + foreach (UUID gid in gpowers.Keys) + { + // WARNING we dont' have AcceptNotices in cache.. sending as true mb no one notices ;) + AgentGroupData agd = new AgentGroupData(gid,gpowers[gid],true); + cAgent.Groups[i++] = agd; + } + } + } } private void CopyFrom(AgentData cAgent) @@ -4629,6 +4657,45 @@ namespace OpenSim.Region.Framework.Scenes if (Scene.AttachmentsModule != null) Scene.AttachmentsModule.CopyAttachments(cAgent, this); + haveGroupInformation = false; + + // using this as protocol detection don't want to mess with the numbers for now + if(cAgent.ActiveGroupTitle != null) + { + COF = cAgent.agentCOF; + ControllingClient.ActiveGroupId = cAgent.ActiveGroupID; + ControllingClient.ActiveGroupName = cAgent.ActiveGroupName; + ControllingClient.ActiveGroupPowers = 0; + Grouptitle = cAgent.ActiveGroupTitle; + int ngroups = cAgent.Groups.Length; + if(ngroups > 0) + { + Dictionary gpowers = new Dictionary(ngroups); + for(int i = 0 ; i < ngroups; i++) + { + AgentGroupData agd = cAgent.Groups[i]; + gpowers[agd.GroupID] = agd.GroupPowers; + } + + ControllingClient.SetGroupPowers(gpowers); + + if(cAgent.ActiveGroupID == UUID.Zero) + haveGroupInformation = true; + else if(gpowers.ContainsKey(cAgent.ActiveGroupID)) + { + ControllingClient.ActiveGroupPowers = gpowers[cAgent.ActiveGroupID]; + haveGroupInformation = true; + } + } + else if(cAgent.ActiveGroupID == UUID.Zero) + { + haveGroupInformation = true; + } + } + + gotCrossUpdate = cAgent.isCrossingUpdate; + + lock (m_originRegionIDAccessLock) m_originRegionID = cAgent.RegionID; } @@ -4636,7 +4703,7 @@ namespace OpenSim.Region.Framework.Scenes public bool CopyAgent(out IAgentData agent) { agent = new CompleteAgentData(); - CopyTo((AgentData)agent); + CopyTo((AgentData)agent, false); return true; } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index ddeac6689a..5205eae72c 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 // There might be some problem with the thread we're generating this on but not // doing the update at this time causes problems (Mantis #7920 and #7915) // TODO: move sending this update to a later time in the rootification of the client. - SendAgentGroupDataUpdate(sp.ControllingClient, false); + if(!sp.haveGroupInformation) + SendAgentGroupDataUpdate(sp.ControllingClient, false); } private void OnMakeChild(ScenePresence sp) From e0e8b784a59dfdd36daf3b48b7d8dbbfe7abd716 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Jul 2016 21:43:26 +0100 Subject: [PATCH 34/45] apply the change to groups v2 also --- OpenSim/Addons/Groups/GroupsModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index 1afdd0fba3..e586dd7f34 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs @@ -249,7 +249,8 @@ namespace OpenSim.Groups // There might be some problem with the thread we're generating this on but not // doing the update at this time causes problems (Mantis #7920 and #7915) // TODO: move sending this update to a later time in the rootification of the client. - SendAgentGroupDataUpdate(sp.ControllingClient, false); + if(!sp.haveGroupInformation) + SendAgentGroupDataUpdate(sp.ControllingClient, false); } private void OnMakeChild(ScenePresence sp) From f19b3d28bd9a467f1da7fef51fe86b9da223462c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Jul 2016 22:09:06 +0100 Subject: [PATCH 35/45] do GridUserService.SetLastPosition async on crossings --- .../GridUser/ActivityDetector.cs | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs index 2238c9077f..98ccc955c9 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 scene.EventManager.OnNewClient -= OnNewClient; } - public void OnMakeRootAgent(ScenePresence sp) - { - if (sp.PresenceType != PresenceType.Npc) + public void OnMakeRootAgent(ScenePresence sp) + { + if (sp.isNPC) + return; + + if(sp.gotCrossUpdate) { - string userid; - //m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", userid, sp.Scene.RegionInfo.RegionName); - if (sp.Scene.UserManagementModule.GetUserUUI(sp.UUID, out userid)) + Util.FireAndForget(delegate { - /* we only setposition on known agents that have a valid lookup */ - m_GridUserService.SetLastPosition( - userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); - } + DoOnMakeRootAgent(sp); + }, null, "ActivityDetector_MakeRoot"); + } + else + DoOnMakeRootAgent(sp); + } + + public void DoOnMakeRootAgent(ScenePresence sp) + { + string userid; + //m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", userid, sp.Scene.RegionInfo.RegionName); + if (sp.Scene.UserManagementModule.GetUserUUI(sp.UUID, out userid)) + { + /* we only setposition on known agents that have a valid lookup */ + m_GridUserService.SetLastPosition( + userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); } } From 800044ceadf1cfde3cdbb75cfa2622c62f11530c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Jul 2016 22:30:51 +0100 Subject: [PATCH 36/45] take friends out of onMakeRoot if crossing --- .../Avatar/Friends/FriendsModule.cs | 47 +++++++++++++------ .../Framework/Interfaces/IFriendsModule.cs | 2 + 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index d6c4d5bdf5..c88142a47f 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 scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClientClosed += OnClientClosed; - scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; +// scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; scene.EventManager.OnClientLogin += OnClientLogin; } @@ -255,6 +255,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return 0; } + private void OnMakeRootAgent(ScenePresence sp) + { + if(sp.gotCrossUpdate) + return; + + RecacheFriends(sp.ControllingClient); + + lock (m_NeedsToNotifyStatus) + { + if (m_NeedsToNotifyStatus.Remove(sp.UUID)) + { + // Inform the friends that this user is online. This can only be done once the client is a Root Agent. + StatusChange(sp.UUID, true); + } + } + } + private void OnNewClient(IClientAPI client) { client.OnInstantMessage += OnInstantMessage; @@ -327,20 +344,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } } - private void OnMakeRootAgent(ScenePresence sp) - { - RecacheFriends(sp.ControllingClient); - - lock (m_NeedsToNotifyStatus) - { - if (m_NeedsToNotifyStatus.Remove(sp.UUID)) - { - // Inform the friends that this user is online. This can only be done once the client is a Root Agent. - StatusChange(sp.UUID, true); - } - } - } - private void OnClientLogin(IClientAPI client) { UUID agentID = client.AgentId; @@ -359,6 +362,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends m_NeedsListOfOnlineFriends.Add(agentID); } + public void IsNpwRoot(ScenePresence sp) + { + RecacheFriends(sp.ControllingClient); + + lock (m_NeedsToNotifyStatus) + { + if (m_NeedsToNotifyStatus.Remove(sp.UUID)) + { + // Inform the friends that this user is online. This can only be done once the client is a Root Agent. + StatusChange(sp.UUID, true); + } + } + } + public virtual bool SendFriendsOnlineIfNeeded(IClientAPI client) { UUID agentID = client.AgentId; diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs index 7e87006706..5c43b366cd 100644 --- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; namespace OpenSim.Region.Framework.Interfaces @@ -93,6 +94,7 @@ namespace OpenSim.Region.Framework.Interfaces /// These come from the FriendRights enum. void GrantRights(IClientAPI remoteClient, UUID friendID, int perms); + void IsNpwRoot(ScenePresence sp); bool SendFriendsOnlineIfNeeded(IClientAPI client); } } \ No newline at end of file From d6e16c5130026e7e7cf977fa7e18182aabf50ebd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Jul 2016 01:57:20 +0100 Subject: [PATCH 37/45] missing changes about friends on crossings, and missing angular velocity clear on sits --- .../Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c925719d44..eac7cbcc81 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2189,8 +2189,12 @@ namespace OpenSim.Region.Framework.Scenes { IFriendsModule friendsModule = m_scene.RequestModuleInterface(); if (friendsModule != null) - friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); - + { + if(gotCrossUpdate) + friendsModule.IsNpwRoot(this); + else + friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); + } m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); } @@ -3163,6 +3167,7 @@ namespace OpenSim.Region.Framework.Scenes ResetMoveToTarget(); Velocity = Vector3.Zero; + m_AngularVelocity = Vector3.Zero; part.AddSittingAvatar(this); @@ -3488,9 +3493,10 @@ namespace OpenSim.Region.Framework.Scenes part.AddSittingAvatar(this); ParentPart = part; ParentID = m_requestedSitTargetID; + + RemoveFromPhysicalScene(); m_AngularVelocity = Vector3.Zero; Velocity = Vector3.Zero; - RemoveFromPhysicalScene(); m_requestedSitTargetID = 0; @@ -3513,13 +3519,15 @@ namespace OpenSim.Region.Framework.Scenes return; // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. - m_AngularVelocity = Vector3.Zero; sitAnimation = "SIT_GROUND_CONSTRAINED"; // Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); // TriggerScenePresenceUpdated(); SitGround = true; RemoveFromPhysicalScene(); + m_AngularVelocity = Vector3.Zero; + Velocity = Vector3.Zero; + Animator.SetMovementAnimations("SITGROUND"); TriggerScenePresenceUpdated(); } @@ -4236,6 +4244,8 @@ namespace OpenSim.Region.Framework.Scenes pos.Y -= Velocity.Y * 2; Velocity = Vector3.Zero; + m_AngularVelocity = Vector3.Zero; + AbsolutePosition = pos; AddToPhysicalScene(isFlying); From f4fa8919285a4399ebe909aee50285d91f6cd5fe Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Jul 2016 02:54:32 +0100 Subject: [PATCH 38/45] waste another thread job on another thing that should be part of a more unified service, and also not hidding on a so called event" --- .../EntityTransfer/EntityTransferModule.cs | 99 +++++++++---------- .../Presence/PresenceDetector.cs | 16 +++ 2 files changed, 64 insertions(+), 51 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a14fb25fbd..a1ad9104e1 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2080,66 +2080,63 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.KnownRegions = seeds; sp.SetNeighbourRegionSizeInfo(neighbours); - AgentPosition agentpos = new AgentPosition(); - agentpos.AgentID = new UUID(sp.UUID.Guid); - agentpos.SessionID = spClient.SessionId; - agentpos.Size = sp.Appearance.AvatarSize; - agentpos.Center = sp.CameraPosition; - agentpos.Far = sp.DrawDistance; - agentpos.Position = sp.AbsolutePosition; - agentpos.Velocity = sp.Velocity; - agentpos.RegionHandle = currentRegionHandler; - agentpos.Throttles = spClient.GetThrottlesPacked(1); - // agentpos.ChildrenCapSeeds = seeds; - - Util.FireAndForget(delegate + if(newneighbours.Count > 0 || previousRegionNeighbourHandles.Count > 0) { - Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start - int count = 0; + AgentPosition agentpos = new AgentPosition(); + agentpos.AgentID = new UUID(sp.UUID.Guid); + agentpos.SessionID = spClient.SessionId; + agentpos.Size = sp.Appearance.AvatarSize; + agentpos.Center = sp.CameraPosition; + agentpos.Far = sp.DrawDistance; + agentpos.Position = sp.AbsolutePosition; + agentpos.Velocity = sp.Velocity; + agentpos.RegionHandle = currentRegionHandler; + agentpos.Throttles = spClient.GetThrottlesPacked(1); + // agentpos.ChildrenCapSeeds = seeds; - foreach (GridRegion neighbour in neighbours) + Util.FireAndForget(delegate { - ulong handler = neighbour.RegionHandle; - try + Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start + int count = 0; + + foreach (GridRegion neighbour in neighbours) { - if (newneighbours.Contains(handler)) + ulong handler = neighbour.RegionHandle; + try { - InformClientOfNeighbourAsync(sp, cagents[count], neighbour, - neighbour.ExternalEndPoint, true); - count++; + if (newneighbours.Contains(handler)) + { + InformClientOfNeighbourAsync(sp, cagents[count], neighbour, + neighbour.ExternalEndPoint, true); + count++; + } + else if (!previousRegionNeighbourHandles.Contains(handler)) + { + spScene.SimulationService.UpdateAgent(neighbour, agentpos); + } } - else if (!previousRegionNeighbourHandles.Contains(handler)) + catch (ArgumentOutOfRangeException) { - spScene.SimulationService.UpdateAgent(neighbour, agentpos); + m_log.ErrorFormat( + "[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}).", + neighbour.ExternalHostName, + neighbour.RegionHandle, + neighbour.RegionLocX, + neighbour.RegionLocY); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", + neighbour.ExternalHostName, + neighbour.RegionHandle, + neighbour.RegionLocX, + neighbour.RegionLocY, + e); } } - catch (ArgumentOutOfRangeException) - { - m_log.ErrorFormat( - "[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}).", - neighbour.ExternalHostName, - neighbour.RegionHandle, - neighbour.RegionLocX, - neighbour.RegionLocY); - } - catch (Exception e) - { - m_log.ErrorFormat( - "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", - neighbour.ExternalHostName, - neighbour.RegionHandle, - neighbour.RegionLocX, - neighbour.RegionLocY, - e); - - // FIXME: Okay, even though we've failed, we're still going to throw the exception on, - // since I don't know what will happen if we just let the client continue - - // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. - // throw e; - } - } - }); + }); + } } // Computes the difference between two region bases. diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index 50c252c817..117f02c1c2 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 public void OnMakeRootAgent(ScenePresence sp) { + if (sp.isNPC) + return; + + if(sp.gotCrossUpdate) + { + Util.FireAndForget(delegate + { + DoOnMakeRootAgent(sp); + }, null, "PresenceDetector_MakeRoot"); + } + else + DoOnMakeRootAgent(sp); + } + + public void DoOnMakeRootAgent(ScenePresence sp) + { // m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); if (sp.PresenceType != PresenceType.Npc) m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID); From 2e4c8798abf539bddd9770b162acb6d3f3a105ac Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Jul 2016 03:50:47 +0100 Subject: [PATCH 39/45] a few more changes on avatar crossing --- .../EntityTransfer/EntityTransferModule.cs | 46 ++++--------------- .../Region/Framework/Scenes/ScenePresence.cs | 20 ++++---- 2 files changed, 20 insertions(+), 46 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a1ad9104e1..fbb99b0559 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1560,7 +1560,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // We need this because of decimal number parsing of the protocols. Culture.SetCurrentCulture(); - Vector3 pos = agent.AbsolutePosition + agent.Velocity; + Vector3 pos = agent.AbsolutePosition + agent.Velocity * 0.2f; GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos, ctx, out newpos, out failureReason); @@ -1648,17 +1648,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer icon.EndInvoke(iar); } - public bool CrossAgentToNewRegionPrep(ScenePresence agent, GridRegion neighbourRegion) - { - if (neighbourRegion == null) - return false; - - m_entityTransferStateMachine.SetInTransit(agent.UUID); - - agent.RemoveFromPhysicalScene(); - - return true; - } + /// /// This Closes child agents on neighbouring regions @@ -1673,16 +1663,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: new region={1} at <{2},{3}>. newpos={4}", LogHeader, neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, pos); - if (!CrossAgentToNewRegionPrep(agent, neighbourRegion)) + if (neighbourRegion == null) { - m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: prep failed. Resetting transfer state", LogHeader); - m_entityTransferStateMachine.ResetFromTransit(agent.UUID); + m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: invalid destiny", LogHeader); + return agent; } + m_entityTransferStateMachine.SetInTransit(agent.UUID); + agent.RemoveFromPhysicalScene(); + if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying, ctx)) { m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader); m_entityTransferStateMachine.ResetFromTransit(agent.UUID); + return agent; } CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, ctx); @@ -1706,7 +1700,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // agent.Appearance.WearableCacheItems = null; cAgent.Position = pos; - cAgent.ChildrenCapSeeds = agent.KnownRegions; if (isFlying) @@ -1787,15 +1780,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer capsPath); } -/* - // Backwards compatibility. Best effort - if (version == 0f) - { - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); - Thread.Sleep(3000); // wait a little now that we're not waiting for the callback - CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); - } -*/ // SUCCESS! m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); @@ -1814,18 +1798,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // but not sure yet what the side effects would be. m_entityTransferStateMachine.ResetFromTransit(agent.UUID); - - // TODO: Check since what version this wasn't needed anymore. May be as old as 0.6 -/* - // Backwards compatibility. Best effort - if (version == 0f) - { - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); - Thread.Sleep(3000); // wait a little now that we're not waiting for the callback - CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); - } -*/ - // the user may change their profile information in other region, // so the userinfo in UserProfileCache is not reliable any more, delete it // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index eac7cbcc81..c375450a40 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4206,19 +4206,21 @@ namespace OpenSim.Region.Framework.Scenes { // we don't have entity transfer module Vector3 pos = AbsolutePosition; + vel = Velocity; float px = pos.X; if (px < 0) - pos.X += Velocity.X * 2; + pos.X += vel.X * 2; else if (px > m_scene.RegionInfo.RegionSizeX) - pos.X -= Velocity.X * 2; + pos.X -= vel.X * 2; float py = pos.Y; if (py < 0) - pos.Y += Velocity.Y * 2; + pos.Y += vel.Y * 2; else if (py > m_scene.RegionInfo.RegionSizeY) - pos.Y -= Velocity.Y * 2; + pos.Y -= vel.Y * 2; Velocity = Vector3.Zero; + m_AngularVelocity = Vector3.Zero; AbsolutePosition = pos; } } @@ -4231,21 +4233,21 @@ namespace OpenSim.Region.Framework.Scenes RemoveFromPhysicalScene(); Vector3 pos = AbsolutePosition; + Vector3 vel = Velocity; float px = pos.X; if (px < 0) - pos.X += Velocity.X * 2; + pos.X += vel.X * 2; else if (px > m_scene.RegionInfo.RegionSizeX) - pos.X -= Velocity.X * 2; + pos.X -= vel.X * 2; float py = pos.Y; if (py < 0) - pos.Y += Velocity.Y * 2; + pos.Y += vel.Y * 2; else if (py > m_scene.RegionInfo.RegionSizeY) - pos.Y -= Velocity.Y * 2; + pos.Y -= vel.Y * 2; Velocity = Vector3.Zero; m_AngularVelocity = Vector3.Zero; - AbsolutePosition = pos; AddToPhysicalScene(isFlying); From 07853c86ed96329a6dc8ac524cd312d49fa2e459 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Jul 2016 11:45:32 +0100 Subject: [PATCH 40/45] clear SitTargetAvatar on a sop copy --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a46232c69a..133b4ce263 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2213,7 +2213,7 @@ namespace OpenSim.Region.Framework.Scenes dupe.Shape.ExtraParams = extraP; dupe.m_sittingAvatars = new HashSet(); - + dupe.SitTargetAvatar = UUID.Zero; // safeguard actual copy is done in sog.copy dupe.KeyframeMotion = null; dupe.PayPrice = (int[])PayPrice.Clone(); From e951f4cc96cd24388e83ed53afc8fd325ea5e874 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Jul 2016 14:28:16 +0100 Subject: [PATCH 41/45] a few more changes relative to sits crossing --- OpenSim/Framework/ChildAgentDataUpdate.cs | 9 ++++----- .../Framework/Scenes/SceneObjectGroup.cs | 19 +++++++++++++++---- .../Region/Framework/Scenes/ScenePresence.cs | 16 ++++++++++------ 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 663d0ef6fc..74f18bf677 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -356,7 +356,7 @@ namespace OpenSim.Framework public string ActiveGroupName; public string ActiveGroupTitle = null; public UUID agentCOF; - public bool isCrossingUpdate; + public byte CrossingFlags; public AgentGroupData[] Groups; public Dictionary ChildrenCapSeeds = null; @@ -365,7 +365,6 @@ namespace OpenSim.Framework public Animation AnimState = null; public Byte MotionState = 0; - public UUID GranterID; public UUID ParentPart; public Vector3 SitOffset; @@ -430,7 +429,7 @@ namespace OpenSim.Framework args["agent_access"] = OSD.FromString(AgentAccess.ToString()); args["agent_cof"] = OSD.FromUUID(agentCOF); - args["crossingupdate"] = OSD.FromBoolean(isCrossingUpdate); + args["crossingflags"] = OSD.FromInteger(CrossingFlags); args["active_group_id"] = OSD.FromUUID(ActiveGroupID); args["active_group_name"] = OSD.FromString(ActiveGroupName); @@ -625,8 +624,8 @@ namespace OpenSim.Framework if (args.ContainsKey("agent_cof") && args["agent_cof"] != null) agentCOF = args["agent_cof"].AsUUID(); - if (args.ContainsKey("crossingupdate") && args["crossingupdate"] != null) - isCrossingUpdate = args["crossingupdate"].AsBoolean(); + if (args.ContainsKey("crossingflags") && args["crossingflags"] != null) + CrossingFlags = (byte)args["crossingflags"].AsInteger(); if (args.ContainsKey("active_group_id") && args["active_group_id"] != null) ActiveGroupID = args["active_group_id"].AsUUID(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d556fd18ed..a52c0d64e0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -346,9 +346,6 @@ namespace OpenSim.Region.Framework.Scenes get { return RootPart.VolumeDetectActive; } } - private Vector3 lastPhysGroupPos; - private Quaternion lastPhysGroupRot; - /// /// Is this entity set to be saved in persistent storage? /// @@ -702,10 +699,23 @@ namespace OpenSim.Region.Framework.Scenes foreach (ScenePresence av in sog.m_sittingAvatars) { + byte cflags = 1; + avtocrossInfo avinfo = new avtocrossInfo(); SceneObjectPart parentPart = sogScene.GetSceneObjectPart(av.ParentID); if (parentPart != null) + { av.ParentUUID = parentPart.UUID; + if(parentPart.SitTargetAvatar == av.UUID) + cflags = 7; // low 3 bits set + else + cflags = 3; + } + + // 1 is crossing + // 2 is sitting + // 4 is sitting at sittarget + av.crossingFlags = cflags; avinfo.av = av; avinfo.ParentID = av.ParentID; @@ -750,7 +760,7 @@ namespace OpenSim.Region.Framework.Scenes av.ParentUUID = UUID.Zero; // In any case av.IsInTransit = false; - + av.crossingFlags = 0; m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); } else @@ -768,6 +778,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avinfo.av; av.ParentUUID = UUID.Zero; av.ParentID = avinfo.ParentID; + av.crossingFlags = 0; } } avsToCross.Clear(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c375450a40..3167282dd6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -570,6 +570,7 @@ namespace OpenSim.Region.Framework.Scenes public bool haveGroupInformation; public bool gotCrossUpdate; + public byte crossingFlags; public string Grouptitle { @@ -1231,8 +1232,10 @@ namespace OpenSim.Region.Framework.Scenes else { part.AddSittingAvatar(this); - if (part.SitTargetPosition != Vector3.Zero) - part.SitTargetAvatar = UUID; + // if not actually on the target invalidate it + if(gotCrossUpdate && (crossingFlags & 0x04) == 0) + part.SitTargetAvatar = UUID.Zero; + ParentID = part.LocalId; ParentPart = part; m_pos = PrevSitOffset; @@ -1505,6 +1508,7 @@ namespace OpenSim.Region.Framework.Scenes { haveGroupInformation = false; gotCrossUpdate = false; + crossingFlags = 0; m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; RegionHandle = newRegionHandle; @@ -2212,6 +2216,7 @@ namespace OpenSim.Region.Framework.Scenes haveGroupInformation = true; gotCrossUpdate = false; + crossingFlags = 0; m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd; @@ -4552,11 +4557,10 @@ namespace OpenSim.Region.Framework.Scenes if (Scene.AttachmentsModule != null) Scene.AttachmentsModule.CopyAttachments(this, cAgent); - cAgent.isCrossingUpdate = isCrossUpdate; + cAgent.CrossingFlags = isCrossUpdate ? crossingFlags : (byte)0; if(isCrossUpdate && haveGroupInformation) { - cAgent.agentCOF = COF; cAgent.ActiveGroupID = ControllingClient.ActiveGroupId; cAgent.ActiveGroupName = ControllingClient.ActiveGroupName; @@ -4705,8 +4709,8 @@ namespace OpenSim.Region.Framework.Scenes } } - gotCrossUpdate = cAgent.isCrossingUpdate; - + crossingFlags = cAgent.CrossingFlags; + gotCrossUpdate = (crossingFlags != 0); lock (m_originRegionIDAccessLock) m_originRegionID = cAgent.RegionID; From 8c46ab02c7f289acf7544a7c270cae37958285bc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Jul 2016 21:11:39 +0100 Subject: [PATCH 42/45] move refresh forces into applyphysics --- .../Avatar/Attachments/AttachmentsModule.cs | 2 +- .../Framework/Scenes/SceneObjectGroup.cs | 25 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8f03a0ac7a..786258fb1c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments rootPart.RemFlag(PrimFlags.TemporaryOnRez); - so.ApplyPhysics(); + so.ApplyPhysics(false); rootPart.Rezzed = DateTime.Now; so.AttachToBackup(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a52c0d64e0..d399535675 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1237,14 +1237,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } - ApplyPhysics(); - - if (RootPart.PhysActor != null) - RootPart.Force = RootPart.Force; - if (RootPart.PhysActor != null) - RootPart.Torque = RootPart.Torque; - if (RootPart.PhysActor != null) - RootPart.Buoyancy = RootPart.Buoyancy; + ApplyPhysics(true); // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled // for the same object with very different properties. The caller must schedule the update. @@ -1853,7 +1846,7 @@ namespace OpenSim.Region.Framework.Scenes AttachmentPoint = (byte)0; // must check if buildind should be true or false here // m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false); - ApplyPhysics(); + ApplyPhysics(false); HasGroupChanged = true; RootPart.Rezzed = DateTime.Now; @@ -2158,7 +2151,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Apply physics to this group /// - public void ApplyPhysics() + public void ApplyPhysics(bool refreshForces) { SceneObjectPart[] parts = m_parts.GetArray(); if (parts.Length > 1) @@ -2177,16 +2170,22 @@ namespace OpenSim.Region.Framework.Scenes } // Hack to get the physics scene geometries in the right spot // ResetChildPrimPhysicsPositions(); + if (m_rootPart.PhysActor != null) - { m_rootPart.PhysActor.Building = false; - } } else { // Apply physics to the root prim m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false); } + + if (m_rootPart.PhysActor != null && refreshForces) + { + m_rootPart.Force = m_rootPart.Force; + m_rootPart.Torque = m_rootPart.Torque; + m_rootPart.Buoyancy = m_rootPart.Buoyancy; + } } public void SetOwnerId(UUID userId) @@ -3080,7 +3079,7 @@ namespace OpenSim.Region.Framework.Scenes { // cancel physics RootPart.Flags &= ~PrimFlags.Physics; - ApplyPhysics(); + ApplyPhysics(false); } } From 32e30afbcba5463ecf9aa50291b16d7d02c8170b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Jul 2016 21:31:43 +0100 Subject: [PATCH 43/45] actually that was redundante, already done at low level --- .../Avatar/Attachments/AttachmentsModule.cs | 2 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 786258fb1c..8f03a0ac7a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments rootPart.RemFlag(PrimFlags.TemporaryOnRez); - so.ApplyPhysics(false); + so.ApplyPhysics(); rootPart.Rezzed = DateTime.Now; so.AttachToBackup(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d399535675..efc1413a12 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1237,7 +1237,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } - ApplyPhysics(true); + ApplyPhysics(); // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled // for the same object with very different properties. The caller must schedule the update. @@ -1846,7 +1846,7 @@ namespace OpenSim.Region.Framework.Scenes AttachmentPoint = (byte)0; // must check if buildind should be true or false here // m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false); - ApplyPhysics(false); + ApplyPhysics(); HasGroupChanged = true; RootPart.Rezzed = DateTime.Now; @@ -2151,7 +2151,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Apply physics to this group /// - public void ApplyPhysics(bool refreshForces) + public void ApplyPhysics() { SceneObjectPart[] parts = m_parts.GetArray(); if (parts.Length > 1) @@ -2179,13 +2179,6 @@ namespace OpenSim.Region.Framework.Scenes // Apply physics to the root prim m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false); } - - if (m_rootPart.PhysActor != null && refreshForces) - { - m_rootPart.Force = m_rootPart.Force; - m_rootPart.Torque = m_rootPart.Torque; - m_rootPart.Buoyancy = m_rootPart.Buoyancy; - } } public void SetOwnerId(UUID userId) @@ -3079,7 +3072,7 @@ namespace OpenSim.Region.Framework.Scenes { // cancel physics RootPart.Flags &= ~PrimFlags.Physics; - ApplyPhysics(false); + ApplyPhysics(); } } From 9aacdca653e6197430b65c2a81d3af8c7081865b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Jul 2016 21:32:47 +0100 Subject: [PATCH 44/45] but buoyancy was missing --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 133b4ce263..0b8076abdb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4883,6 +4883,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter pa.GravModifier = GravityModifier; pa.Friction = Friction; pa.Restitution = Restitution; + pa.Buoyancy = Buoyancy; if(LocalId == ParentGroup.RootPart.LocalId) { @@ -4927,7 +4928,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter { Velocity = velocity; AngularVelocity = rotationalVelocity; - pa.RotationalVelocity = rotationalVelocity; // if not vehicle and root part apply force and torque if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE)) From 01289b9c2d29dc9db5aec62fff7f38b87f34ee38 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Jul 2016 23:13:24 +0100 Subject: [PATCH 45/45] first step removing MegaRegions: refuse to run. Thanks to all that made MegaRegions possible, they where a important OpenSim feature, but can no longer be mantained --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 11 ++++++++++- OpenSim/Region/Application/OpenSimBase.cs | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 3426d10d9b..1d4deac7bc 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -157,7 +157,16 @@ namespace OpenSim.Framework.Servers "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n", Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32"); - StartupSpecific(); + try + { + StartupSpecific(); + } + catch(Exception e) + { + m_log.FatalFormat("Fatal error: {0}", + (e.Message == null || e.Message == String.Empty) ? "Unknown reason":e.Message ); + Environment.Exit(1); + } TimeSpan timeTaken = DateTime.Now - m_startuptime; diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 41966ff325..52ded3d055 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -218,6 +218,13 @@ namespace OpenSim IConfig startupConfig = Config.Configs["Startup"]; if (startupConfig != null) { + // refuse to run MegaRegions + if(startupConfig.GetBoolean("CombineContiguousRegions", false)) + { + 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"); + throw new Exception("CombineContiguousRegions not suported"); + } + string pidFile = startupConfig.GetString("PIDFile", String.Empty); if (pidFile != String.Empty) CreatePIDFile(pidFile);