Kan-Ed fix series. Fix llTakeControls to behave as documented.
XEngine fixes: prevent queue overruns, prevent spamming when no key is down. Release controls when conflicting permissions are requested or permissions are refused later. Release when prim or script are deleted. Fixes Scene script instance deletion semantics.0.6.0-stable
parent
0ad5d8c0e7
commit
7e8320bada
|
@ -879,12 +879,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectGroup group = part.ParentGroup;
|
SceneObjectGroup group = part.ParentGroup;
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
int type = group.RemoveInventoryItem(localID, itemID);
|
TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
|
||||||
part.GetProperties(remoteClient);
|
if (item.Type == 10)
|
||||||
if (type == 10)
|
|
||||||
{
|
{
|
||||||
EventManager.TriggerRemoveScript(localID, itemID);
|
EventManager.TriggerRemoveScript(localID, itemID);
|
||||||
}
|
}
|
||||||
|
group.RemoveInventoryItem(localID, itemID);
|
||||||
|
part.GetProperties(remoteClient);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1742,6 +1742,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
//SceneObjectPart rootPart = group.GetChildPart(group.UUID);
|
//SceneObjectPart rootPart = group.GetChildPart(group.UUID);
|
||||||
|
|
||||||
|
group.RemoveScriptInstances();
|
||||||
|
|
||||||
foreach (SceneObjectPart part in group.Children.Values)
|
foreach (SceneObjectPart part in group.Children.Values)
|
||||||
{
|
{
|
||||||
if (part.PhysActor != null)
|
if (part.PhysActor != null)
|
||||||
|
|
|
@ -958,7 +958,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
{
|
{
|
||||||
part.RemoveScriptInstances();
|
// part.RemoveScriptInstances();
|
||||||
|
|
||||||
List<ScenePresence> avatars = Scene.GetScenePresences();
|
List<ScenePresence> avatars = Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Count; i++)
|
||||||
|
|
|
@ -93,6 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
DetectParams GetDetectParams(int idx);
|
DetectParams GetDetectParams(int idx);
|
||||||
UUID GetDetectID(int idx);
|
UUID GetDetectID(int idx);
|
||||||
void SaveState(string assembly);
|
void SaveState(string assembly);
|
||||||
|
void DestroyScriptInstance();
|
||||||
|
|
||||||
IScriptApi GetApi(string name);
|
IScriptApi GetApi(string name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2553,6 +2553,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
|
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
|
||||||
{
|
{
|
||||||
|
llReleaseControls();
|
||||||
|
|
||||||
m_host.TaskInventory[invItemID].PermsGranter=UUID.Zero;
|
m_host.TaskInventory[invItemID].PermsGranter=UUID.Zero;
|
||||||
m_host.TaskInventory[invItemID].PermsMask=0;
|
m_host.TaskInventory[invItemID].PermsMask=0;
|
||||||
|
|
||||||
|
@ -2564,6 +2566,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( m_host.TaskInventory[invItemID].PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
|
||||||
|
llReleaseControls();
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if (m_host.ParentGroup.RootPart.IsAttachment && agent == m_host.ParentGroup.RootPart.AttachedAvatar)
|
if (m_host.ParentGroup.RootPart.IsAttachment && agent == m_host.ParentGroup.RootPart.AttachedAvatar)
|
||||||
|
@ -2648,6 +2653,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
client.OnScriptAnswer-=handleScriptAnswer;
|
client.OnScriptAnswer-=handleScriptAnswer;
|
||||||
m_waitingForScriptAnswer=false;
|
m_waitingForScriptAnswer=false;
|
||||||
|
|
||||||
|
if((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
|
||||||
|
llReleaseControls();
|
||||||
|
|
||||||
m_host.TaskInventory[invItemID].PermsMask=answer;
|
m_host.TaskInventory[invItemID].PermsMask=answer;
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
||||||
"run_time_permissions", new Object[] {
|
"run_time_permissions", new Object[] {
|
||||||
|
|
|
@ -77,6 +77,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
private int m_MaxScriptQueue;
|
private int m_MaxScriptQueue;
|
||||||
private bool m_SaveState = true;
|
private bool m_SaveState = true;
|
||||||
private bool m_ShuttingDown = false;
|
private bool m_ShuttingDown = false;
|
||||||
|
private int m_ControlEventsInQueue = 0;
|
||||||
|
private int m_LastControlLevel = 0;
|
||||||
|
|
||||||
private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
|
private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
|
||||||
|
|
||||||
|
@ -320,6 +322,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ReleaseControls()
|
||||||
|
{
|
||||||
|
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID);
|
||||||
|
if (part != null && part.TaskInventory.ContainsKey(m_ItemID))
|
||||||
|
{
|
||||||
|
UUID permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
|
||||||
|
int permsMask = part.TaskInventory[m_ItemID].PermsMask;
|
||||||
|
|
||||||
|
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
ScenePresence presence = m_Engine.World.GetScenePresence(permsGranter);
|
||||||
|
if (presence != null)
|
||||||
|
presence.UnRegisterControlEventsToScript(m_LocalID, m_ItemID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DestroyScriptInstance()
|
||||||
|
{
|
||||||
|
ReleaseControls();
|
||||||
|
}
|
||||||
|
|
||||||
public void RemoveState()
|
public void RemoveState()
|
||||||
{
|
{
|
||||||
string savedState = Path.Combine(Path.GetDirectoryName(m_Assembly),
|
string savedState = Path.Combine(Path.GetDirectoryName(m_Assembly),
|
||||||
|
@ -439,7 +464,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
if (m_EventQueue.Count >= m_MaxScriptQueue)
|
if (m_EventQueue.Count >= m_MaxScriptQueue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_EventQueue.Enqueue(data);
|
|
||||||
if (data.EventName == "timer")
|
if (data.EventName == "timer")
|
||||||
{
|
{
|
||||||
if (m_TimerQueued)
|
if (m_TimerQueued)
|
||||||
|
@ -447,8 +471,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
m_TimerQueued = true;
|
m_TimerQueued = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_RunEvents)
|
if (data.EventName == "control")
|
||||||
return;
|
{
|
||||||
|
int held = ((LSL_Types.LSLInteger)data.Params[1]).value;
|
||||||
|
int changed= ((LSL_Types.LSLInteger)data.Params[2]).value;
|
||||||
|
|
||||||
|
// If the last message was a 0 (nothing held)
|
||||||
|
// and this one is also nothing held, drop it
|
||||||
|
//
|
||||||
|
if (m_LastControlLevel == held && held == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// If there is one or more queued, then queue
|
||||||
|
// only changed ones, else queue unconditionally
|
||||||
|
//
|
||||||
|
if (m_ControlEventsInQueue > 0)
|
||||||
|
{
|
||||||
|
if (m_LastControlLevel == held)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_LastControlLevel = held;
|
||||||
|
m_ControlEventsInQueue++;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_EventQueue.Enqueue(data);
|
||||||
|
|
||||||
if (m_CurrentResult == null)
|
if (m_CurrentResult == null)
|
||||||
{
|
{
|
||||||
|
@ -475,6 +522,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
}
|
}
|
||||||
if (data.EventName == "timer")
|
if (data.EventName == "timer")
|
||||||
m_TimerQueued = false;
|
m_TimerQueued = false;
|
||||||
|
if (data.EventName == "control")
|
||||||
|
{
|
||||||
|
if (m_ControlEventsInQueue > 0)
|
||||||
|
m_ControlEventsInQueue--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
|
//m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
|
||||||
|
@ -616,6 +668,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
bool running = Running;
|
bool running = Running;
|
||||||
|
|
||||||
RemoveState();
|
RemoveState();
|
||||||
|
ReleaseControls();
|
||||||
|
|
||||||
Stop(0);
|
Stop(0);
|
||||||
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID);
|
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID);
|
||||||
|
@ -641,6 +694,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
// bool running = Running;
|
// bool running = Running;
|
||||||
|
|
||||||
RemoveState();
|
RemoveState();
|
||||||
|
ReleaseControls();
|
||||||
|
|
||||||
m_Script.ResetVars();
|
m_Script.ResetVars();
|
||||||
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID);
|
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID);
|
||||||
|
|
|
@ -565,6 +565,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.RemoveState();
|
instance.RemoveState();
|
||||||
|
instance.DestroyScriptInstance();
|
||||||
|
|
||||||
instance = null;
|
instance = null;
|
||||||
|
|
||||||
|
|
|
@ -1830,6 +1830,7 @@
|
||||||
<Reference name="OpenSim.Region.ScriptEngine.Shared"/>
|
<Reference name="OpenSim.Region.ScriptEngine.Shared"/>
|
||||||
<Reference name="OpenSim.Region.ScriptEngine.Shared.CodeTools"/>
|
<Reference name="OpenSim.Region.ScriptEngine.Shared.CodeTools"/>
|
||||||
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api"/>
|
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api"/>
|
||||||
|
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api.Runtime"/>
|
||||||
<Reference name="SmartThreadPool"/>
|
<Reference name="SmartThreadPool"/>
|
||||||
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
|
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
|
||||||
<Reference name="Nini.dll" />
|
<Reference name="Nini.dll" />
|
||||||
|
|
Loading…
Reference in New Issue