Yengine: change script first line processing, also look to language option
parent
5485ba2ae6
commit
3e5ca6efd6
|
@ -1164,6 +1164,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
|||
public void OnRezScript(uint localID, UUID itemID, string script,
|
||||
int startParam, bool postOnRez, string defEngine, int stateSource)
|
||||
{
|
||||
if (script.StartsWith("//MRM:"))
|
||||
return;
|
||||
|
||||
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID);
|
||||
|
||||
|
@ -1175,23 +1178,30 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
|||
|
||||
TraceCalls("[YEngine]: OnRezScript(...,{0},...)", itemID.ToString());
|
||||
|
||||
// Assume script uses the default engine, whatever that is.
|
||||
// Assume script uses the default engine
|
||||
string engineName = defEngine;
|
||||
|
||||
// Very first line might contain "//" scriptengine ":".
|
||||
string firstline = "";
|
||||
// Very first line might contain // scriptengine : language
|
||||
string langsrt = "";
|
||||
if (script.StartsWith("//"))
|
||||
{
|
||||
int lineEnd = script.IndexOf('\n');
|
||||
if(lineEnd > 1)
|
||||
firstline = script.Substring(0, lineEnd).Trim();
|
||||
int colon = firstline.IndexOf(':');
|
||||
if(colon >= 2)
|
||||
if(lineEnd > 5)
|
||||
{
|
||||
engineName = firstline.Substring(2, colon - 2).Trim();
|
||||
if(engineName == "")
|
||||
string firstline = script.Substring(2, lineEnd - 2).Trim();
|
||||
int colon = firstline.IndexOf(':');
|
||||
if(colon >= 3)
|
||||
{
|
||||
engineName = firstline.Substring(0, colon).TrimEnd();
|
||||
if(string.IsNullOrEmpty(engineName))
|
||||
engineName = defEngine;
|
||||
}
|
||||
if (colon > 0 && colon < firstline.Length - 2)
|
||||
{
|
||||
langsrt = firstline.Substring(colon + 1).Trim();
|
||||
langsrt = langsrt.ToLower();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the default or requested engine is us.
|
||||
|
@ -1219,6 +1229,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
|||
// m_log.Info("[YEngine]: will attempt to processing it anyway as default script engine");
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(langsrt) && langsrt !="lsl")
|
||||
return;
|
||||
|
||||
// Put on object/instance lists.
|
||||
XMRInstance instance = (XMRInstance)Activator.CreateInstance(ScriptCodeGen.xmrInstSuperType);
|
||||
instance.m_LocalID = localID;
|
||||
|
|
Loading…
Reference in New Issue