From f2055a35246a991fd73240789f4354d200ac6cc8 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 19 Aug 2008 21:37:12 +0000 Subject: Mantis #2001 Thank you, nlin, for a patch that implements part of llCreateLink - DotNetEngine implementation by nlin. - Shared/ port by me. --- .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (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 9195063..3823ff8 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -2781,7 +2781,37 @@ namespace OpenSim.Region.ScriptEngine.Common public void llCreateLink(string target, int parent) { m_host.AddScriptLPS(1); - NotImplemented("llCreateLink"); + LLUUID invItemID = InventorySelf(); + if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CHANGE_LINKS) == 0) { + ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); + return; + } + IClientAPI client = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter).ControllingClient; + SceneObjectPart targetPart = World.GetSceneObjectPart(target); + SceneObjectGroup parentPrim = null, childPrim = null; + if (targetPart != null) + { + if (parent == BuiltIn_Commands_BaseClass.TRUE) { + parentPrim = m_host.ParentGroup; + childPrim = targetPart.ParentGroup; + } + else + { + parentPrim = targetPart.ParentGroup; + childPrim = m_host.ParentGroup; + } + byte uf = childPrim.RootPart.UpdateFlag; + childPrim.RootPart.UpdateFlag = 0; + parentPrim.LinkToGroup(childPrim); + childPrim.RootPart.UpdateFlag = uf; + } + parentPrim.TriggerScriptChangedEvent(Changed.LINK); + parentPrim.RootPart.AddFlag(LLObject.ObjectFlags.CreateSelected); + parentPrim.GetProperties(client); + + // sleep for 1 second + System.Threading.Thread.Sleep(1000); + } public void llBreakLink(int linknum) -- cgit v1.1