aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-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
3 files changed, 129 insertions, 66 deletions
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 */