diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 29 |
3 files changed, 50 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 0209d16..fa357f5 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -229,11 +229,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
229 | } | 229 | } |
230 | 230 | ||
231 | m_scene.RegisterModuleInterface<ITerrainModule>(this); | 231 | m_scene.RegisterModuleInterface<ITerrainModule>(this); |
232 | m_scene.EventManager.OnFrame += EventManager_OnFrame; | ||
233 | m_scene.EventManager.OnNewClient += EventManager_OnNewClient; | 232 | m_scene.EventManager.OnNewClient += EventManager_OnNewClient; |
234 | m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed; | 233 | m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed; |
235 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | 234 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; |
236 | m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick; | 235 | m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick; |
236 | m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates; | ||
237 | } | 237 | } |
238 | 238 | ||
239 | InstallDefaultEffects(); | 239 | InstallDefaultEffects(); |
@@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
272 | // remove the commands | 272 | // remove the commands |
273 | m_scene.UnregisterModuleCommander(m_commander.Name); | 273 | m_scene.UnregisterModuleCommander(m_commander.Name); |
274 | // remove the event-handlers | 274 | // remove the event-handlers |
275 | m_scene.EventManager.OnFrame -= EventManager_OnFrame; | 275 | m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates; |
276 | m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick; | 276 | m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick; |
277 | m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; | 277 | m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; |
278 | m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; | 278 | m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; |
@@ -759,13 +759,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
759 | } | 759 | } |
760 | 760 | ||
761 | /// <summary> | 761 | /// <summary> |
762 | /// Called before processing of every simulation frame. | ||
763 | /// This is used to check to see of any of the terrain is tainted and, if so, schedule | 762 | /// This is used to check to see of any of the terrain is tainted and, if so, schedule |
764 | /// updates for all the presences. | 763 | /// updates for all the presences. |
765 | /// This also checks to see if there are updates that need to be sent for each presence. | 764 | /// This also checks to see if there are updates that need to be sent for each presence. |
766 | /// This is where the logic is to send terrain updates to clients. | 765 | /// This is where the logic is to send terrain updates to clients. |
767 | /// </summary> | 766 | /// </summary> |
768 | private void EventManager_OnFrame() | 767 | private void EventManager_TerrainCheckUpdates() |
769 | { | 768 | { |
770 | // this needs fixing | 769 | // this needs fixing |
771 | TerrainData terrData = m_channel.GetTerrainData(); | 770 | TerrainData terrData = m_channel.GetTerrainData(); |
@@ -775,7 +774,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
775 | { | 774 | { |
776 | for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) | 775 | for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) |
777 | { | 776 | { |
778 | if (terrData.IsTaintedAt(x, y)) | 777 | if (terrData.IsTaintedAt(x, y,true)) |
779 | { | 778 | { |
780 | // Found a patch that was modified. Push this flag into the clients. | 779 | // Found a patch that was modified. Push this flag into the clients. |
781 | SendToClients(terrData, x, y); | 780 | SendToClients(terrData, x, y); |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 692e0c9..24fbef9 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -80,6 +80,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
80 | public event OnTerrainTaintedDelegate OnTerrainTainted; | 80 | public event OnTerrainTaintedDelegate OnTerrainTainted; |
81 | 81 | ||
82 | public delegate void OnTerrainTickDelegate(); | 82 | public delegate void OnTerrainTickDelegate(); |
83 | public delegate void OnTerrainCheckUpdatesDelegate(); | ||
83 | 84 | ||
84 | /// <summary> | 85 | /// <summary> |
85 | /// Triggered if the terrain has been edited | 86 | /// Triggered if the terrain has been edited |
@@ -89,6 +90,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
89 | /// but is used by core solely to update the physics engine. | 90 | /// but is used by core solely to update the physics engine. |
90 | /// </remarks> | 91 | /// </remarks> |
91 | public event OnTerrainTickDelegate OnTerrainTick; | 92 | public event OnTerrainTickDelegate OnTerrainTick; |
93 | public event OnTerrainCheckUpdatesDelegate OnTerrainCheckUpdates; | ||
92 | 94 | ||
93 | public delegate void OnTerrainUpdateDelegate(); | 95 | public delegate void OnTerrainUpdateDelegate(); |
94 | 96 | ||
@@ -1484,6 +1486,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1484 | } | 1486 | } |
1485 | } | 1487 | } |
1486 | 1488 | ||
1489 | public void TriggerTerrainCheckUpdates() | ||
1490 | { | ||
1491 | OnTerrainCheckUpdatesDelegate TerrainCheckUpdates = OnTerrainCheckUpdates; | ||
1492 | if (TerrainCheckUpdates != null) | ||
1493 | { | ||
1494 | foreach (OnTerrainCheckUpdatesDelegate d in TerrainCheckUpdates.GetInvocationList()) | ||
1495 | { | ||
1496 | try | ||
1497 | { | ||
1498 | d(); | ||
1499 | } | ||
1500 | catch (Exception e) | ||
1501 | { | ||
1502 | m_log.ErrorFormat( | ||
1503 | "[EVENT MANAGER]: Delegate for TerrainCheckUpdates failed - continuing. {0} {1}", | ||
1504 | e.Message, e.StackTrace); | ||
1505 | } | ||
1506 | } | ||
1507 | } | ||
1508 | } | ||
1509 | |||
1487 | public void TriggerTerrainTainted() | 1510 | public void TriggerTerrainTainted() |
1488 | { | 1511 | { |
1489 | OnTerrainTaintedDelegate handlerTerrainTainted = OnTerrainTainted; | 1512 | OnTerrainTaintedDelegate handlerTerrainTainted = OnTerrainTainted; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d6a1fab..41f8871 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -245,8 +245,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
245 | get { return m_defaultDrawDistance; } | 245 | get { return m_defaultDrawDistance; } |
246 | } | 246 | } |
247 | 247 | ||
248 | // protected float m_maxDrawDistance = 512.0f; | 248 | protected float m_maxDrawDistance = 512.0f; |
249 | protected float m_maxDrawDistance = 256.0f; | 249 | // protected float m_maxDrawDistance = 256.0f; |
250 | public float MaxDrawDistance | 250 | public float MaxDrawDistance |
251 | { | 251 | { |
252 | get { return m_maxDrawDistance; } | 252 | get { return m_maxDrawDistance; } |
@@ -1581,13 +1581,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1581 | EventManager.TriggerRegionHeartbeatStart(this); | 1581 | EventManager.TriggerRegionHeartbeatStart(this); |
1582 | 1582 | ||
1583 | // Apply taints in terrain module to terrain in physics scene | 1583 | // Apply taints in terrain module to terrain in physics scene |
1584 | |||
1585 | tmpMS = Util.EnvironmentTickCount(); | ||
1586 | if (Frame % 4 == 0) | ||
1587 | { | ||
1588 | CheckTerrainUpdates(); | ||
1589 | } | ||
1590 | |||
1584 | if (Frame % m_update_terrain == 0) | 1591 | if (Frame % m_update_terrain == 0) |
1585 | { | 1592 | { |
1586 | tmpMS = Util.EnvironmentTickCount(); | ||
1587 | UpdateTerrain(); | 1593 | UpdateTerrain(); |
1588 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); | ||
1589 | } | 1594 | } |
1590 | 1595 | ||
1596 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); | ||
1597 | |||
1591 | tmpMS = Util.EnvironmentTickCount(); | 1598 | tmpMS = Util.EnvironmentTickCount(); |
1592 | if (PhysicsEnabled && Frame % m_update_physics == 0) | 1599 | if (PhysicsEnabled && Frame % m_update_physics == 0) |
1593 | m_sceneGraph.UpdatePreparePhysics(); | 1600 | m_sceneGraph.UpdatePreparePhysics(); |
@@ -1809,6 +1816,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1809 | EventManager.TriggerTerrainTick(); | 1816 | EventManager.TriggerTerrainTick(); |
1810 | } | 1817 | } |
1811 | 1818 | ||
1819 | private void CheckTerrainUpdates() | ||
1820 | { | ||
1821 | EventManager.TriggerTerrainCheckUpdates(); | ||
1822 | } | ||
1823 | |||
1812 | /// <summary> | 1824 | /// <summary> |
1813 | /// Back up queued up changes | 1825 | /// Back up queued up changes |
1814 | /// </summary> | 1826 | /// </summary> |
@@ -5880,11 +5892,12 @@ Environment.Exit(1); | |||
5880 | /// or corssing the broder walking, but will NOT prevent | 5892 | /// or corssing the broder walking, but will NOT prevent |
5881 | /// child agent creation, thereby emulating the SL behavior. | 5893 | /// child agent creation, thereby emulating the SL behavior. |
5882 | /// </remarks> | 5894 | /// </remarks> |
5883 | /// <param name='agentID'></param> | 5895 | /// <param name='agentID'>The visitor's User ID</param> |
5896 | /// <param name="agentHomeURI">The visitor's Home URI (may be null)</param> | ||
5884 | /// <param name='position'></param> | 5897 | /// <param name='position'></param> |
5885 | /// <param name='reason'></param> | 5898 | /// <param name='reason'></param> |
5886 | /// <returns></returns> | 5899 | /// <returns></returns> |
5887 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5900 | public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason) |
5888 | { | 5901 | { |
5889 | reason = "You are banned from the region"; | 5902 | reason = "You are banned from the region"; |
5890 | 5903 | ||
@@ -5894,6 +5907,10 @@ Environment.Exit(1); | |||
5894 | return true; | 5907 | return true; |
5895 | } | 5908 | } |
5896 | 5909 | ||
5910 | |||
5911 | // if (!AllowAvatarCrossing && !viaTeleport) | ||
5912 | // return false; | ||
5913 | |||
5897 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5914 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5898 | // However, the long term fix is to make sure root agent count is always accurate. | 5915 | // However, the long term fix is to make sure root agent count is always accurate. |
5899 | m_sceneGraph.RecalculateStats(); | 5916 | m_sceneGraph.RecalculateStats(); |