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 +++++++++++++++++++--- .../Common/ScriptEngineBase/EventManager.cs | 4 +-- .../ScriptEngine/Common/ScriptServerInterfaces.cs | 2 +- 3 files changed, 35 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 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) diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index 77a4048..f8f38a1 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs @@ -225,9 +225,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "no_sensor", EventQueueManager.llDetectNull); } - public void control(uint localID, LLUUID itemID) + public void control(uint localID, LLUUID itemID, LLUUID agentID, uint held, uint change) { - myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "control", EventQueueManager.llDetectNull); + myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "control", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLString(agentID.ToString()), new LSL_Types.LSLInteger(held), new LSL_Types.LSLInteger(change)}); } public void email(uint localID, LLUUID itemID) diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs index 1edd3bd..be42539 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs @@ -54,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Common void on_rez(uint localID, LLUUID itemID); void sensor(uint localID, LLUUID itemID); void no_sensor(uint localID, LLUUID itemID); - void control(uint localID, LLUUID itemID); + void control(uint localID, LLUUID itemID, LLUUID agentID, uint held, uint change); void money(uint LocalID, LLUUID agentID, int amount); void email(uint localID, LLUUID itemID); void at_target(uint localID, uint handle, LLVector3 targetpos, LLVector3 atpos); -- cgit v1.1