Add methods to block and queue agent updates during region crossing and TP

This is to ensure integrity of animations and script states with regard
to controls pressed or released. No user functionality yet.
0.6.5-rc1
Melanie Thielker 2009-05-01 17:10:42 +00:00
parent 13c597baba
commit 8020af6184
1 changed files with 43 additions and 0 deletions

View File

@ -116,6 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_setAlwaysRun; private bool m_setAlwaysRun;
private bool m_updatesAllowed = true;
private List<AgentUpdateArgs> m_agentUpdates = new List<AgentUpdateArgs>();
private string m_movementAnimation = "DEFAULT"; private string m_movementAnimation = "DEFAULT";
private long m_animPersistUntil = 0; private long m_animPersistUntil = 0;
private bool m_allowFalling = false; private bool m_allowFalling = false;
@ -1127,10 +1129,51 @@ namespace OpenSim.Region.Framework.Scenes
} }
// These methods allow to queue up agent updates (like key presses)
// until all attachment scripts are running and the animations from
// AgentDataUpdate have been started. It is essential for combat
// devices, weapons and AOs that keypresses are not processed
// until scripts that are potentially interested in them are
// up and running and that animations a script knows to be running
// from before a crossing are running again
//
public void LockAgentUpdates()
{
m_updatesAllowed = false;
}
public void UnlockAgentUpdates()
{
lock (m_agentUpdates)
{
if (m_updatesAllowed == false)
{
foreach (AgentUpdateArgs a in m_agentUpdates)
RealHandleAgentUpdate(ControllingClient, a);
m_agentUpdates.Clear();
m_updatesAllowed = true;
}
}
}
/// <summary> /// <summary>
/// This is the event handler for client movement. If a client is moving, this event is triggering. /// This is the event handler for client movement. If a client is moving, this event is triggering.
/// </summary> /// </summary>
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{
lock (m_agentUpdates)
{
if (m_updatesAllowed)
{
RealHandleAgentUpdate(remoteClient, agentData);
return;
}
m_agentUpdates.Add(agentData);
}
}
private void RealHandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{ {
//if (m_isChildAgent) //if (m_isChildAgent)
//{ //{