From 6bcdc82a465d8471e1aab66077ce5aaa944f78f6 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 17 Sep 2008 13:14:07 +0000 Subject: * Apply http://opensimulator.org/mantis/view.php?id=2206 * Fix/implement LSL group-related functions llDetectedGroup, llSameGroup * Thanks nlin --- .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 26 ++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Common') diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 3495305..3615e94 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -932,14 +932,17 @@ namespace OpenSim.Region.ScriptEngine.Common } public LSL_Types.LSLInteger llDetectedGroup(int number) - { //CFK: I *think* this is right, but am not sure. + { m_host.AddScriptLPS(1); - EntityBase SensedObject = entityDetectedKey(number); - if (SensedObject == null) + UUID SensedUUID = uuidDetectedKey(number); + if (SensedUUID == UUID.Zero) return new LSL_Types.LSLInteger(0); - if (m_host.GroupID == m_host.ParentGroup.RootPart.GroupID) + ScenePresence presence = World.GetScenePresence(SensedUUID); + IClientAPI client = presence.ControllingClient; + if (m_host.GroupID == client.ActiveGroupId) return new LSL_Types.LSLInteger(1); - return new LSL_Types.LSLInteger(0); + else + return new LSL_Types.LSLInteger(0); } public LSL_Types.LSLInteger llDetectedLinkNumber(int number) @@ -4708,8 +4711,17 @@ namespace OpenSim.Region.ScriptEngine.Common public LSL_Types.LSLInteger llSameGroup(string agent) { m_host.AddScriptLPS(1); - NotImplemented("llSameGroup"); - return 0; + UUID agentId = new UUID(); + if (!UUID.TryParse(agent, out agentId)) + return new LSL_Types.LSLInteger(0); + ScenePresence presence = World.GetScenePresence(agentId); + if (presence == null) + return new LSL_Types.LSLInteger(0); + IClientAPI client = presence.ControllingClient; + if (m_host.GroupID == client.ActiveGroupId) + return new LSL_Types.LSLInteger(1); + else + return new LSL_Types.LSLInteger(0); } public void llUnSit(string id) -- cgit v1.1