Merge branch 'master' into careminster

Conflicts:
	OpenSim/Framework/Watchdog.cs
	OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
	OpenSim/Region/Framework/Scenes/Scene.cs
	OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
	OpenSim/Region/Framework/Scenes/ScenePresence.cs
This commit is contained in:
Melanie
2012-07-11 03:56:50 +01:00
39 changed files with 962 additions and 314 deletions

View File

@@ -2725,6 +2725,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num)
{
CheckThreatLevel(ThreatLevel.High, "osNpcTouch");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
int linkNum = link_num.value;
if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS))
{
UUID npcId;
if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID))
return;
SceneObjectPart part = null;
UUID objectId;
if (UUID.TryParse(LSL_String.ToString(object_key), out objectId))
part = World.GetSceneObjectPart(objectId);
if (part == null)
return;
if (linkNum != ScriptBaseClass.LINK_THIS)
{
if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT)
{ // 0 and 1 are treated as root, find the root if the current part isnt it
if (!part.IsRoot)
part = part.ParentGroup.RootPart;
}
else
{ // Find the prim with the given link number if not found then fail silently
part = part.ParentGroup.GetLinkNumPart(linkNum);
if (part == null)
return;
}
}
module.Touch(npcId, part.UUID);
}
}
/// <summary>
/// Save the current appearance of the script owner permanently to the named notecard.
/// </summary>
@@ -3203,13 +3238,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatarFromInventory");
m_host.AddScriptLPS(1);
ForceAttachToAvatarFromInventory(m_host.OwnerID, itemName, attachmentPoint);
}
public void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint)
{
CheckThreatLevel(ThreatLevel.Severe, "osForceAttachToOtherAvatarFromInventory");
m_host.AddScriptLPS(1);
UUID avatarId;
if (!UUID.TryParse(rawAvatarId, out avatarId))
return;
ForceAttachToAvatarFromInventory(avatarId, itemName, attachmentPoint);
}
public void ForceAttachToAvatarFromInventory(UUID avatarId, string itemName, int attachmentPoint)
{
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
if (attachmentsModule == null)
return;
m_host.AddScriptLPS(1);
InitLSL();
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName);
@@ -3232,7 +3286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
ScenePresence sp = World.GetScenePresence(avatarId);
if (sp == null)
return;