diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 32 |
2 files changed, 62 insertions, 2 deletions
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 | |||
2781 | public void llCreateLink(string target, int parent) | 2781 | public void llCreateLink(string target, int parent) |
2782 | { | 2782 | { |
2783 | m_host.AddScriptLPS(1); | 2783 | m_host.AddScriptLPS(1); |
2784 | NotImplemented("llCreateLink"); | 2784 | LLUUID invItemID = InventorySelf(); |
2785 | if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CHANGE_LINKS) == 0) { | ||
2786 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); | ||
2787 | return; | ||
2788 | } | ||
2789 | IClientAPI client = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter).ControllingClient; | ||
2790 | SceneObjectPart targetPart = World.GetSceneObjectPart(target); | ||
2791 | SceneObjectGroup parentPrim = null, childPrim = null; | ||
2792 | if (targetPart != null) | ||
2793 | { | ||
2794 | if (parent == BuiltIn_Commands_BaseClass.TRUE) { | ||
2795 | parentPrim = m_host.ParentGroup; | ||
2796 | childPrim = targetPart.ParentGroup; | ||
2797 | } | ||
2798 | else | ||
2799 | { | ||
2800 | parentPrim = targetPart.ParentGroup; | ||
2801 | childPrim = m_host.ParentGroup; | ||
2802 | } | ||
2803 | byte uf = childPrim.RootPart.UpdateFlag; | ||
2804 | childPrim.RootPart.UpdateFlag = 0; | ||
2805 | parentPrim.LinkToGroup(childPrim); | ||
2806 | childPrim.RootPart.UpdateFlag = uf; | ||
2807 | } | ||
2808 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | ||
2809 | parentPrim.RootPart.AddFlag(LLObject.ObjectFlags.CreateSelected); | ||
2810 | parentPrim.GetProperties(client); | ||
2811 | |||
2812 | // sleep for 1 second | ||
2813 | System.Threading.Thread.Sleep(1000); | ||
2814 | |||
2785 | } | 2815 | } |
2786 | 2816 | ||
2787 | public void llBreakLink(int linknum) | 2817 | public void llBreakLink(int linknum) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4de207a..3d68121 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2768,7 +2768,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2768 | public void llCreateLink(string target, int parent) | 2768 | public void llCreateLink(string target, int parent) |
2769 | { | 2769 | { |
2770 | m_host.AddScriptLPS(1); | 2770 | m_host.AddScriptLPS(1); |
2771 | NotImplemented("llCreateLink"); | 2771 | LLUUID invItemID = InventorySelf(); |
2772 | if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CHANGE_LINKS) == 0) { | ||
2773 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); | ||
2774 | return; | ||
2775 | } | ||
2776 | IClientAPI client = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter).ControllingClient; | ||
2777 | SceneObjectPart targetPart = World.GetSceneObjectPart(target); | ||
2778 | SceneObjectGroup parentPrim = null, childPrim = null; | ||
2779 | if (targetPart != null) | ||
2780 | { | ||
2781 | if (parent == BuiltIn_Commands_BaseClass.TRUE) { | ||
2782 | parentPrim = m_host.ParentGroup; | ||
2783 | childPrim = targetPart.ParentGroup; | ||
2784 | } | ||
2785 | else | ||
2786 | { | ||
2787 | parentPrim = targetPart.ParentGroup; | ||
2788 | childPrim = m_host.ParentGroup; | ||
2789 | } | ||
2790 | byte uf = childPrim.RootPart.UpdateFlag; | ||
2791 | childPrim.RootPart.UpdateFlag = 0; | ||
2792 | parentPrim.LinkToGroup(childPrim); | ||
2793 | childPrim.RootPart.UpdateFlag = uf; | ||
2794 | } | ||
2795 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | ||
2796 | parentPrim.RootPart.AddFlag(LLObject.ObjectFlags.CreateSelected); | ||
2797 | parentPrim.GetProperties(client); | ||
2798 | |||
2799 | // sleep for 1 second | ||
2800 | System.Threading.Thread.Sleep(1000); | ||
2801 | |||
2772 | } | 2802 | } |
2773 | 2803 | ||
2774 | public void llBreakLink(int linknum) | 2804 | public void llBreakLink(int linknum) |