Thank you, nlin, for a patch that implements part of llCreateLink
- DotNetEngine implementation by nlin.
- Shared/ port by me.
0.6.0-stable
Melanie Thielker 2008-08-19 21:37:12 +00:00
parent fc83af4bf6
commit f2055a3524
2 changed files with 62 additions and 2 deletions

View File

@ -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)

View File

@ -2768,7 +2768,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
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)