From 32ad66c2744a4b3491c12835ae0c2124c0385b2e Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Thu, 10 Apr 2014 11:47:46 +0200 Subject: Allows to sell objects on a parcel of land together with that parcel of land. The objects that are sold together with the parcel of land need to fulfill the following preconditions: owned by the current parcel owner, not set to a group, transferrable. This feature does not work for group owned parcels or land bought by a group. --- .../Region/CoreModules/World/Land/LandObject.cs | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 920eee8..af19ca3 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -385,9 +385,16 @@ namespace OpenSim.Region.CoreModules.World.Land newData.SalePrice = 0; newData.AuthBuyerID = UUID.Zero; newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); + + bool sellObjects = (LandData.Flags & (uint)(ParcelFlags.SellParcelObjects)) != 0 + && !LandData.IsGroupOwned && !groupOwned; + UUID previousOwner = LandData.OwnerID; + m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); m_scene.EventManager.TriggerParcelPrimCountUpdate(); SendLandUpdateToAvatarsOverMe(true); + + if (sellObjects) SellLandObjects(previousOwner); } public void DeedToGroup(UUID groupID) @@ -1067,6 +1074,43 @@ namespace OpenSim.Region.CoreModules.World.Land #endregion + #region Object Sales + + public void SellLandObjects(UUID previousOwner) + { + // m_log.DebugFormat( + // "[LAND OBJECT]: Request to sell objects in {0} from {1}", LandData.Name, previousOwner); + + if (LandData.IsGroupOwned) + return; + + IBuySellModule m_BuySellModule = m_scene.RequestModuleInterface(); + if (m_BuySellModule == null) + { + m_log.Error("[LAND OBJECT]: BuySellModule not found"); + return; + } + + ScenePresence sp; + if (!m_scene.TryGetScenePresence(LandData.OwnerID, out sp)) + { + m_log.Error("[LAND OBJECT]: New owner is not present in scene"); + return; + } + + lock (primsOverMe) + { + foreach (SceneObjectGroup obj in primsOverMe) + { + if (obj.OwnerID == previousOwner && obj.GroupID == UUID.Zero && + (obj.GetEffectivePermissions() & (uint)(OpenSim.Framework.PermissionMask.Transfer)) != 0) + m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0); + } + } + } + + #endregion + #region Object Returning public void ReturnObject(SceneObjectGroup obj) -- cgit v1.1