aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorMelanie2013-04-25 00:24:48 +0100
committerMelanie2013-04-25 00:24:48 +0100
commit6f3c905744e674f3cca555a4d36ede2139fcb9d7 (patch)
tree52a79ea2f9b6f4c71b9999c128455a629514a06b /OpenSim/Region/CoreModules/World
parentBulletSim: version of libBulletSim.so for 32 bit systems that doesn't (diff)
downloadopensim-SC_OLD-6f3c905744e674f3cca555a4d36ede2139fcb9d7.zip
opensim-SC_OLD-6f3c905744e674f3cca555a4d36ede2139fcb9d7.tar.gz
opensim-SC_OLD-6f3c905744e674f3cca555a4d36ede2139fcb9d7.tar.bz2
opensim-SC_OLD-6f3c905744e674f3cca555a4d36ede2139fcb9d7.tar.xz
Add Avination's support for parcel eject and freeze
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs85
1 files changed, 85 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index dbf5138..693de1d 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -210,6 +210,9 @@ namespace OpenSim.Region.CoreModules.World.Land
210 client.OnParcelInfoRequest += ClientOnParcelInfoRequest; 210 client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
211 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; 211 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
212 client.OnPreAgentUpdate += ClientOnPreAgentUpdate; 212 client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
213 client.OnParcelEjectUser += ClientOnParcelEjectUser;
214 client.OnParcelFreezeUser += ClientOnParcelFreezeUser;
215
213 216
214 EntityBase presenceEntity; 217 EntityBase presenceEntity;
215 if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) 218 if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence)
@@ -1738,6 +1741,88 @@ namespace OpenSim.Region.CoreModules.World.Land
1738 UpdateLandObject(localID, land.LandData); 1741 UpdateLandObject(localID, land.LandData);
1739 } 1742 }
1740 1743
1744 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
1745
1746 public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1747 {
1748 ScenePresence targetAvatar = null;
1749 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1750 ScenePresence parcelManager = null;
1751 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1752 System.Threading.Timer Timer;
1753
1754 if (targetAvatar.UserLevel == 0)
1755 {
1756 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1757 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze))
1758 return;
1759 if (flags == 0)
1760 {
1761 targetAvatar.AllowMovement = false;
1762 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world.");
1763 parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen.");
1764 System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
1765 Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0);
1766 Timers.Add(targetAvatar.UUID, Timer);
1767 }
1768 else
1769 {
1770 targetAvatar.AllowMovement = true;
1771 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you.");
1772 parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen.");
1773 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1774 Timers.Remove(targetAvatar.UUID);
1775 Timer.Dispose();
1776 }
1777 }
1778 }
1779
1780 private void OnEndParcelFrozen(object avatar)
1781 {
1782 ScenePresence targetAvatar = (ScenePresence)avatar;
1783 targetAvatar.AllowMovement = true;
1784 System.Threading.Timer Timer;
1785 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1786 Timers.Remove(targetAvatar.UUID);
1787 targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false);
1788 }
1789
1790 public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1791 {
1792 ScenePresence targetAvatar = null;
1793 ScenePresence parcelManager = null;
1794
1795 // Must have presences
1796 if (!m_scene.TryGetScenePresence(target, out targetAvatar) ||
1797 !m_scene.TryGetScenePresence(client.AgentId, out parcelManager))
1798 return;
1799
1800 // Cannot eject estate managers or gods
1801 if (m_scene.Permissions.IsAdministrator(target))
1802 return;
1803
1804 // Check if you even have permission to do this
1805 ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1806 if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze) &&
1807 !m_scene.Permissions.IsAdministrator(client.AgentId))
1808 return;
1809 Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land);
1810
1811 targetAvatar.TeleportWithMomentum(pos, null);
1812 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1813 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1814
1815 if ((flags & 1) != 0) // Ban TODO: Remove magic number
1816 {
1817 LandAccessEntry entry = new LandAccessEntry();
1818 entry.AgentID = targetAvatar.UUID;
1819 entry.Flags = AccessList.Ban;
1820 entry.Expires = 0; // Perm
1821
1822 land.LandData.ParcelAccessList.Add(entry);
1823 }
1824 }
1825
1741 protected void InstallInterfaces() 1826 protected void InstallInterfaces()
1742 { 1827 {
1743 Command clearCommand 1828 Command clearCommand