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

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

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>();