aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Land
diff options
context:
space:
mode:
authorUbitUmarov2017-05-14 01:44:04 +0100
committerUbitUmarov2017-05-14 01:44:04 +0100
commitcb21caae777341b7b4af724e86b9a82b9b827c43 (patch)
treed4eb86f9ba6fc1fd1c35015a335e7a1a55fa0ad1 /OpenSim/Region/CoreModules/World/Land
parentfind parcels by GlobalID.. well most time (diff)
downloadopensim-SC-cb21caae777341b7b4af724e86b9a82b9b827c43.zip
opensim-SC-cb21caae777341b7b4af724e86b9a82b9b827c43.tar.gz
opensim-SC-cb21caae777341b7b4af724e86b9a82b9b827c43.tar.bz2
opensim-SC-cb21caae777341b7b4af724e86b9a82b9b827c43.tar.xz
fix some issue on parcels loading and make parcels dwell show something. Resolution is 2.5min aprox.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/DwellModule.cs26
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs16
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs40
3 files changed, 61 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs
index 5f1eab2..55a341e 100644
--- a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs
@@ -53,7 +53,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
53namespace OpenSim.Region.CoreModules.World.Land 53namespace OpenSim.Region.CoreModules.World.Land
54{ 54{
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultDwellModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultDwellModule")]
56 public class DefaultDwellModule : IDwellModule, INonSharedRegionModule 56 public class DefaultDwellModule : INonSharedRegionModule, IDwellModule
57 { 57 {
58 private Scene m_scene; 58 private Scene m_scene;
59 private IConfigSource m_Config; 59 private IConfigSource m_Config;
@@ -88,16 +88,21 @@ namespace OpenSim.Region.CoreModules.World.Land
88 return; 88 return;
89 89
90 m_scene = scene; 90 m_scene = scene;
91 91 m_scene.RegisterModuleInterface<IDwellModule>(this);
92 m_scene.EventManager.OnNewClient += OnNewClient;
93 } 92 }
94 93
95 public void RegionLoaded(Scene scene) 94 public void RegionLoaded(Scene scene)
96 { 95 {
96 if (!m_Enabled)
97 return;
98 m_scene.EventManager.OnNewClient += OnNewClient;
97 } 99 }
98 100
99 public void RemoveRegion(Scene scene) 101 public void RemoveRegion(Scene scene)
100 { 102 {
103 if (!m_Enabled)
104 return;
105 m_scene.EventManager.OnNewClient -= OnNewClient;
101 } 106 }
102 107
103 public void Close() 108 public void Close()
@@ -115,15 +120,26 @@ namespace OpenSim.Region.CoreModules.World.Land
115 if (parcel == null) 120 if (parcel == null)
116 return; 121 return;
117 122
118 client.SendParcelDwellReply(localID, parcel.LandData.GlobalID, parcel.LandData.Dwell); 123 LandData land = parcel.LandData;
124 if(land!= null)
125 client.SendParcelDwellReply(localID, land.GlobalID, land.Dwell);
119 } 126 }
120 127
128
121 public int GetDwell(UUID parcelID) 129 public int GetDwell(UUID parcelID)
122 { 130 {
123 ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelID); 131 ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelID);
124 if (parcel != null && parcel.LandData != null) 132 if (parcel != null && parcel.LandData != null)
125 return (int)parcel.LandData.Dwell; 133 return (int)(parcel.LandData.Dwell + 0.5f);
134 return 0;
135 }
136
137 public int GetDwell(LandData land)
138 {
139 if (land != null)
140 return (int)(land.Dwell + 0.5f);
126 return 0; 141 return 0;
127 } 142 }
143
128 } 144 }
129} 145}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index e1f2975..ce982a2 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -439,15 +439,6 @@ namespace OpenSim.Region.CoreModules.World.Land
439 if (parcelAvatarIsEntering != null && 439 if (parcelAvatarIsEntering != null &&
440 avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID) 440 avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID)
441 { 441 {
442 if(!avatar.IsNPC && avatar.currentParcelUUID != UUID.Zero)
443 {
444 ILandObject last = GetLandObject(avatar.currentParcelUUID);
445 if(last != null)
446 {
447
448 }
449 }
450
451 SendLandUpdate(avatar, parcelAvatarIsEntering); 442 SendLandUpdate(avatar, parcelAvatarIsEntering);
452 avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID; 443 avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID;
453 EnforceBans(parcelAvatarIsEntering, avatar); 444 EnforceBans(parcelAvatarIsEntering, avatar);
@@ -602,10 +593,8 @@ namespace OpenSim.Region.CoreModules.World.Land
602 /// The land object being added. 593 /// The land object being added.
603 /// Will return null if this overlaps with an existing parcel that has not had its bitmap adjusted. 594 /// Will return null if this overlaps with an existing parcel that has not had its bitmap adjusted.
604 /// </param> 595 /// </param>
605 public ILandObject AddLandObject(ILandObject land) 596 public ILandObject AddLandObject(ILandObject new_land)
606 { 597 {
607 ILandObject new_land = land.Copy();
608
609 // Only now can we add the prim counts to the land object - we rely on the global ID which is generated 598 // Only now can we add the prim counts to the land object - we rely on the global ID which is generated
610 // as a random UUID inside LandData initialization 599 // as a random UUID inside LandData initialization
611 if (m_primCountModule != null) 600 if (m_primCountModule != null)
@@ -1621,8 +1610,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1621 1610
1622 private void IncomingLandObjectFromStorage(LandData data) 1611 private void IncomingLandObjectFromStorage(LandData data)
1623 { 1612 {
1624 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1613 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene, data);
1625 new_land.LandData = data.Copy();
1626 1614
1627 new_land.SetLandBitmapFromByteArray(); 1615 new_land.SetLandBitmapFromByteArray();
1628 AddLandObject(new_land); 1616 AddLandObject(new_land);
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()