diff options
author | Melanie | 2012-07-11 14:27:33 +0100 |
---|---|---|
committer | Melanie | 2012-07-11 14:27:33 +0100 |
commit | 89c9528e38b4e06a2af6231ced4ed733bbafa174 (patch) | |
tree | aed380f4bc51d9102e593446762f476694b9d87c /OpenSim/Region/ScriptEngine | |
parent | Merge branch 'master' into careminster (diff) | |
parent | remove expensive and leaked ( in Xengine at least) SayShout timer and (diff) | |
download | opensim-SC-89c9528e38b4e06a2af6231ced4ed733bbafa174.zip opensim-SC-89c9528e38b4e06a2af6231ced4ed733bbafa174.tar.gz opensim-SC-89c9528e38b4e06a2af6231ced4ed733bbafa174.tar.bz2 opensim-SC-89c9528e38b4e06a2af6231ced4ed733bbafa174.tar.xz |
Merge branch 'avination' into careminster
Conflicts:
OpenSim/Data/MySQL/MySQLSimulationData.cs
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 16 |
2 files changed, 35 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b257cd4..e9db5d5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -113,8 +113,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
113 | new Dictionary<UUID, UserInfoCacheEntry>(); | 113 | new Dictionary<UUID, UserInfoCacheEntry>(); |
114 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. | 114 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. |
115 | 115 | ||
116 | protected Timer m_ShoutSayTimer; | 116 | // protected Timer m_ShoutSayTimer; |
117 | protected int m_SayShoutCount = 0; | 117 | protected int m_SayShoutCount = 0; |
118 | DateTime m_lastSayShoutCheck; | ||
118 | 119 | ||
119 | private Dictionary<string, string> MovementAnimationsForLSL = | 120 | private Dictionary<string, string> MovementAnimationsForLSL = |
120 | new Dictionary<string, string> { | 121 | new Dictionary<string, string> { |
@@ -140,10 +141,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
140 | 141 | ||
141 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 142 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
142 | { | 143 | { |
144 | /* | ||
143 | m_ShoutSayTimer = new Timer(1000); | 145 | m_ShoutSayTimer = new Timer(1000); |
144 | m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed; | 146 | m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed; |
145 | m_ShoutSayTimer.AutoReset = true; | 147 | m_ShoutSayTimer.AutoReset = true; |
146 | m_ShoutSayTimer.Start(); | 148 | m_ShoutSayTimer.Start(); |
149 | */ | ||
150 | m_lastSayShoutCheck = DateTime.UtcNow; | ||
147 | 151 | ||
148 | m_ScriptEngine = ScriptEngine; | 152 | m_ScriptEngine = ScriptEngine; |
149 | m_host = host; | 153 | m_host = host; |
@@ -858,12 +862,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
858 | wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text); | 862 | wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text); |
859 | } | 863 | } |
860 | 864 | ||
865 | private void CheckSayShoutTime() | ||
866 | { | ||
867 | DateTime now = DateTime.UtcNow; | ||
868 | if ((now - m_lastSayShoutCheck).Ticks > 10000000) // 1sec | ||
869 | { | ||
870 | m_lastSayShoutCheck = now; | ||
871 | m_SayShoutCount = 0; | ||
872 | } | ||
873 | else | ||
874 | m_SayShoutCount++; | ||
875 | } | ||
876 | |||
861 | public void llSay(int channelID, string text) | 877 | public void llSay(int channelID, string text) |
862 | { | 878 | { |
863 | m_host.AddScriptLPS(1); | 879 | m_host.AddScriptLPS(1); |
864 | 880 | ||
865 | if (channelID == 0) | 881 | if (channelID == 0) |
866 | m_SayShoutCount++; | 882 | // m_SayShoutCount++; |
883 | CheckSayShoutTime(); | ||
867 | 884 | ||
868 | if (m_SayShoutCount >= 11) | 885 | if (m_SayShoutCount >= 11) |
869 | ScriptSleep(2000); | 886 | ScriptSleep(2000); |
@@ -891,7 +908,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
891 | m_host.AddScriptLPS(1); | 908 | m_host.AddScriptLPS(1); |
892 | 909 | ||
893 | if (channelID == 0) | 910 | if (channelID == 0) |
894 | m_SayShoutCount++; | 911 | // m_SayShoutCount++; |
912 | CheckSayShoutTime(); | ||
895 | 913 | ||
896 | if (m_SayShoutCount >= 11) | 914 | if (m_SayShoutCount >= 11) |
897 | ScriptSleep(2000); | 915 | ScriptSleep(2000); |
@@ -2556,12 +2574,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2556 | return new LSL_Vector(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z); | 2574 | return new LSL_Vector(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z); |
2557 | } | 2575 | } |
2558 | 2576 | ||
2559 | |||
2560 | public void llSetAngularVelocity(LSL_Vector avel, int local) | 2577 | public void llSetAngularVelocity(LSL_Vector avel, int local) |
2561 | { | 2578 | { |
2562 | m_host.AddScriptLPS(1); | 2579 | m_host.AddScriptLPS(1); |
2563 | // Still not done !!!! | 2580 | m_host.SetAngularVelocity(new Vector3((float)avel.x, (float)avel.y, (float)avel.z), local != 0); |
2564 | // m_host.SetAngularVelocity(new Vector3((float)avel.x, (float)avel.y, (float)avel.z), local != 0); | ||
2565 | } | 2581 | } |
2566 | 2582 | ||
2567 | public LSL_Vector llGetOmega() | 2583 | public LSL_Vector llGetOmega() |
@@ -3671,6 +3687,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3671 | 3687 | ||
3672 | protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) | 3688 | protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) |
3673 | { | 3689 | { |
3690 | spinrate *= gain; | ||
3674 | part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate))); | 3691 | part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate))); |
3675 | } | 3692 | } |
3676 | 3693 | ||
@@ -12044,12 +12061,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12044 | 12061 | ||
12045 | return rq.ToString(); | 12062 | return rq.ToString(); |
12046 | } | 12063 | } |
12047 | 12064 | /* | |
12048 | private void SayShoutTimerElapsed(Object sender, ElapsedEventArgs args) | 12065 | private void SayShoutTimerElapsed(Object sender, ElapsedEventArgs args) |
12049 | { | 12066 | { |
12050 | m_SayShoutCount = 0; | 12067 | m_SayShoutCount = 0; |
12051 | } | 12068 | } |
12052 | 12069 | */ | |
12053 | private struct Tri | 12070 | private struct Tri |
12054 | { | 12071 | { |
12055 | public Vector3 p1; | 12072 | public Vector3 p1; |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 2886344..cc783aa 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -636,7 +636,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
636 | if (!m_Enabled) | 636 | if (!m_Enabled) |
637 | return; | 637 | return; |
638 | lockScriptsForRead(true); | 638 | lockScriptsForRead(true); |
639 | foreach (IScriptInstance instance in m_Scripts.Values) | 639 | |
640 | List<IScriptInstance> instancesToDel = new List<IScriptInstance>(m_Scripts.Values); | ||
641 | |||
642 | // foreach (IScriptInstance instance in m_Scripts.Values) | ||
643 | foreach (IScriptInstance instance in instancesToDel) | ||
640 | { | 644 | { |
641 | // Force a final state save | 645 | // Force a final state save |
642 | // | 646 | // |
@@ -659,7 +663,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
659 | // Must be done explicitly because they have infinite | 663 | // Must be done explicitly because they have infinite |
660 | // lifetime | 664 | // lifetime |
661 | // | 665 | // |
662 | if (!m_SimulatorShuttingDown) | 666 | // if (!m_SimulatorShuttingDown) |
663 | { | 667 | { |
664 | m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); | 668 | m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); |
665 | if (m_DomainScripts[instance.AppDomain].Count == 0) | 669 | if (m_DomainScripts[instance.AppDomain].Count == 0) |
@@ -669,10 +673,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
669 | } | 673 | } |
670 | } | 674 | } |
671 | 675 | ||
672 | m_Scripts.Clear(); | 676 | // m_Scripts.Clear(); |
673 | m_PrimObjects.Clear(); | 677 | // m_PrimObjects.Clear(); |
674 | m_Assemblies.Clear(); | 678 | // m_Assemblies.Clear(); |
675 | m_DomainScripts.Clear(); | 679 | // m_DomainScripts.Clear(); |
676 | } | 680 | } |
677 | lockScriptsForRead(false); | 681 | lockScriptsForRead(false); |
678 | lockScriptsForWrite(true); | 682 | lockScriptsForWrite(true); |