aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs25
-rw-r--r--OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs81
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs4
4 files changed, 52 insertions, 60 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
index ed27385..92b5831 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
@@ -134,11 +134,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
134 private int llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint) 134 private int llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint)
135 { 135 {
136 SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host); 136 SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host);
137
138 if (hostPart == null) 137 if (hostPart == null)
139 return 0; 138 return 0;
140 139
141 if (hostPart.ParentGroup.IsAttachment) 140 SceneObjectGroup hostgroup = hostPart.ParentGroup;
141
142 if (hostgroup== null || hostgroup.IsAttachment)
142 return 0; 143 return 0;
143 144
144 IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface<IAttachmentsModule>(); 145 IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface<IAttachmentsModule>();
@@ -156,32 +157,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
156 if (!m_scene.TryGetScenePresence(item.PermsGranter, out target)) 157 if (!m_scene.TryGetScenePresence(item.PermsGranter, out target))
157 return 0; 158 return 0;
158 159
159 if (target.UUID != hostPart.ParentGroup.OwnerID) 160 if (target.UUID != hostgroup.OwnerID)
160 { 161 {
161 uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions(); 162 uint effectivePerms = hostgroup.EffectiveOwnerPerms;
162 163
163 if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) 164 if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
164 return 0; 165 return 0;
165 166
166 hostPart.ParentGroup.SetOwnerId(target.UUID); 167 hostgroup.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId);
167 hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId);
168 168
169 if (m_scene.Permissions.PropagatePermissions()) 169 if (m_scene.Permissions.PropagatePermissions())
170 { 170 {
171 foreach (SceneObjectPart child in hostPart.ParentGroup.Parts) 171 foreach (SceneObjectPart child in hostgroup.Parts)
172 { 172 {
173 child.Inventory.ChangeInventoryOwner(target.UUID); 173 child.Inventory.ChangeInventoryOwner(target.UUID);
174 child.TriggerScriptChangedEvent(Changed.OWNER); 174 child.TriggerScriptChangedEvent(Changed.OWNER);
175 child.ApplyNextOwnerPermissions(); 175 child.ApplyNextOwnerPermissions();
176 } 176 }
177 hostgroup.AggregatePerms();
177 } 178 }
178 179
179 hostPart.ParentGroup.RootPart.ObjectSaleType = 0; 180 hostgroup.RootPart.ObjectSaleType = 0;
180 hostPart.ParentGroup.RootPart.SalePrice = 10; 181 hostgroup.RootPart.SalePrice = 10;
181 182
182 hostPart.ParentGroup.HasGroupChanged = true; 183 hostgroup.HasGroupChanged = true;
183 hostPart.ParentGroup.RootPart.SendPropertiesToClient(target.ControllingClient); 184 hostgroup.RootPart.SendPropertiesToClient(target.ControllingClient);
184 hostPart.ParentGroup.RootPart.ScheduleFullUpdate(); 185 hostgroup.RootPart.ScheduleFullUpdate();
185 } 186 }
186 187
187 return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, true) ? 1 : 0; 188 return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, true) ? 1 : 0;
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index 9c0fa75..af32d05 100644
--- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
+++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Region.OptionalModules
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 private bool m_enabled; 53 private bool m_enabled;
54 54
55 private Scene m_scene;
55 public string Name { get { return "PrimLimitsModule"; } } 56 public string Name { get { return "PrimLimitsModule"; } }
56 57
57 public Type ReplaceableInterface { get { return null; } } 58 public Type ReplaceableInterface { get { return null; } }
@@ -77,9 +78,9 @@ namespace OpenSim.Region.OptionalModules
77 public void AddRegion(Scene scene) 78 public void AddRegion(Scene scene)
78 { 79 {
79 if (!m_enabled) 80 if (!m_enabled)
80 {
81 return; 81 return;
82 } 82
83 m_scene = scene;
83 scene.Permissions.OnRezObject += CanRezObject; 84 scene.Permissions.OnRezObject += CanRezObject;
84 scene.Permissions.OnObjectEntry += CanObjectEnter; 85 scene.Permissions.OnObjectEntry += CanObjectEnter;
85 scene.Permissions.OnDuplicateObject += CanDuplicateObject; 86 scene.Permissions.OnDuplicateObject += CanDuplicateObject;
@@ -89,14 +90,12 @@ namespace OpenSim.Region.OptionalModules
89 90
90 public void RemoveRegion(Scene scene) 91 public void RemoveRegion(Scene scene)
91 { 92 {
92 if (m_enabled) 93 if (!m_enabled)
93 {
94 return; 94 return;
95 }
96 95
97 scene.Permissions.OnRezObject -= CanRezObject; 96 m_scene.Permissions.OnRezObject -= CanRezObject;
98 scene.Permissions.OnObjectEntry -= CanObjectEnter; 97 m_scene.Permissions.OnObjectEntry -= CanObjectEnter;
99 scene.Permissions.OnDuplicateObject -= CanDuplicateObject; 98 m_scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
100 } 99 }
101 100
102 public void RegionLoaded(Scene scene) 101 public void RegionLoaded(Scene scene)
@@ -104,11 +103,12 @@ namespace OpenSim.Region.OptionalModules
104 m_dialogModule = scene.RequestModuleInterface<IDialogModule>(); 103 m_dialogModule = scene.RequestModuleInterface<IDialogModule>();
105 } 104 }
106 105
107 private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene) 106 private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition)
108 { 107 {
109 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 108
109 ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
110 110
111 string response = DoCommonChecks(objectCount, ownerID, lo, scene); 111 string response = DoCommonChecks(objectCount, ownerID, lo);
112 112
113 if (response != null) 113 if (response != null)
114 { 114 {
@@ -119,88 +119,79 @@ namespace OpenSim.Region.OptionalModules
119 } 119 }
120 120
121 //OnDuplicateObject 121 //OnDuplicateObject
122 private bool CanDuplicateObject(int objectCount, UUID objectID, UUID ownerID, Scene scene, Vector3 objectPosition) 122 private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp)
123 { 123 {
124 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 124 Vector3 objectPosition = sog.AbsolutePosition;
125 ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
125 126
126 string response = DoCommonChecks(objectCount, ownerID, lo, scene); 127 string response = DoCommonChecks(sog.PrimCount, sp.UUID, lo);
127 128
128 if (response != null) 129 if (response != null)
129 { 130 {
130 m_dialogModule.SendAlertToUser(ownerID, response); 131 m_dialogModule.SendAlertToUser(sp.UUID, response);
131 return false; 132 return false;
132 } 133 }
133 return true; 134 return true;
134 } 135 }
135 136
136 private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) 137 private bool CanObjectEnter(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
137 { 138 {
138 if (newPoint.X < -1f || newPoint.X > (scene.RegionInfo.RegionSizeX + 1) || 139 float newX = newPoint.X;
139 newPoint.Y < -1f || newPoint.Y > (scene.RegionInfo.RegionSizeY) ) 140 float newY = newPoint.Y;
141 if (newX < -1.0f || newX > (m_scene.RegionInfo.RegionSizeX + 1.0f) ||
142 newY < -1.0f || newY > (m_scene.RegionInfo.RegionSizeY + 1.0f) )
140 return true; 143 return true;
141 144
142 SceneObjectPart obj = scene.GetSceneObjectPart(objectID); 145 if (sog == null)
143
144 if (obj == null)
145 return false; 146 return false;
146 147
147 // Prim counts are determined by the location of the root prim. if we're 148 ILandObject newParcel = m_scene.LandChannel.GetLandObject(newX, newY);
148 // moving a child prim, just let it pass
149 if (!obj.IsRoot)
150 {
151 return true;
152 }
153
154 ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
155 149
156 if (newParcel == null) 150 if (newParcel == null)
157 return true; 151 return true;
158 152
159 Vector3 oldPoint = obj.GroupPosition; 153 if(!enteringRegion)
160 ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
161
162 // The prim hasn't crossed a region boundry so we don't need to worry
163 // about prim counts here
164 if(oldParcel != null && oldParcel.Equals(newParcel))
165 { 154 {
166 return true; 155 Vector3 oldPoint = sog.AbsolutePosition;
156 ILandObject oldParcel = m_scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
157 if(oldParcel != null && oldParcel.Equals(newParcel))
158 return true;
167 } 159 }
168 160
169 int objectCount = obj.ParentGroup.PrimCount; 161 int objectCount = sog.PrimCount;
170 int usedPrims = newParcel.PrimCounts.Total;
171 int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount();
172 162
173 // TODO: Add Special Case here for temporary prims 163 // TODO: Add Special Case here for temporary prims
174 164
175 string response = DoCommonChecks(objectCount, obj.OwnerID, newParcel, scene); 165 string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel);
176 166
177 if (response != null) 167 if (response != null)
178 { 168 {
179 m_dialogModule.SendAlertToUser(obj.OwnerID, response); 169 if(m_dialogModule != null)
170 m_dialogModule.SendAlertToUser(sog.OwnerID, response);
180 return false; 171 return false;
181 } 172 }
182 return true; 173 return true;
183 } 174 }
184 175
185 private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo, Scene scene) 176 private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo)
186 { 177 {
187 string response = null; 178 string response = null;
188 179
189 int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount(); 180 int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount();
190 if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity) 181 if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity)
191 { 182 {
192 response = "Unable to rez object because the parcel is too full"; 183 response = "Unable to rez object because the parcel is full";
193 } 184 }
194 else 185 else
195 { 186 {
196 int maxPrimsPerUser = scene.RegionInfo.MaxPrimsPerUser; 187 int maxPrimsPerUser = m_scene.RegionInfo.MaxPrimsPerUser;
197 if (maxPrimsPerUser >= 0) 188 if (maxPrimsPerUser >= 0)
198 { 189 {
199 // per-user prim limit is set 190 // per-user prim limit is set
200 if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned) 191 if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned)
201 { 192 {
202 // caller is not the sole Parcel owner 193 // caller is not the sole Parcel owner
203 EstateSettings estateSettings = scene.RegionInfo.EstateSettings; 194 EstateSettings estateSettings = m_scene.RegionInfo.EstateSettings;
204 if (ownerID != estateSettings.EstateOwner) 195 if (ownerID != estateSettings.EstateOwner)
205 { 196 {
206 // caller is NOT the Estate owner 197 // caller is NOT the Estate owner
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
index a9fdb66..6cf0092 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
@@ -665,7 +665,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
665 taskItem.AssetID = asset.FullID; 665 taskItem.AssetID = asset.FullID;
666 666
667 host.Inventory.AddInventoryItem(taskItem, false); 667 host.Inventory.AddInventoryItem(taskItem, false);
668 668 host.ParentGroup.AggregatePerms();
669 m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString()); 669 m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString());
670 } 670 }
671 671
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index e22c6ea..b26fa32 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -523,9 +523,9 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
523 523
524 rootPart.AddFlag(PrimFlags.Phantom); 524 rootPart.AddFlag(PrimFlags.Phantom);
525 525
526 m_scene.AddNewSceneObject(sceneObject, true);
527 sceneObject.SetGroup(groupID, null); 526 sceneObject.SetGroup(groupID, null);
528 527 m_scene.AddNewSceneObject(sceneObject, true);
528 sceneObject.AggregatePerms();
529 return sceneObject; 529 return sceneObject;
530 } 530 }
531 531