From 8020af61845eaf408d9db0ee5d3958b60809d67b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 1 May 2009 17:10:42 +0000 Subject: 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. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 72c6630..f01a1cd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -116,6 +116,8 @@ namespace OpenSim.Region.Framework.Scenes private bool m_setAlwaysRun; + private bool m_updatesAllowed = true; + private List m_agentUpdates = new List(); private string m_movementAnimation = "DEFAULT"; private long m_animPersistUntil = 0; private bool m_allowFalling = false; @@ -1127,11 +1129,52 @@ 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; + } + } + } + /// /// This is the event handler for client movement. If a client is moving, this event is triggering. /// 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) //{ // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); -- cgit v1.1