diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs index 635df96..6f2eedc 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; } } |
@@ -80,6 +81,7 @@ namespace OpenSim.Region.OptionalModules | |||
80 | { | 81 | { |
81 | return; | 82 | return; |
82 | } | 83 | } |
84 | m_scene = scene; | ||
83 | scene.Permissions.OnRezObject += CanRezObject; | 85 | scene.Permissions.OnRezObject += CanRezObject; |
84 | scene.Permissions.OnObjectEntry += CanObjectEnter; | 86 | scene.Permissions.OnObjectEntry += CanObjectEnter; |
85 | scene.Permissions.OnDuplicateObject += CanDuplicateObject; | 87 | scene.Permissions.OnDuplicateObject += CanDuplicateObject; |
@@ -94,9 +96,9 @@ namespace OpenSim.Region.OptionalModules | |||
94 | return; | 96 | return; |
95 | } | 97 | } |
96 | 98 | ||
97 | scene.Permissions.OnRezObject -= CanRezObject; | 99 | m_scene.Permissions.OnRezObject -= CanRezObject; |
98 | scene.Permissions.OnObjectEntry -= CanObjectEnter; | 100 | m_scene.Permissions.OnObjectEntry -= CanObjectEnter; |
99 | scene.Permissions.OnDuplicateObject -= CanDuplicateObject; | 101 | m_scene.Permissions.OnDuplicateObject -= CanDuplicateObject; |
100 | } | 102 | } |
101 | 103 | ||
102 | public void RegionLoaded(Scene scene) | 104 | public void RegionLoaded(Scene scene) |
@@ -104,12 +106,12 @@ namespace OpenSim.Region.OptionalModules | |||
104 | m_dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 106 | m_dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
105 | } | 107 | } |
106 | 108 | ||
107 | private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene) | 109 | private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition) |
108 | { | 110 | { |
109 | 111 | ||
110 | ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); | 112 | ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); |
111 | 113 | ||
112 | string response = DoCommonChecks(objectCount, ownerID, lo, scene); | 114 | string response = DoCommonChecks(objectCount, ownerID, lo); |
113 | 115 | ||
114 | if (response != null) | 116 | if (response != null) |
115 | { | 117 | { |
@@ -120,12 +122,12 @@ namespace OpenSim.Region.OptionalModules | |||
120 | } | 122 | } |
121 | 123 | ||
122 | //OnDuplicateObject | 124 | //OnDuplicateObject |
123 | private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene) | 125 | private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp) |
124 | { | 126 | { |
125 | Vector3 objectPosition = sog.AbsolutePosition; | 127 | Vector3 objectPosition = sog.AbsolutePosition; |
126 | ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); | 128 | ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); |
127 | 129 | ||
128 | string response = DoCommonChecks(sog.PrimCount, sp.UUID, lo, scene); | 130 | string response = DoCommonChecks(sog.PrimCount, sp.UUID, lo); |
129 | 131 | ||
130 | if (response != null) | 132 | if (response != null) |
131 | { | 133 | { |
@@ -135,18 +137,18 @@ namespace OpenSim.Region.OptionalModules | |||
135 | return true; | 137 | return true; |
136 | } | 138 | } |
137 | 139 | ||
138 | private bool CanObjectEnter(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene) | 140 | private bool CanObjectEnter(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint) |
139 | { | 141 | { |
140 | float newX = newPoint.X; | 142 | float newX = newPoint.X; |
141 | float newY = newPoint.Y; | 143 | float newY = newPoint.Y; |
142 | if (newX < -1.0f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) || | 144 | if (newX < -1.0f || newX > (m_scene.RegionInfo.RegionSizeX + 1.0f) || |
143 | newY < -1.0f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) ) | 145 | newY < -1.0f || newY > (m_scene.RegionInfo.RegionSizeY + 1.0f) ) |
144 | return true; | 146 | return true; |
145 | 147 | ||
146 | if (sog == null) | 148 | if (sog == null) |
147 | return false; | 149 | return false; |
148 | 150 | ||
149 | ILandObject newParcel = scene.LandChannel.GetLandObject(newX, newY); | 151 | ILandObject newParcel = m_scene.LandChannel.GetLandObject(newX, newY); |
150 | 152 | ||
151 | if (newParcel == null) | 153 | if (newParcel == null) |
152 | return true; | 154 | return true; |
@@ -154,7 +156,7 @@ namespace OpenSim.Region.OptionalModules | |||
154 | if(!enteringRegion) | 156 | if(!enteringRegion) |
155 | { | 157 | { |
156 | Vector3 oldPoint = sog.AbsolutePosition; | 158 | Vector3 oldPoint = sog.AbsolutePosition; |
157 | ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); | 159 | ILandObject oldParcel = m_scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); |
158 | if(oldParcel != null && oldParcel.Equals(newParcel)) | 160 | if(oldParcel != null && oldParcel.Equals(newParcel)) |
159 | return true; | 161 | return true; |
160 | } | 162 | } |
@@ -163,7 +165,7 @@ namespace OpenSim.Region.OptionalModules | |||
163 | 165 | ||
164 | // TODO: Add Special Case here for temporary prims | 166 | // TODO: Add Special Case here for temporary prims |
165 | 167 | ||
166 | string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel, scene); | 168 | string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel); |
167 | 169 | ||
168 | if (response != null) | 170 | if (response != null) |
169 | { | 171 | { |
@@ -174,25 +176,25 @@ namespace OpenSim.Region.OptionalModules | |||
174 | return true; | 176 | return true; |
175 | } | 177 | } |
176 | 178 | ||
177 | private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo, Scene scene) | 179 | private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo) |
178 | { | 180 | { |
179 | string response = null; | 181 | string response = null; |
180 | 182 | ||
181 | int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount(); | 183 | int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount(); |
182 | if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity) | 184 | if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity) |
183 | { | 185 | { |
184 | response = "Unable to rez object because the region is too full"; | 186 | response = "Unable to rez object because the parcel is full"; |
185 | } | 187 | } |
186 | else | 188 | else |
187 | { | 189 | { |
188 | int maxPrimsPerUser = scene.RegionInfo.MaxPrimsPerUser; | 190 | int maxPrimsPerUser = m_scene.RegionInfo.MaxPrimsPerUser; |
189 | if (maxPrimsPerUser >= 0) | 191 | if (maxPrimsPerUser >= 0) |
190 | { | 192 | { |
191 | // per-user prim limit is set | 193 | // per-user prim limit is set |
192 | if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned) | 194 | if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned) |
193 | { | 195 | { |
194 | // caller is not the sole Parcel owner | 196 | // caller is not the sole Parcel owner |
195 | EstateSettings estateSettings = scene.RegionInfo.EstateSettings; | 197 | EstateSettings estateSettings = m_scene.RegionInfo.EstateSettings; |
196 | if (ownerID != estateSettings.EstateOwner) | 198 | if (ownerID != estateSettings.EstateOwner) |
197 | { | 199 | { |
198 | // caller is NOT the Estate owner | 200 | // caller is NOT the Estate owner |