diff options
author | UbitUmarov | 2016-07-26 21:39:47 +0100 |
---|---|---|
committer | UbitUmarov | 2016-07-26 21:39:47 +0100 |
commit | 52decfcc16bab0332798745d59c43277f1c034b6 (patch) | |
tree | a07e3791dbf9309e010e59de725b4242d2de1079 /OpenSim/Region/Framework/Scenes/ScenePresence.cs | |
parent | add a public SetGroupPowers to clientView (diff) | |
download | opensim-SC_OLD-52decfcc16bab0332798745d59c43277f1c034b6.zip opensim-SC_OLD-52decfcc16bab0332798745d59c43277f1c034b6.tar.gz opensim-SC_OLD-52decfcc16bab0332798745d59c43277f1c034b6.tar.bz2 opensim-SC_OLD-52decfcc16bab0332798745d59c43277f1c034b6.tar.xz |
reduce some grid services calls on region crossings, sending more information on the agent update ( groups v2 needs change )
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 115 |
1 files changed, 91 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0ccdbf7..c925719 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -346,7 +346,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
346 | private float m_healRate = 1f; | 346 | private float m_healRate = 1f; |
347 | private float m_healRatePerFrame = 0.05f; | 347 | private float m_healRatePerFrame = 0.05f; |
348 | 348 | ||
349 | protected ulong crossingFromRegion; | 349 | // protected ulong crossingFromRegion; |
350 | 350 | ||
351 | private readonly Vector3[] Dir_Vectors = new Vector3[12]; | 351 | private readonly Vector3[] Dir_Vectors = new Vector3[12]; |
352 | 352 | ||
@@ -568,19 +568,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
568 | public string Firstname { get; private set; } | 568 | public string Firstname { get; private set; } |
569 | public string Lastname { get; private set; } | 569 | public string Lastname { get; private set; } |
570 | 570 | ||
571 | public bool haveGroupInformation; | ||
572 | public bool gotCrossUpdate; | ||
573 | |||
571 | public string Grouptitle | 574 | public string Grouptitle |
572 | { | 575 | { |
573 | get { return UseFakeGroupTitle ? "(Loading)" : m_groupTitle; } | 576 | get { return m_groupTitle; } |
574 | set { m_groupTitle = value; } | 577 | set { m_groupTitle = value; } |
575 | } | 578 | } |
576 | private string m_groupTitle; | 579 | private string m_groupTitle; |
577 | 580 | ||
578 | /// <summary> | ||
579 | /// When this is 'true', return a dummy group title instead of the real group title. This is | ||
580 | /// used as part of a hack to force viewers to update the displayed avatar name. | ||
581 | /// </summary> | ||
582 | public bool UseFakeGroupTitle { get; set; } | ||
583 | |||
584 | // Agent's Draw distance. | 581 | // Agent's Draw distance. |
585 | private float m_drawDistance = 255f; | 582 | private float m_drawDistance = 255f; |
586 | public float DrawDistance | 583 | public float DrawDistance |
@@ -1062,9 +1059,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1062 | if (account != null) | 1059 | if (account != null) |
1063 | UserLevel = account.UserLevel; | 1060 | UserLevel = account.UserLevel; |
1064 | 1061 | ||
1065 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 1062 | // IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
1066 | if (gm != null) | 1063 | // if (gm != null) |
1067 | Grouptitle = gm.GetGroupTitle(m_uuid); | 1064 | // Grouptitle = gm.GetGroupTitle(m_uuid); |
1068 | 1065 | ||
1069 | m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); | 1066 | m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); |
1070 | 1067 | ||
@@ -1258,11 +1255,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1258 | // Should not be needed if we are not trying to tell this region to close | 1255 | // Should not be needed if we are not trying to tell this region to close |
1259 | // DoNotCloseAfterTeleport = false; | 1256 | // DoNotCloseAfterTeleport = false; |
1260 | 1257 | ||
1261 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
1262 | if (gm != null) | ||
1263 | Grouptitle = gm.GetGroupTitle(m_uuid); | ||
1264 | |||
1265 | m_log.DebugFormat("[MakeRootAgent] Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
1266 | 1258 | ||
1267 | RegionHandle = m_scene.RegionInfo.RegionHandle; | 1259 | RegionHandle = m_scene.RegionInfo.RegionHandle; |
1268 | 1260 | ||
@@ -1511,6 +1503,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1511 | /// </remarks> | 1503 | /// </remarks> |
1512 | public void MakeChildAgent(ulong newRegionHandle) | 1504 | public void MakeChildAgent(ulong newRegionHandle) |
1513 | { | 1505 | { |
1506 | haveGroupInformation = false; | ||
1507 | gotCrossUpdate = false; | ||
1514 | m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; | 1508 | m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; |
1515 | 1509 | ||
1516 | RegionHandle = newRegionHandle; | 1510 | RegionHandle = newRegionHandle; |
@@ -1978,25 +1972,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1978 | 1972 | ||
1979 | m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1973 | m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1980 | 1974 | ||
1975 | if(!haveGroupInformation && !IsChildAgent && !isNPC) | ||
1976 | { | ||
1977 | // oh crap.. lets retry it directly | ||
1978 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
1979 | if (gm != null) | ||
1980 | Grouptitle = gm.GetGroupTitle(m_uuid); | ||
1981 | 1981 | ||
1982 | // start sending terrain patchs | 1982 | m_log.DebugFormat("[CompleteMovement] Missing Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1983 | if (!isNPC) | ||
1984 | Scene.SendLayerData(ControllingClient); | ||
1985 | 1983 | ||
1986 | if (!IsChildAgent && !isNPC) | ||
1987 | { | ||
1988 | InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); | 1984 | InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); |
1989 | if (cof == null) | 1985 | if (cof == null) |
1990 | COF = UUID.Zero; | 1986 | COF = UUID.Zero; |
1991 | else | 1987 | else |
1992 | COF = cof.ID; | 1988 | COF = cof.ID; |
1993 | 1989 | ||
1994 | m_log.DebugFormat("[ScenePresence]: CompleteMovement COF for {0} is {1}", client.AgentId, COF); | 1990 | m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); |
1995 | } | 1991 | } |
1996 | 1992 | ||
1993 | |||
1997 | // Tell the client that we're totally ready | 1994 | // Tell the client that we're totally ready |
1998 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | 1995 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); |
1999 | 1996 | ||
1997 | |||
2000 | m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1998 | m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
2001 | 1999 | ||
2002 | if (!string.IsNullOrEmpty(m_callbackURI)) | 2000 | if (!string.IsNullOrEmpty(m_callbackURI)) |
@@ -2029,6 +2027,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2029 | 2027 | ||
2030 | m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2028 | m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
2031 | 2029 | ||
2030 | // start sending terrain patchs | ||
2031 | if (!gotCrossUpdate && !isNPC) | ||
2032 | Scene.SendLayerData(ControllingClient); | ||
2033 | |||
2032 | m_previusParcelHide = false; | 2034 | m_previusParcelHide = false; |
2033 | m_previusParcelUUID = UUID.Zero; | 2035 | m_previusParcelUUID = UUID.Zero; |
2034 | m_currentParcelHide = false; | 2036 | m_currentParcelHide = false; |
@@ -2204,6 +2206,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2204 | // m_currentParcelHide = newhide; | 2206 | // m_currentParcelHide = newhide; |
2205 | // } | 2207 | // } |
2206 | 2208 | ||
2209 | haveGroupInformation = true; | ||
2210 | gotCrossUpdate = false; | ||
2211 | |||
2207 | m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd; | 2212 | m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd; |
2208 | 2213 | ||
2209 | m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2214 | m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
@@ -4470,7 +4475,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4470 | checkRePrioritization(); | 4475 | checkRePrioritization(); |
4471 | } | 4476 | } |
4472 | 4477 | ||
4473 | public void CopyTo(AgentData cAgent) | 4478 | public void CopyTo(AgentData cAgent, bool isCrossUpdate) |
4474 | { | 4479 | { |
4475 | cAgent.CallbackURI = m_callbackURI; | 4480 | cAgent.CallbackURI = m_callbackURI; |
4476 | 4481 | ||
@@ -4534,6 +4539,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
4534 | 4539 | ||
4535 | if (Scene.AttachmentsModule != null) | 4540 | if (Scene.AttachmentsModule != null) |
4536 | Scene.AttachmentsModule.CopyAttachments(this, cAgent); | 4541 | Scene.AttachmentsModule.CopyAttachments(this, cAgent); |
4542 | |||
4543 | cAgent.isCrossingUpdate = isCrossUpdate; | ||
4544 | |||
4545 | if(isCrossUpdate && haveGroupInformation) | ||
4546 | { | ||
4547 | |||
4548 | cAgent.agentCOF = COF; | ||
4549 | cAgent.ActiveGroupID = ControllingClient.ActiveGroupId; | ||
4550 | cAgent.ActiveGroupName = ControllingClient.ActiveGroupName; | ||
4551 | cAgent.ActiveGroupTitle = Grouptitle; | ||
4552 | Dictionary<UUID, ulong> gpowers = ControllingClient.GetGroupPowers(); | ||
4553 | if(gpowers.Count >0) | ||
4554 | { | ||
4555 | cAgent.Groups = new AgentGroupData[gpowers.Count]; | ||
4556 | int i = 0; | ||
4557 | foreach (UUID gid in gpowers.Keys) | ||
4558 | { | ||
4559 | // WARNING we dont' have AcceptNotices in cache.. sending as true mb no one notices ;) | ||
4560 | AgentGroupData agd = new AgentGroupData(gid,gpowers[gid],true); | ||
4561 | cAgent.Groups[i++] = agd; | ||
4562 | } | ||
4563 | } | ||
4564 | } | ||
4537 | } | 4565 | } |
4538 | 4566 | ||
4539 | private void CopyFrom(AgentData cAgent) | 4567 | private void CopyFrom(AgentData cAgent) |
@@ -4629,6 +4657,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
4629 | if (Scene.AttachmentsModule != null) | 4657 | if (Scene.AttachmentsModule != null) |
4630 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); | 4658 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); |
4631 | 4659 | ||
4660 | haveGroupInformation = false; | ||
4661 | |||
4662 | // using this as protocol detection don't want to mess with the numbers for now | ||
4663 | if(cAgent.ActiveGroupTitle != null) | ||
4664 | { | ||
4665 | COF = cAgent.agentCOF; | ||
4666 | ControllingClient.ActiveGroupId = cAgent.ActiveGroupID; | ||
4667 | ControllingClient.ActiveGroupName = cAgent.ActiveGroupName; | ||
4668 | ControllingClient.ActiveGroupPowers = 0; | ||
4669 | Grouptitle = cAgent.ActiveGroupTitle; | ||
4670 | int ngroups = cAgent.Groups.Length; | ||
4671 | if(ngroups > 0) | ||
4672 | { | ||
4673 | Dictionary<UUID, ulong> gpowers = new Dictionary<UUID, ulong>(ngroups); | ||
4674 | for(int i = 0 ; i < ngroups; i++) | ||
4675 | { | ||
4676 | AgentGroupData agd = cAgent.Groups[i]; | ||
4677 | gpowers[agd.GroupID] = agd.GroupPowers; | ||
4678 | } | ||
4679 | |||
4680 | ControllingClient.SetGroupPowers(gpowers); | ||
4681 | |||
4682 | if(cAgent.ActiveGroupID == UUID.Zero) | ||
4683 | haveGroupInformation = true; | ||
4684 | else if(gpowers.ContainsKey(cAgent.ActiveGroupID)) | ||
4685 | { | ||
4686 | ControllingClient.ActiveGroupPowers = gpowers[cAgent.ActiveGroupID]; | ||
4687 | haveGroupInformation = true; | ||
4688 | } | ||
4689 | } | ||
4690 | else if(cAgent.ActiveGroupID == UUID.Zero) | ||
4691 | { | ||
4692 | haveGroupInformation = true; | ||
4693 | } | ||
4694 | } | ||
4695 | |||
4696 | gotCrossUpdate = cAgent.isCrossingUpdate; | ||
4697 | |||
4698 | |||
4632 | lock (m_originRegionIDAccessLock) | 4699 | lock (m_originRegionIDAccessLock) |
4633 | m_originRegionID = cAgent.RegionID; | 4700 | m_originRegionID = cAgent.RegionID; |
4634 | } | 4701 | } |
@@ -4636,7 +4703,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4636 | public bool CopyAgent(out IAgentData agent) | 4703 | public bool CopyAgent(out IAgentData agent) |
4637 | { | 4704 | { |
4638 | agent = new CompleteAgentData(); | 4705 | agent = new CompleteAgentData(); |
4639 | CopyTo((AgentData)agent); | 4706 | CopyTo((AgentData)agent, false); |
4640 | return true; | 4707 | return true; |
4641 | } | 4708 | } |
4642 | 4709 | ||