diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/InnerScene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 81 |
1 files changed, 38 insertions, 43 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 48fa3dc..57b8ae7 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -150,7 +150,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
150 | { | 150 | { |
151 | lock (m_syncRoot) | 151 | lock (m_syncRoot) |
152 | { | 152 | { |
153 | return _PhyScene.Simulate((float) elapsed); | 153 | return _PhyScene.Simulate((float)elapsed); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
@@ -175,7 +175,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
175 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 175 | foreach (SceneObjectPart part in sceneObject.Children.Values) |
176 | { | 176 | { |
177 | part.LocalID = m_parentScene.PrimIDAllocate(); | 177 | part.LocalID = m_parentScene.PrimIDAllocate(); |
178 | 178 | ||
179 | } | 179 | } |
180 | sceneObject.UpdateParentIDs(); | 180 | sceneObject.UpdateParentIDs(); |
181 | AddEntity(sceneObject); | 181 | AddEntity(sceneObject); |
@@ -222,9 +222,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
222 | { | 222 | { |
223 | if (obj is SceneObjectGroup) | 223 | if (obj is SceneObjectGroup) |
224 | { | 224 | { |
225 | if (((SceneObjectGroup) obj).LocalId == localID) | 225 | if (((SceneObjectGroup)obj).LocalId == localID) |
226 | { | 226 | { |
227 | m_parentScene.RemoveEntity((SceneObjectGroup) obj); | 227 | m_parentScene.RemoveEntity((SceneObjectGroup)obj); |
228 | m_numPrim--; | 228 | m_numPrim--; |
229 | return; | 229 | return; |
230 | } | 230 | } |
@@ -237,7 +237,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
237 | System.Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt); | 237 | System.Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt); |
238 | SceneObjectPart p = GetSceneObjectPart(objectLocalID); | 238 | SceneObjectPart p = GetSceneObjectPart(objectLocalID); |
239 | ScenePresence av = null; | 239 | ScenePresence av = null; |
240 | if (TryGetAvatar(remoteClient.AgentId, out av)) { | 240 | if (TryGetAvatar(remoteClient.AgentId, out av)) |
241 | { | ||
241 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | 242 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
242 | objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle; | 243 | objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle; |
243 | objupdate.RegionData.TimeDilation = ushort.MaxValue; | 244 | objupdate.RegionData.TimeDilation = ushort.MaxValue; |
@@ -287,7 +288,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
287 | objupdate.ObjectData[0].NameValue = | 288 | objupdate.ObjectData[0].NameValue = |
288 | Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname); | 289 | Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname); |
289 | LLVector3 pos2 = av.AbsolutePosition; | 290 | LLVector3 pos2 = av.AbsolutePosition; |
290 | // new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z); | 291 | // new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z); |
291 | byte[] pb = pos2.GetBytes(); | 292 | byte[] pb = pos2.GetBytes(); |
292 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | 293 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); |
293 | 294 | ||
@@ -318,7 +319,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
318 | 319 | ||
319 | objupdate.ObjectData[1].TextureEntry = primData.TextureEntry; | 320 | objupdate.ObjectData[1].TextureEntry = primData.TextureEntry; |
320 | objupdate.ObjectData[1].PCode = primData.PCode; | 321 | objupdate.ObjectData[1].PCode = primData.PCode; |
321 | objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4) ; | 322 | objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4); |
322 | objupdate.ObjectData[1].PathBegin = primData.PathBegin; | 323 | objupdate.ObjectData[1].PathBegin = primData.PathBegin; |
323 | objupdate.ObjectData[1].PathEnd = primData.PathEnd; | 324 | objupdate.ObjectData[1].PathEnd = primData.PathEnd; |
324 | objupdate.ObjectData[1].PathScaleX = primData.PathScaleX; | 325 | objupdate.ObjectData[1].PathScaleX = primData.PathScaleX; |
@@ -356,7 +357,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
356 | objupdate.ObjectData[1].Radius = 20; | 357 | objupdate.ObjectData[1].Radius = 20; |
357 | objupdate.ObjectData[1].NameValue = | 358 | objupdate.ObjectData[1].NameValue = |
358 | Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID); | 359 | Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID); |
359 | LLVector3 pos = new LLVector3((float) 0.0, (float) 0.0, (float) 0.0); | 360 | LLVector3 pos = new LLVector3((float)0.0, (float)0.0, (float)0.0); |
360 | 361 | ||
361 | pb = pos.GetBytes(); | 362 | pb = pos.GetBytes(); |
362 | Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length); | 363 | Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length); |
@@ -364,13 +365,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
364 | byte[] brot = rot.GetBytes(); | 365 | byte[] brot = rot.GetBytes(); |
365 | Array.Copy(brot, 0, objupdate.ObjectData[1].ObjectData, 36, brot.Length); | 366 | Array.Copy(brot, 0, objupdate.ObjectData[1].ObjectData, 36, brot.Length); |
366 | 367 | ||
367 | 368 | remoteClient.OutPacket(objupdate, ThrottleOutPacketType.Task); | |
368 | |||
369 | remoteClient.OutPacket(objupdate, ThrottleOutPacketType.Task); | ||
370 | |||
371 | |||
372 | |||
373 | |||
374 | } | 369 | } |
375 | else | 370 | else |
376 | { | 371 | { |
@@ -466,8 +461,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
466 | { | 461 | { |
467 | // some network situations come in where child agents get closed twice. | 462 | // some network situations come in where child agents get closed twice. |
468 | if (m_numChildAgents < 0) | 463 | if (m_numChildAgents < 0) |
469 | { | 464 | { |
470 | m_numChildAgents = 0; | 465 | m_numChildAgents = 0; |
471 | } | 466 | } |
472 | 467 | ||
473 | return m_numChildAgents; | 468 | return m_numChildAgents; |
@@ -569,8 +564,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
569 | { | 564 | { |
570 | if (ent is SceneObjectGroup) | 565 | if (ent is SceneObjectGroup) |
571 | { | 566 | { |
572 | if (((SceneObjectGroup) ent).HasChildPrim(localID)) | 567 | if (((SceneObjectGroup)ent).HasChildPrim(localID)) |
573 | return (SceneObjectGroup) ent; | 568 | return (SceneObjectGroup)ent; |
574 | } | 569 | } |
575 | } | 570 | } |
576 | return null; | 571 | return null; |
@@ -584,8 +579,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
584 | { | 579 | { |
585 | if (ent is SceneObjectGroup) | 580 | if (ent is SceneObjectGroup) |
586 | { | 581 | { |
587 | if (((SceneObjectGroup) ent).HasChildPrim(fullID)) | 582 | if (((SceneObjectGroup)ent).HasChildPrim(fullID)) |
588 | return (SceneObjectGroup) ent; | 583 | return (SceneObjectGroup)ent; |
589 | } | 584 | } |
590 | } | 585 | } |
591 | return null; | 586 | return null; |
@@ -600,7 +595,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
600 | { | 595 | { |
601 | if (ent is SceneObjectGroup) | 596 | if (ent is SceneObjectGroup) |
602 | { | 597 | { |
603 | SceneObjectGroup reportingG = (SceneObjectGroup) ent; | 598 | SceneObjectGroup reportingG = (SceneObjectGroup)ent; |
604 | EntityIntersection result = reportingG.TestIntersection(hray); | 599 | EntityIntersection result = reportingG.TestIntersection(hray); |
605 | if (result.HitTF) | 600 | if (result.HitTF) |
606 | { | 601 | { |
@@ -613,7 +608,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
613 | } | 608 | } |
614 | } | 609 | } |
615 | return returnResult; | 610 | return returnResult; |
616 | } | 611 | } |
617 | 612 | ||
618 | public SceneObjectPart GetSceneObjectPart(uint localID) | 613 | public SceneObjectPart GetSceneObjectPart(uint localID) |
619 | { | 614 | { |
@@ -719,7 +714,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
719 | if (presence.IsChildAgent && m_parentScene.m_seeIntoRegionFromNeighbor) | 714 | if (presence.IsChildAgent && m_parentScene.m_seeIntoRegionFromNeighbor) |
720 | { | 715 | { |
721 | LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition; | 716 | LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition; |
722 | float distResult = (float)Util.GetDistanceTo(presence.AbsolutePosition,oLoc); | 717 | float distResult = (float)Util.GetDistanceTo(presence.AbsolutePosition, oLoc); |
723 | 718 | ||
724 | //m_log.Info("[DISTANCE]: " + distResult.ToString()); | 719 | //m_log.Info("[DISTANCE]: " + distResult.ToString()); |
725 | 720 | ||
@@ -727,13 +722,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
727 | { | 722 | { |
728 | // Send Only if we don't already know about it. | 723 | // Send Only if we don't already know about it. |
729 | // KnownPrim also makes the prim known when called. | 724 | // KnownPrim also makes the prim known when called. |
730 | if (!presence.KnownPrim(((SceneObjectGroup) ent).UUID)) | 725 | if (!presence.KnownPrim(((SceneObjectGroup)ent).UUID)) |
731 | ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); | 726 | ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); |
732 | } | 727 | } |
733 | } | 728 | } |
734 | else | 729 | else |
735 | { | 730 | { |
736 | ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); | 731 | ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); |
737 | } | 732 | } |
738 | } | 733 | } |
739 | } | 734 | } |
@@ -903,7 +898,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
903 | { | 898 | { |
904 | if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) | 899 | if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) |
905 | { | 900 | { |
906 | group.UpdatePrimFlags(localID, (ushort) packet.Type, true, packet.ToBytes()); | 901 | group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes()); |
907 | } | 902 | } |
908 | } | 903 | } |
909 | } | 904 | } |
@@ -1003,9 +998,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1003 | { | 998 | { |
1004 | if (ent is SceneObjectGroup) | 999 | if (ent is SceneObjectGroup) |
1005 | { | 1000 | { |
1006 | if (((SceneObjectGroup) ent).LocalId == parentPrim) | 1001 | if (((SceneObjectGroup)ent).LocalId == parentPrim) |
1007 | { | 1002 | { |
1008 | parenPrim = (SceneObjectGroup) ent; | 1003 | parenPrim = (SceneObjectGroup)ent; |
1009 | break; | 1004 | break; |
1010 | } | 1005 | } |
1011 | } | 1006 | } |
@@ -1020,9 +1015,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1020 | { | 1015 | { |
1021 | if (ent is SceneObjectGroup) | 1016 | if (ent is SceneObjectGroup) |
1022 | { | 1017 | { |
1023 | if (((SceneObjectGroup) ent).LocalId == childPrims[i]) | 1018 | if (((SceneObjectGroup)ent).LocalId == childPrims[i]) |
1024 | { | 1019 | { |
1025 | children.Add((SceneObjectGroup) ent); | 1020 | children.Add((SceneObjectGroup)ent); |
1026 | } | 1021 | } |
1027 | } | 1022 | } |
1028 | } | 1023 | } |
@@ -1049,25 +1044,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
1049 | // be more efficient yet to keep this dictionary permanently on hand. | 1044 | // be more efficient yet to keep this dictionary permanently on hand. |
1050 | 1045 | ||
1051 | Dictionary<uint, SceneObjectGroup> sceneObjects = new Dictionary<uint, SceneObjectGroup>(); | 1046 | Dictionary<uint, SceneObjectGroup> sceneObjects = new Dictionary<uint, SceneObjectGroup>(); |
1052 | 1047 | ||
1053 | List<EntityBase> EntitieList = GetEntities(); | 1048 | List<EntityBase> EntitieList = GetEntities(); |
1054 | foreach (EntityBase ent in EntitieList) | 1049 | foreach (EntityBase ent in EntitieList) |
1055 | { | 1050 | { |
1056 | if (ent is SceneObjectGroup) | 1051 | if (ent is SceneObjectGroup) |
1057 | { | 1052 | { |
1058 | SceneObjectGroup obj = (SceneObjectGroup) ent; | 1053 | SceneObjectGroup obj = (SceneObjectGroup)ent; |
1059 | sceneObjects.Add(obj.LocalId, obj); | 1054 | sceneObjects.Add(obj.LocalId, obj); |
1060 | 1055 | ||
1061 | } | 1056 | } |
1062 | } | 1057 | } |
1063 | 1058 | ||
1064 | // Find the root prim among the prim ids we've been given | 1059 | // Find the root prim among the prim ids we've been given |
1065 | for (int i = 0; i < primIds.Count; i++) | 1060 | for (int i = 0; i < primIds.Count; i++) |
1066 | { | 1061 | { |
1067 | 1062 | ||
1068 | if (sceneObjects.ContainsKey(primIds[i])) | 1063 | if (sceneObjects.ContainsKey(primIds[i])) |
1069 | { | 1064 | { |
1070 | 1065 | ||
1071 | parenPrim = sceneObjects[primIds[i]]; | 1066 | parenPrim = sceneObjects[primIds[i]]; |
1072 | primIds.RemoveAt(i); | 1067 | primIds.RemoveAt(i); |
1073 | break; | 1068 | break; |
@@ -1124,9 +1119,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1124 | { | 1119 | { |
1125 | if (ent is SceneObjectGroup) | 1120 | if (ent is SceneObjectGroup) |
1126 | { | 1121 | { |
1127 | if (((SceneObjectGroup) ent).LocalId == originalPrim) | 1122 | if (((SceneObjectGroup)ent).LocalId == originalPrim) |
1128 | { | 1123 | { |
1129 | originPrim = (SceneObjectGroup) ent; | 1124 | originPrim = (SceneObjectGroup)ent; |
1130 | break; | 1125 | break; |
1131 | } | 1126 | } |
1132 | } | 1127 | } |
@@ -1139,14 +1134,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1139 | SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); | 1134 | SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); |
1140 | copy.AbsolutePosition = copy.AbsolutePosition + offset; | 1135 | copy.AbsolutePosition = copy.AbsolutePosition + offset; |
1141 | copy.ResetIDs(); | 1136 | copy.ResetIDs(); |
1142 | 1137 | ||
1143 | lock (Entities) | 1138 | lock (Entities) |
1144 | { | 1139 | { |
1145 | Entities.Add(copy.UUID, copy); | 1140 | Entities.Add(copy.UUID, copy); |
1146 | } | 1141 | } |
1147 | 1142 | ||
1148 | m_numPrim++; | 1143 | m_numPrim++; |
1149 | 1144 | ||
1150 | copy.StartScripts(); | 1145 | copy.StartScripts(); |
1151 | copy.ScheduleGroupForFullUpdate(); | 1146 | copy.ScheduleGroupForFullUpdate(); |
1152 | } | 1147 | } |
@@ -1170,7 +1165,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1170 | 1165 | ||
1171 | return | 1166 | return |
1172 | (float) | 1167 | (float) |
1173 | Math.Sqrt((v1.x - v2.x)*(v1.x - v2.x) + (v1.y - v2.y)*(v1.y - v2.y) + (v1.z - v2.z)*(v1.z - v2.z)); | 1168 | Math.Sqrt((v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y) + (v1.z - v2.z) * (v1.z - v2.z)); |
1174 | } | 1169 | } |
1175 | 1170 | ||
1176 | #endregion | 1171 | #endregion |