diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land/LandObject.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 2b5cb31..cb54184 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
270 | m_scene = scene; | 270 | m_scene = scene; |
271 | } | 271 | } |
272 | 272 | ||
273 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) | 273 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene, LandData data = null) |
274 | { | 274 | { |
275 | m_scene = scene; | 275 | m_scene = scene; |
276 | if (m_scene == null) | 276 | if (m_scene == null) |
@@ -278,12 +278,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
278 | else | 278 | else |
279 | LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; | 279 | LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; |
280 | 280 | ||
281 | LandData = new LandData(); | 281 | if(data == null) |
282 | LandData = new LandData(); | ||
283 | else | ||
284 | LandData = data; | ||
285 | |||
282 | LandData.OwnerID = owner_id; | 286 | LandData.OwnerID = owner_id; |
283 | if (is_group_owned) | 287 | if (is_group_owned) |
284 | LandData.GroupID = owner_id; | 288 | LandData.GroupID = owner_id; |
285 | else | 289 | else |
286 | LandData.GroupID = UUID.Zero; | 290 | LandData.GroupID = UUID.Zero; |
291 | |||
287 | LandData.IsGroupOwned = is_group_owned; | 292 | LandData.IsGroupOwned = is_group_owned; |
288 | 293 | ||
289 | m_scene.EventManager.OnFrame += OnFrame; | 294 | m_scene.EventManager.OnFrame += OnFrame; |
@@ -1812,6 +1817,37 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1812 | ExpireAccessList(); | 1817 | ExpireAccessList(); |
1813 | m_expiryCounter = 0; | 1818 | m_expiryCounter = 0; |
1814 | } | 1819 | } |
1820 | |||
1821 | // need to update dwell here bc landdata has no parent info | ||
1822 | if(LandData != null) | ||
1823 | { | ||
1824 | double now = Util.GetTimeStampMS(); | ||
1825 | double elapsed = now - LandData.LastDwellTimeMS; | ||
1826 | if(elapsed > 150000) //2.5 minutes resolution / throttle | ||
1827 | { | ||
1828 | float dwell = LandData.Dwell; | ||
1829 | double cur = dwell * 60000.0; | ||
1830 | double decay = 1.5e-8 * cur * elapsed; | ||
1831 | cur -= decay; | ||
1832 | if(cur < 0) | ||
1833 | cur = 0; | ||
1834 | |||
1835 | UUID lgid = LandData.GlobalID; | ||
1836 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | ||
1837 | { | ||
1838 | if(sp.IsNPC || sp.IsLoggingIn || sp.IsDeleted || sp.currentParcelUUID != lgid) | ||
1839 | return; | ||
1840 | cur += (now - sp.ParcelDwellTickMS); | ||
1841 | sp.ParcelDwellTickMS = now; | ||
1842 | }); | ||
1843 | |||
1844 | float newdwell = (float)(cur * 1.666666666667e-5); | ||
1845 | LandData.Dwell = newdwell; | ||
1846 | |||
1847 | if(Math.Abs(newdwell - dwell) > 1.0) | ||
1848 | m_scene.EventManager.TriggerLandObjectAdded(this); | ||
1849 | } | ||
1850 | } | ||
1815 | } | 1851 | } |
1816 | 1852 | ||
1817 | private void ExpireAccessList() | 1853 | private void ExpireAccessList() |