aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs43
1 files changed, 22 insertions, 21 deletions
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