diff options
Diffstat (limited to 'OpenSim/Region')
11 files changed, 164 insertions, 35 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 5cb6a88..bc6d7b3 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -74,7 +74,12 @@ namespace OpenSim | |||
74 | AppDomain.CurrentDomain.UnhandledException += | 74 | AppDomain.CurrentDomain.UnhandledException += |
75 | new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); | 75 | new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); |
76 | 76 | ||
77 | ServicePointManager.DefaultConnectionLimit = 12; | 77 | if(Util.IsWindows()) |
78 | ServicePointManager.DefaultConnectionLimit = 32; | ||
79 | else | ||
80 | ServicePointManager.DefaultConnectionLimit = 12; | ||
81 | |||
82 | ServicePointManager.Expect100Continue = false; | ||
78 | ServicePointManager.UseNagleAlgorithm = false; | 83 | ServicePointManager.UseNagleAlgorithm = false; |
79 | 84 | ||
80 | // Add the arguments supplied when running the application to the configuration | 85 | // Add the arguments supplied when running the application to the configuration |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5b3c3e6..298c933 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -3111,10 +3111,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3111 | 3111 | ||
3112 | public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) | 3112 | public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) |
3113 | { | 3113 | { |
3114 | float dwell = 0.0f; | ||
3115 | IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>(); | ||
3116 | if (dwellModule != null) | ||
3117 | dwell = dwellModule.GetDwell(land.GlobalID); | ||
3118 | ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); | 3114 | ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); |
3119 | reply.AgentData.AgentID = m_agentId; | 3115 | reply.AgentData.AgentID = m_agentId; |
3120 | reply.Data.ParcelID = parcelID; | 3116 | reply.Data.ParcelID = parcelID; |
@@ -3141,7 +3137,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3141 | reply.Data.GlobalZ = pos.Z; | 3137 | reply.Data.GlobalZ = pos.Z; |
3142 | reply.Data.SimName = Utils.StringToBytes(info.RegionName); | 3138 | reply.Data.SimName = Utils.StringToBytes(info.RegionName); |
3143 | reply.Data.SnapshotID = land.SnapshotID; | 3139 | reply.Data.SnapshotID = land.SnapshotID; |
3144 | reply.Data.Dwell = dwell; | 3140 | reply.Data.Dwell = land.Dwell; |
3145 | reply.Data.SalePrice = land.SalePrice; | 3141 | reply.Data.SalePrice = land.SalePrice; |
3146 | reply.Data.AuctionID = (int)land.AuctionID; | 3142 | reply.Data.AuctionID = (int)land.AuctionID; |
3147 | 3143 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs index 21483c5..fb8c306 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs | |||
@@ -151,7 +151,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land | |||
151 | x = rx - s.RegionInfo.WorldLocX; | 151 | x = rx - s.RegionInfo.WorldLocX; |
152 | y = ry - s.RegionInfo.WorldLocY; | 152 | y = ry - s.RegionInfo.WorldLocY; |
153 | regionAccess = s.RegionInfo.AccessLevel; | 153 | regionAccess = s.RegionInfo.AccessLevel; |
154 | return s.GetLandData(x, y); | 154 | LandData land = s.GetLandData(x, y); |
155 | IDwellModule dwellModule = s.RequestModuleInterface<IDwellModule>(); | ||
156 | if (dwellModule != null) | ||
157 | land.Dwell = dwellModule.GetDwell(land); | ||
158 | return land; | ||
155 | } | 159 | } |
156 | } | 160 | } |
157 | m_log.DebugFormat("[LAND IN CONNECTOR]: region handle {0} not found", regionHandle); | 161 | m_log.DebugFormat("[LAND IN CONNECTOR]: region handle {0} not found", regionHandle); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs index cad2061..8baf41a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs | |||
@@ -143,6 +143,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land | |||
143 | { | 143 | { |
144 | LandData land = s.GetLandData(x, y); | 144 | LandData land = s.GetLandData(x, y); |
145 | regionAccess = s.RegionInfo.AccessLevel; | 145 | regionAccess = s.RegionInfo.AccessLevel; |
146 | IDwellModule dwellModule = s.RequestModuleInterface<IDwellModule>(); | ||
147 | if (dwellModule != null) | ||
148 | land.Dwell = dwellModule.GetDwell(land); | ||
149 | |||
146 | return land; | 150 | return land; |
147 | } | 151 | } |
148 | } | 152 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs index 70c6028..22480e6 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; | |||
53 | namespace OpenSim.Region.CoreModules.World.Land | 53 | namespace 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,12 +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 | { |
131 | ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelID); | ||
132 | if (parcel != null && parcel.LandData != null) | ||
133 | return (int)(parcel.LandData.Dwell); | ||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | public int GetDwell(LandData land) | ||
138 | { | ||
139 | if (land != null) | ||
140 | return (int)(land.Dwell); | ||
123 | return 0; | 141 | return 0; |
124 | } | 142 | } |
143 | |||
125 | } | 144 | } |
126 | } | 145 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index e4c0373..b59e2af 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs | |||
@@ -106,6 +106,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
106 | return null; | 106 | return null; |
107 | } | 107 | } |
108 | 108 | ||
109 | public ILandObject GetLandObject(UUID GlobalID) | ||
110 | { | ||
111 | if (m_landManagementModule != null) | ||
112 | { | ||
113 | return m_landManagementModule.GetLandObject(GlobalID); | ||
114 | } | ||
115 | return null; | ||
116 | } | ||
117 | |||
109 | public ILandObject GetLandObject(Vector3 position) | 118 | public ILandObject GetLandObject(Vector3 position) |
110 | { | 119 | { |
111 | return GetLandObject(position.X, position.Y); | 120 | return GetLandObject(position.X, position.Y); |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 53b9796..057e204 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -92,6 +92,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
92 | 92 | ||
93 | //ubit: removed the readonly so i can move it around | 93 | //ubit: removed the readonly so i can move it around |
94 | private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); | 94 | private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); |
95 | private Dictionary<UUID, int> m_landUUIDList = new Dictionary<UUID, int>(); | ||
95 | 96 | ||
96 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 97 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
97 | 98 | ||
@@ -249,7 +250,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
249 | lock (m_landList) | 250 | lock (m_landList) |
250 | { | 251 | { |
251 | if (m_landList.TryGetValue(local_id, out land)) | 252 | if (m_landList.TryGetValue(local_id, out land)) |
253 | { | ||
252 | land.LandData = newData; | 254 | land.LandData = newData; |
255 | m_landUUIDList[newData.GlobalID] = local_id; | ||
256 | } | ||
253 | } | 257 | } |
254 | 258 | ||
255 | if (land != null) | 259 | if (land != null) |
@@ -270,7 +274,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
270 | //Remove all the land objects in the sim and add a blank, full sim land object set to public | 274 | //Remove all the land objects in the sim and add a blank, full sim land object set to public |
271 | lock (m_landList) | 275 | lock (m_landList) |
272 | { | 276 | { |
277 | foreach(ILandObject parcel in m_landList.Values) | ||
278 | parcel.Clear(); | ||
279 | |||
273 | m_landList.Clear(); | 280 | m_landList.Clear(); |
281 | m_landUUIDList.Clear(); | ||
274 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 282 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
275 | 283 | ||
276 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; | 284 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; |
@@ -588,10 +596,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
588 | /// The land object being added. | 596 | /// The land object being added. |
589 | /// Will return null if this overlaps with an existing parcel that has not had its bitmap adjusted. | 597 | /// Will return null if this overlaps with an existing parcel that has not had its bitmap adjusted. |
590 | /// </param> | 598 | /// </param> |
591 | public ILandObject AddLandObject(ILandObject land) | 599 | public ILandObject AddLandObject(ILandObject new_land) |
592 | { | 600 | { |
593 | ILandObject new_land = land.Copy(); | ||
594 | |||
595 | // Only now can we add the prim counts to the land object - we rely on the global ID which is generated | 601 | // Only now can we add the prim counts to the land object - we rely on the global ID which is generated |
596 | // as a random UUID inside LandData initialization | 602 | // as a random UUID inside LandData initialization |
597 | if (m_primCountModule != null) | 603 | if (m_primCountModule != null) |
@@ -656,6 +662,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
656 | } | 662 | } |
657 | 663 | ||
658 | m_landList.Add(newLandLocalID, new_land); | 664 | m_landList.Add(newLandLocalID, new_land); |
665 | m_landUUIDList[new_land.LandData.GlobalID] = newLandLocalID; | ||
659 | m_lastLandLocalID++; | 666 | m_lastLandLocalID++; |
660 | } | 667 | } |
661 | 668 | ||
@@ -690,6 +697,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
690 | 697 | ||
691 | land = m_landList[local_id]; | 698 | land = m_landList[local_id]; |
692 | m_landList.Remove(local_id); | 699 | m_landList.Remove(local_id); |
700 | if(land.LandData != null) | ||
701 | m_landUUIDList.Remove(land.LandData.GlobalID); | ||
702 | land.Clear(); | ||
693 | } | 703 | } |
694 | 704 | ||
695 | m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID); | 705 | m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID); |
@@ -740,11 +750,29 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
740 | } | 750 | } |
741 | } | 751 | } |
742 | } | 752 | } |
743 | 753 | master.LandData.Dwell += slave.LandData.Dwell; | |
744 | removeLandObject(slave.LandData.LocalID); | 754 | removeLandObject(slave.LandData.LocalID); |
745 | UpdateLandObject(master.LandData.LocalID, master.LandData); | 755 | UpdateLandObject(master.LandData.LocalID, master.LandData); |
746 | } | 756 | } |
747 | 757 | ||
758 | public ILandObject GetLandObject(UUID globalID) | ||
759 | { | ||
760 | lock (m_landList) | ||
761 | { | ||
762 | int lid = -1; | ||
763 | if(m_landUUIDList.TryGetValue(globalID, out lid) && lid >= 0) | ||
764 | { | ||
765 | if (m_landList.ContainsKey(lid)) | ||
766 | { | ||
767 | return m_landList[lid]; | ||
768 | } | ||
769 | else | ||
770 | m_landUUIDList.Remove(globalID); // auto heal | ||
771 | } | ||
772 | } | ||
773 | return null; | ||
774 | } | ||
775 | |||
748 | public ILandObject GetLandObject(int parcelLocalID) | 776 | public ILandObject GetLandObject(int parcelLocalID) |
749 | { | 777 | { |
750 | lock (m_landList) | 778 | lock (m_landList) |
@@ -1351,7 +1379,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1351 | 1379 | ||
1352 | public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client) | 1380 | public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client) |
1353 | { | 1381 | { |
1354 | ILandObject land; | 1382 | ILandObject land = null; |
1355 | lock (m_landList) | 1383 | lock (m_landList) |
1356 | { | 1384 | { |
1357 | m_landList.TryGetValue(local_id, out land); | 1385 | m_landList.TryGetValue(local_id, out land); |
@@ -1360,7 +1388,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1360 | if (land != null) | 1388 | if (land != null) |
1361 | { | 1389 | { |
1362 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 1390 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
1363 | m_landList[local_id].SendLandObjectOwners(remote_client); | 1391 | land.SendLandObjectOwners(remote_client); |
1364 | } | 1392 | } |
1365 | else | 1393 | else |
1366 | { | 1394 | { |
@@ -1370,7 +1398,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1370 | 1398 | ||
1371 | public void ClientOnParcelGodForceOwner(int local_id, UUID ownerID, IClientAPI remote_client) | 1399 | public void ClientOnParcelGodForceOwner(int local_id, UUID ownerID, IClientAPI remote_client) |
1372 | { | 1400 | { |
1373 | ILandObject land; | 1401 | ILandObject land = null; |
1374 | lock (m_landList) | 1402 | lock (m_landList) |
1375 | { | 1403 | { |
1376 | m_landList.TryGetValue(local_id, out land); | 1404 | m_landList.TryGetValue(local_id, out land); |
@@ -1393,7 +1421,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1393 | 1421 | ||
1394 | public void ClientOnParcelAbandonRequest(int local_id, IClientAPI remote_client) | 1422 | public void ClientOnParcelAbandonRequest(int local_id, IClientAPI remote_client) |
1395 | { | 1423 | { |
1396 | ILandObject land; | 1424 | ILandObject land = null; |
1397 | lock (m_landList) | 1425 | lock (m_landList) |
1398 | { | 1426 | { |
1399 | m_landList.TryGetValue(local_id, out land); | 1427 | m_landList.TryGetValue(local_id, out land); |
@@ -1417,7 +1445,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1417 | 1445 | ||
1418 | public void ClientOnParcelReclaim(int local_id, IClientAPI remote_client) | 1446 | public void ClientOnParcelReclaim(int local_id, IClientAPI remote_client) |
1419 | { | 1447 | { |
1420 | ILandObject land; | 1448 | ILandObject land = null; |
1421 | lock (m_landList) | 1449 | lock (m_landList) |
1422 | { | 1450 | { |
1423 | m_landList.TryGetValue(local_id, out land); | 1451 | m_landList.TryGetValue(local_id, out land); |
@@ -1503,17 +1531,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1503 | 1531 | ||
1504 | void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client) | 1532 | void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client) |
1505 | { | 1533 | { |
1506 | ILandObject land; | 1534 | ILandObject land = null; |
1507 | lock (m_landList) | 1535 | lock (m_landList) |
1508 | { | 1536 | { |
1509 | m_landList.TryGetValue(parcelLocalID, out land); | 1537 | m_landList.TryGetValue(parcelLocalID, out land); |
1510 | } | 1538 | } |
1511 | 1539 | ||
1512 | if (!m_scene.Permissions.CanDeedParcel(remote_client.AgentId, land)) | ||
1513 | return; | ||
1514 | |||
1515 | if (land != null) | 1540 | if (land != null) |
1516 | { | 1541 | { |
1542 | if (!m_scene.Permissions.CanDeedParcel(remote_client.AgentId, land)) | ||
1543 | return; | ||
1517 | land.DeedToGroup(groupID); | 1544 | land.DeedToGroup(groupID); |
1518 | } | 1545 | } |
1519 | } | 1546 | } |
@@ -1587,8 +1614,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1587 | 1614 | ||
1588 | private void IncomingLandObjectFromStorage(LandData data) | 1615 | private void IncomingLandObjectFromStorage(LandData data) |
1589 | { | 1616 | { |
1590 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1617 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene, data); |
1591 | new_land.LandData = data.Copy(); | ||
1592 | 1618 | ||
1593 | new_land.SetLandBitmapFromByteArray(); | 1619 | new_land.SetLandBitmapFromByteArray(); |
1594 | AddLandObject(new_land); | 1620 | AddLandObject(new_land); |
@@ -1763,7 +1789,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1763 | land_update.GroupAVSounds = true; | 1789 | land_update.GroupAVSounds = true; |
1764 | } | 1790 | } |
1765 | 1791 | ||
1766 | ILandObject land; | 1792 | ILandObject land = null; |
1767 | lock (m_landList) | 1793 | lock (m_landList) |
1768 | { | 1794 | { |
1769 | m_landList.TryGetValue(parcelID, out land); | 1795 | m_landList.TryGetValue(parcelID, out land); |
@@ -1926,6 +1952,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1926 | if (data.RegionHandle == m_scene.RegionInfo.RegionHandle) | 1952 | if (data.RegionHandle == m_scene.RegionInfo.RegionHandle) |
1927 | { | 1953 | { |
1928 | info = new GridRegion(m_scene.RegionInfo); | 1954 | info = new GridRegion(m_scene.RegionInfo); |
1955 | IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>(); | ||
1956 | if (dwellModule != null) | ||
1957 | data.LandData.Dwell = dwellModule.GetDwell(data.LandData); | ||
1929 | } | 1958 | } |
1930 | else | 1959 | else |
1931 | { | 1960 | { |
@@ -1951,7 +1980,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1951 | 1980 | ||
1952 | public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) | 1981 | public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) |
1953 | { | 1982 | { |
1954 | ILandObject land; | 1983 | ILandObject land = null; |
1955 | lock (m_landList) | 1984 | lock (m_landList) |
1956 | { | 1985 | { |
1957 | m_landList.TryGetValue(localID, out land); | 1986 | m_landList.TryGetValue(localID, out land); |
@@ -2248,7 +2277,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2248 | if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[2], out landLocalId)) | 2277 | if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[2], out landLocalId)) |
2249 | return; | 2278 | return; |
2250 | 2279 | ||
2251 | ILandObject lo; | 2280 | ILandObject lo = null; |
2252 | 2281 | ||
2253 | lock (m_landList) | 2282 | lock (m_landList) |
2254 | { | 2283 | { |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 2b5cb31..b534a2b 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -58,6 +58,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
58 | 58 | ||
59 | protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); | 59 | protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); |
60 | protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds | 60 | protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds |
61 | IDwellModule m_dwellModule; | ||
61 | 62 | ||
62 | private bool[,] m_landBitmap; | 63 | private bool[,] m_landBitmap; |
63 | public bool[,] LandBitmap | 64 | public bool[,] LandBitmap |
@@ -268,27 +269,48 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
268 | { | 269 | { |
269 | LandData = landData.Copy(); | 270 | LandData = landData.Copy(); |
270 | m_scene = scene; | 271 | m_scene = scene; |
272 | m_scene.EventManager.OnFrame += OnFrame; | ||
273 | m_dwellModule = m_scene.RequestModuleInterface<IDwellModule>(); | ||
271 | } | 274 | } |
272 | 275 | ||
273 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) | 276 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene, LandData data = null) |
274 | { | 277 | { |
275 | m_scene = scene; | 278 | m_scene = scene; |
276 | if (m_scene == null) | 279 | if (m_scene == null) |
277 | LandBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit]; | 280 | LandBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit]; |
278 | else | 281 | else |
282 | { | ||
279 | LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; | 283 | LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; |
284 | m_dwellModule = m_scene.RequestModuleInterface<IDwellModule>(); | ||
285 | } | ||
286 | |||
287 | if(data == null) | ||
288 | LandData = new LandData(); | ||
289 | else | ||
290 | LandData = data; | ||
280 | 291 | ||
281 | LandData = new LandData(); | ||
282 | LandData.OwnerID = owner_id; | 292 | LandData.OwnerID = owner_id; |
283 | if (is_group_owned) | 293 | if (is_group_owned) |
284 | LandData.GroupID = owner_id; | 294 | LandData.GroupID = owner_id; |
285 | else | 295 | else |
286 | LandData.GroupID = UUID.Zero; | 296 | LandData.GroupID = UUID.Zero; |
297 | |||
287 | LandData.IsGroupOwned = is_group_owned; | 298 | LandData.IsGroupOwned = is_group_owned; |
288 | 299 | ||
300 | if(m_dwellModule == null) | ||
301 | LandData.Dwell = 0; | ||
302 | |||
289 | m_scene.EventManager.OnFrame += OnFrame; | 303 | m_scene.EventManager.OnFrame += OnFrame; |
290 | } | 304 | } |
291 | 305 | ||
306 | public void Clear() | ||
307 | { | ||
308 | if(m_scene != null) | ||
309 | m_scene.EventManager.OnFrame -= OnFrame; | ||
310 | LandData = null; | ||
311 | } | ||
312 | |||
313 | |||
292 | #endregion | 314 | #endregion |
293 | 315 | ||
294 | #region Member Functions | 316 | #region Member Functions |
@@ -1812,6 +1834,37 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1812 | ExpireAccessList(); | 1834 | ExpireAccessList(); |
1813 | m_expiryCounter = 0; | 1835 | m_expiryCounter = 0; |
1814 | } | 1836 | } |
1837 | |||
1838 | // need to update dwell here bc landdata has no parent info | ||
1839 | if(LandData != null && m_dwellModule != null) | ||
1840 | { | ||
1841 | double now = Util.GetTimeStampMS(); | ||
1842 | double elapsed = now - LandData.LastDwellTimeMS; | ||
1843 | if(elapsed > 150000) //2.5 minutes resolution / throttle | ||
1844 | { | ||
1845 | float dwell = LandData.Dwell; | ||
1846 | double cur = dwell * 60000.0; | ||
1847 | double decay = 1.5e-8 * cur * elapsed; | ||
1848 | cur -= decay; | ||
1849 | if(cur < 0) | ||
1850 | cur = 0; | ||
1851 | |||
1852 | UUID lgid = LandData.GlobalID; | ||
1853 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | ||
1854 | { | ||
1855 | if(sp.IsNPC || sp.IsLoggingIn || sp.IsDeleted || sp.currentParcelUUID != lgid) | ||
1856 | return; | ||
1857 | cur += (now - sp.ParcelDwellTickMS); | ||
1858 | sp.ParcelDwellTickMS = now; | ||
1859 | }); | ||
1860 | |||
1861 | float newdwell = (float)(cur * 1.666666666667e-5); | ||
1862 | LandData.Dwell = newdwell; | ||
1863 | |||
1864 | if(Math.Abs(newdwell - dwell) >= 0.9) | ||
1865 | m_scene.EventManager.TriggerLandObjectAdded(this); | ||
1866 | } | ||
1867 | } | ||
1815 | } | 1868 | } |
1816 | 1869 | ||
1817 | private void ExpireAccessList() | 1870 | 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 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 1808c34..cc98bbb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -160,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
160 | ts.arc = arc; | 160 | ts.arc = arc; |
161 | ts.host = host; | 161 | ts.host = host; |
162 | 162 | ||
163 | ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); | 163 | ts.next = DateTime.UtcNow.AddSeconds(ts.interval); |
164 | 164 | ||
165 | AddSenseRepeater(ts); | 165 | AddSenseRepeater(ts); |
166 | } | 166 | } |
@@ -196,14 +196,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
196 | public void CheckSenseRepeaterEvents() | 196 | public void CheckSenseRepeaterEvents() |
197 | { | 197 | { |
198 | // Go through all timers | 198 | // Go through all timers |
199 | foreach (SensorInfo ts in SenseRepeaters) | 199 | |
200 | List<SensorInfo> curSensors; | ||
201 | lock(SenseRepeatListLock) | ||
202 | curSensors = SenseRepeaters; | ||
203 | |||
204 | DateTime now = DateTime.UtcNow; | ||
205 | foreach (SensorInfo ts in curSensors) | ||
200 | { | 206 | { |
201 | // Time has passed? | 207 | // Time has passed? |
202 | if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) | 208 | if (ts.next < now) |
203 | { | 209 | { |
204 | SensorSweep(ts); | 210 | SensorSweep(ts); |
205 | // set next interval | 211 | // set next interval |
206 | ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); | 212 | ts.next = now.AddSeconds(ts.interval); |
207 | } | 213 | } |
208 | } | 214 | } |
209 | } | 215 | } |