aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs36
-rw-r--r--OpenSim/Region/Environment/Scenes/EventManager.cs15
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs31
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs32
5 files changed, 110 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
index d3aa4aa..ab5898d 100644
--- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
@@ -313,12 +313,21 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
313 } 313 }
314 private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient) 314 private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient)
315 { 315 {
316 Dictionary<uint, float> colliders = m_scene.PhysicsScene.GetTopColliders(); 316 Dictionary<uint, float> SceneData = new Dictionary<uint,float>();
317 317
318 List<LandStatReportItem> collidera = new List<LandStatReportItem>(); 318 if (reportType == 1)
319 lock (colliders) 319 {
320 SceneData = m_scene.PhysicsScene.GetTopColliders();
321 }
322 else if (reportType == 0)
320 { 323 {
321 foreach (uint obj in colliders.Keys) 324 SceneData = m_scene.m_innerScene.GetTopScripts();
325 }
326
327 List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
328 lock (SceneData)
329 {
330 foreach (uint obj in SceneData.Keys)
322 { 331 {
323 SceneObjectPart prt = m_scene.GetSceneObjectPart(obj); 332 SceneObjectPart prt = m_scene.GetSceneObjectPart(obj);
324 if (prt != null) 333 if (prt != null)
@@ -332,21 +341,30 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
332 lsri.LocationX = sog.AbsolutePosition.X; 341 lsri.LocationX = sog.AbsolutePosition.X;
333 lsri.LocationY = sog.AbsolutePosition.Y; 342 lsri.LocationY = sog.AbsolutePosition.Y;
334 lsri.LocationZ = sog.AbsolutePosition.Z; 343 lsri.LocationZ = sog.AbsolutePosition.Z;
335 lsri.Score = colliders[obj]; 344 lsri.Score = SceneData[obj];
336 lsri.TaskID = sog.UUID; 345 lsri.TaskID = sog.UUID;
337 lsri.TaskLocalID = sog.LocalId; 346 lsri.TaskLocalID = sog.LocalId;
338 lsri.TaskName = sog.GetPartName(obj); 347 lsri.TaskName = sog.GetPartName(obj);
339 lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID); 348 lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID);
340 349 if (filter.Length != 0)
350 {
351 if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
352 {
353 }
354 else
355 {
356 continue;
357 }
358 }
341 359
342 collidera.Add(lsri); 360 SceneReport.Add(lsri);
343 } 361 }
344 } 362 }
345 } 363 }
346 364
347 } 365 }
348 } 366 }
349 remoteClient.SendLandStatReply(reportType, requestFlags, (uint)collidera.Count,collidera.ToArray()); 367 remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
350 368
351 } 369 }
352 370
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs
index a3f5d2f..1c345ba 100644
--- a/OpenSim/Region/Environment/Scenes/EventManager.cs
+++ b/OpenSim/Region/Environment/Scenes/EventManager.cs
@@ -174,6 +174,9 @@ namespace OpenSim.Region.Environment.Scenes
174 174
175 public event AvatarKillData OnAvatarKilled; 175 public event AvatarKillData OnAvatarKilled;
176 176
177 public delegate void ScriptTimerEvent(uint localID, double timerinterval);
178
179 public event ScriptTimerEvent OnScriptTimerEvent;
177 180
178 181
179 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); 182 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
@@ -332,6 +335,7 @@ namespace OpenSim.Region.Environment.Scenes
332 private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null; 335 private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null;
333 private ParcelPrimCountTainted handlerParcelPrimCountTainted = null; 336 private ParcelPrimCountTainted handlerParcelPrimCountTainted = null;
334 private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null; 337 private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null;
338 private ScriptTimerEvent handlerScriptTimerEvent = null;
335 339
336 public void TriggerOnScriptChangedEvent(uint localID, uint change) 340 public void TriggerOnScriptChangedEvent(uint localID, uint change)
337 { 341 {
@@ -755,5 +759,16 @@ namespace OpenSim.Region.Environment.Scenes
755 759
756 } 760 }
757 } 761 }
762 // this lets us keep track of nasty script events like timer, etc.
763 public void TriggerTimerEvent(uint objLocalID, double Interval)
764 {
765 handlerScriptTimerEvent = OnScriptTimerEvent;
766 if (handlerScriptTimerEvent != null)
767 {
768 handlerScriptTimerEvent(objLocalID, Interval);
769
770 }
771
772 }
758 } 773 }
759} 774}
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 84de71f..d6e905b 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -846,6 +846,37 @@ namespace OpenSim.Region.Environment.Scenes
846 return result; 846 return result;
847 } 847 }
848 848
849 public Dictionary<uint, float> GetTopScripts()
850 {
851 Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
852
853 List<EntityBase> EntityList = GetEntities();
854 int limit = 0;
855 foreach (EntityBase ent in EntityList)
856 {
857 if (ent is SceneObjectGroup)
858 {
859 SceneObjectGroup grp = (SceneObjectGroup)ent;
860 if ((grp.RootPart.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Scripted) != 0)
861 {
862 if (grp.scriptScore >= 0.01)
863 {
864 topScripts.Add(grp.LocalId, grp.scriptScore);
865 limit++;
866 if (limit >= 100)
867 {
868 break;
869 }
870
871 }
872 grp.scriptScore = 0;
873 }
874 }
875 }
876
877 return topScripts;
878 }
879
849 #endregion 880 #endregion
850 881
851 #region Other Methods 882 #region Other Methods
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 25b3d16..cd4be99 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -90,6 +90,7 @@ namespace OpenSim.Region.Environment.Scenes
90 /// since the group's last persistent backup 90 /// since the group's last persistent backup
91 /// </summary> 91 /// </summary>
92 public bool HasGroupChanged = false; 92 public bool HasGroupChanged = false;
93 public float scriptScore = 0f;
93 94
94 95
95 96
@@ -959,6 +960,10 @@ namespace OpenSim.Region.Environment.Scenes
959 960
960 public void AddScriptLPS(int count) 961 public void AddScriptLPS(int count)
961 { 962 {
963 if (scriptScore + count >= float.MaxValue - count)
964 scriptScore = 0;
965
966 scriptScore += (float)count;
962 InnerScene d = m_scene.m_innerScene; 967 InnerScene d = m_scene.m_innerScene;
963 d.AddToScriptLPS(count); 968 d.AddToScriptLPS(count);
964 } 969 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index b724bda..c6b3059 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -2752,6 +2752,14 @@ namespace OpenSim.Region.Environment.Scenes
2752 PhysActor.OnCollisionUpdate -= PhysicsCollision; 2752 PhysActor.OnCollisionUpdate -= PhysicsCollision;
2753 } 2753 }
2754 } 2754 }
2755 if ((GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Scripted) != 0)
2756 {
2757 m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
2758 }
2759 else
2760 {
2761 m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting;
2762 }
2755 2763
2756 LocalFlags=(LLObject.ObjectFlags)objectflagupdate; 2764 LocalFlags=(LLObject.ObjectFlags)objectflagupdate;
2757 2765
@@ -2812,6 +2820,30 @@ namespace OpenSim.Region.Environment.Scenes
2812 GetProperties(client); 2820 GetProperties(client);
2813 m_updateFlag = 2; 2821 m_updateFlag = 2;
2814 } 2822 }
2823 private void handleTimerAccounting(uint localID, double interval)
2824 {
2825 if (localID == LocalId)
2826 {
2827
2828 float sec = (float)interval;
2829 if (m_parentGroup != null)
2830 {
2831 if (sec == 0)
2832 {
2833 if (m_parentGroup.scriptScore + 0.001f >= float.MaxValue - 0.001)
2834 m_parentGroup.scriptScore = 0;
2835
2836 m_parentGroup.scriptScore += 0.001f;
2837 return;
2838 }
2839
2840 if (m_parentGroup.scriptScore + (0.001f / sec) >= float.MaxValue - (0.001f / sec))
2841 m_parentGroup.scriptScore = 0;
2842 m_parentGroup.scriptScore += (0.001f / sec);
2843 }
2844
2845 }
2846 }
2815 2847
2816 } 2848 }
2817} 2849}