diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 52d787d..ed2f221 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -135,6 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
135 | internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; | 135 | internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; |
136 | internal float m_ScriptDelayFactor = 1.0f; | 136 | internal float m_ScriptDelayFactor = 1.0f; |
137 | internal float m_ScriptDistanceFactor = 1.0f; | 137 | internal float m_ScriptDistanceFactor = 1.0f; |
138 | internal bool m_debuggerSafe = false; | ||
138 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); | 139 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); |
139 | 140 | ||
140 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 141 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) |
@@ -143,6 +144,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
143 | m_host = host; | 144 | m_host = host; |
144 | m_localID = localID; | 145 | m_localID = localID; |
145 | m_itemID = itemID; | 146 | m_itemID = itemID; |
147 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); | ||
146 | 148 | ||
147 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) | 149 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) |
148 | m_OSFunctionsEnabled = true; | 150 | m_OSFunctionsEnabled = true; |
@@ -201,7 +203,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
201 | 203 | ||
202 | internal void OSSLError(string msg) | 204 | internal void OSSLError(string msg) |
203 | { | 205 | { |
204 | throw new Exception("OSSL Runtime Error: " + msg); | 206 | if (m_debuggerSafe) |
207 | { | ||
208 | OSSLShoutError(msg); | ||
209 | } | ||
210 | else | ||
211 | { | ||
212 | throw new Exception("OSSL Runtime Error: " + msg); | ||
213 | } | ||
205 | } | 214 | } |
206 | 215 | ||
207 | private void InitLSL() | 216 | private void InitLSL() |
@@ -840,18 +849,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
840 | if (target != null) | 849 | if (target != null) |
841 | { | 850 | { |
842 | UUID animID=UUID.Zero; | 851 | UUID animID=UUID.Zero; |
843 | lock (m_host.TaskInventory) | 852 | m_host.TaskInventory.LockItemsForRead(true); |
853 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
844 | { | 854 | { |
845 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 855 | if (inv.Value.Name == animation) |
846 | { | 856 | { |
847 | if (inv.Value.Name == animation) | 857 | if (inv.Value.Type == (int)AssetType.Animation) |
848 | { | 858 | animID = inv.Value.AssetID; |
849 | if (inv.Value.Type == (int)AssetType.Animation) | 859 | continue; |
850 | animID = inv.Value.AssetID; | ||
851 | continue; | ||
852 | } | ||
853 | } | 860 | } |
854 | } | 861 | } |
862 | m_host.TaskInventory.LockItemsForRead(false); | ||
855 | if (animID == UUID.Zero) | 863 | if (animID == UUID.Zero) |
856 | target.Animator.AddAnimation(animation, m_host.UUID); | 864 | target.Animator.AddAnimation(animation, m_host.UUID); |
857 | else | 865 | else |
@@ -873,18 +881,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
873 | if (target != null) | 881 | if (target != null) |
874 | { | 882 | { |
875 | UUID animID = UUID.Zero; | 883 | UUID animID = UUID.Zero; |
876 | lock (m_host.TaskInventory) | 884 | m_host.TaskInventory.LockItemsForRead(true); |
885 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
877 | { | 886 | { |
878 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 887 | if (inv.Value.Name == animation) |
879 | { | 888 | { |
880 | if (inv.Value.Name == animation) | 889 | if (inv.Value.Type == (int)AssetType.Animation) |
881 | { | 890 | animID = inv.Value.AssetID; |
882 | if (inv.Value.Type == (int)AssetType.Animation) | 891 | continue; |
883 | animID = inv.Value.AssetID; | ||
884 | continue; | ||
885 | } | ||
886 | } | 892 | } |
887 | } | 893 | } |
894 | m_host.TaskInventory.LockItemsForRead(false); | ||
888 | 895 | ||
889 | if (animID == UUID.Zero) | 896 | if (animID == UUID.Zero) |
890 | target.Animator.RemoveAnimation(animation); | 897 | target.Animator.RemoveAnimation(animation); |
@@ -1841,6 +1848,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1841 | 1848 | ||
1842 | if (!UUID.TryParse(notecardNameOrUuid, out assetID)) | 1849 | if (!UUID.TryParse(notecardNameOrUuid, out assetID)) |
1843 | { | 1850 | { |
1851 | m_host.TaskInventory.LockItemsForRead(true); | ||
1844 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 1852 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) |
1845 | { | 1853 | { |
1846 | if (item.Type == 7 && item.Name == notecardNameOrUuid) | 1854 | if (item.Type == 7 && item.Name == notecardNameOrUuid) |
@@ -1848,6 +1856,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1848 | assetID = item.AssetID; | 1856 | assetID = item.AssetID; |
1849 | } | 1857 | } |
1850 | } | 1858 | } |
1859 | m_host.TaskInventory.LockItemsForRead(false); | ||
1851 | } | 1860 | } |
1852 | 1861 | ||
1853 | if (assetID == UUID.Zero) | 1862 | if (assetID == UUID.Zero) |
@@ -2171,8 +2180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2171 | UUID x = module.CreateNPC(firstname, | 2180 | UUID x = module.CreateNPC(firstname, |
2172 | lastname, | 2181 | lastname, |
2173 | new Vector3((float) position.x, (float) position.y, (float) position.z), | 2182 | new Vector3((float) position.x, (float) position.y, (float) position.z), |
2174 | World, | 2183 | World,appearance); |
2175 | appearance); | ||
2176 | 2184 | ||
2177 | return new LSL_Key(x.ToString()); | 2185 | return new LSL_Key(x.ToString()); |
2178 | } | 2186 | } |