From ab5556055e6104d3e5c18faf7f6f9e44b518839f Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 7 May 2008 18:23:46 +0000 Subject: * Theoretically, everything is in place for scripted take controls... Theoretically. * I've still got to test, it's still theoretical code :D. Good thing it isn't enabled by default! --- .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 36 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs') diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index e8e4f80..1f23d00 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -1936,25 +1936,53 @@ namespace OpenSim.Region.ScriptEngine.Common public void llTakeControls(int controls, int accept, int pass_on) { + if (!m_host.TaskInventory.ContainsKey(InventorySelf())) + { + return; + } + if (m_host.TaskInventory[InventorySelf()].PermsGranter != LLUUID.Zero) { ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[InventorySelf()].PermsGranter]; - if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0) + if (presence != null) { - presence.SendMovementEventsToScript(controls, accept, pass_on, m_localID, m_itemID); + if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0) + { + presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID); + } } } m_host.AddScriptLPS(1); - NotImplemented("llTakeControls"); + //NotImplemented("llTakeControls"); } public void llReleaseControls() { m_host.AddScriptLPS(1); - NotImplemented("llReleaseControls"); + + if (!m_host.TaskInventory.ContainsKey(InventorySelf())) + { + return; + } + + if (m_host.TaskInventory[InventorySelf()].PermsGranter != LLUUID.Zero) + { + + ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[InventorySelf()].PermsGranter]; + if (presence != null) + { + if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0) + { + // Unregister controls from Presence + presence.UnRegisterControlEventsToScript(m_localID, m_itemID); + // Remove Take Control permission. + m_host.TaskInventory[InventorySelf()].PermsMask &= ~BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS; + } + } + } } public void llAttachToAvatar(int attachment) -- cgit v1.1