diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 357 |
1 files changed, 225 insertions, 132 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 1789d6d..317dfd8 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -89,19 +89,21 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
89 | /// <value> | 89 | /// <value> |
90 | /// Land objects keyed by local id | 90 | /// Land objects keyed by local id |
91 | /// </value> | 91 | /// </value> |
92 | private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); | 92 | // private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); |
93 | |||
94 | //ubit: removed the readonly so i can move it around | ||
95 | private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); | ||
93 | 96 | ||
94 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 97 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
95 | 98 | ||
96 | private bool m_allowedForcefulBans = true; | 99 | private bool m_allowedForcefulBans = true; |
100 | private UUID DefaultGodParcelGroup; | ||
101 | private string DefaultGodParcelName; | ||
97 | 102 | ||
98 | // caches ExtendedLandData | 103 | // caches ExtendedLandData |
99 | private Cache parcelInfoCache; | 104 | private Cache parcelInfoCache; |
100 | 105 | private Dictionary<UUID, Vector3> forcedPosition = | |
101 | /// <summary> | 106 | new Dictionary<UUID, Vector3>(); |
102 | /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. | ||
103 | /// </summary> | ||
104 | private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); | ||
105 | 107 | ||
106 | #region INonSharedRegionModule Members | 108 | #region INonSharedRegionModule Members |
107 | 109 | ||
@@ -112,6 +114,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
112 | 114 | ||
113 | public void Initialise(IConfigSource source) | 115 | public void Initialise(IConfigSource source) |
114 | { | 116 | { |
117 | IConfig cnf = source.Configs["LandManagement"]; | ||
118 | if (cnf != null) | ||
119 | { | ||
120 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | ||
121 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | ||
122 | } | ||
115 | } | 123 | } |
116 | 124 | ||
117 | public void AddRegion(Scene scene) | 125 | public void AddRegion(Scene scene) |
@@ -165,13 +173,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
165 | m_scene.UnregisterModuleCommander(m_commander.Name); | 173 | m_scene.UnregisterModuleCommander(m_commander.Name); |
166 | } | 174 | } |
167 | 175 | ||
168 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) | ||
169 | // { | ||
170 | // ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); | ||
171 | // reason = "You are not allowed to enter this sim."; | ||
172 | // return nearestParcel != null; | ||
173 | // } | ||
174 | |||
175 | /// <summary> | 176 | /// <summary> |
176 | /// Processes commandline input. Do not call directly. | 177 | /// Processes commandline input. Do not call directly. |
177 | /// </summary> | 178 | /// </summary> |
@@ -216,7 +217,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
216 | client.OnParcelFreezeUser += ClientOnParcelFreezeUser; | 217 | client.OnParcelFreezeUser += ClientOnParcelFreezeUser; |
217 | client.OnSetStartLocationRequest += ClientOnSetHome; | 218 | client.OnSetStartLocationRequest += ClientOnSetHome; |
218 | 219 | ||
219 | |||
220 | EntityBase presenceEntity; | 220 | EntityBase presenceEntity; |
221 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) | 221 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) |
222 | { | 222 | { |
@@ -232,48 +232,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
232 | 232 | ||
233 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 233 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
234 | { | 234 | { |
235 | //If we are forcing a position for them to go | ||
236 | if (forcedPosition.ContainsKey(remoteClient.AgentId)) | ||
237 | { | ||
238 | ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId); | ||
239 | |||
240 | //Putting the user into flying, both keeps the avatar in fligth when it bumps into something and stopped from going another direction AND | ||
241 | //When the avatar walks into a ban line on the ground, it prevents getting stuck | ||
242 | agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
243 | |||
244 | //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines | ||
245 | if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) | ||
246 | { | ||
247 | // m_log.DebugFormat( | ||
248 | // "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}", | ||
249 | // clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); | ||
250 | |||
251 | forcedPosition.Remove(remoteClient.AgentId); | ||
252 | } | ||
253 | //if we are far away, teleport | ||
254 | else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) | ||
255 | { | ||
256 | Vector3 forcePosition = forcedPosition[remoteClient.AgentId]; | ||
257 | // m_log.DebugFormat( | ||
258 | // "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}", | ||
259 | // clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition); | ||
260 | |||
261 | m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle, | ||
262 | forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect); | ||
263 | |||
264 | forcedPosition.Remove(remoteClient.AgentId); | ||
265 | } | ||
266 | else | ||
267 | { | ||
268 | // m_log.DebugFormat( | ||
269 | // "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}", | ||
270 | // clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); | ||
271 | |||
272 | //Forces them toward the forced position we want if they aren't there yet | ||
273 | agentData.UseClientAgentPosition = true; | ||
274 | agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; | ||
275 | } | ||
276 | } | ||
277 | } | 235 | } |
278 | 236 | ||
279 | public void Close() | 237 | public void Close() |
@@ -298,6 +256,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
298 | { | 256 | { |
299 | LandData newData = data.Copy(); | 257 | LandData newData = data.Copy(); |
300 | newData.LocalID = local_id; | 258 | newData.LocalID = local_id; |
259 | ILandObject landobj = null; | ||
301 | 260 | ||
302 | ILandObject land; | 261 | ILandObject land; |
303 | lock (m_landList) | 262 | lock (m_landList) |
@@ -337,14 +296,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
337 | protected ILandObject CreateDefaultParcel() | 296 | protected ILandObject CreateDefaultParcel() |
338 | { | 297 | { |
339 | m_log.DebugFormat( | 298 | m_log.DebugFormat( |
340 | "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); | 299 | "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); |
341 | 300 | ||
342 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); | 301 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); |
343 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | 302 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); |
344 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 303 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
345 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); | 304 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); |
346 | 305 | ||
347 | return AddLandObject(fullSimParcel); | 306 | return AddLandObject(fullSimParcel); |
348 | } | 307 | } |
349 | 308 | ||
350 | public List<ILandObject> AllParcels() | 309 | public List<ILandObject> AllParcels() |
@@ -393,10 +352,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
393 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) | 352 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) |
394 | { | 353 | { |
395 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; | 354 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; |
396 | if (position.HasValue) | 355 | |
397 | { | 356 | if (!position.HasValue) |
398 | forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position; | 357 | return; |
399 | } | 358 | |
359 | bool isFlying = avatar.PhysicsActor.Flying; | ||
360 | avatar.RemoveFromPhysicalScene(); | ||
361 | |||
362 | avatar.AbsolutePosition = (Vector3)position; | ||
363 | |||
364 | avatar.AddToPhysicalScene(isFlying); | ||
400 | } | 365 | } |
401 | 366 | ||
402 | public void SendYouAreRestrictedNotice(ScenePresence avatar) | 367 | public void SendYouAreRestrictedNotice(ScenePresence avatar) |
@@ -416,29 +381,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
416 | } | 381 | } |
417 | 382 | ||
418 | if (parcelAvatarIsEntering != null) | 383 | if (parcelAvatarIsEntering != null) |
419 | { | 384 | EnforceBans(parcelAvatarIsEntering, avatar); |
420 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
421 | { | ||
422 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) | ||
423 | { | ||
424 | SendYouAreBannedNotice(avatar); | ||
425 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
426 | } | ||
427 | else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) | ||
428 | { | ||
429 | SendYouAreRestrictedNotice(avatar); | ||
430 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
431 | } | ||
432 | else | ||
433 | { | ||
434 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
435 | } | ||
436 | } | ||
437 | else | ||
438 | { | ||
439 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
440 | } | ||
441 | } | ||
442 | } | 385 | } |
443 | } | 386 | } |
444 | 387 | ||
@@ -467,30 +410,51 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
467 | 410 | ||
468 | public void SendLandUpdate(ScenePresence avatar, bool force) | 411 | public void SendLandUpdate(ScenePresence avatar, bool force) |
469 | { | 412 | { |
413 | |||
414 | /* stop sendind same data twice | ||
415 | ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), | ||
416 | (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); | ||
417 | |||
418 | if (over != null) | ||
419 | { | ||
420 | |||
421 | if (force) | ||
422 | { | ||
423 | if (!avatar.IsChildAgent) | ||
424 | { | ||
425 | over.SendLandUpdateToClient(avatar.ControllingClient); | ||
426 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, | ||
427 | m_scene.RegionInfo.RegionID); | ||
428 | } | ||
429 | } | ||
430 | |||
431 | if (avatar.currentParcelUUID != over.LandData.GlobalID) | ||
432 | { | ||
433 | if (!avatar.IsChildAgent) | ||
434 | { | ||
435 | over.SendLandUpdateToClient(avatar.ControllingClient); | ||
436 | avatar.currentParcelUUID = over.LandData.GlobalID; | ||
437 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, | ||
438 | m_scene.RegionInfo.RegionID); | ||
439 | } | ||
440 | } | ||
441 | */ | ||
442 | if (avatar.IsChildAgent) | ||
443 | return; | ||
444 | |||
470 | ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), | 445 | ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), |
471 | (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); | 446 | (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); |
472 | 447 | ||
473 | if (over != null) | 448 | if (over != null) |
474 | { | 449 | { |
475 | if (force) | 450 | bool NotsameID = (avatar.currentParcelUUID != over.LandData.GlobalID); |
476 | { | 451 | if (force || NotsameID) |
477 | if (!avatar.IsChildAgent) | ||
478 | { | ||
479 | over.SendLandUpdateToClient(avatar.ControllingClient); | ||
480 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, | ||
481 | m_scene.RegionInfo.RegionID); | ||
482 | } | ||
483 | } | ||
484 | |||
485 | if (avatar.currentParcelUUID != over.LandData.GlobalID) | ||
486 | { | 452 | { |
487 | if (!avatar.IsChildAgent) | 453 | over.SendLandUpdateToClient(avatar.ControllingClient); |
488 | { | 454 | if (NotsameID) |
489 | over.SendLandUpdateToClient(avatar.ControllingClient); | ||
490 | avatar.currentParcelUUID = over.LandData.GlobalID; | 455 | avatar.currentParcelUUID = over.LandData.GlobalID; |
491 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, | 456 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, |
492 | m_scene.RegionInfo.RegionID); | 457 | m_scene.RegionInfo.RegionID); |
493 | } | ||
494 | } | 458 | } |
495 | } | 459 | } |
496 | } | 460 | } |
@@ -542,6 +506,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
542 | //when we are finally in a safe place, lets release the forced position lock | 506 | //when we are finally in a safe place, lets release the forced position lock |
543 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); | 507 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); |
544 | } | 508 | } |
509 | EnforceBans(parcel, clientAvatar); | ||
545 | } | 510 | } |
546 | } | 511 | } |
547 | 512 | ||
@@ -692,27 +657,28 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
692 | /// </summary> | 657 | /// </summary> |
693 | public void Clear(bool setupDefaultParcel) | 658 | public void Clear(bool setupDefaultParcel) |
694 | { | 659 | { |
695 | List<ILandObject> parcels; | 660 | Dictionary<int, ILandObject> landworkList; |
661 | // move to work pointer since we are deleting it all | ||
696 | lock (m_landList) | 662 | lock (m_landList) |
697 | { | 663 | { |
698 | parcels = new List<ILandObject>(m_landList.Values); | 664 | landworkList = m_landList; |
665 | m_landList = new Dictionary<int, ILandObject>(); | ||
699 | } | 666 | } |
700 | 667 | ||
701 | foreach (ILandObject lo in parcels) | 668 | // this 2 methods have locks (now) |
669 | ResetSimLandObjects(); | ||
670 | |||
671 | if (setupDefaultParcel) | ||
672 | CreateDefaultParcel(); | ||
673 | |||
674 | // fire outside events unlocked | ||
675 | foreach (ILandObject lo in landworkList.Values) | ||
702 | { | 676 | { |
703 | //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); | 677 | //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); |
704 | m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); | 678 | m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); |
705 | } | 679 | } |
680 | landworkList.Clear(); | ||
706 | 681 | ||
707 | lock (m_landList) | ||
708 | { | ||
709 | m_landList.Clear(); | ||
710 | |||
711 | ResetSimLandObjects(); | ||
712 | } | ||
713 | |||
714 | if (setupDefaultParcel) | ||
715 | CreateDefaultParcel(); | ||
716 | } | 682 | } |
717 | 683 | ||
718 | private void performFinalLandJoin(ILandObject master, ILandObject slave) | 684 | private void performFinalLandJoin(ILandObject master, ILandObject slave) |
@@ -759,7 +725,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
759 | int x; | 725 | int x; |
760 | int y; | 726 | int y; |
761 | 727 | ||
762 | if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) | 728 | if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) |
763 | return null; | 729 | return null; |
764 | 730 | ||
765 | try | 731 | try |
@@ -809,14 +775,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
809 | { | 775 | { |
810 | try | 776 | try |
811 | { | 777 | { |
812 | return m_landList[m_landIDList[x / 4, y / 4]]; | 778 | //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) |
779 | return m_landList[m_landIDList[x / 4, y / 4]]; | ||
780 | //else | ||
781 | // return null; | ||
813 | } | 782 | } |
814 | catch (IndexOutOfRangeException) | 783 | catch (IndexOutOfRangeException) |
815 | { | 784 | { |
816 | // m_log.WarnFormat( | ||
817 | // "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", | ||
818 | // x, y, m_scene.RegionInfo.RegionName); | ||
819 | |||
820 | return null; | 785 | return null; |
821 | } | 786 | } |
822 | } | 787 | } |
@@ -1100,6 +1065,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1100 | //Owner Flag | 1065 | //Owner Flag |
1101 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | 1066 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); |
1102 | } | 1067 | } |
1068 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
1069 | { | ||
1070 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP); | ||
1071 | } | ||
1103 | else if (currentParcelBlock.LandData.SalePrice > 0 && | 1072 | else if (currentParcelBlock.LandData.SalePrice > 0 && |
1104 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | 1073 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || |
1105 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | 1074 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) |
@@ -1180,8 +1149,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1180 | { | 1149 | { |
1181 | if (!temp.Contains(currentParcel)) | 1150 | if (!temp.Contains(currentParcel)) |
1182 | { | 1151 | { |
1183 | currentParcel.ForceUpdateLandInfo(); | 1152 | if (!currentParcel.IsEitherBannedOrRestricted(remote_client.AgentId)) |
1184 | temp.Add(currentParcel); | 1153 | { |
1154 | currentParcel.ForceUpdateLandInfo(); | ||
1155 | temp.Add(currentParcel); | ||
1156 | } | ||
1185 | } | 1157 | } |
1186 | } | 1158 | } |
1187 | } | 1159 | } |
@@ -1400,8 +1372,26 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1400 | 1372 | ||
1401 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1373 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
1402 | { | 1374 | { |
1403 | // m_log.DebugFormat( | 1375 | Dictionary<int, ILandObject> landworkList; |
1404 | // "[LAND MANAGMENT MODULE]: Processing {0} incoming parcels on {1}", data.Count, m_scene.Name); | 1376 | // move to work pointer since we are deleting it all |
1377 | lock (m_landList) | ||
1378 | { | ||
1379 | landworkList = m_landList; | ||
1380 | m_landList = new Dictionary<int, ILandObject>(); | ||
1381 | } | ||
1382 | |||
1383 | //Remove all the land objects in the sim and then process our new data | ||
1384 | foreach (int n in landworkList.Keys) | ||
1385 | { | ||
1386 | m_scene.EventManager.TriggerLandObjectRemoved(landworkList[n].LandData.GlobalID); | ||
1387 | } | ||
1388 | landworkList.Clear(); | ||
1389 | |||
1390 | lock (m_landList) | ||
1391 | { | ||
1392 | m_landIDList.Initialize(); | ||
1393 | m_landList.Clear(); | ||
1394 | } | ||
1405 | 1395 | ||
1406 | for (int i = 0; i < data.Count; i++) | 1396 | for (int i = 0; i < data.Count; i++) |
1407 | IncomingLandObjectFromStorage(data[i]); | 1397 | IncomingLandObjectFromStorage(data[i]); |
@@ -1409,10 +1399,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1409 | 1399 | ||
1410 | public void IncomingLandObjectFromStorage(LandData data) | 1400 | public void IncomingLandObjectFromStorage(LandData data) |
1411 | { | 1401 | { |
1402 | |||
1412 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1403 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); |
1413 | new_land.LandData = data.Copy(); | 1404 | new_land.LandData = data.Copy(); |
1414 | new_land.SetLandBitmapFromByteArray(); | 1405 | new_land.SetLandBitmapFromByteArray(); |
1415 | AddLandObject(new_land); | 1406 | AddLandObject(new_land); |
1407 | new_land.SendLandUpdateToAvatarsOverMe(); | ||
1416 | } | 1408 | } |
1417 | 1409 | ||
1418 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) | 1410 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) |
@@ -1743,7 +1735,86 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1743 | 1735 | ||
1744 | UpdateLandObject(localID, land.LandData); | 1736 | UpdateLandObject(localID, land.LandData); |
1745 | } | 1737 | } |
1746 | 1738 | ||
1739 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1740 | { | ||
1741 | ILandObject land = null; | ||
1742 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1743 | foreach (ILandObject landObject in Land) | ||
1744 | { | ||
1745 | if (landObject.LandData.LocalID == landID) | ||
1746 | { | ||
1747 | land = landObject; | ||
1748 | } | ||
1749 | } | ||
1750 | land.DeedToGroup(DefaultGodParcelGroup); | ||
1751 | land.LandData.Name = DefaultGodParcelName; | ||
1752 | land.SendLandUpdateToAvatarsOverMe(); | ||
1753 | } | ||
1754 | |||
1755 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1756 | { | ||
1757 | ScenePresence SP; | ||
1758 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); | ||
1759 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1760 | if (SP.UserLevel != 0) | ||
1761 | { | ||
1762 | if (flags == 0) //All parcels, scripted or not | ||
1763 | { | ||
1764 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1765 | { | ||
1766 | if (e.OwnerID == targetID) | ||
1767 | { | ||
1768 | returns.Add(e); | ||
1769 | } | ||
1770 | } | ||
1771 | ); | ||
1772 | } | ||
1773 | if (flags == 4) //All parcels, scripted object | ||
1774 | { | ||
1775 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1776 | { | ||
1777 | if (e.OwnerID == targetID) | ||
1778 | { | ||
1779 | if (e.ContainsScripts()) | ||
1780 | { | ||
1781 | returns.Add(e); | ||
1782 | } | ||
1783 | } | ||
1784 | } | ||
1785 | ); | ||
1786 | } | ||
1787 | if (flags == 4) //not target parcel, scripted object | ||
1788 | { | ||
1789 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1790 | { | ||
1791 | if (e.OwnerID == targetID) | ||
1792 | { | ||
1793 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1794 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1795 | { | ||
1796 | if (e.ContainsScripts()) | ||
1797 | { | ||
1798 | returns.Add(e); | ||
1799 | } | ||
1800 | } | ||
1801 | } | ||
1802 | } | ||
1803 | ); | ||
1804 | } | ||
1805 | foreach (SceneObjectGroup ol in returns) | ||
1806 | { | ||
1807 | ReturnObject(ol, client); | ||
1808 | } | ||
1809 | } | ||
1810 | } | ||
1811 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1812 | { | ||
1813 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1814 | objs[0] = obj; | ||
1815 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1816 | } | ||
1817 | |||
1747 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | 1818 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); |
1748 | 1819 | ||
1749 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | 1820 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) |
@@ -1779,7 +1850,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1779 | } | 1850 | } |
1780 | } | 1851 | } |
1781 | } | 1852 | } |
1782 | |||
1783 | private void OnEndParcelFrozen(object avatar) | 1853 | private void OnEndParcelFrozen(object avatar) |
1784 | { | 1854 | { |
1785 | ScenePresence targetAvatar = (ScenePresence)avatar; | 1855 | ScenePresence targetAvatar = (ScenePresence)avatar; |
@@ -1790,6 +1860,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1790 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | 1860 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); |
1791 | } | 1861 | } |
1792 | 1862 | ||
1863 | |||
1793 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | 1864 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) |
1794 | { | 1865 | { |
1795 | ScenePresence targetAvatar = null; | 1866 | ScenePresence targetAvatar = null; |
@@ -1809,12 +1880,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1809 | if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze) && | 1880 | if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze) && |
1810 | !m_scene.Permissions.IsAdministrator(client.AgentId)) | 1881 | !m_scene.Permissions.IsAdministrator(client.AgentId)) |
1811 | return; | 1882 | return; |
1883 | |||
1812 | Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land); | 1884 | Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land); |
1813 | 1885 | ||
1814 | targetAvatar.TeleportWithMomentum(pos, null); | 1886 | targetAvatar.TeleportWithMomentum(pos, null); |
1815 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | 1887 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); |
1816 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | 1888 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); |
1817 | 1889 | ||
1818 | if ((flags & 1) != 0) // Ban TODO: Remove magic number | 1890 | if ((flags & 1) != 0) // Ban TODO: Remove magic number |
1819 | { | 1891 | { |
1820 | LandAccessEntry entry = new LandAccessEntry(); | 1892 | LandAccessEntry entry = new LandAccessEntry(); |
@@ -1872,7 +1944,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1872 | m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); | 1944 | m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); |
1873 | } | 1945 | } |
1874 | 1946 | ||
1875 | |||
1876 | protected void InstallInterfaces() | 1947 | protected void InstallInterfaces() |
1877 | { | 1948 | { |
1878 | Command clearCommand | 1949 | Command clearCommand |
@@ -1934,5 +2005,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1934 | 2005 | ||
1935 | MainConsole.Instance.Output(report.ToString()); | 2006 | MainConsole.Instance.Output(report.ToString()); |
1936 | } | 2007 | } |
2008 | |||
2009 | public void EnforceBans(ILandObject land, ScenePresence avatar) | ||
2010 | { | ||
2011 | if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
2012 | return; | ||
2013 | |||
2014 | if (land.IsEitherBannedOrRestricted(avatar.UUID)) | ||
2015 | { | ||
2016 | if (land.ContainsPoint(Convert.ToInt32(avatar.lastKnownAllowedPosition.X), Convert.ToInt32(avatar.lastKnownAllowedPosition.Y))) | ||
2017 | { | ||
2018 | Vector3? pos = m_scene.GetNearestAllowedPosition(avatar); | ||
2019 | if (pos == null) | ||
2020 | m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient); | ||
2021 | else | ||
2022 | ForceAvatarToPosition(avatar, (Vector3)pos); | ||
2023 | } | ||
2024 | else | ||
2025 | { | ||
2026 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); | ||
2027 | } | ||
2028 | } | ||
2029 | } | ||
1937 | } | 2030 | } |
1938 | } | 2031 | } |