mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
This commit is contained in:
@@ -3593,7 +3593,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
return new LSL_Key(m_host.ParentGroup.FromPartID.ToString());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the response type for an HTTP request/response
|
||||
/// </summary>
|
||||
@@ -3604,5 +3604,92 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (m_UrlModule != null)
|
||||
m_UrlModule.HttpContentType(new UUID(id),type);
|
||||
}
|
||||
|
||||
/// Shout an error if the object owner did not grant the script the specified permissions.
|
||||
/// </summary>
|
||||
/// <param name="perms"></param>
|
||||
/// <returns>boolean indicating whether an error was shouted.</returns>
|
||||
protected bool ShoutErrorOnLackingOwnerPerms(int perms, string errorPrefix)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment");
|
||||
m_host.AddScriptLPS(1);
|
||||
bool fail = false;
|
||||
if (m_item.PermsGranter != m_host.OwnerID)
|
||||
{
|
||||
fail = true;
|
||||
OSSLShoutError(string.Format("{0}. Permissions not granted to owner.", errorPrefix));
|
||||
}
|
||||
else if ((m_item.PermsMask & perms) == 0)
|
||||
{
|
||||
fail = true;
|
||||
OSSLShoutError(string.Format("{0}. Permissions not granted.", errorPrefix));
|
||||
}
|
||||
|
||||
return fail;
|
||||
}
|
||||
|
||||
protected void DropAttachment(bool checkPerms)
|
||||
{
|
||||
if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
||||
ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID);
|
||||
|
||||
if (attachmentsModule != null && sp != null)
|
||||
{
|
||||
attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId);
|
||||
}
|
||||
}
|
||||
|
||||
protected void DropAttachmentAt(bool checkPerms, LSL_Vector pos, LSL_Rotation rot)
|
||||
{
|
||||
if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
||||
ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID);
|
||||
|
||||
if (attachmentsModule != null && sp != null)
|
||||
{
|
||||
attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, pos, rot);
|
||||
}
|
||||
}
|
||||
|
||||
public void osDropAttachment()
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
DropAttachment(true);
|
||||
}
|
||||
|
||||
public void osForceDropAttachment()
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osForceDropAttachment");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
DropAttachment(false);
|
||||
}
|
||||
|
||||
public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
DropAttachmentAt(true, pos, rot);
|
||||
}
|
||||
|
||||
public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
DropAttachmentAt(false, pos, rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,5 +394,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
void osSetContentType(LSL_Key id, string type);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to drop an attachment to the ground
|
||||
/// </summary>
|
||||
void osDropAttachment();
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to drop an attachment to the ground while bypassing the script permissions
|
||||
/// </summary>
|
||||
void osForceDropAttachment();
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to drop an attachment at the specified coordinates.
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="rot"></param>
|
||||
void osDropAttachmentAt(vector pos, rotation rot);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to drop an attachment at the specified coordinates while bypassing the script permissions
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="rot"></param>
|
||||
void osForceDropAttachmentAt(vector pos, rotation rot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,5 +972,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
{
|
||||
m_OSSL_Functions.osSetContentType(id,type);
|
||||
}
|
||||
|
||||
public void osDropAttachment()
|
||||
{
|
||||
m_OSSL_Functions.osDropAttachment();
|
||||
}
|
||||
|
||||
public void osForceDropAttachment()
|
||||
{
|
||||
m_OSSL_Functions.osForceDropAttachment();
|
||||
}
|
||||
|
||||
public void osDropAttachmentAt(vector pos, rotation rot)
|
||||
{
|
||||
m_OSSL_Functions.osDropAttachmentAt(pos, rot);
|
||||
}
|
||||
|
||||
public void osForceDropAttachmentAt(vector pos, rotation rot)
|
||||
{
|
||||
m_OSSL_Functions.osForceDropAttachmentAt(pos, rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,9 +96,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
if (part == null)
|
||||
return;
|
||||
|
||||
if ((part.ScriptEvents & scriptEvents.money) == 0)
|
||||
part = part.ParentGroup.RootPart;
|
||||
|
||||
m_log.Debug("Paid: " + objectID + " from " + agentID + ", amount " + amount);
|
||||
|
||||
part = part.ParentGroup.RootPart;
|
||||
// part = part.ParentGroup.RootPart;
|
||||
money(part.LocalId, agentID, amount);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user