diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region')
8 files changed, 88 insertions, 81 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 930a117..d11d677 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -365,12 +365,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
365 | 365 | ||
366 | landData.Add(parcel); | 366 | landData.Add(parcel); |
367 | } | 367 | } |
368 | 368 | ||
369 | if (!m_merge) | 369 | if (!m_merge) |
370 | m_scene.LandChannel.Clear(false); | 370 | { |
371 | bool setupDefaultParcel = (landData.Count == 0); | ||
372 | m_scene.LandChannel.Clear(setupDefaultParcel); | ||
373 | } | ||
371 | 374 | ||
372 | m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData); | 375 | m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData); |
373 | m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count); | 376 | m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count); |
374 | } | 377 | } |
375 | 378 | ||
376 | /// <summary> | 379 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 2307c8e..729e9f7 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -313,6 +313,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
313 | Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); | 313 | Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); |
314 | Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); | 314 | Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); |
315 | 315 | ||
316 | Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels"); | ||
317 | |||
316 | // Temporary | 318 | // Temporary |
317 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); | 319 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); |
318 | } | 320 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index f28faed..4e7c76f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -437,8 +437,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
437 | } | 437 | } |
438 | } | 438 | } |
439 | 439 | ||
440 | /// <summary> | ||
441 | /// Like handleEventManagerOnSignificantClientMovement, but called with an AgentUpdate regardless of distance. | ||
442 | /// </summary> | ||
443 | /// <param name="avatar"></param> | ||
440 | public void EventManagerOnClientMovement(ScenePresence avatar) | 444 | public void EventManagerOnClientMovement(ScenePresence avatar) |
441 | //Like handleEventManagerOnSignificantClientMovement, but called with an AgentUpdate regardless of distance. | 445 | // |
442 | { | 446 | { |
443 | ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 447 | ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); |
444 | if (over != null) | 448 | if (over != null) |
@@ -451,7 +455,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
451 | } | 455 | } |
452 | } | 456 | } |
453 | 457 | ||
454 | |||
455 | public void ClientOnParcelAccessListRequest(UUID agentID, UUID sessionID, uint flags, int sequenceID, | 458 | public void ClientOnParcelAccessListRequest(UUID agentID, UUID sessionID, uint flags, int sequenceID, |
456 | int landLocalID, IClientAPI remote_client) | 459 | int landLocalID, IClientAPI remote_client) |
457 | { | 460 | { |
@@ -585,14 +588,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
585 | //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); | 588 | //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); |
586 | m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); | 589 | m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); |
587 | } | 590 | } |
588 | 591 | ||
589 | m_landList.Clear(); | 592 | m_landList.Clear(); |
593 | |||
594 | ResetSimLandObjects(); | ||
595 | |||
596 | if (setupDefaultParcel) | ||
597 | CreateDefaultParcel(); | ||
590 | } | 598 | } |
591 | |||
592 | ResetSimLandObjects(); | ||
593 | |||
594 | if (setupDefaultParcel) | ||
595 | CreateDefaultParcel(); | ||
596 | } | 599 | } |
597 | 600 | ||
598 | private void performFinalLandJoin(ILandObject master, ILandObject slave) | 601 | private void performFinalLandJoin(ILandObject master, ILandObject slave) |
@@ -1324,8 +1327,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1324 | 1327 | ||
1325 | public void EventManagerOnNoLandDataFromStorage() | 1328 | public void EventManagerOnNoLandDataFromStorage() |
1326 | { | 1329 | { |
1327 | ResetSimLandObjects(); | 1330 | lock (m_landList) |
1328 | CreateDefaultParcel(); | 1331 | { |
1332 | ResetSimLandObjects(); | ||
1333 | CreateDefaultParcel(); | ||
1334 | } | ||
1329 | } | 1335 | } |
1330 | 1336 | ||
1331 | #endregion | 1337 | #endregion |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 0fbc93c..6c9bb10 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
67 | public int GetPrimsFree() | 67 | public int GetPrimsFree() |
68 | { | 68 | { |
69 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 69 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
70 | int free = GetSimulatorMaxPrimCount(this) - m_landData.SimwidePrims; | 70 | int free = GetSimulatorMaxPrimCount() - m_landData.SimwidePrims; |
71 | return free; | 71 | return free; |
72 | } | 72 | } |
73 | 73 | ||
@@ -181,11 +181,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
181 | overrideSimulatorMaxPrimCount = overrideDel; | 181 | overrideSimulatorMaxPrimCount = overrideDel; |
182 | } | 182 | } |
183 | 183 | ||
184 | public int GetParcelMaxPrimCount(ILandObject thisObject) | 184 | public int GetParcelMaxPrimCount() |
185 | { | 185 | { |
186 | if (overrideParcelMaxPrimCount != null) | 186 | if (overrideParcelMaxPrimCount != null) |
187 | { | 187 | { |
188 | return overrideParcelMaxPrimCount(thisObject); | 188 | return overrideParcelMaxPrimCount(this); |
189 | } | 189 | } |
190 | else | 190 | else |
191 | { | 191 | { |
@@ -197,11 +197,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
197 | return parcelMax; | 197 | return parcelMax; |
198 | } | 198 | } |
199 | } | 199 | } |
200 | public int GetSimulatorMaxPrimCount(ILandObject thisObject) | 200 | |
201 | public int GetSimulatorMaxPrimCount() | ||
201 | { | 202 | { |
202 | if (overrideSimulatorMaxPrimCount != null) | 203 | if (overrideSimulatorMaxPrimCount != null) |
203 | { | 204 | { |
204 | return overrideSimulatorMaxPrimCount(thisObject); | 205 | return overrideSimulatorMaxPrimCount(this); |
205 | } | 206 | } |
206 | else | 207 | else |
207 | { | 208 | { |
@@ -244,8 +245,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
244 | remote_client.SendLandProperties(seq_id, | 245 | remote_client.SendLandProperties(seq_id, |
245 | snap_selection, request_result, this, | 246 | snap_selection, request_result, this, |
246 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, | 247 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, |
247 | GetParcelMaxPrimCount(this), | 248 | GetParcelMaxPrimCount(), |
248 | GetSimulatorMaxPrimCount(this), regionFlags); | 249 | GetSimulatorMaxPrimCount(), regionFlags); |
249 | } | 250 | } |
250 | 251 | ||
251 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) | 252 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) |
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index c2934cd..7f6f4df 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -82,14 +82,14 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
82 | false, "region restart bluebox", | 82 | false, "region restart bluebox", |
83 | "region restart bluebox <message> <delta seconds>+", | 83 | "region restart bluebox <message> <delta seconds>+", |
84 | "Schedule a region restart", | 84 | "Schedule a region restart", |
85 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.", | 85 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.", |
86 | HandleRegionRestart); | 86 | HandleRegionRestart); |
87 | 87 | ||
88 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 88 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
89 | false, "region restart notice", | 89 | false, "region restart notice", |
90 | "region restart notice <message> <delta seconds>+", | 90 | "region restart notice <message> <delta seconds>+", |
91 | "Schedule a region restart", | 91 | "Schedule a region restart", |
92 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.", | 92 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.", |
93 | HandleRegionRestart); | 93 | HandleRegionRestart); |
94 | 94 | ||
95 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 95 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 1c30a35..17242dc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -927,9 +927,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
927 | uint callbackID, string description, string name, | 927 | uint callbackID, string description, string name, |
928 | sbyte invType, sbyte type, UUID olditemID) | 928 | sbyte invType, sbyte type, UUID olditemID) |
929 | { | 929 | { |
930 | m_log.DebugFormat( | 930 | // m_log.DebugFormat( |
931 | "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", | 931 | // "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", |
932 | remoteClient.Name, name, folderID, olditemID); | 932 | // remoteClient.Name, name, folderID, olditemID); |
933 | 933 | ||
934 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) | 934 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) |
935 | return; | 935 | return; |
@@ -937,20 +937,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
937 | ScenePresence presence; | 937 | ScenePresence presence; |
938 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | 938 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) |
939 | { | 939 | { |
940 | bool linkAlreadyExists = false; | 940 | // Disabled the check for duplicate links. |
941 | List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); | 941 | // |
942 | foreach (InventoryItemBase item in existingItems) | 942 | // When outfits are being adjusted, the viewer rapidly sends delete link messages followed by |
943 | if (item.AssetID == olditemID) | 943 | // create links. However, since these are handled asynchronously, the deletes do not complete before |
944 | linkAlreadyExists = true; | 944 | // the creates are handled. Therefore, we cannot enforce a duplicate link check. |
945 | 945 | // InventoryItemBase existingLink = null; | |
946 | if (linkAlreadyExists) | 946 | // List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); |
947 | { | 947 | // foreach (InventoryItemBase item in existingItems) |
948 | m_log.WarnFormat( | 948 | // if (item.AssetID == olditemID) |
949 | "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists", | 949 | // existingLink = item; |
950 | remoteClient.Name, name, folderID, olditemID); | 950 | // |
951 | 951 | // if (existingLink != null) | |
952 | return; | 952 | // { |
953 | } | 953 | // m_log.WarnFormat( |
954 | // "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link named {4} with id {5} already exists", | ||
955 | // remoteClient.Name, name, folderID, olditemID, existingLink.Name, existingLink.ID); | ||
956 | // | ||
957 | // return; | ||
958 | // } | ||
954 | 959 | ||
955 | AssetBase asset = new AssetBase(); | 960 | AssetBase asset = new AssetBase(); |
956 | asset.FullID = olditemID; | 961 | asset.FullID = olditemID; |
@@ -978,7 +983,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
978 | /// <param name="itemID"></param> | 983 | /// <param name="itemID"></param> |
979 | private void RemoveInventoryItem(IClientAPI remoteClient, List<UUID> itemIDs) | 984 | private void RemoveInventoryItem(IClientAPI remoteClient, List<UUID> itemIDs) |
980 | { | 985 | { |
981 | //m_log.Debug("[SCENE INVENTORY]: user " + remoteClient.AgentId); | 986 | // m_log.DebugFormat( |
987 | // "[AGENT INVENTORY]: Removing inventory items {0} for {1}", | ||
988 | // string.Join(",", itemIDs.ConvertAll<string>(uuid => uuid.ToString()).ToArray()), | ||
989 | // remoteClient.Name); | ||
990 | |||
982 | InventoryService.DeleteItems(remoteClient.AgentId, itemIDs); | 991 | InventoryService.DeleteItems(remoteClient.AgentId, itemIDs); |
983 | } | 992 | } |
984 | 993 | ||
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs index 471b90f..c1957e2 100644 --- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs +++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | |||
@@ -76,22 +76,24 @@ namespace OpenSim.Region.OptionalModules | |||
76 | 76 | ||
77 | public void AddRegion(Scene scene) | 77 | public void AddRegion(Scene scene) |
78 | { | 78 | { |
79 | if(!m_enabled) | 79 | if (!m_enabled) |
80 | { | 80 | { |
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | scene.Permissions.OnRezObject += CanRezObject; | 83 | scene.Permissions.OnRezObject += CanRezObject; |
84 | scene.Permissions.OnObjectEntry += CanObjectEnter; | 84 | scene.Permissions.OnObjectEntry += CanObjectEnter; |
85 | scene.Permissions.OnDuplicateObject += CanDuplicateObject; | 85 | scene.Permissions.OnDuplicateObject += CanDuplicateObject; |
86 | |||
86 | m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName); | 87 | m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName); |
87 | } | 88 | } |
88 | 89 | ||
89 | public void RemoveRegion(Scene scene) | 90 | public void RemoveRegion(Scene scene) |
90 | { | 91 | { |
91 | if(m_enabled) | 92 | if (m_enabled) |
92 | { | 93 | { |
93 | return; | 94 | return; |
94 | } | 95 | } |
96 | |||
95 | scene.Permissions.OnRezObject -= CanRezObject; | 97 | scene.Permissions.OnRezObject -= CanRezObject; |
96 | scene.Permissions.OnObjectEntry -= CanObjectEnter; | 98 | scene.Permissions.OnObjectEntry -= CanObjectEnter; |
97 | scene.Permissions.OnDuplicateObject -= CanDuplicateObject; | 99 | scene.Permissions.OnDuplicateObject -= CanDuplicateObject; |
@@ -104,13 +106,11 @@ namespace OpenSim.Region.OptionalModules | |||
104 | 106 | ||
105 | private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) | 107 | private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) |
106 | { | 108 | { |
107 | // This may be a little long winded and can probably be optomized | 109 | ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); |
108 | int usedPrims = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).PrimCounts.Total; | 110 | int usedPrims = lo.PrimCounts.Total; |
109 | LandData landData = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).LandData; | 111 | int simulatorCapacity = lo.GetSimulatorMaxPrimCount(); |
110 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * | ||
111 | (float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus); | ||
112 | 112 | ||
113 | if(objectCount + usedPrims > simulatorCapacity) | 113 | if (objectCount + usedPrims > simulatorCapacity) |
114 | { | 114 | { |
115 | m_dialogModule.SendAlertToUser(owner, "Unable to rez object because the parcel is too full"); | 115 | m_dialogModule.SendAlertToUser(owner, "Unable to rez object because the parcel is too full"); |
116 | return false; | 116 | return false; |
@@ -118,7 +118,7 @@ namespace OpenSim.Region.OptionalModules | |||
118 | 118 | ||
119 | return true; | 119 | return true; |
120 | } | 120 | } |
121 | //OnMoveObject | 121 | |
122 | private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) | 122 | private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) |
123 | { | 123 | { |
124 | SceneObjectPart obj = scene.GetSceneObjectPart(objectID); | 124 | SceneObjectPart obj = scene.GetSceneObjectPart(objectID); |
@@ -126,11 +126,9 @@ namespace OpenSim.Region.OptionalModules | |||
126 | int objectCount = obj.ParentGroup.PrimCount; | 126 | int objectCount = obj.ParentGroup.PrimCount; |
127 | ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); | 127 | ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); |
128 | ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); | 128 | ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); |
129 | 129 | ||
130 | int usedPrims=newParcel.PrimCounts.Total; | 130 | int usedPrims = newParcel.PrimCounts.Total; |
131 | LandData landData = newParcel.LandData; | 131 | int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); |
132 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * | ||
133 | (float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus); | ||
134 | 132 | ||
135 | // The prim hasn't crossed a region boundry so we don't need to worry | 133 | // The prim hasn't crossed a region boundry so we don't need to worry |
136 | // about prim counts here | 134 | // about prim counts here |
@@ -138,36 +136,39 @@ namespace OpenSim.Region.OptionalModules | |||
138 | { | 136 | { |
139 | return true; | 137 | return true; |
140 | } | 138 | } |
139 | |||
141 | // Prim counts are determined by the location of the root prim. if we're | 140 | // Prim counts are determined by the location of the root prim. if we're |
142 | // moving a child prim, just let it pass | 141 | // moving a child prim, just let it pass |
143 | if(!obj.IsRoot) | 142 | if(!obj.IsRoot) |
144 | { | 143 | { |
145 | return true; | 144 | return true; |
146 | } | 145 | } |
147 | // Add Special Case here for temporary prims | 146 | |
147 | // TODO: Add Special Case here for temporary prims | ||
148 | 148 | ||
149 | if(objectCount + usedPrims > simulatorCapacity) | 149 | if(objectCount + usedPrims > simulatorCapacity) |
150 | { | 150 | { |
151 | m_dialogModule.SendAlertToUser(obj.OwnerID, "Unable to move object because the destination parcel is too full"); | 151 | m_dialogModule.SendAlertToUser(obj.OwnerID, "Unable to move object because the destination parcel is too full"); |
152 | return false; | 152 | return false; |
153 | } | 153 | } |
154 | |||
154 | return true; | 155 | return true; |
155 | } | 156 | } |
157 | |||
156 | //OnDuplicateObject | 158 | //OnDuplicateObject |
157 | private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition) | 159 | private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition) |
158 | { | 160 | { |
159 | // This may be a little long winded and can probably be optomized | 161 | ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); |
160 | int usedPrims = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).PrimCounts.Total; | 162 | int usedPrims = lo.PrimCounts.Total; |
161 | LandData landData = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).LandData; | 163 | int simulatorCapacity = lo.GetSimulatorMaxPrimCount(); |
162 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * | ||
163 | (float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus); | ||
164 | 164 | ||
165 | if(objectCount + usedPrims > simulatorCapacity) | 165 | if(objectCount + usedPrims > simulatorCapacity) |
166 | { | 166 | { |
167 | m_dialogModule.SendAlertToUser(owner, "Unable to duplicate object because the parcel is too full"); | 167 | m_dialogModule.SendAlertToUser(owner, "Unable to duplicate object because the parcel is too full"); |
168 | return false; | 168 | return false; |
169 | } | 169 | } |
170 | |||
170 | return true; | 171 | return true; |
171 | } | 172 | } |
172 | } | 173 | } |
173 | } | 174 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1f60a7b..48a7953 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -10587,31 +10587,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10587 | public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide) | 10587 | public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide) |
10588 | { | 10588 | { |
10589 | m_host.AddScriptLPS(1); | 10589 | m_host.AddScriptLPS(1); |
10590 | // Alondria: This currently just is utilizing the normal grid's 0.22 prims/m2 calculation | ||
10591 | // Which probably will be irrelevent in OpenSim.... | ||
10592 | LandData land = World.GetLandData((float)pos.x, (float)pos.y); | ||
10593 | 10590 | ||
10594 | float bonusfactor = (float)World.RegionInfo.RegionSettings.ObjectBonus; | 10591 | ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); |
10595 | 10592 | ||
10596 | if (land == null) | 10593 | if (lo == null) |
10597 | { | ||
10598 | return 0; | 10594 | return 0; |
10599 | } | ||
10600 | 10595 | ||
10601 | if (sim_wide != 0) | 10596 | if (sim_wide != 0) |
10602 | { | 10597 | return lo.GetSimulatorMaxPrimCount(); |
10603 | decimal v = land.SimwideArea * (decimal)(0.22) * (decimal)bonusfactor; | ||
10604 | |||
10605 | return (int)v; | ||
10606 | } | ||
10607 | |||
10608 | else | 10598 | else |
10609 | { | 10599 | return lo.GetParcelMaxPrimCount(); |
10610 | decimal v = land.Area * (decimal)(0.22) * (decimal)bonusfactor; | ||
10611 | |||
10612 | return (int)v; | ||
10613 | } | ||
10614 | |||
10615 | } | 10600 | } |
10616 | 10601 | ||
10617 | public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param) | 10602 | public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param) |