diff options
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region')
3 files changed, 70 insertions, 13 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 4ab719d..0b8b95b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -3514,6 +3514,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3514 | EntityUpdate update; | 3514 | EntityUpdate update; |
3515 | while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) | 3515 | while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) |
3516 | { | 3516 | { |
3517 | // If we have sent a kill packet for this object | ||
3518 | // drop any updates on the floor | ||
3519 | if (update.Entity is SceneObjectPart) | ||
3520 | { | ||
3521 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3522 | if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) | ||
3523 | continue; | ||
3524 | } | ||
3525 | |||
3517 | ++updatesThisCall; | 3526 | ++updatesThisCall; |
3518 | 3527 | ||
3519 | #region UpdateFlags to packet type conversion | 3528 | #region UpdateFlags to packet type conversion |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a0fabff..ba84b88 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3044,6 +3044,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3044 | UUID ownerID = _ownerID; | 3044 | UUID ownerID = _ownerID; |
3045 | UUID objectID = UUID; | 3045 | UUID objectID = UUID; |
3046 | UUID parentID = GetRootPartUUID(); | 3046 | UUID parentID = GetRootPartUUID(); |
3047 | |||
3048 | if (ParentGroup.IsAttachment && ParentGroup.RootPart.Shape.State > 30) | ||
3049 | { | ||
3050 | // Use the avatar as the parent for HUDs, since the prims | ||
3051 | // are not sent to other avatars | ||
3052 | objectID = _ownerID; | ||
3053 | parentID = _ownerID; | ||
3054 | } | ||
3055 | |||
3047 | UUID soundID = UUID.Zero; | 3056 | UUID soundID = UUID.Zero; |
3048 | Vector3 position = AbsolutePosition; // region local | 3057 | Vector3 position = AbsolutePosition; // region local |
3049 | ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; | 3058 | ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d61715e..236458c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -69,6 +69,14 @@ using System.Reflection; | |||
69 | 69 | ||
70 | namespace OpenSim.Region.ScriptEngine.Shared.Api | 70 | namespace OpenSim.Region.ScriptEngine.Shared.Api |
71 | { | 71 | { |
72 | // MUST be a ref type | ||
73 | public class UserInfoCacheEntry | ||
74 | { | ||
75 | public int time; | ||
76 | public UserAccount account; | ||
77 | public PresenceInfo pinfo; | ||
78 | } | ||
79 | |||
72 | /// <summary> | 80 | /// <summary> |
73 | /// Contains all LSL ll-functions. This class will be in Default AppDomain. | 81 | /// Contains all LSL ll-functions. This class will be in Default AppDomain. |
74 | /// </summary> | 82 | /// </summary> |
@@ -93,6 +101,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
93 | protected int m_scriptConsoleChannel = 0; | 101 | protected int m_scriptConsoleChannel = 0; |
94 | protected bool m_scriptConsoleChannelEnabled = false; | 102 | protected bool m_scriptConsoleChannelEnabled = false; |
95 | protected IUrlModule m_UrlModule = null; | 103 | protected IUrlModule m_UrlModule = null; |
104 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = | ||
105 | new Dictionary<UUID, UserInfoCacheEntry>(); | ||
96 | 106 | ||
97 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 107 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) |
98 | { | 108 | { |
@@ -1173,12 +1183,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1173 | public virtual void llDie() | 1183 | public virtual void llDie() |
1174 | { | 1184 | { |
1175 | m_host.AddScriptLPS(1); | 1185 | m_host.AddScriptLPS(1); |
1176 | if (!m_host.IsAttachment) | 1186 | if (!m_host.IsAttachment) throw new SelfDeleteException(); |
1177 | { | ||
1178 | //Enforce a sleep here to avoid ghost prims | ||
1179 | llSleep(0.2d); | ||
1180 | throw new SelfDeleteException(); | ||
1181 | } | ||
1182 | } | 1187 | } |
1183 | 1188 | ||
1184 | public LSL_Float llGround(LSL_Vector offset) | 1189 | public LSL_Float llGround(LSL_Vector offset) |
@@ -4249,16 +4254,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4249 | m_host.AddScriptLPS(1); | 4254 | m_host.AddScriptLPS(1); |
4250 | 4255 | ||
4251 | UUID uuid = (UUID)id; | 4256 | UUID uuid = (UUID)id; |
4257 | PresenceInfo pinfo = null; | ||
4258 | UserAccount account; | ||
4252 | 4259 | ||
4253 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); | 4260 | UserInfoCacheEntry ce; |
4254 | if (account == null) | 4261 | if (!m_userInfoCache.TryGetValue(uuid, out ce)) |
4255 | return UUID.Zero.ToString(); | 4262 | { |
4263 | account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); | ||
4264 | if (account == null) | ||
4265 | { | ||
4266 | m_userInfoCache[uuid] = null; // Cache negative | ||
4267 | return UUID.Zero.ToString(); | ||
4268 | } | ||
4256 | 4269 | ||
4257 | 4270 | ||
4258 | PresenceInfo pinfo = null; | 4271 | PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); |
4259 | PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); | 4272 | if (pinfos != null && pinfos.Length > 0) |
4260 | if (pinfos != null && pinfos.Length > 0) | 4273 | pinfo = pinfos[0]; |
4261 | pinfo = pinfos[0]; | 4274 | |
4275 | ce = new UserInfoCacheEntry(); | ||
4276 | ce.time = Util.EnvironmentTickCount(); | ||
4277 | ce.account = account; | ||
4278 | ce.pinfo = pinfo; | ||
4279 | m_userInfoCache[uuid] = ce; | ||
4280 | } | ||
4281 | else | ||
4282 | { | ||
4283 | if (ce == null) | ||
4284 | return UUID.Zero.ToString(); | ||
4285 | |||
4286 | account = ce.account; | ||
4287 | pinfo = ce.pinfo; | ||
4288 | } | ||
4289 | |||
4290 | if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) | ||
4291 | { | ||
4292 | PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); | ||
4293 | if (pinfos != null && pinfos.Length > 0) | ||
4294 | pinfo = pinfos[0]; | ||
4295 | else | ||
4296 | pinfo = null; | ||
4297 | |||
4298 | ce.time = Util.EnvironmentTickCount(); | ||
4299 | ce.pinfo = pinfo; | ||
4300 | } | ||
4262 | 4301 | ||
4263 | string reply = String.Empty; | 4302 | string reply = String.Empty; |
4264 | 4303 | ||