mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 22:26:09 +08:00
Merge branch 'master' of ssh://TOR/var/git/careminster
This commit is contained in:
@@ -2781,7 +2781,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void llStopLookAt()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
@@ -5905,7 +5904,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.AddScriptLPS(1);
|
||||
return World.SimulatorFPS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* particle system rules should be coming into this routine as doubles, that is
|
||||
rule[0] should be an integer from this list and rule[1] should be the arg
|
||||
@@ -7523,9 +7522,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_POSITION:
|
||||
res.Add(new LSL_Vector(part.AbsolutePosition.X,
|
||||
LSL_Vector v = new LSL_Vector(part.AbsolutePosition.X,
|
||||
part.AbsolutePosition.Y,
|
||||
part.AbsolutePosition.Z));
|
||||
part.AbsolutePosition.Z);
|
||||
// For some reason, the part.AbsolutePosition.* values do not change if the
|
||||
// linkset is rotated; they always reflect the child prim's world position
|
||||
// as though the linkset is unrotated. This is incompatible behavior with SL's
|
||||
// implementation, so will break scripts imported from there (not to mention it
|
||||
// makes it more difficult to determine a child prim's actual inworld position).
|
||||
if (part.ParentID != 0)
|
||||
v = ((v - llGetRootPosition()) * llGetRootRotation()) + llGetRootPosition();
|
||||
res.Add( v );
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_SIZE:
|
||||
@@ -7543,6 +7550,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
PrimitiveBaseShape Shape = part.Shape;
|
||||
int primType = getScriptPrimType(part.Shape);
|
||||
res.Add(new LSL_Integer(primType));
|
||||
double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX
|
||||
double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY.
|
||||
switch (primType)
|
||||
{
|
||||
case ScriptBaseClass.PRIM_TYPE_BOX:
|
||||
@@ -7553,7 +7562,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
|
||||
res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
|
||||
res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
|
||||
res.Add(new LSL_Vector(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0));
|
||||
res.Add(new LSL_Vector(topshearx, topsheary, 0));
|
||||
break;
|
||||
|
||||
case ScriptBaseClass.PRIM_TYPE_SPHERE:
|
||||
@@ -7588,7 +7597,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
|
||||
|
||||
// vector topshear
|
||||
res.Add(new LSL_Vector(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0));
|
||||
res.Add(new LSL_Vector(topshearx, topsheary, 0));
|
||||
|
||||
// vector profilecut
|
||||
res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
|
||||
@@ -7597,8 +7606,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
|
||||
|
||||
// float revolutions
|
||||
res.Add(new LSL_Float(Shape.PathRevolutions / 50.0)); // needs fixing :(
|
||||
|
||||
res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned
|
||||
// byte is being used to represent the entire
|
||||
// range of floating-point values from 1.0
|
||||
// through 4.0 (which is how SL does it).
|
||||
|
||||
// float radiusoffset
|
||||
res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0));
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||
if (emessage.StartsWith(slinfo+": "))
|
||||
emessage = emessage.Substring(slinfo.Length+2);
|
||||
|
||||
message = String.Format("Line ({0},{1}) {2}",
|
||||
message = String.Format("({0},{1}) {2}",
|
||||
e.slInfo.lineNumber - 2,
|
||||
e.slInfo.charPosition - 1, emessage);
|
||||
|
||||
|
||||
@@ -623,7 +623,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||
|
||||
// The Second Life viewer's script editor begins
|
||||
// countingn lines and columns at 0, so we subtract 1.
|
||||
errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n",
|
||||
errtext += String.Format("({0},{1}): {4} {2}: {3}\n",
|
||||
lslPos.Key - 1, lslPos.Value - 1,
|
||||
CompErr.ErrorNumber, text, severity);
|
||||
hadErrors = true;
|
||||
|
||||
@@ -1673,7 +1673,7 @@ default
|
||||
{
|
||||
// The syntax error is on line 6, char 5 (expected ';', found
|
||||
// '}').
|
||||
Assert.AreEqual("Line (4,4) syntax error", e.Message);
|
||||
Assert.AreEqual("(4,4) syntax error", e.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@@ -1698,7 +1698,7 @@ default
|
||||
catch (System.Exception e)
|
||||
{
|
||||
// The syntax error is on line 5, char 14 (Syntax error)
|
||||
Assert.AreEqual("Line (3,13) syntax error", e.Message);
|
||||
Assert.AreEqual("(3,13) syntax error", e.Message);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
@@ -974,7 +974,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
if (col == 0)
|
||||
col++;
|
||||
message = string.Format("Runtime error:\n" +
|
||||
"Line ({0}): {1}", scriptLine - 1,
|
||||
"({0}): {1}", scriptLine - 1,
|
||||
e.InnerException.Message);
|
||||
|
||||
System.Console.WriteLine(e.ToString()+"\n");
|
||||
|
||||
@@ -78,6 +78,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
private string m_ScriptErrorMessage;
|
||||
private Dictionary<string, string> m_uniqueScripts = new Dictionary<string, string>();
|
||||
private bool m_AppDomainLoading;
|
||||
private Dictionary<UUID,ArrayList> m_ScriptErrors =
|
||||
new Dictionary<UUID,ArrayList>();
|
||||
|
||||
// disable warning: need to keep a reference to XEngine.EventManager
|
||||
// alive to avoid it being garbage collected
|
||||
@@ -657,87 +659,97 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
|
||||
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap;
|
||||
|
||||
try
|
||||
{
|
||||
lock (m_AddingAssemblies)
|
||||
{
|
||||
m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap);
|
||||
if (!m_AddingAssemblies.ContainsKey(assembly)) {
|
||||
m_AddingAssemblies[assembly] = 1;
|
||||
} else {
|
||||
m_AddingAssemblies[assembly]++;
|
||||
}
|
||||
}
|
||||
|
||||
string[] warnings = m_Compiler.GetWarnings();
|
||||
|
||||
if (warnings != null && warnings.Length != 0)
|
||||
{
|
||||
foreach (string warning in warnings)
|
||||
{
|
||||
try
|
||||
{
|
||||
// DISPLAY WARNING INWORLD
|
||||
string text = "Warning:\n" + warning;
|
||||
if (text.Length > 1000)
|
||||
text = text.Substring(0, 1000);
|
||||
if (!ShowScriptSaveResponse(item.OwnerID,
|
||||
assetID, text, true))
|
||||
{
|
||||
if (presence != null && (!postOnRez))
|
||||
presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false);
|
||||
|
||||
World.SimChat(Utils.StringToBytes(text),
|
||||
ChatTypeEnum.DebugChannel, 2147483647,
|
||||
part.AbsolutePosition,
|
||||
part.Name, part.UUID, false);
|
||||
}
|
||||
}
|
||||
catch (Exception e2) // LEGIT: User Scripting
|
||||
{
|
||||
m_log.Error("[XEngine]: " +
|
||||
"Error displaying warning in-world: " +
|
||||
e2.ToString());
|
||||
m_log.Error("[XEngine]: " +
|
||||
"Warning:\r\n" +
|
||||
warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
lock(m_ScriptErrors)
|
||||
{
|
||||
try
|
||||
{
|
||||
// DISPLAY ERROR INWORLD
|
||||
m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
|
||||
|
||||
m_ScriptFailCount++;
|
||||
string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
|
||||
if (text.Length > 1000)
|
||||
text = text.Substring(0, 1000);
|
||||
if (!ShowScriptSaveResponse(item.OwnerID,
|
||||
assetID, text, false))
|
||||
lock (m_AddingAssemblies)
|
||||
{
|
||||
if (presence != null && (!postOnRez))
|
||||
presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
|
||||
World.SimChat(Utils.StringToBytes(text),
|
||||
ChatTypeEnum.DebugChannel, 2147483647,
|
||||
part.AbsolutePosition,
|
||||
part.Name, part.UUID, false);
|
||||
m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap);
|
||||
if (!m_AddingAssemblies.ContainsKey(assembly)) {
|
||||
m_AddingAssemblies[assembly] = 1;
|
||||
} else {
|
||||
m_AddingAssemblies[assembly]++;
|
||||
}
|
||||
}
|
||||
|
||||
string[] warnings = m_Compiler.GetWarnings();
|
||||
|
||||
if (warnings != null && warnings.Length != 0)
|
||||
{
|
||||
foreach (string warning in warnings)
|
||||
{
|
||||
if (!m_ScriptErrors.ContainsKey(itemID))
|
||||
m_ScriptErrors[itemID] = new ArrayList();
|
||||
|
||||
m_ScriptErrors[itemID].Add(warning);
|
||||
// try
|
||||
// {
|
||||
// // DISPLAY WARNING INWORLD
|
||||
// string text = "Warning:\n" + warning;
|
||||
// if (text.Length > 1000)
|
||||
// text = text.Substring(0, 1000);
|
||||
// if (!ShowScriptSaveResponse(item.OwnerID,
|
||||
// assetID, text, true))
|
||||
// {
|
||||
// if (presence != null && (!postOnRez))
|
||||
// presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false);
|
||||
//
|
||||
// World.SimChat(Utils.StringToBytes(text),
|
||||
// ChatTypeEnum.DebugChannel, 2147483647,
|
||||
// part.AbsolutePosition,
|
||||
// part.Name, part.UUID, false);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception e2) // LEGIT: User Scripting
|
||||
// {
|
||||
// m_log.Error("[XEngine]: " +
|
||||
// "Error displaying warning in-world: " +
|
||||
// e2.ToString());
|
||||
// m_log.Error("[XEngine]: " +
|
||||
// "Warning:\r\n" +
|
||||
// warning);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e2) // LEGIT: User Scripting
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[XEngine]: "+
|
||||
"Error displaying error in-world: " +
|
||||
e2.ToString());
|
||||
m_log.Error("[XEngine]: " +
|
||||
"Errormessage: Error compiling script:\r\n" +
|
||||
e.Message.ToString());
|
||||
}
|
||||
// try
|
||||
// {
|
||||
if (!m_ScriptErrors.ContainsKey(itemID))
|
||||
m_ScriptErrors[itemID] = new ArrayList();
|
||||
// DISPLAY ERROR INWORLD
|
||||
// m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
|
||||
//
|
||||
m_ScriptFailCount++;
|
||||
m_ScriptErrors[itemID].Add(e.Message.ToString());
|
||||
// string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
|
||||
// if (text.Length > 1000)
|
||||
// text = text.Substring(0, 1000);
|
||||
// if (!ShowScriptSaveResponse(item.OwnerID,
|
||||
// assetID, text, false))
|
||||
// {
|
||||
// if (presence != null && (!postOnRez))
|
||||
// presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
|
||||
// World.SimChat(Utils.StringToBytes(text),
|
||||
// ChatTypeEnum.DebugChannel, 2147483647,
|
||||
// part.AbsolutePosition,
|
||||
// part.Name, part.UUID, false);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception e2) // LEGIT: User Scripting
|
||||
// {
|
||||
// m_log.Error("[XEngine]: "+
|
||||
// "Error displaying error in-world: " +
|
||||
// e2.ToString());
|
||||
// m_log.Error("[XEngine]: " +
|
||||
// "Errormessage: Error compiling script:\r\n" +
|
||||
// e.Message.ToString());
|
||||
// }
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1252,7 +1264,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
public void SetState(UUID itemID, string newState)
|
||||
{
|
||||
IScriptInstance instance = GetInstance(itemID);
|
||||
@@ -1260,13 +1271,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
return;
|
||||
instance.SetState(newState);
|
||||
}
|
||||
public string GetState(UUID itemID)
|
||||
{
|
||||
IScriptInstance instance = GetInstance(itemID);
|
||||
if (instance == null)
|
||||
return "default";
|
||||
return instance.State;
|
||||
}
|
||||
|
||||
public int GetStartParameter(UUID itemID)
|
||||
{
|
||||
@@ -1552,5 +1556,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public ArrayList GetScriptErrors(UUID itemID)
|
||||
{
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
|
||||
lock (m_ScriptErrors)
|
||||
{
|
||||
if (m_ScriptErrors.ContainsKey(itemID))
|
||||
{
|
||||
ArrayList ret = m_ScriptErrors[itemID];
|
||||
m_ScriptErrors.Remove(itemID);
|
||||
return ret;
|
||||
}
|
||||
return new ArrayList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user