diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
3 files changed, 417 insertions, 109 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 98ba8c3..ad75ea5 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -92,11 +92,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
92 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 92 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
93 | 93 | ||
94 | private bool m_allowedForcefulBans = true; | 94 | private bool m_allowedForcefulBans = true; |
95 | private UUID DefaultGodParcelGroup; | ||
96 | private string DefaultGodParcelName; | ||
95 | 97 | ||
96 | // caches ExtendedLandData | 98 | // caches ExtendedLandData |
97 | private Cache parcelInfoCache; | 99 | private Cache parcelInfoCache; |
98 | private Dictionary<UUID, Vector3> forcedPosition = | ||
99 | new Dictionary<UUID, Vector3>(); | ||
100 | 100 | ||
101 | #region INonSharedRegionModule Members | 101 | #region INonSharedRegionModule Members |
102 | 102 | ||
@@ -107,6 +107,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
107 | 107 | ||
108 | public void Initialise(IConfigSource source) | 108 | public void Initialise(IConfigSource source) |
109 | { | 109 | { |
110 | IConfig cnf = source.Configs["LandManagement"]; | ||
111 | if (cnf != null) | ||
112 | { | ||
113 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | ||
114 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | ||
115 | } | ||
110 | } | 116 | } |
111 | 117 | ||
112 | public void AddRegion(Scene scene) | 118 | public void AddRegion(Scene scene) |
@@ -157,13 +163,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
157 | m_scene.UnregisterModuleCommander(m_commander.Name); | 163 | m_scene.UnregisterModuleCommander(m_commander.Name); |
158 | } | 164 | } |
159 | 165 | ||
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> | 166 | /// <summary> |
168 | /// Processes commandline input. Do not call directly. | 167 | /// Processes commandline input. Do not call directly. |
169 | /// </summary> | 168 | /// </summary> |
@@ -215,36 +214,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
215 | 214 | ||
216 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 215 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
217 | { | 216 | { |
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 | } | 217 | } |
249 | 218 | ||
250 | public void Close() | 219 | public void Close() |
@@ -359,10 +328,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
359 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) | 328 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) |
360 | { | 329 | { |
361 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; | 330 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; |
362 | if (position.HasValue) | 331 | |
363 | { | 332 | if (!position.HasValue) |
364 | forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position; | 333 | return; |
365 | } | 334 | |
335 | bool isFlying = avatar.PhysicsActor.Flying; | ||
336 | avatar.RemoveFromPhysicalScene(); | ||
337 | |||
338 | avatar.AbsolutePosition = (Vector3)position; | ||
339 | |||
340 | avatar.AddToPhysicalScene(isFlying); | ||
366 | } | 341 | } |
367 | 342 | ||
368 | public void SendYouAreRestrictedNotice(ScenePresence avatar) | 343 | public void SendYouAreRestrictedNotice(ScenePresence avatar) |
@@ -382,29 +357,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
382 | } | 357 | } |
383 | 358 | ||
384 | if (parcelAvatarIsEntering != null) | 359 | if (parcelAvatarIsEntering != null) |
385 | { | 360 | EnforceBans(parcelAvatarIsEntering, avatar); |
386 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
387 | { | ||
388 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) | ||
389 | { | ||
390 | SendYouAreBannedNotice(avatar); | ||
391 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
392 | } | ||
393 | else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) | ||
394 | { | ||
395 | SendYouAreRestrictedNotice(avatar); | ||
396 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
397 | } | ||
398 | else | ||
399 | { | ||
400 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
401 | } | ||
402 | } | ||
403 | else | ||
404 | { | ||
405 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
406 | } | ||
407 | } | ||
408 | } | 361 | } |
409 | } | 362 | } |
410 | 363 | ||
@@ -476,43 +429,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
476 | SendOutNearestBanLine(remote_client); | 429 | SendOutNearestBanLine(remote_client); |
477 | ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); | 430 | ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); |
478 | if (parcel != null) | 431 | if (parcel != null) |
479 | { | 432 | EnforceBans(parcel, clientAvatar); |
480 | if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && | ||
481 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) | ||
482 | { | ||
483 | EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, | ||
484 | m_scene.RegionInfo.RegionID); | ||
485 | //They are going under the safety line! | ||
486 | if (!parcel.IsBannedFromLand(clientAvatar.UUID)) | ||
487 | { | ||
488 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; | ||
489 | } | ||
490 | } | ||
491 | else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && | ||
492 | parcel.IsBannedFromLand(clientAvatar.UUID)) | ||
493 | { | ||
494 | //once we've sent the message once, keep going toward the target until we are done | ||
495 | if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) | ||
496 | { | ||
497 | SendYouAreBannedNotice(clientAvatar); | ||
498 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); | ||
499 | } | ||
500 | } | ||
501 | else if (parcel.IsRestrictedFromLand(clientAvatar.UUID)) | ||
502 | { | ||
503 | //once we've sent the message once, keep going toward the target until we are done | ||
504 | if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) | ||
505 | { | ||
506 | SendYouAreRestrictedNotice(clientAvatar); | ||
507 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); | ||
508 | } | ||
509 | } | ||
510 | else | ||
511 | { | ||
512 | //when we are finally in a safe place, lets release the forced position lock | ||
513 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); | ||
514 | } | ||
515 | } | ||
516 | } | 433 | } |
517 | } | 434 | } |
518 | 435 | ||
@@ -709,7 +626,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
709 | int x; | 626 | int x; |
710 | int y; | 627 | int y; |
711 | 628 | ||
712 | if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) | 629 | if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) |
713 | return null; | 630 | return null; |
714 | 631 | ||
715 | try | 632 | try |
@@ -1052,6 +969,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1052 | //Owner Flag | 969 | //Owner Flag |
1053 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | 970 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); |
1054 | } | 971 | } |
972 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
973 | { | ||
974 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP); | ||
975 | } | ||
1055 | else if (currentParcelBlock.LandData.SalePrice > 0 && | 976 | else if (currentParcelBlock.LandData.SalePrice > 0 && |
1056 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | 977 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || |
1057 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | 978 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) |
@@ -1345,24 +1266,38 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1345 | { | 1266 | { |
1346 | land.DeedToGroup(groupID); | 1267 | land.DeedToGroup(groupID); |
1347 | } | 1268 | } |
1269 | EventManagerOnParcelPrimCountTainted(); | ||
1348 | } | 1270 | } |
1349 | 1271 | ||
1350 | #region Land Object From Storage Functions | 1272 | #region Land Object From Storage Functions |
1351 | 1273 | ||
1352 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1274 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
1353 | { | 1275 | { |
1354 | for (int i = 0; i < data.Count; i++) | 1276 | lock (m_landList) |
1355 | { | 1277 | { |
1356 | IncomingLandObjectFromStorage(data[i]); | 1278 | //Remove all the land objects in the sim and then process our new data |
1279 | foreach (int n in m_landList.Keys) | ||
1280 | { | ||
1281 | m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID); | ||
1282 | } | ||
1283 | m_landIDList.Initialize(); | ||
1284 | m_landList.Clear(); | ||
1285 | |||
1286 | for (int i = 0; i < data.Count; i++) | ||
1287 | { | ||
1288 | IncomingLandObjectFromStorage(data[i]); | ||
1289 | } | ||
1357 | } | 1290 | } |
1358 | } | 1291 | } |
1359 | 1292 | ||
1360 | public void IncomingLandObjectFromStorage(LandData data) | 1293 | public void IncomingLandObjectFromStorage(LandData data) |
1361 | { | 1294 | { |
1295 | |||
1362 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1296 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); |
1363 | new_land.LandData = data.Copy(); | 1297 | new_land.LandData = data.Copy(); |
1364 | new_land.SetLandBitmapFromByteArray(); | 1298 | new_land.SetLandBitmapFromByteArray(); |
1365 | AddLandObject(new_land); | 1299 | AddLandObject(new_land); |
1300 | new_land.SendLandUpdateToAvatarsOverMe(); | ||
1366 | } | 1301 | } |
1367 | 1302 | ||
1368 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) | 1303 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) |
@@ -1636,6 +1571,322 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1636 | 1571 | ||
1637 | UpdateLandObject(localID, land.LandData); | 1572 | UpdateLandObject(localID, land.LandData); |
1638 | } | 1573 | } |
1574 | |||
1575 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1576 | { | ||
1577 | ILandObject land = null; | ||
1578 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1579 | foreach (ILandObject landObject in Land) | ||
1580 | { | ||
1581 | if (landObject.LandData.LocalID == landID) | ||
1582 | { | ||
1583 | land = landObject; | ||
1584 | } | ||
1585 | } | ||
1586 | land.DeedToGroup(DefaultGodParcelGroup); | ||
1587 | land.LandData.Name = DefaultGodParcelName; | ||
1588 | land.SendLandUpdateToAvatarsOverMe(); | ||
1589 | } | ||
1590 | |||
1591 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1592 | { | ||
1593 | ScenePresence SP; | ||
1594 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); | ||
1595 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1596 | if (SP.UserLevel != 0) | ||
1597 | { | ||
1598 | if (flags == 0) //All parcels, scripted or not | ||
1599 | { | ||
1600 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1601 | { | ||
1602 | if (e.OwnerID == targetID) | ||
1603 | { | ||
1604 | returns.Add(e); | ||
1605 | } | ||
1606 | } | ||
1607 | ); | ||
1608 | } | ||
1609 | if (flags == 4) //All parcels, scripted object | ||
1610 | { | ||
1611 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1612 | { | ||
1613 | if (e.OwnerID == targetID) | ||
1614 | { | ||
1615 | if (e.scriptScore >= 0.01) | ||
1616 | { | ||
1617 | returns.Add(e); | ||
1618 | } | ||
1619 | } | ||
1620 | } | ||
1621 | ); | ||
1622 | } | ||
1623 | if (flags == 4) //not target parcel, scripted object | ||
1624 | { | ||
1625 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1626 | { | ||
1627 | if (e.OwnerID == targetID) | ||
1628 | { | ||
1629 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1630 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1631 | { | ||
1632 | if (e.scriptScore >= 0.01) | ||
1633 | { | ||
1634 | returns.Add(e); | ||
1635 | } | ||
1636 | } | ||
1637 | } | ||
1638 | } | ||
1639 | ); | ||
1640 | } | ||
1641 | foreach (SceneObjectGroup ol in returns) | ||
1642 | { | ||
1643 | ReturnObject(ol, client); | ||
1644 | } | ||
1645 | } | ||
1646 | } | ||
1647 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1648 | { | ||
1649 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1650 | objs[0] = obj; | ||
1651 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1652 | } | ||
1653 | |||
1654 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
1655 | |||
1656 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1657 | { | ||
1658 | ScenePresence targetAvatar = null; | ||
1659 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1660 | ScenePresence parcelManager = null; | ||
1661 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1662 | System.Threading.Timer Timer; | ||
1663 | |||
1664 | if (targetAvatar.UserLevel == 0) | ||
1665 | { | ||
1666 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1667 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1668 | return; | ||
1669 | if (flags == 0) | ||
1670 | { | ||
1671 | targetAvatar.AllowMovement = false; | ||
1672 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world."); | ||
1673 | parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen."); | ||
1674 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
1675 | Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0); | ||
1676 | Timers.Add(targetAvatar.UUID, Timer); | ||
1677 | } | ||
1678 | else | ||
1679 | { | ||
1680 | targetAvatar.AllowMovement = true; | ||
1681 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you."); | ||
1682 | parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen."); | ||
1683 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1684 | Timers.Remove(targetAvatar.UUID); | ||
1685 | Timer.Dispose(); | ||
1686 | } | ||
1687 | } | ||
1688 | } | ||
1689 | private void OnEndParcelFrozen(object avatar) | ||
1690 | { | ||
1691 | ScenePresence targetAvatar = (ScenePresence)avatar; | ||
1692 | targetAvatar.AllowMovement = true; | ||
1693 | System.Threading.Timer Timer; | ||
1694 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1695 | Timers.Remove(targetAvatar.UUID); | ||
1696 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | ||
1697 | } | ||
1698 | |||
1699 | |||
1700 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1701 | { | ||
1702 | ScenePresence targetAvatar = null; | ||
1703 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1704 | ScenePresence parcelManager = null; | ||
1705 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1706 | //Just eject | ||
1707 | if (flags == 0) | ||
1708 | { | ||
1709 | if (targetAvatar.UserLevel == 0) | ||
1710 | { | ||
1711 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1712 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1713 | return; | ||
1714 | |||
1715 | Vector3 position = new Vector3(0, 0, 0); | ||
1716 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1717 | allParcels = AllParcels(); | ||
1718 | if (allParcels.Count != 1) | ||
1719 | { | ||
1720 | foreach (ILandObject parcel in allParcels) | ||
1721 | { | ||
1722 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1723 | { | ||
1724 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1725 | { | ||
1726 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1727 | { | ||
1728 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1729 | { | ||
1730 | if (parcel.ContainsPoint(x, y)) | ||
1731 | { | ||
1732 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1733 | targetAvatar.TeleportWithMomentum(position); | ||
1734 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1735 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1736 | return; | ||
1737 | } | ||
1738 | } | ||
1739 | } | ||
1740 | } | ||
1741 | } | ||
1742 | } | ||
1743 | } | ||
1744 | Vector3 targetVector; | ||
1745 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1746 | { | ||
1747 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1748 | { | ||
1749 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1750 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1751 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1752 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1753 | return; | ||
1754 | } | ||
1755 | else | ||
1756 | { | ||
1757 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1758 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1759 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1760 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1761 | return; | ||
1762 | } | ||
1763 | } | ||
1764 | else | ||
1765 | { | ||
1766 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1767 | { | ||
1768 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1769 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1770 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1771 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1772 | return; | ||
1773 | } | ||
1774 | else | ||
1775 | { | ||
1776 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1777 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1778 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1779 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1780 | return; | ||
1781 | } | ||
1782 | } | ||
1783 | } | ||
1784 | } | ||
1785 | //Eject and ban | ||
1786 | if (flags == 1) | ||
1787 | { | ||
1788 | if (targetAvatar.UserLevel == 0) | ||
1789 | { | ||
1790 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1791 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1792 | return; | ||
1793 | |||
1794 | Vector3 position = new Vector3(0, 0, 0); | ||
1795 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1796 | allParcels = AllParcels(); | ||
1797 | if (allParcels.Count != 1) | ||
1798 | { | ||
1799 | foreach (ILandObject parcel in allParcels) | ||
1800 | { | ||
1801 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1802 | { | ||
1803 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1804 | { | ||
1805 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1806 | { | ||
1807 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1808 | { | ||
1809 | if (parcel.ContainsPoint(x, y)) | ||
1810 | { | ||
1811 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1812 | targetAvatar.TeleportWithMomentum(position); | ||
1813 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1814 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1815 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1816 | entry.AgentID = targetAvatar.UUID; | ||
1817 | entry.Flags = AccessList.Ban; | ||
1818 | entry.Time = new DateTime(); | ||
1819 | land.LandData.ParcelAccessList.Add(entry); | ||
1820 | return; | ||
1821 | } | ||
1822 | } | ||
1823 | } | ||
1824 | } | ||
1825 | } | ||
1826 | } | ||
1827 | } | ||
1828 | Vector3 targetVector; | ||
1829 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1830 | { | ||
1831 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1832 | { | ||
1833 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1834 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1835 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1836 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1837 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1838 | entry.AgentID = targetAvatar.UUID; | ||
1839 | entry.Flags = AccessList.Ban; | ||
1840 | entry.Time = new DateTime(); | ||
1841 | land.LandData.ParcelAccessList.Add(entry); | ||
1842 | return; | ||
1843 | } | ||
1844 | else | ||
1845 | { | ||
1846 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1847 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1848 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1849 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1850 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1851 | entry.AgentID = targetAvatar.UUID; | ||
1852 | entry.Flags = AccessList.Ban; | ||
1853 | entry.Time = new DateTime(); | ||
1854 | land.LandData.ParcelAccessList.Add(entry); | ||
1855 | return; | ||
1856 | } | ||
1857 | } | ||
1858 | else | ||
1859 | { | ||
1860 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1861 | { | ||
1862 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1863 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1864 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1865 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1866 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1867 | entry.AgentID = targetAvatar.UUID; | ||
1868 | entry.Flags = AccessList.Ban; | ||
1869 | entry.Time = new DateTime(); | ||
1870 | land.LandData.ParcelAccessList.Add(entry); | ||
1871 | return; | ||
1872 | } | ||
1873 | else | ||
1874 | { | ||
1875 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1876 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1877 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1878 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1879 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1880 | entry.AgentID = targetAvatar.UUID; | ||
1881 | entry.Flags = AccessList.Ban; | ||
1882 | entry.Time = new DateTime(); | ||
1883 | land.LandData.ParcelAccessList.Add(entry); | ||
1884 | return; | ||
1885 | } | ||
1886 | } | ||
1887 | } | ||
1888 | } | ||
1889 | } | ||
1639 | 1890 | ||
1640 | protected void InstallInterfaces() | 1891 | protected void InstallInterfaces() |
1641 | { | 1892 | { |
@@ -1698,5 +1949,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1698 | 1949 | ||
1699 | MainConsole.Instance.Output(report.ToString()); | 1950 | MainConsole.Instance.Output(report.ToString()); |
1700 | } | 1951 | } |
1952 | |||
1953 | public void EnforceBans(ILandObject land, ScenePresence avatar) | ||
1954 | { | ||
1955 | if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
1956 | return; | ||
1957 | |||
1958 | if (land.IsEitherBannedOrRestricted(avatar.UUID)) | ||
1959 | { | ||
1960 | if (land.ContainsPoint(Convert.ToInt32(avatar.lastKnownAllowedPosition.X), Convert.ToInt32(avatar.lastKnownAllowedPosition.Y))) | ||
1961 | { | ||
1962 | Vector3? pos = m_scene.GetNearestAllowedPosition(avatar); | ||
1963 | if (pos == null) | ||
1964 | m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient); | ||
1965 | else | ||
1966 | ForceAvatarToPosition(avatar, (Vector3)pos); | ||
1967 | } | ||
1968 | else | ||
1969 | { | ||
1970 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); | ||
1971 | } | ||
1972 | } | ||
1973 | } | ||
1701 | } | 1974 | } |
1702 | } \ No newline at end of file | 1975 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 46c15ed..b114db1 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -414,6 +414,37 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
414 | return false; | 414 | return false; |
415 | } | 415 | } |
416 | 416 | ||
417 | public bool HasGroupAccess(UUID avatar) | ||
418 | { | ||
419 | if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) | ||
420 | { | ||
421 | ScenePresence sp; | ||
422 | if (!m_scene.TryGetScenePresence(avatar, out sp)) | ||
423 | { | ||
424 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
425 | if (groupsModule == null) | ||
426 | return false; | ||
427 | |||
428 | GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar); | ||
429 | if (membership == null || membership.Length == 0) | ||
430 | return false; | ||
431 | |||
432 | foreach (GroupMembershipData d in membership) | ||
433 | { | ||
434 | if (d.GroupID == LandData.GroupID) | ||
435 | return true; | ||
436 | } | ||
437 | return false; | ||
438 | } | ||
439 | |||
440 | if (!sp.ControllingClient.IsGroupMember(LandData.GroupID)) | ||
441 | return false; | ||
442 | |||
443 | return true; | ||
444 | } | ||
445 | return false; | ||
446 | } | ||
447 | |||
417 | public bool IsBannedFromLand(UUID avatar) | 448 | public bool IsBannedFromLand(UUID avatar) |
418 | { | 449 | { |
419 | if (m_scene.Permissions.IsAdministrator(avatar)) | 450 | if (m_scene.Permissions.IsAdministrator(avatar)) |
@@ -450,9 +481,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
450 | return false; | 481 | return false; |
451 | }) == -1 && LandData.OwnerID != avatar) | 482 | }) == -1 && LandData.OwnerID != avatar) |
452 | { | 483 | { |
453 | return true; | 484 | if (!HasGroupAccess(avatar)) |
485 | { | ||
486 | return true; | ||
487 | } | ||
454 | } | 488 | } |
455 | } | 489 | } |
490 | |||
456 | return false; | 491 | return false; |
457 | } | 492 | } |
458 | 493 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 34ef67f..2d1979f 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
169 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) | 169 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) |
170 | { | 170 | { |
171 | UUID landOwner = landData.OwnerID; | 171 | UUID landOwner = landData.OwnerID; |
172 | int partCount = obj.Parts.Length; | 172 | int partCount = obj.GetPartCount(); |
173 | 173 | ||
174 | m_SimwideCounts[landOwner] += partCount; | 174 | m_SimwideCounts[landOwner] += partCount; |
175 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) | 175 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) |