diff options
author | UbitUmarov | 2018-11-20 22:54:57 +0000 |
---|---|---|
committer | UbitUmarov | 2018-11-20 22:54:57 +0000 |
commit | 3e5ca6efd62b61ee2e2294b4c4552ee360b89e22 (patch) | |
tree | 252ddc5230e529e6d36be3e33457f77e51c747a2 /OpenSim | |
parent | Yengine: do use SourceHashCode (diff) | |
download | opensim-SC-3e5ca6efd62b61ee2e2294b4c4552ee360b89e22.zip opensim-SC-3e5ca6efd62b61ee2e2294b4c4552ee360b89e22.tar.gz opensim-SC-3e5ca6efd62b61ee2e2294b4c4552ee360b89e22.tar.bz2 opensim-SC-3e5ca6efd62b61ee2e2294b4c4552ee360b89e22.tar.xz |
Yengine: change script first line processing, also look to language option
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs b/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs index 92bd352..a9498dd 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs | |||
@@ -1164,6 +1164,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine | |||
1164 | public void OnRezScript(uint localID, UUID itemID, string script, | 1164 | public void OnRezScript(uint localID, UUID itemID, string script, |
1165 | int startParam, bool postOnRez, string defEngine, int stateSource) | 1165 | int startParam, bool postOnRez, string defEngine, int stateSource) |
1166 | { | 1166 | { |
1167 | if (script.StartsWith("//MRM:")) | ||
1168 | return; | ||
1169 | |||
1167 | SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); | 1170 | SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); |
1168 | TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID); | 1171 | TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID); |
1169 | 1172 | ||
@@ -1175,22 +1178,29 @@ namespace OpenSim.Region.ScriptEngine.Yengine | |||
1175 | 1178 | ||
1176 | TraceCalls("[YEngine]: OnRezScript(...,{0},...)", itemID.ToString()); | 1179 | TraceCalls("[YEngine]: OnRezScript(...,{0},...)", itemID.ToString()); |
1177 | 1180 | ||
1178 | // Assume script uses the default engine, whatever that is. | 1181 | // Assume script uses the default engine |
1179 | string engineName = defEngine; | 1182 | string engineName = defEngine; |
1180 | 1183 | ||
1181 | // Very first line might contain "//" scriptengine ":". | 1184 | // Very first line might contain // scriptengine : language |
1182 | string firstline = ""; | 1185 | string langsrt = ""; |
1183 | if(script.StartsWith("//")) | 1186 | if (script.StartsWith("//")) |
1184 | { | 1187 | { |
1185 | int lineEnd = script.IndexOf('\n'); | 1188 | int lineEnd = script.IndexOf('\n'); |
1186 | if(lineEnd > 1) | 1189 | if(lineEnd > 5) |
1187 | firstline = script.Substring(0, lineEnd).Trim(); | ||
1188 | int colon = firstline.IndexOf(':'); | ||
1189 | if(colon >= 2) | ||
1190 | { | 1190 | { |
1191 | engineName = firstline.Substring(2, colon - 2).Trim(); | 1191 | string firstline = script.Substring(2, lineEnd - 2).Trim(); |
1192 | if(engineName == "") | 1192 | int colon = firstline.IndexOf(':'); |
1193 | engineName = defEngine; | 1193 | if(colon >= 3) |
1194 | { | ||
1195 | engineName = firstline.Substring(0, colon).TrimEnd(); | ||
1196 | if(string.IsNullOrEmpty(engineName)) | ||
1197 | engineName = defEngine; | ||
1198 | } | ||
1199 | if (colon > 0 && colon < firstline.Length - 2) | ||
1200 | { | ||
1201 | langsrt = firstline.Substring(colon + 1).Trim(); | ||
1202 | langsrt = langsrt.ToLower(); | ||
1203 | } | ||
1194 | } | 1204 | } |
1195 | } | 1205 | } |
1196 | 1206 | ||
@@ -1219,6 +1229,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine | |||
1219 | // m_log.Info("[YEngine]: will attempt to processing it anyway as default script engine"); | 1229 | // m_log.Info("[YEngine]: will attempt to processing it anyway as default script engine"); |
1220 | } | 1230 | } |
1221 | 1231 | ||
1232 | if(!string.IsNullOrEmpty(langsrt) && langsrt !="lsl") | ||
1233 | return; | ||
1234 | |||
1222 | // Put on object/instance lists. | 1235 | // Put on object/instance lists. |
1223 | XMRInstance instance = (XMRInstance)Activator.CreateInstance(ScriptCodeGen.xmrInstSuperType); | 1236 | XMRInstance instance = (XMRInstance)Activator.CreateInstance(ScriptCodeGen.xmrInstSuperType); |
1224 | instance.m_LocalID = localID; | 1237 | instance.m_LocalID = localID; |