*Added a Few External Checks relating to scripts including the seperation of runscript into 3 different situations (Rez, start stop)
parent
b0be8075cd
commit
1d38510bd2
|
@ -1018,13 +1018,16 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
|
if (ExternalChecks.ExternalChecksCanRunScript(item.ID, part.UUID, remoteClient.AgentId))
|
||||||
part.ParentGroup.StartScript(localID, copyID);
|
{
|
||||||
part.GetProperties(remoteClient);
|
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
|
||||||
|
part.ParentGroup.StartScript(localID, copyID);
|
||||||
|
part.GetProperties(remoteClient);
|
||||||
|
|
||||||
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
||||||
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
||||||
// item.inventoryName, localID, remoteClient.Name);
|
// item.inventoryName, localID, remoteClient.Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1076,7 +1079,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
part.AddInventoryItem(taskItem);
|
part.AddInventoryItem(taskItem);
|
||||||
part.GetProperties(remoteClient);
|
part.GetProperties(remoteClient);
|
||||||
part.StartScript(taskItem);
|
if (ExternalChecks.ExternalChecksCanRunScript(taskItem.AssetID, part.UUID, remoteClient.AgentId))
|
||||||
|
{
|
||||||
|
part.StartScript(taskItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectPart part=GetSceneObjectPart(objectID);
|
SceneObjectPart part=GetSceneObjectPart(objectID);
|
||||||
if (part == null)
|
if (part == null)
|
||||||
return;
|
return;
|
||||||
EventManager.TriggerScriptReset(part.LocalId, itemID);
|
|
||||||
|
if (ExternalChecks.ExternalChecksCanResetScript(itemID, remoteClient.AgentId))
|
||||||
|
{
|
||||||
|
EventManager.TriggerScriptReset(part.LocalId, itemID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -582,7 +582,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region RUN SCRIPT
|
#region RUN SCRIPT (When Script Placed in Object)
|
||||||
public delegate bool CanRunScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene);
|
public delegate bool CanRunScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene);
|
||||||
private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>();
|
private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>();
|
||||||
|
|
||||||
|
@ -611,6 +611,93 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
#endregion
|
#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
|
#region TERRAFORM LAND
|
||||||
public delegate bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene);
|
public delegate bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene);
|
||||||
private List<CanTerraformLand> CanTerraformLandCheckFunctions = new List<CanTerraformLand>();
|
private List<CanTerraformLand> CanTerraformLandCheckFunctions = new List<CanTerraformLand>();
|
||||||
|
|
|
@ -49,6 +49,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectPart part = GetChildPart(localID);
|
SceneObjectPart part = GetChildPart(localID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
part.StartScript(itemID);
|
part.StartScript(itemID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue