more on scripts *target* events
parent
94f88e330b
commit
ad5aff2d17
|
@ -3011,20 +3011,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void RemoveScriptEvents(UUID scriptid)
|
public void RemoveScriptEvents(UUID scriptid)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ParentGroup != null)
|
|
||||||
ParentGroup.RemoveScriptTargets(scriptid);
|
|
||||||
|
|
||||||
lock (m_scriptEvents)
|
lock (m_scriptEvents)
|
||||||
{
|
{
|
||||||
if (m_scriptEvents.TryGetValue(scriptid, out scriptEvents ev))
|
if (m_scriptEvents.TryGetValue(scriptid, out scriptEvents ev))
|
||||||
{
|
{
|
||||||
|
if((ev & (scriptEvents.anyTarget)) != 0 && ParentGroup != null)
|
||||||
|
ParentGroup.RemoveScriptTargets(scriptid);
|
||||||
m_scriptEvents.Remove(scriptid);
|
m_scriptEvents.Remove(scriptid);
|
||||||
aggregateScriptEvents();
|
aggregateScriptEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveScriptTargets(UUID scriptid)
|
||||||
|
{
|
||||||
|
if(ParentGroup != null)
|
||||||
|
ParentGroup.RemoveScriptTargets(scriptid);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset UUIDs for this part. This involves generate this part's own UUID and
|
/// Reset UUIDs for this part. This involves generate this part's own UUID and
|
||||||
/// generating new UUIDs for all the items in the inventory.
|
/// generating new UUIDs for all the items in the inventory.
|
||||||
|
@ -4001,10 +4005,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// "[SCENE OBJECT PART]: Set script events for script with id {0} on {1}/{2} to {3} in {4}",
|
// "[SCENE OBJECT PART]: Set script events for script with id {0} on {1}/{2} to {3} in {4}",
|
||||||
// scriptid, Name, ParentGroup.Name, events, ParentGroup.Scene.Name);
|
// scriptid, Name, ParentGroup.Name, events, ParentGroup.Scene.Name);
|
||||||
// scriptEvents oldparts;
|
// scriptEvents oldparts;
|
||||||
|
|
||||||
if (ParentGroup != null)
|
|
||||||
ParentGroup.RemoveScriptTargets(scriptid);
|
|
||||||
|
|
||||||
lock (m_scriptEvents)
|
lock (m_scriptEvents)
|
||||||
{
|
{
|
||||||
if (m_scriptEvents.TryGetValue(scriptid, out scriptEvents ev))
|
if (m_scriptEvents.TryGetValue(scriptid, out scriptEvents ev))
|
||||||
|
|
|
@ -876,6 +876,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
// and processing other non-timer events
|
// and processing other non-timer events
|
||||||
m_StateChangeInProgress = false;
|
m_StateChangeInProgress = false;
|
||||||
|
|
||||||
|
Part.RemoveScriptTargets(ItemID);
|
||||||
Part.SetScriptEvents(ItemID, (int)m_Script.GetStateEventFlags(State));
|
Part.SetScriptEvents(ItemID, (int)m_Script.GetStateEventFlags(State));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1072,8 +1073,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
ReleaseControlsorPermissions(true);
|
ReleaseControlsorPermissions(true);
|
||||||
|
|
||||||
Stop(timeout);
|
Stop(timeout);
|
||||||
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
|
||||||
part.CollisionSound = UUID.Zero;
|
|
||||||
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
|
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
|
||||||
|
|
||||||
m_TimerQueued = false;
|
m_TimerQueued = false;
|
||||||
|
@ -1084,7 +1083,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
StartParam = 0;
|
StartParam = 0;
|
||||||
State = "default";
|
State = "default";
|
||||||
|
|
||||||
|
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
||||||
|
if (part == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
part.CollisionSound = UUID.Zero;
|
||||||
|
part.RemoveScriptTargets(ItemID);
|
||||||
part.SetScriptEvents(ItemID, m_Script.GetStateEventFlags(State));
|
part.SetScriptEvents(ItemID, m_Script.GetStateEventFlags(State));
|
||||||
if (running)
|
if (running)
|
||||||
Start();
|
Start();
|
||||||
|
@ -1103,9 +1107,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
RemoveState();
|
RemoveState();
|
||||||
ReleaseControlsorPermissions(true);
|
ReleaseControlsorPermissions(true);
|
||||||
|
|
||||||
m_Script.ResetVars();
|
|
||||||
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
|
||||||
part.CollisionSound = UUID.Zero;
|
|
||||||
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
|
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
|
||||||
|
|
||||||
m_TimerQueued = false;
|
m_TimerQueued = false;
|
||||||
|
@ -1116,8 +1117,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
StartParam = 0;
|
StartParam = 0;
|
||||||
State = "default";
|
State = "default";
|
||||||
|
|
||||||
part.SetScriptEvents(ItemID, m_Script.GetStateEventFlags(State));
|
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
||||||
|
if(part != null)
|
||||||
|
{
|
||||||
|
part.CollisionSound = UUID.Zero;
|
||||||
|
part.RemoveScriptTargets(ItemID);
|
||||||
|
part.SetScriptEvents(ItemID, m_Script.GetStateEventFlags(State));
|
||||||
|
}
|
||||||
if (m_CurrentEvent != "state_entry" || oldState != "default")
|
if (m_CurrentEvent != "state_entry" || oldState != "default")
|
||||||
{
|
{
|
||||||
m_SaveState = StatePersistedHere;
|
m_SaveState = StatePersistedHere;
|
||||||
|
|
|
@ -594,7 +594,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||||
AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);
|
AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);
|
||||||
m_XMRLSLApi.acm.TimerPlugin.CreateFromData(m_LocalID, m_ItemID, UUID.Zero, timers);
|
m_XMRLSLApi.acm.TimerPlugin.CreateFromData(m_LocalID, m_ItemID, UUID.Zero, timers);
|
||||||
|
|
||||||
// Tell whoever cares which event handlers the new state has.
|
// Tell whoever cares which event handlers the new state has.
|
||||||
|
m_Part.RemoveScriptTargets(m_ItemID);
|
||||||
m_Part.SetScriptEvents(m_ItemID, GetStateEventFlags(stateCode));
|
m_Part.SetScriptEvents(m_ItemID, GetStateEventFlags(stateCode));
|
||||||
|
|
||||||
// keep link messages
|
// keep link messages
|
||||||
|
|
|
@ -66,8 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||||
// up. This makes sure we decrement m_CompiledScriptRefCount.
|
// up. This makes sure we decrement m_CompiledScriptRefCount.
|
||||||
~XMRInstance()
|
~XMRInstance()
|
||||||
{
|
{
|
||||||
if(!m_disposed)
|
Dispose(false);
|
||||||
Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,11 +75,20 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||||
*/
|
*/
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Tell script stop executing next time it calls CheckRun().
|
Dispose(true);
|
||||||
|
//GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose(bool fromdispose)
|
||||||
|
{
|
||||||
|
if (m_disposed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Tell script stop executing next time it calls CheckRun().
|
||||||
suspendOnCheckRunHold = true;
|
suspendOnCheckRunHold = true;
|
||||||
|
|
||||||
// Don't send us any more events.
|
// Don't send us any more events.
|
||||||
lock(m_RunLock)
|
lock (m_RunLock)
|
||||||
{
|
{
|
||||||
if(m_Part != null)
|
if(m_Part != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -904,6 +904,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||||
// 'state_entry()' event handler.
|
// 'state_entry()' event handler.
|
||||||
m_RunOnePhase = "ResetLocked: posting default:state_entry() event";
|
m_RunOnePhase = "ResetLocked: posting default:state_entry() event";
|
||||||
stateCode = 0;
|
stateCode = 0;
|
||||||
|
m_Part.RemoveScriptTargets(m_ItemID);
|
||||||
m_Part.SetScriptEvents(m_ItemID, GetStateEventFlags(0));
|
m_Part.SetScriptEvents(m_ItemID, GetStateEventFlags(0));
|
||||||
PostEvent(new EventParams("state_entry",
|
PostEvent(new EventParams("state_entry",
|
||||||
zeroObjectArray,
|
zeroObjectArray,
|
||||||
|
|
Loading…
Reference in New Issue