aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs84
1 files changed, 50 insertions, 34 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 3a45e23..874bb41 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -48,7 +48,7 @@ using OpenSim.Region.Environment.Scenes.Scripting;
48using OpenSim.Region.Environment.Types; 48using OpenSim.Region.Environment.Types;
49using OpenSim.Region.Physics.Manager; 49using OpenSim.Region.Physics.Manager;
50using OpenSim.Region.Terrain; 50using OpenSim.Region.Terrain;
51using Timer=System.Timers.Timer; 51using Timer = System.Timers.Timer;
52 52
53namespace OpenSim.Region.Environment.Scenes 53namespace OpenSim.Region.Environment.Scenes
54{ 54{
@@ -195,7 +195,7 @@ namespace OpenSim.Region.Environment.Scenes
195 Prims = new Dictionary<LLUUID, SceneObjectGroup>(); 195 Prims = new Dictionary<LLUUID, SceneObjectGroup>();
196 196
197 MainLog.Instance.Verbose("Creating LandMap"); 197 MainLog.Instance.Verbose("Creating LandMap");
198 Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY); 198 Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY);
199 199
200 ScenePresence.LoadAnims(); 200 ScenePresence.LoadAnims();
201 201
@@ -254,7 +254,7 @@ namespace OpenSim.Region.Environment.Scenes
254 if (phyScene.IsThreaded) 254 if (phyScene.IsThreaded)
255 { 255 {
256 phyScene.GetResults(); 256 phyScene.GetResults();
257 /// no engines implement this, and what does it have to do with threading? possible DEAD CODE 257 /// no engines implement this, and what does it have to do with threading? possible DEAD CODE
258 } 258 }
259 259
260 List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values); 260 List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values);
@@ -313,7 +313,7 @@ namespace OpenSim.Region.Environment.Scenes
313 { 313 {
314 for (int y = 0; y < 16; y++) 314 for (int y = 0; y < 16; y++)
315 { 315 {
316 if (Terrain.Tainted(x*16, y*16)) 316 if (Terrain.Tainted(x * 16, y * 16))
317 { 317 {
318 SendLayerData(x, y, presence.ControllingClient, 318 SendLayerData(x, y, presence.ControllingClient,
319 terData); 319 terData);
@@ -526,7 +526,7 @@ namespace OpenSim.Region.Environment.Scenes
526 { 526 {
527 AddEntityFromStorage(prim); 527 AddEntityFromStorage(prim);
528 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); 528 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
529 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 529 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
530 rootPart.PhysActor = phyScene.AddPrim( 530 rootPart.PhysActor = phyScene.AddPrim(
531 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, 531 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
532 rootPart.AbsolutePosition.Z), 532 rootPart.AbsolutePosition.Z),
@@ -570,10 +570,10 @@ namespace OpenSim.Region.Environment.Scenes
570 // if grass or tree, make phantom 570 // if grass or tree, make phantom
571 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255)) 571 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255))
572 { 572 {
573 rootPart.ObjectFlags += (uint) LLObject.ObjectFlags.Phantom; 573 rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
574 } 574 }
575 // if not phantom, add to physics 575 // if not phantom, add to physics
576 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 576 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
577 rootPart.PhysActor = 577 rootPart.PhysActor =
578 phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), 578 phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z),
579 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), 579 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
@@ -587,9 +587,9 @@ namespace OpenSim.Region.Environment.Scenes
587 { 587 {
588 if (obj is SceneObjectGroup) 588 if (obj is SceneObjectGroup)
589 { 589 {
590 if (((SceneObjectGroup) obj).LocalId == localID) 590 if (((SceneObjectGroup)obj).LocalId == localID)
591 { 591 {
592 RemoveEntity((SceneObjectGroup) obj); 592 RemoveEntity((SceneObjectGroup)obj);
593 return; 593 return;
594 } 594 }
595 } 595 }
@@ -657,7 +657,7 @@ namespace OpenSim.Region.Environment.Scenes
657 AddEntity(obj); 657 AddEntity(obj);
658 658
659 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 659 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
660 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 660 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
661 rootPart.PhysActor = phyScene.AddPrim( 661 rootPart.PhysActor = phyScene.AddPrim(
662 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, 662 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
663 rootPart.AbsolutePosition.Z), 663 rootPart.AbsolutePosition.Z),
@@ -683,7 +683,7 @@ namespace OpenSim.Region.Environment.Scenes
683 { 683 {
684 if (ent is SceneObjectGroup) 684 if (ent is SceneObjectGroup)
685 { 685 {
686 stream.WriteLine(((SceneObjectGroup) ent).ToXmlString()); 686 stream.WriteLine(((SceneObjectGroup)ent).ToXmlString());
687 primCount++; 687 primCount++;
688 } 688 }
689 } 689 }
@@ -706,9 +706,9 @@ namespace OpenSim.Region.Environment.Scenes
706 { 706 {
707 SubscribeToClientEvents(client); 707 SubscribeToClientEvents(client);
708 m_estateManager.sendRegionHandshake(client); 708 m_estateManager.sendRegionHandshake(client);
709 709
710 CreateAndAddScenePresence(client, child); 710 CreateAndAddScenePresence(client, child);
711 711
712 m_LandManager.sendParcelOverlay(client); 712 m_LandManager.sendParcelOverlay(client);
713 commsManager.UserProfiles.AddNewUser(client.AgentId); 713 commsManager.UserProfiles.AddNewUser(client.AgentId);
714 commsManager.TransactionsManager.AddUser(client.AgentId); 714 commsManager.TransactionsManager.AddUser(client.AgentId);
@@ -793,7 +793,7 @@ namespace OpenSim.Region.Environment.Scenes
793 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new root agent."); 793 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new root agent.");
794 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Adding Physical agent."); 794 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Adding Physical agent.");
795 795
796 newAvatar.AddToPhysicalScene( ); 796 newAvatar.AddToPhysicalScene();
797 } 797 }
798 798
799 lock (Entities) 799 lock (Entities)
@@ -835,14 +835,14 @@ namespace OpenSim.Region.Environment.Scenes
835 835
836 ForEachScenePresence( 836 ForEachScenePresence(
837 delegate(ScenePresence presence) 837 delegate(ScenePresence presence)
838 {
839 presence.CoarseLocationChange(avatar);
840 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
841 if (presence.PhysActor != null)
838 { 842 {
839 presence.CoarseLocationChange(avatar); 843 phyScene.RemoveAvatar(presence.PhysActor);
840 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId); 844 }
841 if (presence.PhysActor != null) 845 });
842 {
843 phyScene.RemoveAvatar(presence.PhysActor);
844 }
845 });
846 846
847 lock (Avatars) 847 lock (Avatars)
848 { 848 {
@@ -968,7 +968,7 @@ namespace OpenSim.Region.Environment.Scenes
968 if (ent is SceneObjectGroup) 968 if (ent is SceneObjectGroup)
969 { 969 {
970 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client); 970 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
971 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); 971 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
972 } 972 }
973 } 973 }
974 } 974 }
@@ -1157,17 +1157,17 @@ namespace OpenSim.Region.Environment.Scenes
1157 1157
1158 public void RegisterModuleInterface<M>(M mod) 1158 public void RegisterModuleInterface<M>(M mod)
1159 { 1159 {
1160 if (!ModuleInterfaces.ContainsKey(typeof (M))) 1160 if (!ModuleInterfaces.ContainsKey(typeof(M)))
1161 { 1161 {
1162 ModuleInterfaces.Add(typeof (M), mod); 1162 ModuleInterfaces.Add(typeof(M), mod);
1163 } 1163 }
1164 } 1164 }
1165 1165
1166 public T RequestModuleInterface<T>() 1166 public T RequestModuleInterface<T>()
1167 { 1167 {
1168 if (ModuleInterfaces.ContainsKey(typeof (T))) 1168 if (ModuleInterfaces.ContainsKey(typeof(T)))
1169 { 1169 {
1170 return (T) ModuleInterfaces[typeof (T)]; 1170 return (T)ModuleInterfaces[typeof(T)];
1171 } 1171 }
1172 else 1172 else
1173 { 1173 {
@@ -1257,7 +1257,7 @@ namespace OpenSim.Region.Environment.Scenes
1257 { 1257 {
1258 if (ent is SceneObjectGroup) 1258 if (ent is SceneObjectGroup)
1259 { 1259 {
1260 ((SceneObjectGroup) ent).ScheduleGroupForFullUpdate(); 1260 ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate();
1261 } 1261 }
1262 } 1262 }
1263 } 1263 }
@@ -1269,7 +1269,7 @@ namespace OpenSim.Region.Environment.Scenes
1269 { 1269 {
1270 if (ent is SceneObjectGroup) 1270 if (ent is SceneObjectGroup)
1271 { 1271 {
1272 SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID); 1272 SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID);
1273 if (part != null) 1273 if (part != null)
1274 { 1274 {
1275 if (part.Name == cmmdparams[0]) 1275 if (part.Name == cmmdparams[0])
@@ -1357,10 +1357,10 @@ namespace OpenSim.Region.Environment.Scenes
1357 { 1357 {
1358 if (ent is SceneObjectGroup) 1358 if (ent is SceneObjectGroup)
1359 { 1359 {
1360 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); 1360 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
1361 if (hasPrim != false) 1361 if (hasPrim != false)
1362 { 1362 {
1363 return ((SceneObjectGroup) ent).GetPartsFullID(localID); 1363 return ((SceneObjectGroup)ent).GetPartsFullID(localID);
1364 } 1364 }
1365 } 1365 }
1366 } 1366 }
@@ -1374,10 +1374,10 @@ namespace OpenSim.Region.Environment.Scenes
1374 { 1374 {
1375 if (ent is SceneObjectGroup) 1375 if (ent is SceneObjectGroup)
1376 { 1376 {
1377 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); 1377 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
1378 if (hasPrim != false) 1378 if (hasPrim != false)
1379 { 1379 {
1380 return ((SceneObjectGroup) ent).GetChildPart(localID); 1380 return ((SceneObjectGroup)ent).GetChildPart(localID);
1381 } 1381 }
1382 } 1382 }
1383 } 1383 }
@@ -1391,14 +1391,30 @@ namespace OpenSim.Region.Environment.Scenes
1391 { 1391 {
1392 if (ent is SceneObjectGroup) 1392 if (ent is SceneObjectGroup)
1393 { 1393 {
1394 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(fullID); 1394 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(fullID);
1395 if (hasPrim != false) 1395 if (hasPrim != false)
1396 { 1396 {
1397 return ((SceneObjectGroup) ent).GetChildPart(fullID); 1397 return ((SceneObjectGroup)ent).GetChildPart(fullID);
1398 } 1398 }
1399 } 1399 }
1400 } 1400 }
1401 return null; 1401 return null;
1402 } 1402 }
1403
1404 internal bool TryGetAvatar(LLUUID avatarId, out ScenePresence avatar)
1405 {
1406 ScenePresence presence;
1407 if (Avatars.TryGetValue(avatarId, out presence))
1408 {
1409 if (!presence.childAgent)
1410 {
1411 avatar = presence;
1412 return true;
1413 }
1414 }
1415
1416 avatar = null;
1417 return false;
1418 }
1403 } 1419 }
1404} \ No newline at end of file 1420} \ No newline at end of file