All scripts are now created suspended and are only unsuspended when the object
is fully rezzed and all scripts in it are instantiated. This ensures that link messages will not be lost on rez/region crossing and makes heavily scripted objects reliable.slimupdates
parent
7ef6dc2bac
commit
21cad5d3ac
|
@ -250,6 +250,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
itemID, remoteClient.Name, AttachmentPt);
|
||||
}
|
||||
|
||||
objatt.ResumeScripts();
|
||||
return objatt;
|
||||
}
|
||||
|
||||
|
@ -413,4 +414,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -621,6 +621,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
}
|
||||
}
|
||||
|
||||
rootPart.ParentGroup.ResumeScripts();
|
||||
return rootPart.ParentGroup;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,6 +284,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
{
|
||||
sceneObjectsLoadedCount++;
|
||||
sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0);
|
||||
sceneObject.ResumeScripts();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
|
||||
|
||||
ArrayList GetScriptErrors(UUID itemID);
|
||||
void ResumeScripts();
|
||||
|
||||
/// <summary>
|
||||
/// Stop all the scripts in this entity.
|
||||
|
|
|
@ -41,6 +41,14 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
bool PostScriptEvent(UUID itemID, string name, Object[] args);
|
||||
bool PostObjectEvent(UUID itemID, string name, Object[] args);
|
||||
|
||||
// Suspend ALL scripts in a given scene object. The item ID
|
||||
// is the UUID of a SOG, and the method acts on all contained
|
||||
// scripts. This is different from the suspend/resume that
|
||||
// can be issued by a client.
|
||||
//
|
||||
void SuspendScript(UUID itemID);
|
||||
void ResumeScript(UUID itemID);
|
||||
|
||||
ArrayList GetScriptErrors(UUID itemID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (group is SceneObjectGroup)
|
||||
{
|
||||
((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
|
||||
((SceneObjectGroup) group).ResumeScripts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +219,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
remoteClient.SendAgentAlertMessage("Script saved", false);
|
||||
}
|
||||
part.ParentGroup.ResumeScripts();
|
||||
return errors;
|
||||
}
|
||||
|
||||
|
|
|
@ -1131,7 +1131,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (m_scripts_enabled != !ScriptEngine)
|
||||
{
|
||||
// Tedd! Here's the method to disable the scripting engine!
|
||||
if (ScriptEngine)
|
||||
{
|
||||
m_log.Info("Stopping all Scripts in Scene");
|
||||
|
@ -1153,6 +1152,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
|
||||
((SceneObjectGroup)ent).ResumeScripts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1755,6 +1755,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0);
|
||||
copy.HasGroupChanged = true;
|
||||
copy.ScheduleGroupForFullUpdate();
|
||||
copy.ResumeScripts();
|
||||
|
||||
// required for physics to update it's position
|
||||
copy.AbsolutePosition = copy.AbsolutePosition;
|
||||
|
|
|
@ -416,5 +416,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
scriptModule.SetXMLState(itemID, n.OuterXml);
|
||||
}
|
||||
}
|
||||
|
||||
public void ResumeScripts()
|
||||
{
|
||||
foreach (SceneObjectPart part in m_parts.Values)
|
||||
{
|
||||
part.Inventory.ResumeScripts();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1042,5 +1042,28 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void ResumeScripts()
|
||||
{
|
||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
||||
if (engines == null)
|
||||
return;
|
||||
|
||||
|
||||
lock (m_items)
|
||||
{
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
if (item.InvType == (int)InventoryType.LSL)
|
||||
{
|
||||
foreach (IScriptModule engine in engines)
|
||||
{
|
||||
if (engine != null)
|
||||
engine.ResumeScript(item.ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,6 +182,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
foreach (SceneObjectGroup sceneObject in sceneObjects)
|
||||
{
|
||||
sceneObject.CreateScriptInstances(0, true, scene.DefaultScriptEngine, 0);
|
||||
sceneObject.ResumeScripts();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
|||
|
||||
void PostEvent(EventParams data);
|
||||
|
||||
void Suspend();
|
||||
void Resume();
|
||||
|
||||
/// <summary>
|
||||
/// Process the next event queued for this script
|
||||
/// </summary>
|
||||
|
|
|
@ -95,6 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
private bool m_startedFromSavedState;
|
||||
private UUID m_CurrentStateHash;
|
||||
private UUID m_RegionID;
|
||||
private bool m_Suspended = true;
|
||||
|
||||
private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
|
||||
m_LineMap;
|
||||
|
@ -638,6 +639,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
/// <returns></returns>
|
||||
public object EventProcessor()
|
||||
{
|
||||
if (m_Suspended)
|
||||
return 0;
|
||||
|
||||
lock (m_Script)
|
||||
{
|
||||
EventParams data = null;
|
||||
|
@ -1011,5 +1015,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
{
|
||||
get { return m_RegionID; }
|
||||
}
|
||||
|
||||
public void Suspend()
|
||||
{
|
||||
m_Suspended = true;
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
m_Suspended = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1488,5 +1488,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
return new ArrayList();
|
||||
}
|
||||
}
|
||||
|
||||
public void SuspendScript(UUID itemID)
|
||||
{
|
||||
IScriptInstance instance = GetInstance(itemID);
|
||||
if (instance == null)
|
||||
return;
|
||||
|
||||
instance.Suspend();
|
||||
}
|
||||
|
||||
public void ResumeScript(UUID itemID)
|
||||
{
|
||||
IScriptInstance instance = GetInstance(itemID);
|
||||
if (instance == null)
|
||||
return;
|
||||
|
||||
instance.Resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue