mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
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.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user