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.cs77
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs321
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs34
-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.cs38
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs32
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs50
13 files changed, 461 insertions, 144 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index a6dbaba..38db239 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -298,6 +298,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver
298 // being no copy/no mod for everyone 298 // being no copy/no mod for everyone
299 lock (part.TaskInventory) 299 lock (part.TaskInventory)
300 { 300 {
301 if (!ResolveUserUuid(part.CreatorID))
302 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
303
304 if (!ResolveUserUuid(part.OwnerID))
305 part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
306
307 if (!ResolveUserUuid(part.LastOwnerID))
308 part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
309
310 // And zap any troublesome sit target information
311 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
312 part.SitTargetPosition = new Vector3(0, 0, 0);
313
314 // Fix ownership/creator of inventory items
315 // Not doing so results in inventory items
316 // being no copy/no mod for everyone
317 part.TaskInventory.LockItemsForRead(true);
301 TaskInventoryDictionary inv = part.TaskInventory; 318 TaskInventoryDictionary inv = part.TaskInventory;
302 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) 319 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
303 { 320 {
@@ -313,6 +330,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
313 if (UserManager != null) 330 if (UserManager != null)
314 UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); 331 UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData);
315 } 332 }
333 part.TaskInventory.LockItemsForRead(false);
316 } 334 }
317 } 335 }
318 336
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index 55110dc..1eb641d 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -253,18 +253,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
253 253
254 if (asset != null) 254 if (asset != null)
255 { 255 {
256 if (m_options.ContainsKey("verbose")) 256// m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id);
257 m_log.InfoFormat("[ARCHIVER]: Writing asset {0}", id);
258
259 m_foundAssetUuids.Add(asset.FullID); 257 m_foundAssetUuids.Add(asset.FullID);
260 258
261 m_assetsArchiver.WriteAsset(PostProcess(asset)); 259 m_assetsArchiver.WriteAsset(PostProcess(asset));
262 } 260 }
263 else 261 else
264 { 262 {
265 if (m_options.ContainsKey("verbose")) 263// m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id);
266 m_log.InfoFormat("[ARCHIVER]: Recording asset {0} as not found", id);
267
268 m_notFoundAssetUuids.Add(new UUID(id)); 264 m_notFoundAssetUuids.Add(new UUID(id));
269 } 265 }
270 266
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 58bbd24..ddc2a07 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -32,6 +32,7 @@ using System.IO;
32using System.Linq; 32using System.Linq;
33using System.Reflection; 33using System.Reflection;
34using System.Security; 34using System.Security;
35using System.Timers;
35using log4net; 36using log4net;
36using Mono.Addins; 37using Mono.Addins;
37using Nini.Config; 38using Nini.Config;
@@ -47,6 +48,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
47 { 48 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
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
@@ -61,6 +63,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
61 63
62 #region Packet Data Responders 64 #region Packet Data Responders
63 65
66 private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice)
67 {
68 sendDetailedEstateData(remote_client, invoice);
69 sendEstateLists(remote_client, invoice);
70 }
71
64 private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) 72 private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice)
65 { 73 {
66 uint sun = 0; 74 uint sun = 0;
@@ -83,7 +91,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
83 (uint) Scene.RegionInfo.RegionSettings.CovenantChangedDateTime, 91 (uint) Scene.RegionInfo.RegionSettings.CovenantChangedDateTime,
84 Scene.RegionInfo.EstateSettings.AbuseEmail, 92 Scene.RegionInfo.EstateSettings.AbuseEmail,
85 estateOwner); 93 estateOwner);
94 }
86 95
96 private void sendEstateLists(IClientAPI remote_client, UUID invoice)
97 {
87 remote_client.SendEstateList(invoice, 98 remote_client.SendEstateList(invoice,
88 (int)Constants.EstateAccessCodex.EstateManagers, 99 (int)Constants.EstateAccessCodex.EstateManagers,
89 Scene.RegionInfo.EstateSettings.EstateManagers, 100 Scene.RegionInfo.EstateSettings.EstateManagers,
@@ -257,6 +268,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
257 IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>(); 268 IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>();
258 if (restartModule != null) 269 if (restartModule != null)
259 { 270 {
271 if (timeInSeconds == -1)
272 {
273 restartModule.AbortRestart("Restart aborted by region manager");
274 return;
275 }
276
260 List<int> times = new List<int>(); 277 List<int> times = new List<int>();
261 while (timeInSeconds > 0) 278 while (timeInSeconds > 0)
262 { 279 {
@@ -269,7 +286,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
269 timeInSeconds -= 15; 286 timeInSeconds -= 15;
270 } 287 }
271 288
272 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); 289 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), false);
273 } 290 }
274 } 291 }
275 292
@@ -477,7 +494,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
477 { 494 {
478 if (!s.IsChildAgent) 495 if (!s.IsChildAgent)
479 { 496 {
480 Scene.TeleportClientHome(user, s.ControllingClient); 497 if (!Scene.TeleportClientHome(user, s.ControllingClient))
498 {
499 s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out.");
500 s.ControllingClient.Close();
501 }
481 } 502 }
482 } 503 }
483 504
@@ -486,7 +507,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
486 { 507 {
487 remote_client.SendAlertMessage("User is already on the region ban list"); 508 remote_client.SendAlertMessage("User is already on the region ban list");
488 } 509 }
489 //m_scene.RegionInfo.regionBanlist.Add(Manager(user); 510 //Scene.RegionInfo.regionBanlist.Add(Manager(user);
490 remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); 511 remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID);
491 } 512 }
492 else 513 else
@@ -541,7 +562,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
541 remote_client.SendAlertMessage("User is not on the region ban list"); 562 remote_client.SendAlertMessage("User is not on the region ban list");
542 } 563 }
543 564
544 //m_scene.RegionInfo.regionBanlist.Add(Manager(user); 565 //Scene.RegionInfo.regionBanlist.Add(Manager(user);
545 remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); 566 remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID);
546 } 567 }
547 else 568 else
@@ -700,7 +721,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
700 ScenePresence s = Scene.GetScenePresence(prey); 721 ScenePresence s = Scene.GetScenePresence(prey);
701 if (s != null) 722 if (s != null)
702 { 723 {
703 Scene.TeleportClientHome(prey, s.ControllingClient); 724 if (!Scene.TeleportClientHome(prey, s.ControllingClient))
725 {
726 s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out.");
727 s.ControllingClient.Close();
728 }
704 } 729 }
705 } 730 }
706 } 731 }
@@ -718,7 +743,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
718 // Also make sure they are actually in the region 743 // Also make sure they are actually in the region
719 ScenePresence p; 744 ScenePresence p;
720 if(Scene.TryGetScenePresence(client.AgentId, out p)) 745 if(Scene.TryGetScenePresence(client.AgentId, out p))
721 Scene.TeleportClientHome(p.UUID, p.ControllingClient); 746 {
747 if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient))
748 {
749 p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out.");
750 p.ControllingClient.Close();
751 }
752 }
722 } 753 }
723 }); 754 });
724 } 755 }
@@ -1081,6 +1112,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
1081 1112
1082 public void AddRegion(Scene scene) 1113 public void AddRegion(Scene scene)
1083 { 1114 {
1115 m_regionChangeTimer.AutoReset = false;
1116 m_regionChangeTimer.Interval = 2000;
1117 m_regionChangeTimer.Elapsed += RaiseRegionInfoChange;
1118
1084 Scene = scene; 1119 Scene = scene;
1085 Scene.RegisterModuleInterface<IEstateModule>(this); 1120 Scene.RegisterModuleInterface<IEstateModule>(this);
1086 Scene.EventManager.OnNewClient += EventManager_OnNewClient; 1121 Scene.EventManager.OnNewClient += EventManager_OnNewClient;
@@ -1131,7 +1166,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
1131 1166
1132 private void EventManager_OnNewClient(IClientAPI client) 1167 private void EventManager_OnNewClient(IClientAPI client)
1133 { 1168 {
1134 client.OnDetailedEstateDataRequest += sendDetailedEstateData; 1169 client.OnDetailedEstateDataRequest += clientSendDetailedEstateData;
1135 client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; 1170 client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler;
1136// client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; 1171// client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture;
1137 client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; 1172 client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture;
@@ -1183,6 +1218,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
1183 flags |= RegionFlags.AllowParcelChanges; 1218 flags |= RegionFlags.AllowParcelChanges;
1184 if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) 1219 if (Scene.RegionInfo.RegionSettings.BlockShowInSearch)
1185 flags |= RegionFlags.BlockParcelSearch; 1220 flags |= RegionFlags.BlockParcelSearch;
1221 if (Scene.RegionInfo.RegionSettings.GodBlockSearch)
1222 flags |= (RegionFlags)(1 << 11);
1223 if (Scene.RegionInfo.RegionSettings.Casino)
1224 flags |= (RegionFlags)(1 << 10);
1186 1225
1187 if (Scene.RegionInfo.RegionSettings.FixedSun) 1226 if (Scene.RegionInfo.RegionSettings.FixedSun)
1188 flags |= RegionFlags.SunFixed; 1227 flags |= RegionFlags.SunFixed;
@@ -1190,11 +1229,15 @@ namespace OpenSim.Region.CoreModules.World.Estate
1190 flags |= RegionFlags.Sandbox; 1229 flags |= RegionFlags.Sandbox;
1191 if (Scene.RegionInfo.EstateSettings.AllowVoice) 1230 if (Scene.RegionInfo.EstateSettings.AllowVoice)
1192 flags |= RegionFlags.AllowVoice; 1231 flags |= RegionFlags.AllowVoice;
1232 if (Scene.RegionInfo.EstateSettings.AllowLandmark)
1233 flags |= RegionFlags.AllowLandmark;
1234 if (Scene.RegionInfo.EstateSettings.AllowSetHome)
1235 flags |= RegionFlags.AllowSetHome;
1236 if (Scene.RegionInfo.EstateSettings.BlockDwell)
1237 flags |= RegionFlags.BlockDwell;
1238 if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport)
1239 flags |= RegionFlags.ResetHomeOnTeleport;
1193 1240
1194 // Fudge these to always on, so the menu options activate
1195 //
1196 flags |= RegionFlags.AllowLandmark;
1197 flags |= RegionFlags.AllowSetHome;
1198 1241
1199 // TODO: SkipUpdateInterestList 1242 // TODO: SkipUpdateInterestList
1200 1243
@@ -1235,6 +1278,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
1235 flags |= RegionFlags.ResetHomeOnTeleport; 1278 flags |= RegionFlags.ResetHomeOnTeleport;
1236 if (Scene.RegionInfo.EstateSettings.TaxFree) 1279 if (Scene.RegionInfo.EstateSettings.TaxFree)
1237 flags |= RegionFlags.TaxFree; 1280 flags |= RegionFlags.TaxFree;
1281 if (Scene.RegionInfo.EstateSettings.AllowLandmark)
1282 flags |= RegionFlags.AllowLandmark;
1283 if (Scene.RegionInfo.EstateSettings.AllowParcelChanges)
1284 flags |= RegionFlags.AllowParcelChanges;
1285 if (Scene.RegionInfo.EstateSettings.AllowSetHome)
1286 flags |= RegionFlags.AllowSetHome;
1238 if (Scene.RegionInfo.EstateSettings.DenyMinors) 1287 if (Scene.RegionInfo.EstateSettings.DenyMinors)
1239 flags |= (RegionFlags)(1 << 30); 1288 flags |= (RegionFlags)(1 << 30);
1240 1289
@@ -1255,6 +1304,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
1255 1304
1256 public void TriggerRegionInfoChange() 1305 public void TriggerRegionInfoChange()
1257 { 1306 {
1307 m_regionChangeTimer.Stop();
1308 m_regionChangeTimer.Start();
1309 }
1310
1311 protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e)
1312 {
1258 ChangeDelegate change = OnRegionInfoChange; 1313 ChangeDelegate change = OnRegionInfoChange;
1259 1314
1260 if (change != null) 1315 if (change != null)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 8b7406d..2fa0b3f 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -91,14 +91,13 @@ 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;
97 99 private Dictionary<UUID, Vector3> forcedPosition =
98 /// <summary> 100 new Dictionary<UUID, Vector3>();
99 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
100 /// </summary>
101 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>();
102 101
103 #region INonSharedRegionModule Members 102 #region INonSharedRegionModule Members
104 103
@@ -109,6 +108,12 @@ namespace OpenSim.Region.CoreModules.World.Land
109 108
110 public void Initialise(IConfigSource source) 109 public void Initialise(IConfigSource source)
111 { 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 }
112 } 117 }
113 118
114 public void AddRegion(Scene scene) 119 public void AddRegion(Scene scene)
@@ -160,13 +165,6 @@ namespace OpenSim.Region.CoreModules.World.Land
160 m_scene.UnregisterModuleCommander(m_commander.Name); 165 m_scene.UnregisterModuleCommander(m_commander.Name);
161 } 166 }
162 167
163// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason)
164// {
165// ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y);
166// reason = "You are not allowed to enter this sim.";
167// return nearestParcel != null;
168// }
169
170 /// <summary> 168 /// <summary>
171 /// Processes commandline input. Do not call directly. 169 /// Processes commandline input. Do not call directly.
172 /// </summary> 170 /// </summary>
@@ -207,6 +205,8 @@ namespace OpenSim.Region.CoreModules.World.Land
207 client.OnParcelInfoRequest += ClientOnParcelInfoRequest; 205 client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
208 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; 206 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
209 client.OnPreAgentUpdate += ClientOnPreAgentUpdate; 207 client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
208 client.OnParcelEjectUser += ClientOnParcelEjectUser;
209 client.OnParcelFreezeUser += ClientOnParcelFreezeUser;
210 210
211 EntityBase presenceEntity; 211 EntityBase presenceEntity;
212 if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) 212 if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence)
@@ -218,48 +218,6 @@ namespace OpenSim.Region.CoreModules.World.Land
218 218
219 void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) 219 void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
220 { 220 {
221 //If we are forcing a position for them to go
222 if (forcedPosition.ContainsKey(remoteClient.AgentId))
223 {
224 ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId);
225
226 //Putting the user into flying, both keeps the avatar in fligth when it bumps into something and stopped from going another direction AND
227 //When the avatar walks into a ban line on the ground, it prevents getting stuck
228 agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
229
230 //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines
231 if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2)
232 {
233// m_log.DebugFormat(
234// "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}",
235// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
236
237 forcedPosition.Remove(remoteClient.AgentId);
238 }
239 //if we are far away, teleport
240 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3)
241 {
242 Vector3 forcePosition = forcedPosition[remoteClient.AgentId];
243// m_log.DebugFormat(
244// "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}",
245// clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition);
246
247 m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle,
248 forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect);
249
250 forcedPosition.Remove(remoteClient.AgentId);
251 }
252 else
253 {
254// m_log.DebugFormat(
255// "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}",
256// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
257
258 //Forces them toward the forced position we want if they aren't there yet
259 agentData.UseClientAgentPosition = true;
260 agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId];
261 }
262 }
263 } 221 }
264 222
265 public void Close() 223 public void Close()
@@ -378,10 +336,16 @@ namespace OpenSim.Region.CoreModules.World.Land
378 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) 336 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position)
379 { 337 {
380 if (m_scene.Permissions.IsGod(avatar.UUID)) return; 338 if (m_scene.Permissions.IsGod(avatar.UUID)) return;
381 if (position.HasValue) 339
382 { 340 if (!position.HasValue)
383 forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position; 341 return;
384 } 342
343 bool isFlying = avatar.PhysicsActor.Flying;
344 avatar.RemoveFromPhysicalScene();
345
346 avatar.AbsolutePosition = (Vector3)position;
347
348 avatar.AddToPhysicalScene(isFlying);
385 } 349 }
386 350
387 public void SendYouAreRestrictedNotice(ScenePresence avatar) 351 public void SendYouAreRestrictedNotice(ScenePresence avatar)
@@ -401,29 +365,7 @@ namespace OpenSim.Region.CoreModules.World.Land
401 } 365 }
402 366
403 if (parcelAvatarIsEntering != null) 367 if (parcelAvatarIsEntering != null)
404 { 368 EnforceBans(parcelAvatarIsEntering, avatar);
405 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT)
406 {
407 if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID))
408 {
409 SendYouAreBannedNotice(avatar);
410 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
411 }
412 else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID))
413 {
414 SendYouAreRestrictedNotice(avatar);
415 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
416 }
417 else
418 {
419 avatar.sentMessageAboutRestrictedParcelFlyingDown = true;
420 }
421 }
422 else
423 {
424 avatar.sentMessageAboutRestrictedParcelFlyingDown = true;
425 }
426 }
427 } 369 }
428 } 370 }
429 371
@@ -527,6 +469,7 @@ namespace OpenSim.Region.CoreModules.World.Land
527 //when we are finally in a safe place, lets release the forced position lock 469 //when we are finally in a safe place, lets release the forced position lock
528 forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); 470 forcedPosition.Remove(clientAvatar.ControllingClient.AgentId);
529 } 471 }
472 EnforceBans(parcel, clientAvatar);
530 } 473 }
531 } 474 }
532 475
@@ -735,7 +678,7 @@ namespace OpenSim.Region.CoreModules.World.Land
735 int x; 678 int x;
736 int y; 679 int y;
737 680
738 if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) 681 if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0)
739 return null; 682 return null;
740 683
741 try 684 try
@@ -785,14 +728,13 @@ namespace OpenSim.Region.CoreModules.World.Land
785 { 728 {
786 try 729 try
787 { 730 {
788 return m_landList[m_landIDList[x / 4, y / 4]]; 731 //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4]))
732 return m_landList[m_landIDList[x / 4, y / 4]];
733 //else
734 // return null;
789 } 735 }
790 catch (IndexOutOfRangeException) 736 catch (IndexOutOfRangeException)
791 { 737 {
792// m_log.WarnFormat(
793// "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}",
794// x, y, m_scene.RegionInfo.RegionName);
795
796 return null; 738 return null;
797 } 739 }
798 } 740 }
@@ -1075,6 +1017,10 @@ namespace OpenSim.Region.CoreModules.World.Land
1075 //Owner Flag 1017 //Owner Flag
1076 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); 1018 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
1077 } 1019 }
1020 else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID))
1021 {
1022 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP);
1023 }
1078 else if (currentParcelBlock.LandData.SalePrice > 0 && 1024 else if (currentParcelBlock.LandData.SalePrice > 0 &&
1079 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || 1025 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
1080 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) 1026 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
@@ -1375,18 +1321,31 @@ namespace OpenSim.Region.CoreModules.World.Land
1375 1321
1376 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) 1322 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1377 { 1323 {
1378 for (int i = 0; i < data.Count; i++) 1324 lock (m_landList)
1379 { 1325 {
1380 IncomingLandObjectFromStorage(data[i]); 1326 //Remove all the land objects in the sim and then process our new data
1327 foreach (int n in m_landList.Keys)
1328 {
1329 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID);
1330 }
1331 m_landIDList.Initialize();
1332 m_landList.Clear();
1333
1334 for (int i = 0; i < data.Count; i++)
1335 {
1336 IncomingLandObjectFromStorage(data[i]);
1337 }
1381 } 1338 }
1382 } 1339 }
1383 1340
1384 public void IncomingLandObjectFromStorage(LandData data) 1341 public void IncomingLandObjectFromStorage(LandData data)
1385 { 1342 {
1343
1386 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1344 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1387 new_land.LandData = data.Copy(); 1345 new_land.LandData = data.Copy();
1388 new_land.SetLandBitmapFromByteArray(); 1346 new_land.SetLandBitmapFromByteArray();
1389 AddLandObject(new_land); 1347 AddLandObject(new_land);
1348 new_land.SendLandUpdateToAvatarsOverMe();
1390 } 1349 }
1391 1350
1392 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) 1351 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
@@ -1669,6 +1628,168 @@ namespace OpenSim.Region.CoreModules.World.Land
1669 1628
1670 UpdateLandObject(localID, land.LandData); 1629 UpdateLandObject(localID, land.LandData);
1671 } 1630 }
1631
1632 public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID)
1633 {
1634 ILandObject land = null;
1635 List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels();
1636 foreach (ILandObject landObject in Land)
1637 {
1638 if (landObject.LandData.LocalID == landID)
1639 {
1640 land = landObject;
1641 }
1642 }
1643 land.DeedToGroup(DefaultGodParcelGroup);
1644 land.LandData.Name = DefaultGodParcelName;
1645 land.SendLandUpdateToAvatarsOverMe();
1646 }
1647
1648 private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID)
1649 {
1650 ScenePresence SP;
1651 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP);
1652 List<SceneObjectGroup> returns = new List<SceneObjectGroup>();
1653 if (SP.UserLevel != 0)
1654 {
1655 if (flags == 0) //All parcels, scripted or not
1656 {
1657 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1658 {
1659 if (e.OwnerID == targetID)
1660 {
1661 returns.Add(e);
1662 }
1663 }
1664 );
1665 }
1666 if (flags == 4) //All parcels, scripted object
1667 {
1668 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1669 {
1670 if (e.OwnerID == targetID)
1671 {
1672 if (e.ContainsScripts())
1673 {
1674 returns.Add(e);
1675 }
1676 }
1677 }
1678 );
1679 }
1680 if (flags == 4) //not target parcel, scripted object
1681 {
1682 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1683 {
1684 if (e.OwnerID == targetID)
1685 {
1686 ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y);
1687 if (landobject.LandData.OwnerID != e.OwnerID)
1688 {
1689 if (e.ContainsScripts())
1690 {
1691 returns.Add(e);
1692 }
1693 }
1694 }
1695 }
1696 );
1697 }
1698 foreach (SceneObjectGroup ol in returns)
1699 {
1700 ReturnObject(ol, client);
1701 }
1702 }
1703 }
1704 public void ReturnObject(SceneObjectGroup obj, IClientAPI client)
1705 {
1706 SceneObjectGroup[] objs = new SceneObjectGroup[1];
1707 objs[0] = obj;
1708 ((Scene)client.Scene).returnObjects(objs, client.AgentId);
1709 }
1710
1711 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
1712
1713 public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1714 {
1715 ScenePresence targetAvatar = null;
1716 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1717 ScenePresence parcelManager = null;
1718 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1719 System.Threading.Timer Timer;
1720
1721 if (targetAvatar.UserLevel == 0)
1722 {
1723 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1724 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze))
1725 return;
1726 if (flags == 0)
1727 {
1728 targetAvatar.AllowMovement = false;
1729 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world.");
1730 parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen.");
1731 System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
1732 Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0);
1733 Timers.Add(targetAvatar.UUID, Timer);
1734 }
1735 else
1736 {
1737 targetAvatar.AllowMovement = true;
1738 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you.");
1739 parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen.");
1740 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1741 Timers.Remove(targetAvatar.UUID);
1742 Timer.Dispose();
1743 }
1744 }
1745 }
1746 private void OnEndParcelFrozen(object avatar)
1747 {
1748 ScenePresence targetAvatar = (ScenePresence)avatar;
1749 targetAvatar.AllowMovement = true;
1750 System.Threading.Timer Timer;
1751 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1752 Timers.Remove(targetAvatar.UUID);
1753 targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false);
1754 }
1755
1756
1757 public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1758 {
1759 ScenePresence targetAvatar = null;
1760 ScenePresence parcelManager = null;
1761
1762 // Must have presences
1763 if (!m_scene.TryGetScenePresence(target, out targetAvatar) ||
1764 !m_scene.TryGetScenePresence(client.AgentId, out parcelManager))
1765 return;
1766
1767 // Cannot eject estate managers or gods
1768 if (m_scene.Permissions.IsAdministrator(target))
1769 return;
1770
1771 // Check if you even have permission to do this
1772 ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1773 if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze) &&
1774 !m_scene.Permissions.IsAdministrator(client.AgentId))
1775 return;
1776
1777 Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land);
1778
1779 targetAvatar.TeleportWithMomentum(pos, null);
1780 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1781 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1782
1783 if ((flags & 1) != 0) // Ban TODO: Remove magic number
1784 {
1785 LandAccessEntry entry = new LandAccessEntry();
1786 entry.AgentID = targetAvatar.UUID;
1787 entry.Flags = AccessList.Ban;
1788 entry.Expires = 0; // Perm
1789
1790 land.LandData.ParcelAccessList.Add(entry);
1791 }
1792 }
1672 1793
1673 protected void InstallInterfaces() 1794 protected void InstallInterfaces()
1674 { 1795 {
@@ -1731,5 +1852,27 @@ namespace OpenSim.Region.CoreModules.World.Land
1731 1852
1732 MainConsole.Instance.Output(report.ToString()); 1853 MainConsole.Instance.Output(report.ToString());
1733 } 1854 }
1855
1856 public void EnforceBans(ILandObject land, ScenePresence avatar)
1857 {
1858 if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HIEGHT)
1859 return;
1860
1861 if (land.IsEitherBannedOrRestricted(avatar.UUID))
1862 {
1863 if (land.ContainsPoint(Convert.ToInt32(avatar.lastKnownAllowedPosition.X), Convert.ToInt32(avatar.lastKnownAllowedPosition.Y)))
1864 {
1865 Vector3? pos = m_scene.GetNearestAllowedPosition(avatar);
1866 if (pos == null)
1867 m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient);
1868 else
1869 ForceAvatarToPosition(avatar, (Vector3)pos);
1870 }
1871 else
1872 {
1873 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
1874 }
1875 }
1876 }
1734 } 1877 }
1735} 1878}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 0536f6e..16792b3 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -193,10 +193,27 @@ namespace OpenSim.Region.CoreModules.World.Land
193 else 193 else
194 { 194 {
195 // Normal Calculations 195 // Normal Calculations
196 int parcelMax = (int)(((float)LandData.Area / 65536.0f) 196 int parcelMax = (int)((long)LandData.Area
197 * (float)m_scene.RegionInfo.ObjectCapacity 197 * (long)m_scene.RegionInfo.ObjectCapacity
198 * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 198 * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus
199 // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL! 199 / 65536L);
200 m_log.DebugFormat("Area: {0}, Capacity {1}, Bonus {2}, Parcel {3}", LandData.Area, m_scene.RegionInfo.ObjectCapacity, m_scene.RegionInfo.RegionSettings.ObjectBonus, parcelMax);
201 return parcelMax;
202 }
203 }
204
205 private int GetParcelBasePrimCount()
206 {
207 if (overrideParcelMaxPrimCount != null)
208 {
209 return overrideParcelMaxPrimCount(this);
210 }
211 else
212 {
213 // Normal Calculations
214 int parcelMax = (int)((long)LandData.Area
215 * (long)m_scene.RegionInfo.ObjectCapacity
216 / 65536L);
200 return parcelMax; 217 return parcelMax;
201 } 218 }
202 } 219 }
@@ -210,8 +227,9 @@ namespace OpenSim.Region.CoreModules.World.Land
210 else 227 else
211 { 228 {
212 //Normal Calculations 229 //Normal Calculations
213 int simMax = (int)(((float)LandData.SimwideArea / 65536.0f) 230 int simMax = (int)((long)LandData.SimwideArea
214 * (float)m_scene.RegionInfo.ObjectCapacity); 231 * (long)m_scene.RegionInfo.ObjectCapacity / 65536L);
232 // m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax);
215 return simMax; 233 return simMax;
216 } 234 }
217 } 235 }
@@ -248,7 +266,7 @@ namespace OpenSim.Region.CoreModules.World.Land
248 remote_client.SendLandProperties(seq_id, 266 remote_client.SendLandProperties(seq_id,
249 snap_selection, request_result, this, 267 snap_selection, request_result, this,
250 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, 268 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
251 GetParcelMaxPrimCount(), 269 GetParcelBasePrimCount(),
252 GetSimulatorMaxPrimCount(), regionFlags); 270 GetSimulatorMaxPrimCount(), regionFlags);
253 } 271 }
254 272
@@ -308,7 +326,7 @@ namespace OpenSim.Region.CoreModules.World.Land
308 326
309 allowedDelta |= (uint)(ParcelFlags.ShowDirectory | 327 allowedDelta |= (uint)(ParcelFlags.ShowDirectory |
310 ParcelFlags.AllowPublish | 328 ParcelFlags.AllowPublish |
311 ParcelFlags.MaturePublish); 329 ParcelFlags.MaturePublish) | (uint)(1 << 23);
312 } 330 }
313 331
314 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) 332 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity))
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index b2f71d1..102b4d7 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -205,7 +205,7 @@ namespace OpenSim.Region.CoreModules.World.Land
205 if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) 205 if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
206 { 206 {
207 UUID landOwner = landData.OwnerID; 207 UUID landOwner = landData.OwnerID;
208 int partCount = obj.Parts.Length; 208 int partCount = obj.GetPartCount();
209 209
210 m_SimwideCounts[landOwner] += partCount; 210 m_SimwideCounts[landOwner] += partCount;
211 if (parcelCounts.Users.ContainsKey(obj.OwnerID)) 211 if (parcelCounts.Users.ContainsKey(obj.OwnerID))
@@ -592,4 +592,4 @@ namespace OpenSim.Region.CoreModules.World.Land
592 } 592 }
593 } 593 }
594 } 594 }
595} \ No newline at end of file 595}
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 7d75fad..190f63b 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -368,7 +368,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
368 368
369 public string Name 369 public string Name
370 { 370 {
371 get { return "PermissionsModule"; } 371 get { return "DefaultPermissionsModule"; }
372 } 372 }
373 373
374 public bool IsSharedModule 374 public bool IsSharedModule
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
index fea4de0..65180b5a 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 }
@@ -225,6 +240,9 @@ namespace OpenSim.Region.CoreModules.World.Region
225 if (m_DialogModule != null && message != String.Empty) 240 if (m_DialogModule != null && message != String.Empty)
226 m_DialogModule.SendGeneralAlert(message); 241 m_DialogModule.SendGeneralAlert(message);
227 } 242 }
243 if (m_MarkerPath != String.Empty)
244 File.Delete(Path.Combine(m_MarkerPath,
245 m_Scene.RegionInfo.RegionID.ToString()));
228 } 246 }
229 247
230 private void HandleRegionRestart(string module, string[] args) 248 private void HandleRegionRestart(string module, string[] args)
@@ -266,5 +284,25 @@ namespace OpenSim.Region.CoreModules.World.Region
266 284
267 ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); 285 ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice);
268 } 286 }
287
288 protected void CreateMarkerFile()
289 {
290 if (m_MarkerPath == String.Empty)
291 return;
292
293 string path = Path.Combine(m_MarkerPath, m_Scene.RegionInfo.RegionID.ToString());
294 try
295 {
296 string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
297 FileStream fs = File.Create(path);
298 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
299 Byte[] buf = enc.GetBytes(pidstring);
300 fs.Write(buf, 0, buf.Length);
301 fs.Close();
302 }
303 catch (Exception)
304 {
305 }
306 }
269 } 307 }
270} 308}
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 2eac0fa..5b03ac7 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -636,6 +636,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
636 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); 636 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised());
637 m_scene.SaveTerrain(); 637 m_scene.SaveTerrain();
638 638
639 m_scene.EventManager.TriggerTerrainUpdate();
640
639 // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. 641 // Clients who look at the map will never see changes after they looked at the map, so i've commented this out.
640 //m_scene.CreateTerrainTexture(true); 642 //m_scene.CreateTerrainTexture(true);
641 } 643 }
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
index 4f4e296..e6f2855 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
@@ -64,6 +64,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
64 private bool m_useAntiAliasing = false; // TODO: Make this a config option 64 private bool m_useAntiAliasing = false; // TODO: Make this a config option
65 private bool m_Enabled = false; 65 private bool m_Enabled = false;
66 66
67 private Bitmap lastImage = null;
68 private DateTime lastImageTime = DateTime.MinValue;
69
67 #region IRegionModule Members 70 #region IRegionModule Members
68 71
69 public void Initialise(IConfigSource source) 72 public void Initialise(IConfigSource source)
@@ -86,14 +89,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
86 89
87 List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); 90 List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory());
88 if (renderers.Count > 0) 91 if (renderers.Count > 0)
89 { 92 m_log.Info("[MAPTILE]: Loaded prim mesher " + renderers[0]);
90 m_primMesher = RenderingLoader.LoadRenderer(renderers[0]);
91 m_log.Debug("[MAPTILE]: Loaded prim mesher " + m_primMesher.ToString());
92 }
93 else 93 else
94 { 94 m_log.Info("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled");
95 m_log.Debug("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled");
96 }
97 95
98 m_scene.RegisterModuleInterface<IMapImageGenerator>(this); 96 m_scene.RegisterModuleInterface<IMapImageGenerator>(this);
99 } 97 }
@@ -126,9 +124,25 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
126 124
127 public Bitmap CreateMapTile() 125 public Bitmap CreateMapTile()
128 { 126 {
127 if ((DateTime.Now - lastImageTime).TotalSeconds < 3600)
128 {
129 return lastImage.Clone(new Rectangle(0, 0, 256, 256), lastImage.PixelFormat);
130 }
131
132 List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory());
133 if (renderers.Count > 0)
134 {
135 m_primMesher = RenderingLoader.LoadRenderer(renderers[0]);
136 }
137
129 Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); 138 Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f);
130 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)Constants.RegionSize, (int)Constants.RegionSize, (float)Constants.RegionSize, (float)Constants.RegionSize); 139 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)Constants.RegionSize, (int)Constants.RegionSize, (float)Constants.RegionSize, (float)Constants.RegionSize);
131 return CreateMapTile(viewport, false); 140 Bitmap tile = CreateMapTile(viewport, false);
141 m_primMesher = null;
142
143 lastImage = tile;
144 lastImageTime = DateTime.Now;
145 return lastImage.Clone(new Rectangle(0, 0, 256, 256), lastImage.PixelFormat);
132 } 146 }
133 147
134 public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) 148 public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures)
@@ -655,4 +669,4 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
655 return result; 669 return result;
656 } 670 }
657 } 671 }
658} \ No newline at end of file 672}
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index f37dd94..4e6bfb8 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
@@ -112,10 +112,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
112 112
113 // try to fetch from GridServer 113 // try to fetch from GridServer
114 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); 114 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
115 if (regionInfos.Count == 0) 115// if (regionInfos.Count == 0)
116 remoteClient.SendAlertMessage("Hyperlink could not be established."); 116// remoteClient.SendAlertMessage("Hyperlink could not be established.");
117 117
118 m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); 118 //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count);
119 List<MapBlockData> blocks = new List<MapBlockData>(); 119 List<MapBlockData> blocks = new List<MapBlockData>();
120 120
121 MapBlockData data; 121 MapBlockData data;
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
149 data.Agents = 0; 149 data.Agents = 0;
150 data.Access = 255; 150 data.Access = 255;
151 data.MapImageId = UUID.Zero; 151 data.MapImageId = UUID.Zero;
152 data.Name = ""; // mapName; 152 data.Name = mapName;
153 data.RegionFlags = 0; 153 data.RegionFlags = 0;
154 data.WaterHeight = 0; // not used 154 data.WaterHeight = 0; // not used
155 data.X = 0; 155 data.X = 0;
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 2335bea..be6b240 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -1241,7 +1241,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1241 } 1241 }
1242 else 1242 else
1243 { 1243 {
1244 OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); 1244 OSDArray responsearr = new OSDArray(); // Don't preallocate. MT (m_scene.GetRootAgentCount());
1245 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) 1245 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
1246 { 1246 {
1247 OSDMap responsemapdata = new OSDMap(); 1247 OSDMap responsemapdata = new OSDMap();
@@ -1460,9 +1460,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1460 Color background = Color.FromArgb(0, 0, 0, 0); 1460 Color background = Color.FromArgb(0, 0, 0, 0);
1461 SolidBrush transparent = new SolidBrush(background); 1461 SolidBrush transparent = new SolidBrush(background);
1462 Graphics g = Graphics.FromImage(overlay); 1462 Graphics g = Graphics.FromImage(overlay);
1463 g.FillRectangle(transparent, 0, 0, 256, 256); 1463 g.FillRectangle(transparent, 0, 0, 255, 255);
1464 1464
1465 SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9)); 1465 SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9));
1466 Pen grey = new Pen(Color.FromArgb(255, 92, 92, 92));
1466 1467
1467 foreach (ILandObject land in parcels) 1468 foreach (ILandObject land in parcels)
1468 { 1469 {
@@ -1470,8 +1471,42 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1470 if ((land.LandData.Flags & (uint)ParcelFlags.ForSale) != 0) 1471 if ((land.LandData.Flags & (uint)ParcelFlags.ForSale) != 0)
1471 { 1472 {
1472 landForSale = true; 1473 landForSale = true;
1474
1475 bool[,] landBitmap = land.GetLandBitmap();
1476
1477 for (int x = 0 ; x < 64 ; x++)
1478 {
1479 for (int y = 0 ; y < 64 ; y++)
1480 {
1481 if (landBitmap[x, y])
1482 {
1483 g.FillRectangle(yellow, x * 4, 252 - (y * 4), 4, 4);
1484
1485 if (x > 0)
1486 {
1487 if ((saleBitmap[x - 1, y] || landBitmap[x - 1, y]) == false)
1488 g.DrawLine(grey, x * 4, 252 - (y * 4), x * 4, 255 - (y * 4));
1489 }
1490 if (y > 0)
1491 {
1492 if ((saleBitmap[x, y-1] || landBitmap[x, y-1]) == false)
1493 g.DrawLine(grey, x * 4, 255 - (y * 4), x * 4 + 3, 255 - (y * 4));
1494 }
1495 if (x < 63)
1496 {
1497 if ((saleBitmap[x + 1, y] || landBitmap[x + 1, y]) == false)
1498 g.DrawLine(grey, x * 4 + 3, 252 - (y * 4), x * 4 + 3, 255 - (y * 4));
1499 }
1500 if (y < 63)
1501 {
1502 if ((saleBitmap[x, y + 1] || landBitmap[x, y + 1]) == false)
1503 g.DrawLine(grey, x * 4, 252 - (y * 4), x * 4 + 3, 252 - (y * 4));
1504 }
1505 }
1506 }
1507 }
1473 1508
1474 saleBitmap = land.MergeLandBitmaps(saleBitmap, land.GetLandBitmap()); 1509 saleBitmap = land.MergeLandBitmaps(saleBitmap, landBitmap);
1475 } 1510 }
1476 } 1511 }
1477 1512
@@ -1483,15 +1518,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1483 1518
1484 m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, generating overlay", m_scene.RegionInfo.RegionName); 1519 m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, generating overlay", m_scene.RegionInfo.RegionName);
1485 1520
1486 for (int x = 0 ; x < 64 ; x++)
1487 {
1488 for (int y = 0 ; y < 64 ; y++)
1489 {
1490 if (saleBitmap[x, y])
1491 g.FillRectangle(yellow, x * 4, 252 - (y * 4), 4, 4);
1492 }
1493 }
1494
1495 try 1521 try
1496 { 1522 {
1497 return OpenJPEG.EncodeFromImage(overlay, true); 1523 return OpenJPEG.EncodeFromImage(overlay, true);