aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs18
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs73
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs456
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs79
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Region/RestartModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
12 files changed, 586 insertions, 112 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index edc5ba4..a22f619 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -292,6 +292,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver
292 // being no copy/no mod for everyone 292 // being no copy/no mod for everyone
293 lock (part.TaskInventory) 293 lock (part.TaskInventory)
294 { 294 {
295 if (!ResolveUserUuid(part.CreatorID))
296 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
297
298 if (!ResolveUserUuid(part.OwnerID))
299 part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
300
301 if (!ResolveUserUuid(part.LastOwnerID))
302 part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
303
304 // And zap any troublesome sit target information
305 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
306 part.SitTargetPosition = new Vector3(0, 0, 0);
307
308 // Fix ownership/creator of inventory items
309 // Not doing so results in inventory items
310 // being no copy/no mod for everyone
311 part.TaskInventory.LockItemsForRead(true);
295 TaskInventoryDictionary inv = part.TaskInventory; 312 TaskInventoryDictionary inv = part.TaskInventory;
296 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) 313 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
297 { 314 {
@@ -307,6 +324,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
307 if (UserManager != null) 324 if (UserManager != null)
308 UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); 325 UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData);
309 } 326 }
327 part.TaskInventory.LockItemsForRead(false);
310 } 328 }
311 } 329 }
312 330
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index 948aac8..900260d 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -251,18 +251,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
251 251
252 if (asset != null) 252 if (asset != null)
253 { 253 {
254 if (m_options.ContainsKey("verbose")) 254// m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id);
255 m_log.InfoFormat("[ARCHIVER]: Writing asset {0}", id);
256
257 m_foundAssetUuids.Add(asset.FullID); 255 m_foundAssetUuids.Add(asset.FullID);
258 256
259 m_assetsArchiver.WriteAsset(PostProcess(asset)); 257 m_assetsArchiver.WriteAsset(PostProcess(asset));
260 } 258 }
261 else 259 else
262 { 260 {
263 if (m_options.ContainsKey("verbose")) 261// m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id);
264 m_log.InfoFormat("[ARCHIVER]: Recording asset {0} as not found", id);
265
266 m_notFoundAssetUuids.Add(new UUID(id)); 262 m_notFoundAssetUuids.Add(new UUID(id));
267 } 263 }
268 264
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 58d9455..30695ff 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Security; 32using System.Security;
33using System.Timers;
33using log4net; 34using log4net;
34using Mono.Addins; 35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
@@ -47,6 +48,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
47 48
48 private delegate void LookupUUIDS(List<UUID> uuidLst); 49 private delegate void LookupUUIDS(List<UUID> uuidLst);
49 50
51 private Timer m_regionChangeTimer = new Timer();
50 public Scene Scene { get; private set; } 52 public Scene Scene { get; private set; }
51 public IUserManagement UserManager { get; private set; } 53 public IUserManagement UserManager { get; private set; }
52 54
@@ -60,6 +62,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
60 62
61 #region Packet Data Responders 63 #region Packet Data Responders
62 64
65 private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice)
66 {
67 sendDetailedEstateData(remote_client, invoice);
68 sendEstateLists(remote_client, invoice);
69 }
70
63 private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) 71 private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice)
64 { 72 {
65 uint sun = 0; 73 uint sun = 0;
@@ -81,7 +89,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
81 Scene.RegionInfo.RegionSettings.Covenant, 89 Scene.RegionInfo.RegionSettings.Covenant,
82 Scene.RegionInfo.EstateSettings.AbuseEmail, 90 Scene.RegionInfo.EstateSettings.AbuseEmail,
83 estateOwner); 91 estateOwner);
92 }
84 93
94 private void sendEstateLists(IClientAPI remote_client, UUID invoice)
95 {
85 remote_client.SendEstateList(invoice, 96 remote_client.SendEstateList(invoice,
86 (int)Constants.EstateAccessCodex.EstateManagers, 97 (int)Constants.EstateAccessCodex.EstateManagers,
87 Scene.RegionInfo.EstateSettings.EstateManagers, 98 Scene.RegionInfo.EstateSettings.EstateManagers,
@@ -256,7 +267,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
256 timeInSeconds -= 15; 267 timeInSeconds -= 15;
257 } 268 }
258 269
259 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); 270 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), false);
260 } 271 }
261 } 272 }
262 273
@@ -463,7 +474,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
463 { 474 {
464 if (!s.IsChildAgent) 475 if (!s.IsChildAgent)
465 { 476 {
466 Scene.TeleportClientHome(user, s.ControllingClient); 477 if (!Scene.TeleportClientHome(user, s.ControllingClient))
478 {
479 s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out.");
480 s.ControllingClient.Close();
481 }
467 } 482 }
468 } 483 }
469 484
@@ -472,7 +487,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
472 { 487 {
473 remote_client.SendAlertMessage("User is already on the region ban list"); 488 remote_client.SendAlertMessage("User is already on the region ban list");
474 } 489 }
475 //m_scene.RegionInfo.regionBanlist.Add(Manager(user); 490 //Scene.RegionInfo.regionBanlist.Add(Manager(user);
476 remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); 491 remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID);
477 } 492 }
478 else 493 else
@@ -527,7 +542,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
527 remote_client.SendAlertMessage("User is not on the region ban list"); 542 remote_client.SendAlertMessage("User is not on the region ban list");
528 } 543 }
529 544
530 //m_scene.RegionInfo.regionBanlist.Add(Manager(user); 545 //Scene.RegionInfo.regionBanlist.Add(Manager(user);
531 remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); 546 remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID);
532 } 547 }
533 else 548 else
@@ -648,7 +663,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
648 ScenePresence s = Scene.GetScenePresence(prey); 663 ScenePresence s = Scene.GetScenePresence(prey);
649 if (s != null) 664 if (s != null)
650 { 665 {
651 Scene.TeleportClientHome(prey, s.ControllingClient); 666 if (!Scene.TeleportClientHome(prey, s.ControllingClient))
667 {
668 s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out.");
669 s.ControllingClient.Close();
670 }
652 } 671 }
653 } 672 }
654 } 673 }
@@ -666,7 +685,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
666 // Also make sure they are actually in the region 685 // Also make sure they are actually in the region
667 ScenePresence p; 686 ScenePresence p;
668 if(Scene.TryGetScenePresence(client.AgentId, out p)) 687 if(Scene.TryGetScenePresence(client.AgentId, out p))
669 Scene.TeleportClientHome(p.UUID, p.ControllingClient); 688 {
689 if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient))
690 {
691 p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out.");
692 p.ControllingClient.Close();
693 }
694 }
670 } 695 }
671 }); 696 });
672 } 697 }
@@ -910,7 +935,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
910 935
911 for (int i = 0; i < uuidarr.Length; i++) 936 for (int i = 0; i < uuidarr.Length; i++)
912 { 937 {
913 // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); 938 // string lookupname = Scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
914 939
915 IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); 940 IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>();
916 if (userManager != null) 941 if (userManager != null)
@@ -1051,6 +1076,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
1051 1076
1052 public void AddRegion(Scene scene) 1077 public void AddRegion(Scene scene)
1053 { 1078 {
1079 m_regionChangeTimer.AutoReset = false;
1080 m_regionChangeTimer.Interval = 2000;
1081 m_regionChangeTimer.Elapsed += RaiseRegionInfoChange;
1082
1054 Scene = scene; 1083 Scene = scene;
1055 Scene.RegisterModuleInterface<IEstateModule>(this); 1084 Scene.RegisterModuleInterface<IEstateModule>(this);
1056 Scene.EventManager.OnNewClient += EventManager_OnNewClient; 1085 Scene.EventManager.OnNewClient += EventManager_OnNewClient;
@@ -1099,7 +1128,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
1099 1128
1100 private void EventManager_OnNewClient(IClientAPI client) 1129 private void EventManager_OnNewClient(IClientAPI client)
1101 { 1130 {
1102 client.OnDetailedEstateDataRequest += sendDetailedEstateData; 1131 client.OnDetailedEstateDataRequest += clientSendDetailedEstateData;
1103 client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; 1132 client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler;
1104// client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; 1133// client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture;
1105 client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; 1134 client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture;
@@ -1150,6 +1179,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
1150 flags |= RegionFlags.AllowParcelChanges; 1179 flags |= RegionFlags.AllowParcelChanges;
1151 if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) 1180 if (Scene.RegionInfo.RegionSettings.BlockShowInSearch)
1152 flags |= RegionFlags.BlockParcelSearch; 1181 flags |= RegionFlags.BlockParcelSearch;
1182 if (Scene.RegionInfo.RegionSettings.GodBlockSearch)
1183 flags |= (RegionFlags)(1 << 11);
1184 if (Scene.RegionInfo.RegionSettings.Casino)
1185 flags |= (RegionFlags)(1 << 10);
1153 1186
1154 if (Scene.RegionInfo.RegionSettings.FixedSun) 1187 if (Scene.RegionInfo.RegionSettings.FixedSun)
1155 flags |= RegionFlags.SunFixed; 1188 flags |= RegionFlags.SunFixed;
@@ -1157,11 +1190,15 @@ namespace OpenSim.Region.CoreModules.World.Estate
1157 flags |= RegionFlags.Sandbox; 1190 flags |= RegionFlags.Sandbox;
1158 if (Scene.RegionInfo.EstateSettings.AllowVoice) 1191 if (Scene.RegionInfo.EstateSettings.AllowVoice)
1159 flags |= RegionFlags.AllowVoice; 1192 flags |= RegionFlags.AllowVoice;
1193 if (Scene.RegionInfo.EstateSettings.AllowLandmark)
1194 flags |= RegionFlags.AllowLandmark;
1195 if (Scene.RegionInfo.EstateSettings.AllowSetHome)
1196 flags |= RegionFlags.AllowSetHome;
1197 if (Scene.RegionInfo.EstateSettings.BlockDwell)
1198 flags |= RegionFlags.BlockDwell;
1199 if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport)
1200 flags |= RegionFlags.ResetHomeOnTeleport;
1160 1201
1161 // Fudge these to always on, so the menu options activate
1162 //
1163 flags |= RegionFlags.AllowLandmark;
1164 flags |= RegionFlags.AllowSetHome;
1165 1202
1166 // TODO: SkipUpdateInterestList 1203 // TODO: SkipUpdateInterestList
1167 1204
@@ -1202,6 +1239,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
1202 flags |= RegionFlags.ResetHomeOnTeleport; 1239 flags |= RegionFlags.ResetHomeOnTeleport;
1203 if (Scene.RegionInfo.EstateSettings.TaxFree) 1240 if (Scene.RegionInfo.EstateSettings.TaxFree)
1204 flags |= RegionFlags.TaxFree; 1241 flags |= RegionFlags.TaxFree;
1242 if (Scene.RegionInfo.EstateSettings.AllowLandmark)
1243 flags |= RegionFlags.AllowLandmark;
1244 if (Scene.RegionInfo.EstateSettings.AllowParcelChanges)
1245 flags |= RegionFlags.AllowParcelChanges;
1246 if (Scene.RegionInfo.EstateSettings.AllowSetHome)
1247 flags |= RegionFlags.AllowSetHome;
1205 if (Scene.RegionInfo.EstateSettings.DenyMinors) 1248 if (Scene.RegionInfo.EstateSettings.DenyMinors)
1206 flags |= (RegionFlags)(1 << 30); 1249 flags |= (RegionFlags)(1 << 30);
1207 1250
@@ -1222,6 +1265,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
1222 1265
1223 public void TriggerRegionInfoChange() 1266 public void TriggerRegionInfoChange()
1224 { 1267 {
1268 m_regionChangeTimer.Stop();
1269 m_regionChangeTimer.Start();
1270 }
1271
1272 protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e)
1273 {
1225 ChangeDelegate change = OnRegionInfoChange; 1274 ChangeDelegate change = OnRegionInfoChange;
1226 1275
1227 if (change != null) 1276 if (change != null)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 94bba83..7a236bc 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -91,6 +91,8 @@ namespace OpenSim.Region.CoreModules.World.Land
91 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 91 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
92 92
93 private bool m_allowedForcefulBans = true; 93 private bool m_allowedForcefulBans = true;
94 private UUID DefaultGodParcelGroup;
95 private string DefaultGodParcelName;
94 96
95 // caches ExtendedLandData 97 // caches ExtendedLandData
96 private Cache parcelInfoCache; 98 private Cache parcelInfoCache;
@@ -106,6 +108,12 @@ namespace OpenSim.Region.CoreModules.World.Land
106 108
107 public void Initialise(IConfigSource source) 109 public void Initialise(IConfigSource source)
108 { 110 {
111 IConfig cnf = source.Configs["LandManagement"];
112 if (cnf != null)
113 {
114 DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
115 DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel");
116 }
109 } 117 }
110 118
111 public void AddRegion(Scene scene) 119 public void AddRegion(Scene scene)
@@ -157,13 +165,6 @@ namespace OpenSim.Region.CoreModules.World.Land
157 m_scene.UnregisterModuleCommander(m_commander.Name); 165 m_scene.UnregisterModuleCommander(m_commander.Name);
158 } 166 }
159 167
160// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason)
161// {
162// ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y);
163// reason = "You are not allowed to enter this sim.";
164// return nearestParcel != null;
165// }
166
167 /// <summary> 168 /// <summary>
168 /// Processes commandline input. Do not call directly. 169 /// Processes commandline input. Do not call directly.
169 /// </summary> 170 /// </summary>
@@ -215,36 +216,6 @@ namespace OpenSim.Region.CoreModules.World.Land
215 216
216 void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) 217 void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
217 { 218 {
218 //If we are forcing a position for them to go
219 if (forcedPosition.ContainsKey(remoteClient.AgentId))
220 {
221 ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId);
222
223 //Putting the user into flying, both keeps the avatar in fligth when it bumps into something and stopped from going another direction AND
224 //When the avatar walks into a ban line on the ground, it prevents getting stuck
225 agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
226
227
228 //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines
229 if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2)
230 {
231 Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition));
232 forcedPosition.Remove(remoteClient.AgentId);
233 }
234 //if we are far away, teleport
235 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3)
236 {
237 Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition));
238 clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]);
239 forcedPosition.Remove(remoteClient.AgentId);
240 }
241 else
242 {
243 //Forces them toward the forced position we want if they aren't there yet
244 agentData.UseClientAgentPosition = true;
245 agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId];
246 }
247 }
248 } 219 }
249 220
250 public void Close() 221 public void Close()
@@ -363,10 +334,16 @@ namespace OpenSim.Region.CoreModules.World.Land
363 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) 334 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position)
364 { 335 {
365 if (m_scene.Permissions.IsGod(avatar.UUID)) return; 336 if (m_scene.Permissions.IsGod(avatar.UUID)) return;
366 if (position.HasValue) 337
367 { 338 if (!position.HasValue)
368 forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position; 339 return;
369 } 340
341 bool isFlying = avatar.PhysicsActor.Flying;
342 avatar.RemoveFromPhysicalScene();
343
344 avatar.AbsolutePosition = (Vector3)position;
345
346 avatar.AddToPhysicalScene(isFlying);
370 } 347 }
371 348
372 public void SendYouAreRestrictedNotice(ScenePresence avatar) 349 public void SendYouAreRestrictedNotice(ScenePresence avatar)
@@ -386,29 +363,7 @@ namespace OpenSim.Region.CoreModules.World.Land
386 } 363 }
387 364
388 if (parcelAvatarIsEntering != null) 365 if (parcelAvatarIsEntering != null)
389 { 366 EnforceBans(parcelAvatarIsEntering, avatar);
390 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT)
391 {
392 if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID))
393 {
394 SendYouAreBannedNotice(avatar);
395 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
396 }
397 else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID))
398 {
399 SendYouAreRestrictedNotice(avatar);
400 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
401 }
402 else
403 {
404 avatar.sentMessageAboutRestrictedParcelFlyingDown = true;
405 }
406 }
407 else
408 {
409 avatar.sentMessageAboutRestrictedParcelFlyingDown = true;
410 }
411 }
412 } 367 }
413 } 368 }
414 369
@@ -512,6 +467,7 @@ namespace OpenSim.Region.CoreModules.World.Land
512 //when we are finally in a safe place, lets release the forced position lock 467 //when we are finally in a safe place, lets release the forced position lock
513 forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); 468 forcedPosition.Remove(clientAvatar.ControllingClient.AgentId);
514 } 469 }
470 EnforceBans(parcel, clientAvatar);
515 } 471 }
516 } 472 }
517 473
@@ -720,7 +676,7 @@ namespace OpenSim.Region.CoreModules.World.Land
720 int x; 676 int x;
721 int y; 677 int y;
722 678
723 if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) 679 if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0)
724 return null; 680 return null;
725 681
726 try 682 try
@@ -770,14 +726,13 @@ namespace OpenSim.Region.CoreModules.World.Land
770 { 726 {
771 try 727 try
772 { 728 {
773 return m_landList[m_landIDList[x / 4, y / 4]]; 729 //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4]))
730 return m_landList[m_landIDList[x / 4, y / 4]];
731 //else
732 // return null;
774 } 733 }
775 catch (IndexOutOfRangeException) 734 catch (IndexOutOfRangeException)
776 { 735 {
777// m_log.WarnFormat(
778// "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}",
779// x, y, m_scene.RegionInfo.RegionName);
780
781 return null; 736 return null;
782 } 737 }
783 } 738 }
@@ -1060,6 +1015,10 @@ namespace OpenSim.Region.CoreModules.World.Land
1060 //Owner Flag 1015 //Owner Flag
1061 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); 1016 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
1062 } 1017 }
1018 else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID))
1019 {
1020 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP);
1021 }
1063 else if (currentParcelBlock.LandData.SalePrice > 0 && 1022 else if (currentParcelBlock.LandData.SalePrice > 0 &&
1064 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || 1023 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
1065 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) 1024 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
@@ -1360,18 +1319,31 @@ namespace OpenSim.Region.CoreModules.World.Land
1360 1319
1361 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) 1320 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1362 { 1321 {
1363 for (int i = 0; i < data.Count; i++) 1322 lock (m_landList)
1364 { 1323 {
1365 IncomingLandObjectFromStorage(data[i]); 1324 //Remove all the land objects in the sim and then process our new data
1325 foreach (int n in m_landList.Keys)
1326 {
1327 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID);
1328 }
1329 m_landIDList.Initialize();
1330 m_landList.Clear();
1331
1332 for (int i = 0; i < data.Count; i++)
1333 {
1334 IncomingLandObjectFromStorage(data[i]);
1335 }
1366 } 1336 }
1367 } 1337 }
1368 1338
1369 public void IncomingLandObjectFromStorage(LandData data) 1339 public void IncomingLandObjectFromStorage(LandData data)
1370 { 1340 {
1341
1371 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1342 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1372 new_land.LandData = data.Copy(); 1343 new_land.LandData = data.Copy();
1373 new_land.SetLandBitmapFromByteArray(); 1344 new_land.SetLandBitmapFromByteArray();
1374 AddLandObject(new_land); 1345 AddLandObject(new_land);
1346 new_land.SendLandUpdateToAvatarsOverMe();
1375 } 1347 }
1376 1348
1377 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) 1349 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
@@ -1649,6 +1621,322 @@ namespace OpenSim.Region.CoreModules.World.Land
1649 1621
1650 UpdateLandObject(localID, land.LandData); 1622 UpdateLandObject(localID, land.LandData);
1651 } 1623 }
1624
1625 public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID)
1626 {
1627 ILandObject land = null;
1628 List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels();
1629 foreach (ILandObject landObject in Land)
1630 {
1631 if (landObject.LandData.LocalID == landID)
1632 {
1633 land = landObject;
1634 }
1635 }
1636 land.DeedToGroup(DefaultGodParcelGroup);
1637 land.LandData.Name = DefaultGodParcelName;
1638 land.SendLandUpdateToAvatarsOverMe();
1639 }
1640
1641 private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID)
1642 {
1643 ScenePresence SP;
1644 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP);
1645 List<SceneObjectGroup> returns = new List<SceneObjectGroup>();
1646 if (SP.UserLevel != 0)
1647 {
1648 if (flags == 0) //All parcels, scripted or not
1649 {
1650 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1651 {
1652 if (e.OwnerID == targetID)
1653 {
1654 returns.Add(e);
1655 }
1656 }
1657 );
1658 }
1659 if (flags == 4) //All parcels, scripted object
1660 {
1661 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1662 {
1663 if (e.OwnerID == targetID)
1664 {
1665 if (e.scriptScore >= 0.01)
1666 {
1667 returns.Add(e);
1668 }
1669 }
1670 }
1671 );
1672 }
1673 if (flags == 4) //not target parcel, scripted object
1674 {
1675 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1676 {
1677 if (e.OwnerID == targetID)
1678 {
1679 ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y);
1680 if (landobject.LandData.OwnerID != e.OwnerID)
1681 {
1682 if (e.scriptScore >= 0.01)
1683 {
1684 returns.Add(e);
1685 }
1686 }
1687 }
1688 }
1689 );
1690 }
1691 foreach (SceneObjectGroup ol in returns)
1692 {
1693 ReturnObject(ol, client);
1694 }
1695 }
1696 }
1697 public void ReturnObject(SceneObjectGroup obj, IClientAPI client)
1698 {
1699 SceneObjectGroup[] objs = new SceneObjectGroup[1];
1700 objs[0] = obj;
1701 ((Scene)client.Scene).returnObjects(objs, client.AgentId);
1702 }
1703
1704 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
1705
1706 public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1707 {
1708 ScenePresence targetAvatar = null;
1709 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1710 ScenePresence parcelManager = null;
1711 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1712 System.Threading.Timer Timer;
1713
1714 if (targetAvatar.UserLevel == 0)
1715 {
1716 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1717 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze))
1718 return;
1719 if (flags == 0)
1720 {
1721 targetAvatar.AllowMovement = false;
1722 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world.");
1723 parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen.");
1724 System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
1725 Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0);
1726 Timers.Add(targetAvatar.UUID, Timer);
1727 }
1728 else
1729 {
1730 targetAvatar.AllowMovement = true;
1731 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you.");
1732 parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen.");
1733 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1734 Timers.Remove(targetAvatar.UUID);
1735 Timer.Dispose();
1736 }
1737 }
1738 }
1739 private void OnEndParcelFrozen(object avatar)
1740 {
1741 ScenePresence targetAvatar = (ScenePresence)avatar;
1742 targetAvatar.AllowMovement = true;
1743 System.Threading.Timer Timer;
1744 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1745 Timers.Remove(targetAvatar.UUID);
1746 targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false);
1747 }
1748
1749
1750 public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1751 {
1752 ScenePresence targetAvatar = null;
1753 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1754 ScenePresence parcelManager = null;
1755 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1756 //Just eject
1757 if (flags == 0)
1758 {
1759 if (targetAvatar.UserLevel == 0)
1760 {
1761 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1762 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze))
1763 return;
1764
1765 Vector3 position = new Vector3(0, 0, 0);
1766 List<ILandObject> allParcels = new List<ILandObject>();
1767 allParcels = AllParcels();
1768 if (allParcels.Count != 1)
1769 {
1770 foreach (ILandObject parcel in allParcels)
1771 {
1772 if (parcel.LandData.GlobalID != land.LandData.GlobalID)
1773 {
1774 if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
1775 {
1776 for (int x = 1; x <= Constants.RegionSize; x += 2)
1777 {
1778 for (int y = 1; y <= Constants.RegionSize; y += 2)
1779 {
1780 if (parcel.ContainsPoint(x, y))
1781 {
1782 position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
1783 targetAvatar.TeleportWithMomentum(position);
1784 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1785 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1786 return;
1787 }
1788 }
1789 }
1790 }
1791 }
1792 }
1793 }
1794 Vector3 targetVector;
1795 if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
1796 {
1797 if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
1798 {
1799 targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1800 targetAvatar.TeleportWithMomentum(targetVector);
1801 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1802 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1803 return;
1804 }
1805 else
1806 {
1807 targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1808 targetAvatar.TeleportWithMomentum(targetVector);
1809 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1810 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1811 return;
1812 }
1813 }
1814 else
1815 {
1816 if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
1817 {
1818 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
1819 targetAvatar.TeleportWithMomentum(targetVector);
1820 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1821 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1822 return;
1823 }
1824 else
1825 {
1826 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
1827 targetAvatar.TeleportWithMomentum(targetVector);
1828 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1829 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1830 return;
1831 }
1832 }
1833 }
1834 }
1835 //Eject and ban
1836 if (flags == 1)
1837 {
1838 if (targetAvatar.UserLevel == 0)
1839 {
1840 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1841 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze))
1842 return;
1843
1844 Vector3 position = new Vector3(0, 0, 0);
1845 List<ILandObject> allParcels = new List<ILandObject>();
1846 allParcels = AllParcels();
1847 if (allParcels.Count != 1)
1848 {
1849 foreach (ILandObject parcel in allParcels)
1850 {
1851 if (parcel.LandData.GlobalID != land.LandData.GlobalID)
1852 {
1853 if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
1854 {
1855 for (int x = 1; x <= Constants.RegionSize; x += 2)
1856 {
1857 for (int y = 1; y <= Constants.RegionSize; y += 2)
1858 {
1859 if (parcel.ContainsPoint(x, y))
1860 {
1861 position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
1862 targetAvatar.TeleportWithMomentum(position);
1863 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1864 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1865 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1866 entry.AgentID = targetAvatar.UUID;
1867 entry.Flags = AccessList.Ban;
1868 entry.Time = new DateTime();
1869 land.LandData.ParcelAccessList.Add(entry);
1870 return;
1871 }
1872 }
1873 }
1874 }
1875 }
1876 }
1877 }
1878 Vector3 targetVector;
1879 if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
1880 {
1881 if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
1882 {
1883 targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1884 targetAvatar.TeleportWithMomentum(targetVector);
1885 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1886 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1887 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1888 entry.AgentID = targetAvatar.UUID;
1889 entry.Flags = AccessList.Ban;
1890 entry.Time = new DateTime();
1891 land.LandData.ParcelAccessList.Add(entry);
1892 return;
1893 }
1894 else
1895 {
1896 targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1897 targetAvatar.TeleportWithMomentum(targetVector);
1898 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1899 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1900 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1901 entry.AgentID = targetAvatar.UUID;
1902 entry.Flags = AccessList.Ban;
1903 entry.Time = new DateTime();
1904 land.LandData.ParcelAccessList.Add(entry);
1905 return;
1906 }
1907 }
1908 else
1909 {
1910 if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
1911 {
1912 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
1913 targetAvatar.TeleportWithMomentum(targetVector);
1914 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1915 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1916 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1917 entry.AgentID = targetAvatar.UUID;
1918 entry.Flags = AccessList.Ban;
1919 entry.Time = new DateTime();
1920 land.LandData.ParcelAccessList.Add(entry);
1921 return;
1922 }
1923 else
1924 {
1925 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
1926 targetAvatar.TeleportWithMomentum(targetVector);
1927 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1928 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1929 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1930 entry.AgentID = targetAvatar.UUID;
1931 entry.Flags = AccessList.Ban;
1932 entry.Time = new DateTime();
1933 land.LandData.ParcelAccessList.Add(entry);
1934 return;
1935 }
1936 }
1937 }
1938 }
1939 }
1652 1940
1653 protected void InstallInterfaces() 1941 protected void InstallInterfaces()
1654 { 1942 {
@@ -1711,5 +1999,27 @@ namespace OpenSim.Region.CoreModules.World.Land
1711 1999
1712 MainConsole.Instance.Output(report.ToString()); 2000 MainConsole.Instance.Output(report.ToString());
1713 } 2001 }
2002
2003 public void EnforceBans(ILandObject land, ScenePresence avatar)
2004 {
2005 if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HIEGHT)
2006 return;
2007
2008 if (land.IsEitherBannedOrRestricted(avatar.UUID))
2009 {
2010 if (land.ContainsPoint(Convert.ToInt32(avatar.lastKnownAllowedPosition.X), Convert.ToInt32(avatar.lastKnownAllowedPosition.Y)))
2011 {
2012 Vector3? pos = m_scene.GetNearestAllowedPosition(avatar);
2013 if (pos == null)
2014 m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient);
2015 else
2016 ForceAvatarToPosition(avatar, (Vector3)pos);
2017 }
2018 else
2019 {
2020 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
2021 }
2022 }
2023 }
1714 } 2024 }
1715} \ No newline at end of file 2025}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 0da0de3..4f10fbf 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -190,10 +190,26 @@ namespace OpenSim.Region.CoreModules.World.Land
190 else 190 else
191 { 191 {
192 // Normal Calculations 192 // Normal Calculations
193 int parcelMax = (int)(((float)LandData.Area / 65536.0f) 193 int parcelMax = (int)((double)(LandData.Area
194 * (float)m_scene.RegionInfo.ObjectCapacity 194 * m_scene.RegionInfo.ObjectCapacity)
195 * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 195 * m_scene.RegionInfo.RegionSettings.ObjectBonus)
196 // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL! 196 / 65536;
197 return parcelMax;
198 }
199 }
200
201 private int GetParcelBasePrimCount()
202 {
203 if (overrideParcelMaxPrimCount != null)
204 {
205 return overrideParcelMaxPrimCount(this);
206 }
207 else
208 {
209 // Normal Calculations
210 int parcelMax = LandData.Area
211 * m_scene.RegionInfo.ObjectCapacity
212 / 65536;
197 return parcelMax; 213 return parcelMax;
198 } 214 }
199 } 215 }
@@ -245,7 +261,7 @@ namespace OpenSim.Region.CoreModules.World.Land
245 remote_client.SendLandProperties(seq_id, 261 remote_client.SendLandProperties(seq_id,
246 snap_selection, request_result, this, 262 snap_selection, request_result, this,
247 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, 263 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
248 GetParcelMaxPrimCount(), 264 GetParcelBasePrimCount(),
249 GetSimulatorMaxPrimCount(), regionFlags); 265 GetSimulatorMaxPrimCount(), regionFlags);
250 } 266 }
251 267
@@ -304,7 +320,7 @@ namespace OpenSim.Region.CoreModules.World.Land
304 320
305 allowedDelta |= (uint)(ParcelFlags.ShowDirectory | 321 allowedDelta |= (uint)(ParcelFlags.ShowDirectory |
306 ParcelFlags.AllowPublish | 322 ParcelFlags.AllowPublish |
307 ParcelFlags.MaturePublish); 323 ParcelFlags.MaturePublish) | (uint)(1 << 23);
308 } 324 }
309 325
310 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) 326 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity))
@@ -416,9 +432,43 @@ namespace OpenSim.Region.CoreModules.World.Land
416 return false; 432 return false;
417 } 433 }
418 434
435 public bool HasGroupAccess(UUID avatar)
436 {
437 if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup)
438 {
439 ScenePresence sp;
440 if (!m_scene.TryGetScenePresence(avatar, out sp))
441 {
442 IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
443 if (groupsModule == null)
444 return false;
445
446 GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar);
447 if (membership == null || membership.Length == 0)
448 return false;
449
450 foreach (GroupMembershipData d in membership)
451 {
452 if (d.GroupID == LandData.GroupID)
453 return true;
454 }
455 return false;
456 }
457
458 if (!sp.ControllingClient.IsGroupMember(LandData.GroupID))
459 return false;
460
461 return true;
462 }
463 return false;
464 }
465
419 public bool IsBannedFromLand(UUID avatar) 466 public bool IsBannedFromLand(UUID avatar)
420 { 467 {
421 if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) 468 if (m_scene.Permissions.IsAdministrator(avatar))
469 return false;
470
471 if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar))
422 return false; 472 return false;
423 473
424 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) 474 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
@@ -429,7 +479,7 @@ namespace OpenSim.Region.CoreModules.World.Land
429 if (e.AgentID == avatar && e.Flags == AccessList.Ban) 479 if (e.AgentID == avatar && e.Flags == AccessList.Ban)
430 return true; 480 return true;
431 return false; 481 return false;
432 }) != -1) 482 }) != -1 && LandData.OwnerID != avatar)
433 { 483 {
434 return true; 484 return true;
435 } 485 }
@@ -439,7 +489,10 @@ namespace OpenSim.Region.CoreModules.World.Land
439 489
440 public bool IsRestrictedFromLand(UUID avatar) 490 public bool IsRestrictedFromLand(UUID avatar)
441 { 491 {
442 if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) 492 if (m_scene.Permissions.IsAdministrator(avatar))
493 return false;
494
495 if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar))
443 return false; 496 return false;
444 497
445 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) 498 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
@@ -450,11 +503,15 @@ namespace OpenSim.Region.CoreModules.World.Land
450 if (e.AgentID == avatar && e.Flags == AccessList.Access) 503 if (e.AgentID == avatar && e.Flags == AccessList.Access)
451 return true; 504 return true;
452 return false; 505 return false;
453 }) == -1) 506 }) == -1 && LandData.OwnerID != avatar)
454 { 507 {
455 return true; 508 if (!HasGroupAccess(avatar))
509 {
510 return true;
511 }
456 } 512 }
457 } 513 }
514
458 return false; 515 return false;
459 } 516 }
460 517
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index efede5c..5122734 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.World.Land
206 if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) 206 if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
207 { 207 {
208 UUID landOwner = landData.OwnerID; 208 UUID landOwner = landData.OwnerID;
209 int partCount = obj.Parts.Length; 209 int partCount = obj.GetPartCount();
210 210
211 m_SimwideCounts[landOwner] += partCount; 211 m_SimwideCounts[landOwner] += partCount;
212 if (parcelCounts.Users.ContainsKey(obj.OwnerID)) 212 if (parcelCounts.Users.ContainsKey(obj.OwnerID))
@@ -593,4 +593,4 @@ namespace OpenSim.Region.CoreModules.World.Land
593 } 593 }
594 } 594 }
595 } 595 }
596} \ No newline at end of file 596}
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 1e4f0a4..eb4731c 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -176,6 +176,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
176 return false; 176 return false;
177 } 177 }
178 178
179 if ((perms & (uint)PermissionMask.Copy) == 0)
180 {
181 if (m_dialogModule != null)
182 m_dialogModule.SendAlertToUser(remoteClient, "This sale has been blocked by the permissions system");
183 return false;
184 }
185
179 AssetBase asset = m_scene.CreateAsset( 186 AssetBase asset = m_scene.CreateAsset(
180 group.GetPartName(localID), 187 group.GetPartName(localID),
181 group.GetPartDescription(localID), 188 group.GetPartDescription(localID),
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index cdecd2f..5e7d37a 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -363,7 +363,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
363 363
364 public string Name 364 public string Name
365 { 365 {
366 get { return "PermissionsModule"; } 366 get { return "DefaultPermissionsModule"; }
367 } 367 }
368 368
369 public bool IsSharedModule 369 public bool IsSharedModule
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
index 0f37ddd..7f6f4df 100644
--- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
+++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
@@ -28,6 +28,8 @@
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using System.Timers; 30using System.Timers;
31using System.IO;
32using System.Diagnostics;
31using System.Threading; 33using System.Threading;
32using System.Collections.Generic; 34using System.Collections.Generic;
33using log4net; 35using log4net;
@@ -56,13 +58,23 @@ namespace OpenSim.Region.CoreModules.World.Region
56 protected UUID m_Initiator; 58 protected UUID m_Initiator;
57 protected bool m_Notice = false; 59 protected bool m_Notice = false;
58 protected IDialogModule m_DialogModule = null; 60 protected IDialogModule m_DialogModule = null;
61 protected string m_MarkerPath = String.Empty;
59 62
60 public void Initialise(IConfigSource config) 63 public void Initialise(IConfigSource config)
61 { 64 {
65 IConfig restartConfig = config.Configs["RestartModule"];
66 if (restartConfig != null)
67 {
68 m_MarkerPath = restartConfig.GetString("MarkerPath", String.Empty);
69 }
62 } 70 }
63 71
64 public void AddRegion(Scene scene) 72 public void AddRegion(Scene scene)
65 { 73 {
74 if (m_MarkerPath != String.Empty)
75 File.Delete(Path.Combine(m_MarkerPath,
76 scene.RegionInfo.RegionID.ToString()));
77
66 m_Scene = scene; 78 m_Scene = scene;
67 79
68 scene.RegisterModuleInterface<IRestartModule>(this); 80 scene.RegisterModuleInterface<IRestartModule>(this);
@@ -121,6 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Region
121 133
122 if (alerts == null) 134 if (alerts == null)
123 { 135 {
136 CreateMarkerFile();
124 m_Scene.RestartNow(); 137 m_Scene.RestartNow();
125 return; 138 return;
126 } 139 }
@@ -134,6 +147,7 @@ namespace OpenSim.Region.CoreModules.World.Region
134 147
135 if (m_Alerts[0] == 0) 148 if (m_Alerts[0] == 0)
136 { 149 {
150 CreateMarkerFile();
137 m_Scene.RestartNow(); 151 m_Scene.RestartNow();
138 return; 152 return;
139 } 153 }
@@ -147,6 +161,7 @@ namespace OpenSim.Region.CoreModules.World.Region
147 { 161 {
148 if (m_Alerts.Count == 0 || m_Alerts[0] == 0) 162 if (m_Alerts.Count == 0 || m_Alerts[0] == 0)
149 { 163 {
164 CreateMarkerFile();
150 m_Scene.RestartNow(); 165 m_Scene.RestartNow();
151 return 0; 166 return 0;
152 } 167 }
@@ -266,5 +281,25 @@ namespace OpenSim.Region.CoreModules.World.Region
266 281
267 ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); 282 ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice);
268 } 283 }
284
285 protected void CreateMarkerFile()
286 {
287 if (m_MarkerPath == String.Empty)
288 return;
289
290 string path = Path.Combine(m_MarkerPath, m_Scene.RegionInfo.RegionID.ToString());
291 try
292 {
293 string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
294 FileStream fs = File.Create(path);
295 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
296 Byte[] buf = enc.GetBytes(pidstring);
297 fs.Write(buf, 0, buf.Length);
298 fs.Close();
299 }
300 catch (Exception)
301 {
302 }
303 }
269 } 304 }
270} 305}
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index cf000a4..4805ccb 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -606,6 +606,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
606 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); 606 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised());
607 m_scene.SaveTerrain(); 607 m_scene.SaveTerrain();
608 608
609 m_scene.EventManager.TriggerTerrainUpdate();
610
609 // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. 611 // Clients who look at the map will never see changes after they looked at the map, so i've commented this out.
610 //m_scene.CreateTerrainTexture(true); 612 //m_scene.CreateTerrainTexture(true);
611 } 613 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index 657975b..f9384e9 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -86,9 +86,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
86 86
87 private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) 87 private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags)
88 { 88 {
89 if (mapName.Length < 3) 89 if (mapName.Length < 2)
90 { 90 {
91 remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); 91 remoteClient.SendAlertMessage("Use a search string with at least 2 characters");
92 return; 92 return;
93 } 93 }
94 94
@@ -96,10 +96,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
96 96
97 // try to fetch from GridServer 97 // try to fetch from GridServer
98 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); 98 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
99 if (regionInfos.Count == 0) 99// if (regionInfos.Count == 0)
100 remoteClient.SendAlertMessage("Hyperlink could not be established."); 100// remoteClient.SendAlertMessage("Hyperlink could not be established.");
101 101
102 m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); 102 //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count);
103 List<MapBlockData> blocks = new List<MapBlockData>(); 103 List<MapBlockData> blocks = new List<MapBlockData>();
104 104
105 MapBlockData data; 105 MapBlockData data;
@@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
128 data.Agents = 0; 128 data.Agents = 0;
129 data.Access = 255; 129 data.Access = 255;
130 data.MapImageId = UUID.Zero; 130 data.MapImageId = UUID.Zero;
131 data.Name = ""; // mapName; 131 data.Name = mapName;
132 data.RegionFlags = 0; 132 data.RegionFlags = 0;
133 data.WaterHeight = 0; // not used 133 data.WaterHeight = 0; // not used
134 data.X = 0; 134 data.X = 0;
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 9b0e2ff..7118f16 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -1182,7 +1182,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1182 } 1182 }
1183 else 1183 else
1184 { 1184 {
1185 OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); 1185 OSDArray responsearr = new OSDArray(); // Don't preallocate. MT (m_scene.GetRootAgentCount());
1186 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) 1186 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
1187 { 1187 {
1188 OSDMap responsemapdata = new OSDMap(); 1188 OSDMap responsemapdata = new OSDMap();