diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 302 |
1 files changed, 26 insertions, 276 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2f666c0..676c000 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -160,11 +160,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
160 | /// </summary> | 160 | /// </summary> |
161 | public SimStatsReporter StatsReporter { get; private set; } | 161 | public SimStatsReporter StatsReporter { get; private set; } |
162 | 162 | ||
163 | public List<Border> NorthBorders = new List<Border>(); | ||
164 | public List<Border> EastBorders = new List<Border>(); | ||
165 | public List<Border> SouthBorders = new List<Border>(); | ||
166 | public List<Border> WestBorders = new List<Border>(); | ||
167 | |||
168 | /// <summary> | 163 | /// <summary> |
169 | /// Controls whether physics can be applied to prims. Even if false, prims still have entries in a | 164 | /// Controls whether physics can be applied to prims. Even if false, prims still have entries in a |
170 | /// PhysicsScene in order to perform collision detection | 165 | /// PhysicsScene in order to perform collision detection |
@@ -218,7 +213,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
218 | protected float m_defaultDrawDistance = 255.0f; | 213 | protected float m_defaultDrawDistance = 255.0f; |
219 | public float DefaultDrawDistance | 214 | public float DefaultDrawDistance |
220 | { | 215 | { |
221 | get { return m_defaultDrawDistance; } | 216 | // get { return m_defaultDrawDistance; } |
217 | get { | ||
218 | if (RegionInfo != null) | ||
219 | { | ||
220 | m_defaultDrawDistance = Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); | ||
221 | } | ||
222 | return m_defaultDrawDistance; | ||
223 | } | ||
222 | } | 224 | } |
223 | 225 | ||
224 | private List<string> m_AllowedViewers = new List<string>(); | 226 | private List<string> m_AllowedViewers = new List<string>(); |
@@ -349,7 +351,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
349 | 351 | ||
350 | // TODO: Possibly stop other classes being able to manipulate this directly. | 352 | // TODO: Possibly stop other classes being able to manipulate this directly. |
351 | private SceneGraph m_sceneGraph; | 353 | private SceneGraph m_sceneGraph; |
352 | private volatile int m_bordersLocked; | ||
353 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing | 354 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
354 | private volatile bool m_backingup; | 355 | private volatile bool m_backingup; |
355 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 356 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
@@ -426,18 +427,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
426 | set { m_splitRegionID = value; } | 427 | set { m_splitRegionID = value; } |
427 | } | 428 | } |
428 | 429 | ||
429 | public bool BordersLocked | ||
430 | { | ||
431 | get { return m_bordersLocked == 1; } | ||
432 | set | ||
433 | { | ||
434 | if (value == true) | ||
435 | m_bordersLocked = 1; | ||
436 | else | ||
437 | m_bordersLocked = 0; | ||
438 | } | ||
439 | } | ||
440 | |||
441 | public new float TimeDilation | 430 | public new float TimeDilation |
442 | { | 431 | { |
443 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } | 432 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } |
@@ -1031,28 +1020,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1031 | PeriodicBackup = true; | 1020 | PeriodicBackup = true; |
1032 | UseBackup = true; | 1021 | UseBackup = true; |
1033 | 1022 | ||
1034 | BordersLocked = true; | ||
1035 | Border northBorder = new Border(); | ||
1036 | northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (float)RegionInfo.RegionSizeY); //<--- | ||
1037 | northBorder.CrossDirection = Cardinals.N; | ||
1038 | NorthBorders.Add(northBorder); | ||
1039 | |||
1040 | Border southBorder = new Border(); | ||
1041 | southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,0); //---> | ||
1042 | southBorder.CrossDirection = Cardinals.S; | ||
1043 | SouthBorders.Add(southBorder); | ||
1044 | |||
1045 | Border eastBorder = new Border(); | ||
1046 | eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (float)RegionInfo.RegionSizeY); //<--- | ||
1047 | eastBorder.CrossDirection = Cardinals.E; | ||
1048 | EastBorders.Add(eastBorder); | ||
1049 | |||
1050 | Border westBorder = new Border(); | ||
1051 | westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,0); //---> | ||
1052 | westBorder.CrossDirection = Cardinals.W; | ||
1053 | WestBorders.Add(westBorder); | ||
1054 | BordersLocked = false; | ||
1055 | |||
1056 | m_eventManager = new EventManager(); | 1023 | m_eventManager = new EventManager(); |
1057 | 1024 | ||
1058 | m_permissions = new ScenePermissions(this); | 1025 | m_permissions = new ScenePermissions(this); |
@@ -2445,201 +2412,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
2445 | } | 2412 | } |
2446 | 2413 | ||
2447 | // Simple test to see if a position is in the current region. | 2414 | // Simple test to see if a position is in the current region. |
2448 | // Resuming the position is relative to the region so anything outside its bounds. | 2415 | // This test is mostly used to see if a region crossing is necessary. |
2416 | // Assuming the position is relative to the region so anything outside its bounds. | ||
2449 | // Return 'true' if position inside region. | 2417 | // Return 'true' if position inside region. |
2450 | public bool PositionIsInCurrentRegion(Vector3 pos) | 2418 | public bool PositionIsInCurrentRegion(Vector3 pos) |
2451 | { | 2419 | { |
2452 | bool ret = true; | 2420 | bool ret = false; |
2453 | int xx = (int)Math.Floor(pos.X); | 2421 | int xx = (int)Math.Floor(pos.X); |
2454 | int yy = (int)Math.Floor(pos.Y); | 2422 | int yy = (int)Math.Floor(pos.Y); |
2455 | if (xx < 0 | 2423 | if (xx < 0 || yy < 0) |
2456 | || xx >= RegionInfo.RegionSizeX | 2424 | return false; |
2457 | || yy < 0 | ||
2458 | || yy >= RegionInfo.RegionSizeY) | ||
2459 | ret = false; | ||
2460 | return ret; | ||
2461 | |||
2462 | } | ||
2463 | 2425 | ||
2464 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) | 2426 | IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>(); |
2465 | { | 2427 | if (regionCombinerModule == null) |
2466 | if (BordersLocked) | ||
2467 | { | 2428 | { |
2468 | switch (gridline) | 2429 | // Regular region. Just check for region size |
2469 | { | 2430 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) |
2470 | case Cardinals.N: | 2431 | ret = true; |
2471 | lock (NorthBorders) | ||
2472 | { | ||
2473 | foreach (Border b in NorthBorders) | ||
2474 | { | ||
2475 | if (b.TestCross(position)) | ||
2476 | return b; | ||
2477 | } | ||
2478 | } | ||
2479 | break; | ||
2480 | case Cardinals.S: | ||
2481 | lock (SouthBorders) | ||
2482 | { | ||
2483 | foreach (Border b in SouthBorders) | ||
2484 | { | ||
2485 | if (b.TestCross(position)) | ||
2486 | return b; | ||
2487 | } | ||
2488 | } | ||
2489 | |||
2490 | break; | ||
2491 | case Cardinals.E: | ||
2492 | lock (EastBorders) | ||
2493 | { | ||
2494 | foreach (Border b in EastBorders) | ||
2495 | { | ||
2496 | if (b.TestCross(position)) | ||
2497 | return b; | ||
2498 | } | ||
2499 | } | ||
2500 | |||
2501 | break; | ||
2502 | case Cardinals.W: | ||
2503 | |||
2504 | lock (WestBorders) | ||
2505 | { | ||
2506 | foreach (Border b in WestBorders) | ||
2507 | { | ||
2508 | if (b.TestCross(position)) | ||
2509 | return b; | ||
2510 | } | ||
2511 | } | ||
2512 | break; | ||
2513 | |||
2514 | } | ||
2515 | } | 2432 | } |
2516 | else | 2433 | else |
2517 | { | 2434 | { |
2518 | switch (gridline) | 2435 | // We're in a mega-region so see if we are still in that larger region |
2519 | { | 2436 | ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy); |
2520 | case Cardinals.N: | ||
2521 | foreach (Border b in NorthBorders) | ||
2522 | { | ||
2523 | if (b.TestCross(position)) | ||
2524 | return b; | ||
2525 | } | ||
2526 | |||
2527 | break; | ||
2528 | case Cardinals.S: | ||
2529 | foreach (Border b in SouthBorders) | ||
2530 | { | ||
2531 | if (b.TestCross(position)) | ||
2532 | return b; | ||
2533 | } | ||
2534 | break; | ||
2535 | case Cardinals.E: | ||
2536 | foreach (Border b in EastBorders) | ||
2537 | { | ||
2538 | if (b.TestCross(position)) | ||
2539 | return b; | ||
2540 | } | ||
2541 | |||
2542 | break; | ||
2543 | case Cardinals.W: | ||
2544 | foreach (Border b in WestBorders) | ||
2545 | { | ||
2546 | if (b.TestCross(position)) | ||
2547 | return b; | ||
2548 | } | ||
2549 | break; | ||
2550 | |||
2551 | } | ||
2552 | } | 2437 | } |
2553 | 2438 | ||
2554 | return null; | 2439 | return ret; |
2555 | } | ||
2556 | 2440 | ||
2557 | public bool TestBorderCross(Vector3 position, Cardinals border) | ||
2558 | { | ||
2559 | if (BordersLocked) | ||
2560 | { | ||
2561 | switch (border) | ||
2562 | { | ||
2563 | case Cardinals.N: | ||
2564 | lock (NorthBorders) | ||
2565 | { | ||
2566 | foreach (Border b in NorthBorders) | ||
2567 | { | ||
2568 | if (b.TestCross(position)) | ||
2569 | return true; | ||
2570 | } | ||
2571 | } | ||
2572 | break; | ||
2573 | case Cardinals.E: | ||
2574 | lock (EastBorders) | ||
2575 | { | ||
2576 | foreach (Border b in EastBorders) | ||
2577 | { | ||
2578 | if (b.TestCross(position)) | ||
2579 | return true; | ||
2580 | } | ||
2581 | } | ||
2582 | break; | ||
2583 | case Cardinals.S: | ||
2584 | lock (SouthBorders) | ||
2585 | { | ||
2586 | foreach (Border b in SouthBorders) | ||
2587 | { | ||
2588 | if (b.TestCross(position)) | ||
2589 | return true; | ||
2590 | } | ||
2591 | } | ||
2592 | break; | ||
2593 | case Cardinals.W: | ||
2594 | lock (WestBorders) | ||
2595 | { | ||
2596 | foreach (Border b in WestBorders) | ||
2597 | { | ||
2598 | if (b.TestCross(position)) | ||
2599 | return true; | ||
2600 | } | ||
2601 | } | ||
2602 | break; | ||
2603 | } | ||
2604 | } | ||
2605 | else | ||
2606 | { | ||
2607 | switch (border) | ||
2608 | { | ||
2609 | case Cardinals.N: | ||
2610 | foreach (Border b in NorthBorders) | ||
2611 | { | ||
2612 | if (b.TestCross(position)) | ||
2613 | return true; | ||
2614 | } | ||
2615 | break; | ||
2616 | case Cardinals.E: | ||
2617 | foreach (Border b in EastBorders) | ||
2618 | { | ||
2619 | if (b.TestCross(position)) | ||
2620 | return true; | ||
2621 | } | ||
2622 | break; | ||
2623 | case Cardinals.S: | ||
2624 | foreach (Border b in SouthBorders) | ||
2625 | { | ||
2626 | if (b.TestCross(position)) | ||
2627 | return true; | ||
2628 | } | ||
2629 | break; | ||
2630 | case Cardinals.W: | ||
2631 | foreach (Border b in WestBorders) | ||
2632 | { | ||
2633 | if (b.TestCross(position)) | ||
2634 | return true; | ||
2635 | } | ||
2636 | break; | ||
2637 | } | ||
2638 | } | ||
2639 | return false; | ||
2640 | } | 2441 | } |
2641 | 2442 | ||
2642 | |||
2643 | /// <summary> | 2443 | /// <summary> |
2644 | /// Called when objects or attachments cross the border, or teleport, between regions. | 2444 | /// Called when objects or attachments cross the border, or teleport, between regions. |
2645 | /// </summary> | 2445 | /// </summary> |
@@ -3874,61 +3674,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3874 | { | 3674 | { |
3875 | // CleanDroppedAttachments(); | 3675 | // CleanDroppedAttachments(); |
3876 | 3676 | ||
3877 | if (TestBorderCross(acd.startpos, Cardinals.E)) | 3677 | // Make sure avatar position is in the region (why it wouldn't be is a mystery but do sanity checking) |
3878 | { | 3678 | if (acd.startpos.X < 0) acd.startpos.X = 1f; |
3879 | Border crossedBorder = GetCrossedBorder(acd.startpos, Cardinals.E); | 3679 | if (acd.startpos.X >= RegionInfo.RegionSizeX) acd.startpos.X = RegionInfo.RegionSizeX - 1f; |
3880 | acd.startpos.X = crossedBorder.BorderLine.Z - 1; | 3680 | if (acd.startpos.Y < 0) acd.startpos.Y = 1f; |
3881 | m_log.DebugFormat("{0} NewUserConnection Adjusted border E. startpos={1}", LogHeader, acd.startpos); | 3681 | if (acd.startpos.Y >= RegionInfo.RegionSizeY) acd.startpos.Y = RegionInfo.RegionSizeY - 1f; |
3882 | } | ||
3883 | |||
3884 | if (TestBorderCross(acd.startpos, Cardinals.N)) | ||
3885 | { | ||
3886 | Border crossedBorder = GetCrossedBorder(acd.startpos, Cardinals.N); | ||
3887 | acd.startpos.Y = crossedBorder.BorderLine.Z - 1; | ||
3888 | } | ||
3889 | |||
3890 | //Mitigate http://opensimulator.org/mantis/view.php?id=3522 | ||
3891 | // Check if start position is outside of region | ||
3892 | // If it is, check the Z start position also.. if not, leave it alone. | ||
3893 | if (BordersLocked) | ||
3894 | { | ||
3895 | lock (EastBorders) | ||
3896 | { | ||
3897 | if (acd.startpos.X > EastBorders[0].BorderLine.Z) | ||
3898 | { | ||
3899 | m_log.Warn("FIX AGENT POSITION"); | ||
3900 | acd.startpos.X = EastBorders[0].BorderLine.Z * 0.5f; | ||
3901 | if (acd.startpos.Z > 720) | ||
3902 | acd.startpos.Z = 720; | ||
3903 | } | ||
3904 | } | ||
3905 | lock (NorthBorders) | ||
3906 | { | ||
3907 | if (acd.startpos.Y > NorthBorders[0].BorderLine.Z) | ||
3908 | { | ||
3909 | m_log.Warn("FIX Agent POSITION"); | ||
3910 | acd.startpos.Y = NorthBorders[0].BorderLine.Z * 0.5f; | ||
3911 | if (acd.startpos.Z > 720) | ||
3912 | acd.startpos.Z = 720; | ||
3913 | } | ||
3914 | } | ||
3915 | } else | ||
3916 | { | ||
3917 | if (acd.startpos.X > EastBorders[0].BorderLine.Z) | ||
3918 | { | ||
3919 | m_log.Warn("FIX AGENT POSITION"); | ||
3920 | acd.startpos.X = EastBorders[0].BorderLine.Z * 0.5f; | ||
3921 | if (acd.startpos.Z > 720) | ||
3922 | acd.startpos.Z = 720; | ||
3923 | } | ||
3924 | if (acd.startpos.Y > NorthBorders[0].BorderLine.Z) | ||
3925 | { | ||
3926 | m_log.Warn("FIX Agent POSITION"); | ||
3927 | acd.startpos.Y = NorthBorders[0].BorderLine.Z * 0.5f; | ||
3928 | if (acd.startpos.Z > 720) | ||
3929 | acd.startpos.Z = 720; | ||
3930 | } | ||
3931 | } | ||
3932 | 3682 | ||
3933 | // m_log.DebugFormat( | 3683 | // m_log.DebugFormat( |
3934 | // "[SCENE]: Found telehub object {0} for new user connection {1} to {2}", | 3684 | // "[SCENE]: Found telehub object {0} for new user connection {1} to {2}", |