aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2008-04-23 11:52:25 +0000
committerAdam Frisby2008-04-23 11:52:25 +0000
commitbca7ab7e363e9c9874a9ab137b60a042b9d1139c (patch)
tree52150bf5c1514fdad8ff086c84af8e6ae67cbb17
parent* Fix mantis #842 - folders which are created but left named "New Folder" in ... (diff)
downloadopensim-SC-bca7ab7e363e9c9874a9ab137b60a042b9d1139c.zip
opensim-SC-bca7ab7e363e9c9874a9ab137b60a042b9d1139c.tar.gz
opensim-SC-bca7ab7e363e9c9874a9ab137b60a042b9d1139c.tar.bz2
opensim-SC-bca7ab7e363e9c9874a9ab137b60a042b9d1139c.tar.xz
* Applying Mantis #1020 (Animations) - Thanks Melanie.
-rw-r--r--OpenSim/Framework/IClientAPI.cs4
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs42
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs24
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs33
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs138
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs2
8 files changed, 176 insertions, 80 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index b8264ba..53c75b0 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -245,7 +245,7 @@ namespace OpenSim.Framework
245 245
246 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); 246 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
247 247
248 public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID, int seq); 248 public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID);
249 249
250 public delegate void StopAnim(IClientAPI remoteClient, LLUUID animID); 250 public delegate void StopAnim(IClientAPI remoteClient, LLUUID animID);
251 251
@@ -572,6 +572,8 @@ namespace OpenSim.Framework
572 string FirstName { get; } 572 string FirstName { get; }
573 573
574 string LastName { get; } 574 string LastName { get; }
575
576 int NextAnimationSequenceNumber { get; }
575 577
576 /// <summary> 578 /// <summary>
577 /// Returns the full name of the agent/avatar represented by this client 579 /// Returns the full name of the agent/avatar represented by this client
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 1cf2e58..5453eb3 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -143,16 +143,26 @@ namespace OpenSim.Framework
143 { 143 {
144 "texture", 144 "texture",
145 "sound", 145 "sound",
146 "calling_card",
147 "landmark",
146 String.Empty, 148 String.Empty,
147 String.Empty, 149 String.Empty,
150 "object",
151 "notecard",
148 String.Empty, 152 String.Empty,
149 String.Empty, 153 String.Empty,
154 "lsl_text",
150 String.Empty, 155 String.Empty,
151 String.Empty, 156 String.Empty,
157 "bodypart",
152 String.Empty, 158 String.Empty,
159 "snapshot",
153 String.Empty, 160 String.Empty,
154 "lsl_text", 161 String.Empty,
155 String.Empty 162 "wearable",
163 "animation",
164 "gesture"
165
156 }; 166 };
157 167
158 /// <summary> 168 /// <summary>
@@ -162,16 +172,26 @@ namespace OpenSim.Framework
162 { 172 {
163 "texture", 173 "texture",
164 "sound", 174 "sound",
165 String.Empty, 175 "callcard",
166 String.Empty, 176 "landmark",
167 String.Empty, 177 "clothing", // Deprecated
168 String.Empty, 178 "clothing",
169 String.Empty, 179 "object",
170 String.Empty, 180 "notecard",
171 String.Empty, 181 "category",
172 String.Empty, 182 "root",
173 "lsltext", 183 "lsltext",
174 String.Empty 184 "lslbyte",
185 "txtr_tga",
186 "bodypart",
187 "trash",
188 "snapshot",
189 "lstndfnd",
190 "snd_wav",
191 "img_tga",
192 "jpeg",
193 "animatn",
194 "gesture"
175 }; 195 };
176 196
177 public LLUUID ItemID = LLUUID.Zero; 197 public LLUUID ItemID = LLUUID.Zero;
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 7ff1f23..a58f88f 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -91,6 +91,8 @@ namespace OpenSim.Region.ClientStack
91 private readonly uint m_circuitCode; 91 private readonly uint m_circuitCode;
92 private int m_moneyBalance; 92 private int m_moneyBalance;
93 93
94 private int m_animationSequenceNumber = 1;
95
94 private byte[] m_channelVersion = Helpers.StringToField("OpenSimulator 0.5"); // Dummy value needed by libSL 96 private byte[] m_channelVersion = Helpers.StringToField("OpenSimulator 0.5"); // Dummy value needed by libSL
95 97
96 /* protected variables */ 98 /* protected variables */
@@ -302,6 +304,11 @@ namespace OpenSim.Region.ClientStack
302 get { return m_moneyBalance; } 304 get { return m_moneyBalance; }
303 } 305 }
304 306
307 public int NextAnimationSequenceNumber
308 {
309 get { return m_animationSequenceNumber++; }
310 }
311
305 /* METHODS */ 312 /* METHODS */
306 313
307 public ClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, PacketServer packServer, 314 public ClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, PacketServer packServer,
@@ -3429,7 +3436,7 @@ namespace OpenSim.Region.ClientStack
3429 handlerStartAnim = OnStartAnim; 3436 handlerStartAnim = OnStartAnim;
3430 if (handlerStartAnim != null) 3437 if (handlerStartAnim != null)
3431 { 3438 {
3432 handlerStartAnim(this, AgentAni.AnimationList[i].AnimID, 1); 3439 handlerStartAnim(this, AgentAni.AnimationList[i].AnimID);
3433 } 3440 }
3434 } 3441 }
3435 else 3442 else
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index c5a1be1..e4a9551 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -730,25 +730,11 @@ namespace OpenSim.Region.Environment.Scenes
730 730
731 if (item != null) 731 if (item != null)
732 { 732 {
733 if (item.AssetType == 0 || item.AssetType == 1 || item.AssetType == 10) 733 group.AddInventoryItem(remoteClient, primLocalID, item, copyID);
734 { 734 m_log.InfoFormat(
735 group.AddInventoryItem(remoteClient, primLocalID, item, copyID); 735 "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
736 m_log.InfoFormat( 736 item.Name, primLocalID, remoteClient.Name);
737 "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", 737 group.GetProperties(remoteClient);
738 item.Name, primLocalID, remoteClient.Name);
739 group.GetProperties(remoteClient);
740 }
741 else
742 {
743 // XXX Nasty temporary way of stopping things other than sounds, textures and scripts
744 // from going in a prim's inventory, since other things will not currently work
745 // See http://opensimulator.org/mantis/view.php?id=711 for the error caused later on
746 // - to implement requires changes to TaskInventoryItem (which really requires the current
747 // nasty way it is done to be changed).
748 m_log.WarnFormat(
749 "[PRIM INVENTORY]: Sorry, prim inventory storage of asset type {0} is not yet supported",
750 item.AssetType);
751 }
752 } 738 }
753 else 739 else
754 { 740 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 72f78f3..9b99df7 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -233,6 +233,33 @@ namespace OpenSim.Region.Environment.Scenes
233 } 233 }
234 } 234 }
235 235
236 // Assumes a lock is held on the inventory
237 private bool InventoryContainsName(string name)
238 {
239 foreach (TaskInventoryItem item in m_taskInventory.Values)
240 {
241 if(item.Name == name)
242 return true;
243 }
244 return false;
245 }
246
247 private string FindAvailableInventoryName(string name)
248 {
249 if(!InventoryContainsName(name))
250 return name;
251
252 int suffix=1;
253 while(suffix < 256)
254 {
255 string tryName=String.Format("{0} {1}", name, suffix);
256 if(!InventoryContainsName(tryName))
257 return tryName;
258 suffix++;
259 }
260 return String.Empty;
261 }
262
236 /// <summary> 263 /// <summary>
237 /// Add an item to this prim's inventory. 264 /// Add an item to this prim's inventory.
238 /// </summary> 265 /// </summary>
@@ -243,6 +270,12 @@ namespace OpenSim.Region.Environment.Scenes
243 item.CreationDate = 1000; 270 item.CreationDate = 1000;
244 item.ParentPartID = UUID; 271 item.ParentPartID = UUID;
245 272
273 string name=FindAvailableInventoryName(item.Name);
274 if(name == String.Empty)
275 return;
276
277 item.Name=name;
278
246 lock (m_taskInventory) 279 lock (m_taskInventory)
247 { 280 {
248 m_taskInventory.Add(item.ItemID, item); 281 m_taskInventory.Add(item.ItemID, item);
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index d85eea6..3f70108 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -359,17 +359,15 @@ namespace OpenSim.Region.Environment.Scenes
359 359
360 AbsolutePosition = m_controllingClient.StartPos; 360 AbsolutePosition = m_controllingClient.StartPos;
361 361
362 // TODO: m_animations and m_animationSeqs should always be of the same length.
363 // Move them into an object to (hopefully) avoid threading issues. 362 // Move them into an object to (hopefully) avoid threading issues.
364 try 363 try
365 { 364 {
366 m_animations.Add(Animations.AnimsLLUUID["STAND"]); 365 SetMovementAnimation(Animations.AnimsLLUUID["STAND"]);
367 } 366 }
368 catch (KeyNotFoundException) 367 catch (KeyNotFoundException)
369 { 368 {
370 m_log.Warn("[AVATAR]: KeyNotFound Exception playing avatar stand animation"); 369 m_log.Warn("[AVATAR]: KeyNotFound Exception playing avatar stand animation");
371 } 370 }
372 m_animationSeqs.Add(1);
373 371
374 RegisterToEvents(); 372 RegisterToEvents();
375 SetDirectionVectors(); 373 SetDirectionVectors();
@@ -549,6 +547,7 @@ namespace OpenSim.Region.Environment.Scenes
549 547
550 AddToPhysicalScene(); 548 AddToPhysicalScene();
551 m_physicsActor.Flying = isFlying; 549 m_physicsActor.Flying = isFlying;
550 SendAnimPack();
552 551
553 m_scene.SwapRootAgentCount(false); 552 m_scene.SwapRootAgentCount(false);
554 m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(m_uuid); 553 m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(m_uuid);
@@ -571,6 +570,15 @@ namespace OpenSim.Region.Environment.Scenes
571 /// </summary> 570 /// </summary>
572 public void MakeChildAgent() 571 public void MakeChildAgent()
573 { 572 {
573 if(m_animations.Count > 0)
574 {
575 LLUUID movement=m_animations[0];
576
577 m_animations.Clear();
578 m_animationSeqs.Clear();
579
580 SetMovementAnimation(movement);
581 }
574// m_log.DebugFormat( 582// m_log.DebugFormat(
575// "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}", 583// "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}",
576// Name, UUID, m_scene.RegionInfo.RegionName); 584// Name, UUID, m_scene.RegionInfo.RegionName);
@@ -634,7 +642,7 @@ namespace OpenSim.Region.Environment.Scenes
634 { 642 {
635 AbsolutePosition = AbsolutePosition + new LLVector3(0, 0, (1.56f / 6)); 643 AbsolutePosition = AbsolutePosition + new LLVector3(0, 0, (1.56f / 6));
636 } 644 }
637 SetMovementAnimation(Animations.AnimsLLUUID["LAND"], 2); 645 SetMovementAnimation(Animations.AnimsLLUUID["LAND"]);
638 SendFullUpdateToAllClients(); 646 SendFullUpdateToAllClients();
639 } 647 }
640 648
@@ -754,7 +762,7 @@ namespace OpenSim.Region.Environment.Scenes
754 { 762 {
755 // TODO: This doesn't quite work yet -- probably a parent ID problem 763 // TODO: This doesn't quite work yet -- probably a parent ID problem
756 // m_parentID = (what should this be?) 764 // m_parentID = (what should this be?)
757 SetMovementAnimation(Animations.AnimsLLUUID["SIT_GROUND"], 1); 765 SetMovementAnimation(Animations.AnimsLLUUID["SIT_GROUND"]);
758 } 766 }
759 // In the future, these values might need to go global. 767 // In the future, these values might need to go global.
760 // Here's where you get them. 768 // Here's where you get them.
@@ -891,7 +899,7 @@ namespace OpenSim.Region.Environment.Scenes
891 } 899 }
892 } 900 }
893 901
894 SetMovementAnimation(Animations.AnimsLLUUID["STAND"], 1); 902 SetMovementAnimation(Animations.AnimsLLUUID["STAND"]);
895 } 903 }
896 904
897 private void SendSitResponse(IClientAPI remoteClient, LLUUID targetID, LLVector3 offset) 905 private void SendSitResponse(IClientAPI remoteClient, LLUUID targetID, LLVector3 offset)
@@ -1025,7 +1033,7 @@ namespace OpenSim.Region.Environment.Scenes
1025 Velocity = new LLVector3(0, 0, 0); 1033 Velocity = new LLVector3(0, 0, 0);
1026 RemoveFromPhysicalScene(); 1034 RemoveFromPhysicalScene();
1027 1035
1028 SetMovementAnimation(Animations.AnimsLLUUID["SIT"], 1); 1036 SetMovementAnimation(Animations.AnimsLLUUID["SIT"]);
1029 SendFullUpdateToAllClients(); 1037 SendFullUpdateToAllClients();
1030 // This may seem stupid, but Our Full updates don't send avatar rotation :P 1038 // This may seem stupid, but Our Full updates don't send avatar rotation :P
1031 // So we're also sending a terse update (which has avatar rotation) 1039 // So we're also sending a terse update (which has avatar rotation)
@@ -1045,35 +1053,58 @@ namespace OpenSim.Region.Environment.Scenes
1045 } 1053 }
1046 } 1054 }
1047 1055
1048 public void AddAnimation(LLUUID animID, int seq) 1056 public void AddAnimation(LLUUID animID)
1049 { 1057 {
1058 if(m_isChildAgent)
1059 return;
1060
1061 // Don't let this animation become the movement animation
1062 if(m_animations.Count < 1)
1063 SetMovementAnimation(Animations.AnimsLLUUID["STAND"]);
1064
1050 if (!m_animations.Contains(animID)) 1065 if (!m_animations.Contains(animID))
1051 { 1066 {
1052 m_animations.Add(animID); 1067 m_animations.Add(animID);
1053 m_animationSeqs.Add(seq); 1068 m_animationSeqs.Add(m_controllingClient.NextAnimationSequenceNumber);
1054 SendAnimPack(); 1069 SendAnimPack();
1055 } 1070 }
1056 } 1071 }
1057 1072
1058 public void RemoveAnimation(LLUUID animID) 1073 public void RemoveAnimation(LLUUID animID)
1059 { 1074 {
1075 if(m_isChildAgent)
1076 return;
1077
1060 if (m_animations.Contains(animID)) 1078 if (m_animations.Contains(animID))
1061 { 1079 {
1062 if (m_animations[0] == animID) 1080 if (m_animations[0] == animID)
1063 { 1081 {
1064 SetMovementAnimation(Animations.AnimsLLUUID["STAND"], 1); 1082 SetMovementAnimation(Animations.AnimsLLUUID["STAND"]);
1065 } 1083 }
1066 else 1084 else
1067 { 1085 {
1068 m_animations.Remove(animID); 1086 // What a HACK!! Anim list really needs to be an object!
1069 SendAnimPack(); 1087 int idx;
1088
1089 for(idx=0;idx < m_animations.Count;idx++)
1090 {
1091 if(m_animations[idx] == animID)
1092 {
1093 int seq=m_animationSeqs[idx];
1094
1095 m_animations.Remove(animID);
1096 m_animationSeqs.Remove(seq);
1097 SendAnimPack();
1098 break;
1099 }
1100 }
1070 } 1101 }
1071 } 1102 }
1072 } 1103 }
1073 1104
1074 public void HandleStartAnim(IClientAPI remoteClient, LLUUID animID, int seq) 1105 public void HandleStartAnim(IClientAPI remoteClient, LLUUID animID)
1075 { 1106 {
1076 AddAnimation(animID, seq); 1107 AddAnimation(animID);
1077 } 1108 }
1078 1109
1079 public void HandleStopAnim(IClientAPI remoteClient, LLUUID animID) 1110 public void HandleStopAnim(IClientAPI remoteClient, LLUUID animID)
@@ -1086,25 +1117,35 @@ namespace OpenSim.Region.Environment.Scenes
1086 /// reserved for "main" animations that are mutually exclusive, 1117 /// reserved for "main" animations that are mutually exclusive,
1087 /// like flying and sitting, for example. 1118 /// like flying and sitting, for example.
1088 /// </summary> 1119 /// </summary>
1089 protected void SetMovementAnimation(LLUUID anim, int seq) 1120 protected void SetMovementAnimation(LLUUID anim)
1090 { 1121 {
1091 try 1122 if(m_animations.Count < 1)
1092 { 1123 {
1093 if (m_animations[0] != anim) 1124 m_animations.Add(Animations.AnimsLLUUID["STAND"]);
1094 { 1125 m_animationSeqs.Add(1);
1095 m_animations[0] = anim; 1126
1096 m_animationSeqs[0] = seq; 1127 SendAnimPack();
1097 SendAnimPack(); 1128 }
1098 } 1129 else
1099 } 1130 {
1100 catch 1131 try
1101 { 1132 {
1102 m_log.Warn("[AVATAR]: SetMovementAnimation for avatar failed. Attempting recovery..."); 1133 if (m_animations[0] != anim)
1103 m_animations[0] = anim; 1134 {
1104 m_animationSeqs[0] = seq; 1135 m_animations[0] = anim;
1105 SendAnimPack(); 1136 m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber;
1106 } 1137 }
1107 } 1138 SendAnimPack();
1139 }
1140 catch
1141 {
1142 m_log.Warn("[AVATAR]: SetMovementAnimation for avatar failed. Attempting recovery...");
1143 m_animations[0] = anim;
1144 m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber;
1145 SendAnimPack();
1146 }
1147 }
1148 }
1108 1149
1109 /// <summary> 1150 /// <summary>
1110 /// This method handles agent movement related animations 1151 /// This method handles agent movement related animations
@@ -1123,18 +1164,18 @@ namespace OpenSim.Region.Environment.Scenes
1123 if (m_physicsActor.Flying) 1164 if (m_physicsActor.Flying)
1124 { 1165 {
1125 // We are flying 1166 // We are flying
1126 SetMovementAnimation(Animations.AnimsLLUUID["FLY"], 1); 1167 SetMovementAnimation(Animations.AnimsLLUUID["FLY"]);
1127 } 1168 }
1128 else if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && 1169 else if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
1129 PhysicsActor.IsColliding) 1170 PhysicsActor.IsColliding)
1130 { 1171 {
1131 // Client is pressing the page down button and moving and is colliding with something 1172 // Client is pressing the page down button and moving and is colliding with something
1132 SetMovementAnimation(Animations.AnimsLLUUID["CROUCHWALK"], 1); 1173 SetMovementAnimation(Animations.AnimsLLUUID["CROUCHWALK"]);
1133 } 1174 }
1134 else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6) 1175 else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6)
1135 { 1176 {
1136 // Client is moving and falling at a velocity greater then 6 meters per unit 1177 // Client is moving and falling at a velocity greater then 6 meters per unit
1137 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"], 1); 1178 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"]);
1138 } 1179 }
1139 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && 1180 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 &&
1140 (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) 1181 (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
@@ -1142,7 +1183,7 @@ namespace OpenSim.Region.Environment.Scenes
1142 // Client is moving, and colliding and pressing the page up button but isn't flying 1183 // Client is moving, and colliding and pressing the page up button but isn't flying
1143 try 1184 try
1144 { 1185 {
1145 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1); 1186 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"]);
1146 } 1187 }
1147 catch (KeyNotFoundException) 1188 catch (KeyNotFoundException)
1148 { } 1189 { }
@@ -1152,7 +1193,7 @@ namespace OpenSim.Region.Environment.Scenes
1152 // We are running 1193 // We are running
1153 try 1194 try
1154 { 1195 {
1155 SetMovementAnimation(Animations.AnimsLLUUID["RUN"], 1); 1196 SetMovementAnimation(Animations.AnimsLLUUID["RUN"]);
1156 } 1197 }
1157 catch (KeyNotFoundException) 1198 catch (KeyNotFoundException)
1158 { } 1199 { }
@@ -1162,7 +1203,7 @@ namespace OpenSim.Region.Environment.Scenes
1162 // We're moving, but we're not doing anything else.. so play the stand animation 1203 // We're moving, but we're not doing anything else.. so play the stand animation
1163 try 1204 try
1164 { 1205 {
1165 SetMovementAnimation(Animations.AnimsLLUUID["WALK"], 1); 1206 SetMovementAnimation(Animations.AnimsLLUUID["WALK"]);
1166 } 1207 }
1167 catch (KeyNotFoundException) 1208 catch (KeyNotFoundException)
1168 { } 1209 { }
@@ -1177,23 +1218,23 @@ namespace OpenSim.Region.Environment.Scenes
1177 PhysicsActor.IsColliding) 1218 PhysicsActor.IsColliding)
1178 { 1219 {
1179 // Client pressing the page down button 1220 // Client pressing the page down button
1180 SetMovementAnimation(Animations.AnimsLLUUID["CROUCH"], 1); 1221 SetMovementAnimation(Animations.AnimsLLUUID["CROUCH"]);
1181 } 1222 }
1182 else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6 && !m_physicsActor.Flying) 1223 else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6 && !m_physicsActor.Flying)
1183 { 1224 {
1184 // Not colliding and not flying, and we're falling at high speed 1225 // Not colliding and not flying, and we're falling at high speed
1185 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"], 1); 1226 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"]);
1186 } 1227 }
1187 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && 1228 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying &&
1188 (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) 1229 (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
1189 { 1230 {
1190 // This is the standing jump 1231 // This is the standing jump
1191 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1); 1232 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"]);
1192 } 1233 }
1193 else if (m_physicsActor.Flying) 1234 else if (m_physicsActor.Flying)
1194 { 1235 {
1195 // We're flying but not moving 1236 // We're flying but not moving
1196 SetMovementAnimation(Animations.AnimsLLUUID["HOVER"], 1); 1237 SetMovementAnimation(Animations.AnimsLLUUID["HOVER"]);
1197 } 1238 }
1198 else 1239 else
1199 { 1240 {
@@ -1201,7 +1242,7 @@ namespace OpenSim.Region.Environment.Scenes
1201 try 1242 try
1202 { 1243 {
1203 1244
1204 SetMovementAnimation(Animations.AnimsLLUUID["STAND"], 1); 1245 SetMovementAnimation(Animations.AnimsLLUUID["STAND"]);
1205 } 1246 }
1206 catch (KeyNotFoundException) 1247 catch (KeyNotFoundException)
1207 { } 1248 { }
@@ -1257,8 +1298,8 @@ namespace OpenSim.Region.Environment.Scenes
1257 // PreJump and jump happen too quickly. Many times prejump gets ignored. 1298 // PreJump and jump happen too quickly. Many times prejump gets ignored.
1258 try 1299 try
1259 { 1300 {
1260 SetMovementAnimation(Animations.AnimsLLUUID["PREJUMP"], 1); 1301 SetMovementAnimation(Animations.AnimsLLUUID["PREJUMP"]);
1261 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1); 1302 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"]);
1262 } 1303 }
1263 catch (KeyNotFoundException) 1304 catch (KeyNotFoundException)
1264 { } 1305 { }
@@ -1495,6 +1536,9 @@ namespace OpenSim.Region.Environment.Scenes
1495 /// <param name="seqs"></param> 1536 /// <param name="seqs"></param>
1496 public void SendAnimPack(LLUUID[] animations, int[] seqs) 1537 public void SendAnimPack(LLUUID[] animations, int[] seqs)
1497 { 1538 {
1539 if(m_isChildAgent)
1540 return;
1541
1498 m_scene.Broadcast( 1542 m_scene.Broadcast(
1499 delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId); }); 1543 delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId); });
1500 } 1544 }
@@ -1915,7 +1959,7 @@ namespace OpenSim.Region.Environment.Scenes
1915 1959
1916 m_animations = new List<LLUUID>(); 1960 m_animations = new List<LLUUID>();
1917 m_animations.Add(Animations.AnimsLLUUID["STAND"]); 1961 m_animations.Add(Animations.AnimsLLUUID["STAND"]);
1918 m_animationSeqs.Add(1); 1962 m_animationSeqs.Add(m_controllingClient.NextAnimationSequenceNumber);
1919 1963
1920 SetDirectionVectors(); 1964 SetDirectionVectors();
1921 */ 1965 */
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 4ce68da..199653d 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -217,6 +217,10 @@ namespace OpenSim.Region.Examples.SimpleModule
217 get { return FirstName + LastName; } 217 get { return FirstName + LastName; }
218 } 218 }
219 219
220 public virtual int NextAnimationSequenceNumber
221 {
222 get { return 1; }
223 }
220 224
221 public virtual void OutPacket(Packet newPack, ThrottleOutPacketType packType) 225 public virtual void OutPacket(Packet newPack, ThrottleOutPacketType packType)
222 { 226 {
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
index b919f8d..e403a12 100644
--- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
@@ -434,7 +434,7 @@ namespace OpenSim.Region.ScriptEngine.Common
434 if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence) 434 if (World.Entities.ContainsKey(avatar) && World.Entities[avatar] is ScenePresence)
435 { 435 {
436 ScenePresence target = (ScenePresence)World.Entities[avatar]; 436 ScenePresence target = (ScenePresence)World.Entities[avatar];
437 target.AddAnimation(avatar, 0); 437 target.AddAnimation(avatar);
438 } 438 }
439 } 439 }
440 440