aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorOren Hurvitz2012-04-23 19:07:36 +0300
committerJustin Clark-Casey (justincc)2012-04-27 20:47:02 +0100
commit6473674bbf6ce006512083902e8ff1796d8c8b22 (patch)
tree8f2e71c3c0442050789dc7e15334ad6e11ece27a /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentIf a Grid God teleports then include the Godlike teleport flag. This can affe... (diff)
downloadopensim-SC_OLD-6473674bbf6ce006512083902e8ff1796d8c8b22.zip
opensim-SC_OLD-6473674bbf6ce006512083902e8ff1796d8c8b22.tar.gz
opensim-SC_OLD-6473674bbf6ce006512083902e8ff1796d8c8b22.tar.bz2
opensim-SC_OLD-6473674bbf6ce006512083902e8ff1796d8c8b22.tar.xz
Fixed: custom walking animations didn't stop when the avatar stopped walking.
This happened because the scripts were notified about control changes (e.g., the user stopped pressing the Forward key) when the animation was still WALK, so the script didn't stop the walking animation. Fixing this required: a) Update the movement animation *before* notifying the script; b) Add locking to prevent clashes with the Heartbeat thread (which also updates the animations); c) Handle the case of a user who stops walking just as the avatar is in the air: the avatar should STAND in that case, not WALK. This reverts commit feef1dd73243cfdd5322632fb67e64cabc1ad4bc.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs33
1 files changed, 19 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6b38027..64fe7a8 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -45,6 +45,7 @@ using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags;
45 45
46namespace OpenSim.Region.Framework.Scenes 46namespace OpenSim.Region.Framework.Scenes
47{ 47{
48 [Flags]
48 enum ScriptControlled : uint 49 enum ScriptControlled : uint
49 { 50 {
50 CONTROL_ZERO = 0, 51 CONTROL_ZERO = 0,
@@ -1220,7 +1221,7 @@ namespace OpenSim.Region.Framework.Scenes
1220 { 1221 {
1221// m_log.DebugFormat( 1222// m_log.DebugFormat(
1222// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", 1223// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
1223// Scene.RegionInfo.RegionName, remoteClient.Name, agentData.ControlFlags); 1224// Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
1224 1225
1225 if (IsChildAgent) 1226 if (IsChildAgent)
1226 { 1227 {
@@ -1320,14 +1321,8 @@ namespace OpenSim.Region.Framework.Scenes
1320 } 1321 }
1321 } 1322 }
1322 1323
1323 lock (scriptedcontrols) 1324 uint flagsForScripts = (uint)flags;
1324 { 1325 flags = RemoveIgnoredControls(flags, IgnoredControls);
1325 if (scriptedcontrols.Count > 0)
1326 {
1327 SendControlToScripts((uint)flags);
1328 flags = RemoveIgnoredControls(flags, IgnoredControls);
1329 }
1330 }
1331 1326
1332 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) 1327 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
1333 HandleAgentSitOnGround(); 1328 HandleAgentSitOnGround();
@@ -1420,7 +1415,7 @@ namespace OpenSim.Region.Framework.Scenes
1420 MovementFlag |= (byte)nudgehack; 1415 MovementFlag |= (byte)nudgehack;
1421 } 1416 }
1422 1417
1423// m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF); 1418 //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF);
1424 MovementFlag += (byte)(uint)DCF; 1419 MovementFlag += (byte)(uint)DCF;
1425 update_movementflag = true; 1420 update_movementflag = true;
1426 } 1421 }
@@ -1433,7 +1428,7 @@ namespace OpenSim.Region.Framework.Scenes
1433 && ((MovementFlag & (byte)nudgehack) == nudgehack)) 1428 && ((MovementFlag & (byte)nudgehack) == nudgehack))
1434 ) // This or is for Nudge forward 1429 ) // This or is for Nudge forward
1435 { 1430 {
1436// m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF); 1431 //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF);
1437 MovementFlag -= ((byte)(uint)DCF); 1432 MovementFlag -= ((byte)(uint)DCF);
1438 update_movementflag = true; 1433 update_movementflag = true;
1439 1434
@@ -1514,8 +1509,18 @@ namespace OpenSim.Region.Framework.Scenes
1514// } 1509// }
1515// } 1510// }
1516 1511
1517// if (update_movementflag && ParentID == 0) 1512 if (update_movementflag && ParentID == 0)
1518// Animator.UpdateMovementAnimations(); 1513 Animator.UpdateMovementAnimations();
1514
1515 lock (scriptedcontrols)
1516 {
1517 if (scriptedcontrols.Count > 0)
1518 {
1519 // Notify the scripts only after calling UpdateMovementAnimations(), so that if a script
1520 // (e.g., a walking script) checks which animation is active it will be the correct animation.
1521 SendControlToScripts(flagsForScripts);
1522 }
1523 }
1519 } 1524 }
1520 1525
1521 m_scene.EventManager.TriggerOnClientMovement(this); 1526 m_scene.EventManager.TriggerOnClientMovement(this);