diff options
author | Diva Canto | 2013-05-11 07:15:09 -0700 |
---|---|---|
committer | Diva Canto | 2013-05-11 07:15:09 -0700 |
commit | 48f8b884c33ba5f5b7991d1047f4f2f988eb7415 (patch) | |
tree | a2decab7f74c1fd3c047e179118d0f25d8573667 /OpenSim | |
parent | Delete debug message (diff) | |
download | opensim-SC_OLD-48f8b884c33ba5f5b7991d1047f4f2f988eb7415.zip opensim-SC_OLD-48f8b884c33ba5f5b7991d1047f4f2f988eb7415.tar.gz opensim-SC_OLD-48f8b884c33ba5f5b7991d1047f4f2f988eb7415.tar.bz2 opensim-SC_OLD-48f8b884c33ba5f5b7991d1047f4f2f988eb7415.tar.xz |
Handle SetHome properly
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 693de1d..c295f3a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -74,6 +74,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
74 | 74 | ||
75 | protected IUserManagement m_userManager; | 75 | protected IUserManagement m_userManager; |
76 | protected IPrimCountModule m_primCountModule; | 76 | protected IPrimCountModule m_primCountModule; |
77 | protected IDialogModule m_Dialog; | ||
78 | protected IGroupsModule m_Groups; | ||
77 | 79 | ||
78 | // Minimum for parcels to work is 64m even if we don't actually use them. | 80 | // Minimum for parcels to work is 64m even if we don't actually use them. |
79 | #pragma warning disable 0429 | 81 | #pragma warning disable 0429 |
@@ -153,6 +155,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
153 | { | 155 | { |
154 | m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); | 156 | m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); |
155 | m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>(); | 157 | m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>(); |
158 | m_Dialog = m_scene.RequestModuleInterface<IDialogModule>(); | ||
159 | m_Groups = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
156 | } | 160 | } |
157 | 161 | ||
158 | public void RemoveRegion(Scene scene) | 162 | public void RemoveRegion(Scene scene) |
@@ -212,6 +216,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
212 | client.OnPreAgentUpdate += ClientOnPreAgentUpdate; | 216 | client.OnPreAgentUpdate += ClientOnPreAgentUpdate; |
213 | client.OnParcelEjectUser += ClientOnParcelEjectUser; | 217 | client.OnParcelEjectUser += ClientOnParcelEjectUser; |
214 | client.OnParcelFreezeUser += ClientOnParcelFreezeUser; | 218 | client.OnParcelFreezeUser += ClientOnParcelFreezeUser; |
219 | client.OnSetStartLocationRequest += ClientOnSetHome; | ||
215 | 220 | ||
216 | 221 | ||
217 | EntityBase presenceEntity; | 222 | EntityBase presenceEntity; |
@@ -1823,6 +1828,60 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1823 | } | 1828 | } |
1824 | } | 1829 | } |
1825 | 1830 | ||
1831 | /// <summary> | ||
1832 | /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in | ||
1833 | /// </summary> | ||
1834 | /// <param name="remoteClient"></param> | ||
1835 | /// <param name="regionHandle"></param> | ||
1836 | /// <param name="position"></param> | ||
1837 | /// <param name="lookAt"></param> | ||
1838 | /// <param name="flags"></param> | ||
1839 | public virtual void ClientOnSetHome(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | ||
1840 | { | ||
1841 | m_log.DebugFormat("[XXX]: SetHome"); | ||
1842 | // Let's find the parcel in question | ||
1843 | ILandObject land = landChannel.GetLandObject(position); | ||
1844 | if (land == null || m_scene.GridUserService == null) | ||
1845 | { | ||
1846 | m_Dialog.SendAlertToUser(remoteClient, "Set Home request Failed."); | ||
1847 | return; | ||
1848 | } | ||
1849 | |||
1850 | // Can the user set home here? | ||
1851 | bool canSetHome = false; | ||
1852 | // (a) land owners can set home | ||
1853 | if (remoteClient.AgentId == land.LandData.OwnerID) | ||
1854 | canSetHome = true; | ||
1855 | // (b) members of land-owned group in roles that can set home | ||
1856 | if (land.LandData.IsGroupOwned && m_Groups != null) | ||
1857 | { | ||
1858 | ulong gpowers = remoteClient.GetGroupPowers(land.LandData.GroupID); | ||
1859 | m_log.DebugFormat("[XXX]: GroupPowers 0x{0:x16}", gpowers); | ||
1860 | if ((gpowers & (ulong)GroupPowers.AllowSetHome) == 1) | ||
1861 | canSetHome = true; | ||
1862 | } | ||
1863 | // (c) parcels with telehubs can be the home of anyone | ||
1864 | if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero) | ||
1865 | { | ||
1866 | // If the telehub in this parcel? | ||
1867 | SceneObjectGroup telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); | ||
1868 | if (telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y)) | ||
1869 | canSetHome = true; | ||
1870 | } | ||
1871 | |||
1872 | if (canSetHome) | ||
1873 | { | ||
1874 | if (m_scene.GridUserService != null && m_scene.GridUserService.SetHome(remoteClient.AgentId.ToString(), land.RegionUUID, position, lookAt)) | ||
1875 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | ||
1876 | m_Dialog.SendAlertToUser(remoteClient, "Home position set."); | ||
1877 | else | ||
1878 | m_Dialog.SendAlertToUser(remoteClient, "Set Home request Failed."); | ||
1879 | } | ||
1880 | else | ||
1881 | m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); | ||
1882 | } | ||
1883 | |||
1884 | |||
1826 | protected void InstallInterfaces() | 1885 | protected void InstallInterfaces() |
1827 | { | 1886 | { |
1828 | Command clearCommand | 1887 | Command clearCommand |