aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs2
-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
-rw-r--r--OpenSim/Region/Framework/Interfaces/IDwellModule.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs3
6 files changed, 66 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 5b3c3e6..6a3960d 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -3114,7 +3114,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3114 float dwell = 0.0f; 3114 float dwell = 0.0f;
3115 IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>(); 3115 IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
3116 if (dwellModule != null) 3116 if (dwellModule != null)
3117 dwell = dwellModule.GetDwell(land.GlobalID); 3117 dwell = dwellModule.GetDwell(land);
3118 ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); 3118 ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
3119 reply.AgentData.AgentID = m_agentId; 3119 reply.AgentData.AgentID = m_agentId;
3120 reply.Data.ParcelID = parcelID; 3120 reply.Data.ParcelID = parcelID;
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()
diff --git a/OpenSim/Region/Framework/Interfaces/IDwellModule.cs b/OpenSim/Region/Framework/Interfaces/IDwellModule.cs
index db50439..ebef5a4 100644
--- a/OpenSim/Region/Framework/Interfaces/IDwellModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IDwellModule.cs
@@ -33,5 +33,6 @@ namespace OpenSim.Region.Framework.Interfaces
33 public interface IDwellModule 33 public interface IDwellModule
34 { 34 {
35 int GetDwell(UUID parcelID); 35 int GetDwell(UUID parcelID);
36 int GetDwell(LandData land);
36 } 37 }
37} 38}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6d4cb52..805c9ad 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -170,6 +170,7 @@ namespace OpenSim.Region.Framework.Scenes
170 private bool m_previusParcelHide = false; 170 private bool m_previusParcelHide = false;
171 private bool m_currentParcelHide = false; 171 private bool m_currentParcelHide = false;
172 private object parcelLock = new Object(); 172 private object parcelLock = new Object();
173 public double ParcelDwellTickMS;
173 174
174 public UUID currentParcelUUID 175 public UUID currentParcelUUID
175 { 176 {
@@ -182,6 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
182 bool checksame = true; 183 bool checksame = true;
183 if (value != m_currentParcelUUID) 184 if (value != m_currentParcelUUID)
184 { 185 {
186 ParcelDwellTickMS = Util.GetTimeStampMS();
185 m_previusParcelHide = m_currentParcelHide; 187 m_previusParcelHide = m_currentParcelHide;
186 m_previusParcelUUID = m_currentParcelUUID; 188 m_previusParcelUUID = m_currentParcelUUID;
187 checksame = false; 189 checksame = false;
@@ -2141,6 +2143,7 @@ namespace OpenSim.Region.Framework.Scenes
2141 m_previusParcelUUID = UUID.Zero; 2143 m_previusParcelUUID = UUID.Zero;
2142 m_currentParcelHide = false; 2144 m_currentParcelHide = false;
2143 m_currentParcelUUID = UUID.Zero; 2145 m_currentParcelUUID = UUID.Zero;
2146 ParcelDwellTickMS = Util.GetTimeStampMS();
2144 2147
2145 if(!IsNPC) 2148 if(!IsNPC)
2146 { 2149 {