*Added a Few External Checks relating to scripts including the seperation of runscript into 3 different situations (Rez, start stop)

0.6.0-stable
mingchen 2008-05-28 23:20:01 +00:00
parent b0be8075cd
commit 1d38510bd2
4 changed files with 107 additions and 9 deletions

View File

@ -1018,13 +1018,16 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart part = GetSceneObjectPart(localID);
if (part != null)
{
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
part.ParentGroup.StartScript(localID, copyID);
part.GetProperties(remoteClient);
if (ExternalChecks.ExternalChecksCanRunScript(item.ID, part.UUID, remoteClient.AgentId))
{
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
part.ParentGroup.StartScript(localID, copyID);
part.GetProperties(remoteClient);
// m_log.InfoFormat("[PRIMINVENTORY]: " +
// "Rezzed script {0} into prim local ID {1} for user {2}",
// item.inventoryName, localID, remoteClient.Name);
// m_log.InfoFormat("[PRIMINVENTORY]: " +
// "Rezzed script {0} into prim local ID {1} for user {2}",
// item.inventoryName, localID, remoteClient.Name);
}
}
else
{
@ -1076,7 +1079,10 @@ namespace OpenSim.Region.Environment.Scenes
part.AddInventoryItem(taskItem);
part.GetProperties(remoteClient);
part.StartScript(taskItem);
if (ExternalChecks.ExternalChecksCanRunScript(taskItem.AssetID, part.UUID, remoteClient.AgentId))
{
part.StartScript(taskItem);
}
}
}

View File

@ -295,7 +295,11 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart part=GetSceneObjectPart(objectID);
if (part == null)
return;
EventManager.TriggerScriptReset(part.LocalId, itemID);
if (ExternalChecks.ExternalChecksCanResetScript(itemID, remoteClient.AgentId))
{
EventManager.TriggerScriptReset(part.LocalId, itemID);
}
}
}
}

View File

@ -582,7 +582,7 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region RUN SCRIPT
#region RUN SCRIPT (When Script Placed in Object)
public delegate bool CanRunScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene);
private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>();
@ -611,6 +611,93 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region START SCRIPT (When Script run box is Checked after placed in object)
public delegate bool CanStartScript(LLUUID script, LLUUID user, Scene scene);
private List<CanStartScript> CanStartScriptCheckFunctions = new List<CanStartScript>();
public void addCheckStartScript(CanStartScript delegateFunc)
{
if (!CanStartScriptCheckFunctions.Contains(delegateFunc))
CanStartScriptCheckFunctions.Add(delegateFunc);
}
public void removeCheckStartScript(CanStartScript delegateFunc)
{
if (CanStartScriptCheckFunctions.Contains(delegateFunc))
CanStartScriptCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanStartScript(LLUUID script, LLUUID user)
{
foreach (CanStartScript check in CanStartScriptCheckFunctions)
{
if (check(script, user, m_scene) == false)
{
return false;
}
}
return true;
}
#endregion
#region STOP SCRIPT (When Script run box is unchecked after placed in object)
public delegate bool CanStopScript(LLUUID script, LLUUID user, Scene scene);
private List<CanStopScript> CanStopScriptCheckFunctions = new List<CanStopScript>();
public void addCheckStopScript(CanStopScript delegateFunc)
{
if (!CanStopScriptCheckFunctions.Contains(delegateFunc))
CanStopScriptCheckFunctions.Add(delegateFunc);
}
public void removeCheckStopScript(CanStopScript delegateFunc)
{
if (CanStopScriptCheckFunctions.Contains(delegateFunc))
CanStopScriptCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanStopScript(LLUUID script, LLUUID user)
{
foreach (CanStopScript check in CanStopScriptCheckFunctions)
{
if (check(script, user, m_scene) == false)
{
return false;
}
}
return true;
}
#endregion
#region RESET SCRIPT
public delegate bool CanResetScript(LLUUID script, LLUUID user, Scene scene);
private List<CanResetScript> CanResetScriptCheckFunctions = new List<CanResetScript>();
public void addCheckResetScript(CanResetScript delegateFunc)
{
if (!CanResetScriptCheckFunctions.Contains(delegateFunc))
CanResetScriptCheckFunctions.Add(delegateFunc);
}
public void removeCheckResetScript(CanResetScript delegateFunc)
{
if (CanResetScriptCheckFunctions.Contains(delegateFunc))
CanResetScriptCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanResetScript(LLUUID script, LLUUID user)
{
foreach (CanResetScript check in CanResetScriptCheckFunctions)
{
if (check(script, user, m_scene) == false)
{
return false;
}
}
return true;
}
#endregion
#region TERRAFORM LAND
public delegate bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene);
private List<CanTerraformLand> CanTerraformLandCheckFunctions = new List<CanTerraformLand>();

View File

@ -49,6 +49,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
part.StartScript(itemID);
}