diff options
author | Melanie | 2012-07-18 14:30:40 +0200 |
---|---|---|
committer | Melanie | 2012-07-18 14:30:40 +0200 |
commit | 4917637ce618f8489111b465eaa1c9aa214d1649 (patch) | |
tree | f1dc08af317c4d0fa278a35e48567adeb644cfe7 | |
parent | Merge branch 'ubitwork' into avination (diff) | |
download | opensim-SC_OLD-4917637ce618f8489111b465eaa1c9aa214d1649.zip opensim-SC_OLD-4917637ce618f8489111b465eaa1c9aa214d1649.tar.gz opensim-SC_OLD-4917637ce618f8489111b465eaa1c9aa214d1649.tar.bz2 opensim-SC_OLD-4917637ce618f8489111b465eaa1c9aa214d1649.tar.xz |
Fix llSameGroup to work according to specs
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6ec3081..7cb4a26 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6371,22 +6371,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6371 | return agentSize; | 6371 | return agentSize; |
6372 | } | 6372 | } |
6373 | 6373 | ||
6374 | public LSL_Integer llSameGroup(string agent) | 6374 | public LSL_Integer llSameGroup(string id) |
6375 | { | 6375 | { |
6376 | m_host.AddScriptLPS(1); | 6376 | m_host.AddScriptLPS(1); |
6377 | UUID agentId = new UUID(); | 6377 | UUID uuid = new UUID(); |
6378 | if (!UUID.TryParse(agent, out agentId)) | 6378 | if (!UUID.TryParse(id, out uuid)) |
6379 | return new LSL_Integer(0); | 6379 | return new LSL_Integer(0); |
6380 | if (agentId == m_host.GroupID) | 6380 | |
6381 | // Check if it's a group key | ||
6382 | if (uuid == m_host.ParentGroup.RootPart.GroupID) | ||
6381 | return new LSL_Integer(1); | 6383 | return new LSL_Integer(1); |
6382 | ScenePresence presence = World.GetScenePresence(agentId); | 6384 | |
6383 | if (presence == null || presence.IsChildAgent) // Return false for child agents | 6385 | // We got passed a UUID.Zero |
6386 | if (uuid == UUID.Zero) | ||
6384 | return new LSL_Integer(0); | 6387 | return new LSL_Integer(0); |
6385 | IClientAPI client = presence.ControllingClient; | 6388 | |
6386 | if (m_host.GroupID == client.ActiveGroupId) | 6389 | // Handle the case where id names an avatar |
6387 | return new LSL_Integer(1); | 6390 | ScenePresence presence = World.GetScenePresence(uuid); |
6388 | else | 6391 | if (presence != null) |
6392 | { | ||
6393 | if (presence.IsChildAgent) | ||
6394 | return new LSL_Integer(0); | ||
6395 | |||
6396 | IClientAPI client = presence.ControllingClient; | ||
6397 | if (m_host.ParentGroup.RootPart.GroupID == client.ActiveGroupId) | ||
6398 | return new LSL_Integer(1); | ||
6399 | |||
6389 | return new LSL_Integer(0); | 6400 | return new LSL_Integer(0); |
6401 | } | ||
6402 | |||
6403 | // Handle object case | ||
6404 | SceneObjectPart part = World.GetSceneObjectPart(uuid); | ||
6405 | if (part != null) | ||
6406 | { | ||
6407 | // This will handle both deed and non-deed and also the no | ||
6408 | // group case | ||
6409 | if (part.ParentGroup.RootPart.GroupID == m_host.ParentGroup.RootPart.GroupID) | ||
6410 | return new LSL_Integer(1); | ||
6411 | |||
6412 | return new LSL_Integer(0); | ||
6413 | } | ||
6414 | |||
6415 | return new LSL_Integer(0); | ||
6390 | } | 6416 | } |
6391 | 6417 | ||
6392 | public void llUnSit(string id) | 6418 | public void llUnSit(string id) |