Formatting cleanup, minor refactoring, svn properties.
parent
0a2d399cad
commit
4ec4e16c80
|
@ -137,6 +137,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("Using Obsolete to drive development is invalid. Obsolete presumes that something new has already been created to replace this.")]
|
[Obsolete("Using Obsolete to drive development is invalid. Obsolete presumes that something new has already been created to replace this.")]
|
||||||
public uint[] GetAllCircuits(LLUUID agentId)
|
public uint[] GetAllCircuits(LLUUID agentId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -224,14 +224,14 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
|
||||||
LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw);
|
LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw);
|
||||||
LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw);
|
LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw);
|
||||||
LSL_Types.Quaternion a = new LSL_Types.Quaternion();
|
LSL_Types.Quaternion a = new LSL_Types.Quaternion();
|
||||||
//This multiplication doesnt compile, yet. a = a1 * a2 * a3;
|
//This multiplication doesn't compile, yet. a = a1 * a2 * a3;
|
||||||
LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax*bw*cw + aw*by*cz,
|
LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax*bw*cw + aw*by*cz,
|
||||||
aw*by*cw - ax*bw*cz, aw*bw*cz + ax*by*cw,
|
aw*by*cw - ax*bw*cz, aw*bw*cz + ax*by*cw,
|
||||||
aw*bw*cw - ax*by*cz);
|
aw*bw*cw - ax*by*cz);
|
||||||
LSL_Types.Quaternion c = new LSL_Types.Quaternion();
|
LSL_Types.Quaternion c = new LSL_Types.Quaternion();
|
||||||
//This addition doesnt compile yet c = a + b;
|
//This addition doesn't compile yet c = a + b;
|
||||||
LSL_Types.Quaternion d = new LSL_Types.Quaternion();
|
LSL_Types.Quaternion d = new LSL_Types.Quaternion();
|
||||||
//This addition doesnt compile yet d = a - b;
|
//This addition doesn't compile yet d = a - b;
|
||||||
if ((Math.Abs(c.X) > err && Math.Abs(d.X) > err) ||
|
if ((Math.Abs(c.X) > err && Math.Abs(d.X) > err) ||
|
||||||
(Math.Abs(c.Y) > err && Math.Abs(d.Y) > err) ||
|
(Math.Abs(c.Y) > err && Math.Abs(d.Y) > err) ||
|
||||||
(Math.Abs(c.Z) > err && Math.Abs(d.Z) > err) ||
|
(Math.Abs(c.Z) > err && Math.Abs(d.Z) > err) ||
|
||||||
|
|
|
@ -647,7 +647,7 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ch = new TcpChannel((int)NetworkServersInfo.RemotingListenerPort);
|
ch = new TcpChannel((int)NetworkServersInfo.RemotingListenerPort);
|
||||||
ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesnt support this.
|
ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesn't support this.
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -279,7 +279,7 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( resp == null )
|
if (resp == null)
|
||||||
{
|
{
|
||||||
m_log.Warn("[OSG1 USER SERVICES]: Got no response, Grid server may not be updated.");
|
m_log.Warn("[OSG1 USER SERVICES]: Got no response, Grid server may not be updated.");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
for (int i = 0; i < m_localScenes.Count; i++)
|
for (int i = 0; i < m_localScenes.Count; i++)
|
||||||
{
|
{
|
||||||
// extract known shared modules from scene
|
// extract known shared modules from scene
|
||||||
foreach(string k in m_localScenes[i].Modules.Keys)
|
foreach (string k in m_localScenes[i].Modules.Keys)
|
||||||
{
|
{
|
||||||
if (m_localScenes[i].Modules[k].IsSharedModule &&
|
if (m_localScenes[i].Modules[k].IsSharedModule &&
|
||||||
!sharedModules.ContainsKey(k))
|
!sharedModules.ContainsKey(k))
|
||||||
|
@ -96,7 +96,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
// all regions/scenes are now closed, we can now safely
|
// all regions/scenes are now closed, we can now safely
|
||||||
// close all shared modules
|
// close all shared modules
|
||||||
foreach(IRegionModule mod in sharedModules.Values)
|
foreach (IRegionModule mod in sharedModules.Values)
|
||||||
{
|
{
|
||||||
mod.Close();
|
mod.Close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
Vector3 normalpart = ipoint - vAbsolutePosition;
|
Vector3 normalpart = ipoint - vAbsolutePosition;
|
||||||
returnresult.normal = normalpart / normalpart.Length;
|
returnresult.normal = normalpart / normalpart.Length;
|
||||||
|
|
||||||
// It's funny how the LLVector3 object has a Distance function, but the Axiom.Math object doesnt.
|
// It's funny how the LLVector3 object has a Distance function, but the Axiom.Math object doesn't.
|
||||||
// I can write a function to do it.. but I like the fact that this one is Static.
|
// I can write a function to do it.. but I like the fact that this one is Static.
|
||||||
|
|
||||||
LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z);
|
LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z);
|
||||||
|
|
|
@ -165,7 +165,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
|
|
||||||
for (int i = 0; i < workingMiddle.vertices.Count; i++)
|
for (int i = 0; i < workingMiddle.vertices.Count; i++)
|
||||||
{
|
{
|
||||||
int iNext = (i + 1);
|
int iNext = i + 1;
|
||||||
|
|
||||||
if (workingMiddle.vertices[i] == null) // Can't make a simplex here
|
if (workingMiddle.vertices[i] == null) // Can't make a simplex here
|
||||||
{
|
{
|
||||||
|
@ -200,7 +200,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
iLastNull = 0;
|
iLastNull = 0;
|
||||||
for (int i = 0; i < workingPlus.vertices.Count; i++)
|
for (int i = 0; i < workingPlus.vertices.Count; i++)
|
||||||
{
|
{
|
||||||
int iNext = (i + 1);
|
int iNext = i + 1;
|
||||||
|
|
||||||
if (workingPlus.vertices[i] == null) // Can't make a simplex here
|
if (workingPlus.vertices[i] == null) // Can't make a simplex here
|
||||||
{
|
{
|
||||||
|
@ -261,7 +261,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
|
|
||||||
float twistTotal = twistTop - twistBot;
|
float twistTotal = twistTop - twistBot;
|
||||||
// if the profile has a lot of twist, add more layers otherwise the layers may overlap
|
// if the profile has a lot of twist, add more layers otherwise the layers may overlap
|
||||||
// and the resulting mesh may be quite inaccurate. This method is arbitrary and doesnt
|
// and the resulting mesh may be quite inaccurate. This method is arbitrary and doesn't
|
||||||
// accurately match the viewer
|
// accurately match the viewer
|
||||||
if (System.Math.Abs(twistTotal) > (float)System.Math.PI * 1.5f) steps *= 2;
|
if (System.Math.Abs(twistTotal) > (float)System.Math.PI * 1.5f) steps *= 2;
|
||||||
if (System.Math.Abs(twistTotal) > (float)System.Math.PI * 3.0f) steps *= 2;
|
if (System.Math.Abs(twistTotal) > (float)System.Math.PI * 3.0f) steps *= 2;
|
||||||
|
@ -292,7 +292,6 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
System.Console.WriteLine("Extruder: PathScaleX: " + pathScaleX.ToString() + " pathScaleY: " + pathScaleY.ToString());
|
System.Console.WriteLine("Extruder: PathScaleX: " + pathScaleX.ToString() + " pathScaleY: " + pathScaleY.ToString());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
do // loop through the length of the path and add the layers
|
do // loop through the length of the path and add the layers
|
||||||
{
|
{
|
||||||
|
@ -319,12 +318,16 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
|
|
||||||
// apply the taper to the profile before any rotations
|
// apply the taper to the profile before any rotations
|
||||||
if (xProfileScale != 1.0f || yProfileScale != 1.0f)
|
if (xProfileScale != 1.0f || yProfileScale != 1.0f)
|
||||||
|
{
|
||||||
foreach (Vertex v in newLayer.vertices)
|
foreach (Vertex v in newLayer.vertices)
|
||||||
if ( v != null )
|
{
|
||||||
|
if (v != null)
|
||||||
{
|
{
|
||||||
v.X *= xProfileScale;
|
v.X *= xProfileScale;
|
||||||
v.Y *= yProfileScale;
|
v.Y *= yProfileScale;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float radiusScale;
|
float radiusScale;
|
||||||
|
|
||||||
|
@ -332,8 +335,8 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
radiusScale = 1.0f - radius * percentOfPath;
|
radiusScale = 1.0f - radius * percentOfPath;
|
||||||
else if (radius < 0.001f)
|
else if (radius < 0.001f)
|
||||||
radiusScale = 1.0f + radius * (1.0f - percentOfPath);
|
radiusScale = 1.0f + radius * (1.0f - percentOfPath);
|
||||||
else radiusScale = 1.0f;
|
else
|
||||||
|
radiusScale = 1.0f;
|
||||||
|
|
||||||
#if SPAM
|
#if SPAM
|
||||||
System.Console.WriteLine("Extruder: angle: " + angle.ToString() + " percentOfPath: " + percentOfPath.ToString()
|
System.Console.WriteLine("Extruder: angle: " + angle.ToString() + " percentOfPath: " + percentOfPath.ToString()
|
||||||
|
@ -379,10 +382,12 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
}
|
}
|
||||||
|
|
||||||
if (angle == startAngle) // the first layer, invert normals
|
if (angle == startAngle) // the first layer, invert normals
|
||||||
|
{
|
||||||
foreach (Triangle t in newLayer.triangles)
|
foreach (Triangle t in newLayer.triangles)
|
||||||
{
|
{
|
||||||
t.invertNormal();
|
t.invertNormal();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
result.Append(newLayer);
|
result.Append(newLayer);
|
||||||
|
|
||||||
|
@ -397,7 +402,9 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
int iNext = (i + 1);
|
int iNext = (i + 1);
|
||||||
|
|
||||||
if (lastLayer.vertices[i] == null) // cant make a simplex here
|
if (lastLayer.vertices[i] == null) // cant make a simplex here
|
||||||
|
{
|
||||||
iLastNull = i + 1;
|
iLastNull = i + 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (i == count - 1) // End of list
|
if (i == count - 1) // End of list
|
||||||
|
@ -413,17 +420,17 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
}
|
}
|
||||||
lastLayer = newLayer;
|
lastLayer = newLayer;
|
||||||
|
|
||||||
|
|
||||||
// calc the angle for the next interation of the loop
|
// calc the angle for the next interation of the loop
|
||||||
if (angle >= endAngle)
|
if (angle >= endAngle)
|
||||||
|
{
|
||||||
done = true;
|
done = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
angle = stepSize * ++step;
|
angle = stepSize * ++step;
|
||||||
if (angle > endAngle)
|
if (angle > endAngle)
|
||||||
angle = endAngle;
|
angle = endAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (!done); // loop until all the layers in the path are completed
|
} while (!done); // loop until all the layers in the path are completed
|
||||||
|
|
||||||
// scale the mesh to the desired size
|
// scale the mesh to the desired size
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
{
|
{
|
||||||
ListPair VFC = new ListPair(FunctionCode, new Variable());
|
ListPair VFC = new ListPair(FunctionCode, new Variable());
|
||||||
//Console.WriteLine("-------------------------")
|
//Console.WriteLine("-------------------------")
|
||||||
//Console.WriteLine( FunctionCode.ToString())
|
//Console.WriteLine(FunctionCode.ToString())
|
||||||
//Console.WriteLine("-------------------------")
|
//Console.WriteLine("-------------------------")
|
||||||
YPCompiler.convertFunctionCSharp(FunctionCode);
|
YPCompiler.convertFunctionCSharp(FunctionCode);
|
||||||
//YPCompiler.convertStringCodesCSharp(VFC);
|
//YPCompiler.convertStringCodesCSharp(VFC);
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||||
|
|
||||||
// If match has already indexed answers for a signature, we need to add
|
// If match has already indexed answers for a signature, we need to add
|
||||||
// this to the existing indexed answers.
|
// this to the existing indexed answers.
|
||||||
foreach(int signature in _gotAnswersForSignature.Keys)
|
foreach (int signature in _gotAnswersForSignature.Keys)
|
||||||
indexAnswerForSignature(answerCopy, signature);
|
indexAnswerForSignature(answerCopy, signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
List<Object> data = new List<Object>();
|
List<Object> data = new List<Object>();
|
||||||
|
|
||||||
Object[] listeners=m_Listener.GetSerializationData(itemID);
|
Object[] listeners=m_Listener.GetSerializationData(itemID);
|
||||||
if(listeners.Length > 0)
|
if (listeners.Length > 0)
|
||||||
{
|
{
|
||||||
data.Add("listener");
|
data.Add("listener");
|
||||||
data.Add(listeners.Length);
|
data.Add(listeners.Length);
|
||||||
|
@ -192,7 +192,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
Object[] timers=m_Timer.GetSerializationData(itemID);
|
Object[] timers=m_Timer.GetSerializationData(itemID);
|
||||||
if(timers.Length > 0)
|
if (timers.Length > 0)
|
||||||
{
|
{
|
||||||
data.Add("timer");
|
data.Add("timer");
|
||||||
data.Add(timers.Length);
|
data.Add(timers.Length);
|
||||||
|
@ -200,7 +200,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
Object[] sensors=m_SensorRepeat.GetSerializationData(itemID);
|
Object[] sensors=m_SensorRepeat.GetSerializationData(itemID);
|
||||||
if(sensors.Length > 0)
|
if (sensors.Length > 0)
|
||||||
{
|
{
|
||||||
data.Add("sensor");
|
data.Add("sensor");
|
||||||
data.Add(sensors.Length);
|
data.Add(sensors.Length);
|
||||||
|
@ -213,23 +213,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
public void CreateFromData(uint localID, LLUUID itemID, LLUUID hostID,
|
public void CreateFromData(uint localID, LLUUID itemID, LLUUID hostID,
|
||||||
Object[] data)
|
Object[] data)
|
||||||
{
|
{
|
||||||
int idx=0;
|
int idx = 0;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
while(idx < data.Length)
|
while (idx < data.Length)
|
||||||
{
|
{
|
||||||
string type = data[idx].ToString();
|
string type = data[idx].ToString();
|
||||||
len = (int)data[idx+1];
|
len = (int)data[idx+1];
|
||||||
idx+=2;
|
idx+=2;
|
||||||
|
|
||||||
if(len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
Object[] item = new Object[len];
|
Object[] item = new Object[len];
|
||||||
Array.Copy(data, idx, item, 0, len);
|
Array.Copy(data, idx, item, 0, len);
|
||||||
|
|
||||||
idx+=len;
|
idx+=len;
|
||||||
|
|
||||||
switch(type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case "listener":
|
case "listener":
|
||||||
m_Listener.CreateFromData(localID, itemID, hostID,
|
m_Listener.CreateFromData(localID, itemID, hostID,
|
||||||
|
@ -249,12 +249,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
#region Check llRemoteData channels
|
#region Check llRemoteData channels
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Check llListeners
|
#region Check llListeners
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -59,9 +59,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
public LLUUID RegisterRequest(uint localID, LLUUID itemID,
|
public LLUUID RegisterRequest(uint localID, LLUUID itemID,
|
||||||
string identifier)
|
string identifier)
|
||||||
{
|
{
|
||||||
lock(DataserverRequests)
|
lock (DataserverRequests)
|
||||||
{
|
{
|
||||||
if(DataserverRequests.ContainsKey(identifier))
|
if (DataserverRequests.ContainsKey(identifier))
|
||||||
return LLUUID.Zero;
|
return LLUUID.Zero;
|
||||||
|
|
||||||
DataserverRequest ds = new DataserverRequest();
|
DataserverRequest ds = new DataserverRequest();
|
||||||
|
@ -84,9 +84,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
{
|
{
|
||||||
DataserverRequest ds;
|
DataserverRequest ds;
|
||||||
|
|
||||||
lock(DataserverRequests)
|
lock (DataserverRequests)
|
||||||
{
|
{
|
||||||
if(!DataserverRequests.ContainsKey(identifier))
|
if (!DataserverRequests.ContainsKey(identifier))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ds=DataserverRequests[identifier];
|
ds=DataserverRequests[identifier];
|
||||||
|
@ -94,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
}
|
}
|
||||||
|
|
||||||
m_CmdManager.m_ScriptEngine.PostObjectEvent(ds.localID,
|
m_CmdManager.m_ScriptEngine.PostObjectEvent(ds.localID,
|
||||||
new XEventParams( "dataserver", new Object[]
|
new XEventParams("dataserver", new Object[]
|
||||||
{ new LSL_Types.LSLString(ds.ID.ToString()),
|
{ new LSL_Types.LSLString(ds.ID.ToString()),
|
||||||
new LSL_Types.LSLString(reply)},
|
new LSL_Types.LSLString(reply)},
|
||||||
new XDetectParams[0]));
|
new XDetectParams[0]));
|
||||||
|
@ -102,11 +102,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
|
|
||||||
public void RemoveEvents(uint localID, LLUUID itemID)
|
public void RemoveEvents(uint localID, LLUUID itemID)
|
||||||
{
|
{
|
||||||
lock(DataserverRequests)
|
lock (DataserverRequests)
|
||||||
{
|
{
|
||||||
foreach (DataserverRequest ds in new List<DataserverRequest>(DataserverRequests.Values))
|
foreach (DataserverRequest ds in new List<DataserverRequest>(DataserverRequests.Values))
|
||||||
{
|
{
|
||||||
if(ds.itemID == itemID)
|
if (ds.itemID == itemID)
|
||||||
DataserverRequests.Remove(ds.handle);
|
DataserverRequests.Remove(ds.handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,11 +114,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
|
|
||||||
public void ExpireRequests()
|
public void ExpireRequests()
|
||||||
{
|
{
|
||||||
lock(DataserverRequests)
|
lock (DataserverRequests)
|
||||||
{
|
{
|
||||||
foreach (DataserverRequest ds in new List<DataserverRequest>(DataserverRequests.Values))
|
foreach (DataserverRequest ds in new List<DataserverRequest>(DataserverRequests.Values))
|
||||||
{
|
{
|
||||||
if(ds.startTime > DateTime.Now.AddSeconds(30))
|
if (ds.startTime > DateTime.Now.AddSeconds(30))
|
||||||
DataserverRequests.Remove(ds.handle);
|
DataserverRequests.Remove(ds.handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,12 +57,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
SceneObjectPart part = m_CmdManager.m_ScriptEngine.World.
|
SceneObjectPart part = m_CmdManager.m_ScriptEngine.World.
|
||||||
GetSceneObjectPart(localID);
|
GetSceneObjectPart(localID);
|
||||||
|
|
||||||
if(part == null) // Can't register events for non-prims
|
if (part == null) // Can't register events for non-prims
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!part.ContainsScripts())
|
if (!part.ContainsScripts())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveObjectEvent(uint localID, string eventName, LLUUID id)
|
public void RemoveObjectEvent(uint localID, string eventName, LLUUID id)
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
|
|
||||||
foreach (XEngine xe in XEngine.ScriptEngines)
|
foreach (XEngine xe in XEngine.ScriptEngines)
|
||||||
{
|
{
|
||||||
if(xe.PostObjectEvent(httpInfo.localID,
|
if (xe.PostObjectEvent(httpInfo.localID,
|
||||||
new XEventParams("http_response",
|
new XEventParams("http_response",
|
||||||
resobj, new XDetectParams[0])))
|
resobj, new XDetectParams[0])))
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -69,7 +69,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
private object SenseRepeatListLock = new object();
|
private object SenseRepeatListLock = new object();
|
||||||
|
|
||||||
public void SetSenseRepeatEvent(uint m_localID, LLUUID m_itemID,
|
public void SetSenseRepeatEvent(uint m_localID, LLUUID m_itemID,
|
||||||
string name, LLUUID keyID, int type, double range, double arc, double sec, SceneObjectPart host)
|
string name, LLUUID keyID, int type, double range,
|
||||||
|
double arc, double sec, SceneObjectPart host)
|
||||||
{
|
{
|
||||||
Console.WriteLine("SetSensorEvent");
|
Console.WriteLine("SetSensorEvent");
|
||||||
|
|
||||||
|
@ -319,7 +320,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
new XDetectParams[SensedObjects.Length];
|
new XDetectParams[SensedObjects.Length];
|
||||||
|
|
||||||
int idx;
|
int idx;
|
||||||
for(idx = 0 ; idx < SensedObjects.Length; idx++)
|
for (idx = 0; idx < SensedObjects.Length; idx++)
|
||||||
{
|
{
|
||||||
detect[idx].Key=(LLUUID)(SensedObjects.Data[idx]);
|
detect[idx].Key=(LLUUID)(SensedObjects.Data[idx]);
|
||||||
}
|
}
|
||||||
|
@ -339,7 +340,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
|
|
||||||
foreach (SenseRepeatClass ts in SenseRepeaters)
|
foreach (SenseRepeatClass ts in SenseRepeaters)
|
||||||
{
|
{
|
||||||
if(ts.itemID == itemID)
|
if (ts.itemID == itemID)
|
||||||
{
|
{
|
||||||
data.Add(ts.interval);
|
data.Add(ts.interval);
|
||||||
data.Add(ts.name);
|
data.Add(ts.name);
|
||||||
|
@ -359,12 +360,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
m_CmdManager.m_ScriptEngine.World.GetSceneObjectPart(
|
m_CmdManager.m_ScriptEngine.World.GetSceneObjectPart(
|
||||||
objectID);
|
objectID);
|
||||||
|
|
||||||
if(part == null)
|
if (part == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int idx=0;
|
int idx = 0;
|
||||||
|
|
||||||
while(idx < data.Length)
|
while (idx < data.Length)
|
||||||
{
|
{
|
||||||
SenseRepeatClass ts = new SenseRepeatClass();
|
SenseRepeatClass ts = new SenseRepeatClass();
|
||||||
|
|
||||||
|
@ -386,6 +387,5 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
idx += 6;
|
idx += 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
{
|
{
|
||||||
foreach (TimerClass ts in Timers)
|
foreach (TimerClass ts in Timers)
|
||||||
{
|
{
|
||||||
if(ts.itemID == itemID)
|
if (ts.itemID == itemID)
|
||||||
{
|
{
|
||||||
data.Add(ts.interval);
|
data.Add(ts.interval);
|
||||||
data.Add(ts.next-DateTime.Now.Ticks);
|
data.Add(ts.next-DateTime.Now.Ticks);
|
||||||
|
@ -144,9 +144,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
public void CreateFromData(uint localID, LLUUID itemID, LLUUID objectID,
|
public void CreateFromData(uint localID, LLUUID itemID, LLUUID objectID,
|
||||||
Object[] data)
|
Object[] data)
|
||||||
{
|
{
|
||||||
int idx=0;
|
int idx = 0;
|
||||||
|
|
||||||
while(idx < data.Length)
|
while (idx < data.Length)
|
||||||
{
|
{
|
||||||
TimerClass ts = new TimerClass();
|
TimerClass ts = new TimerClass();
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
|
|
||||||
foreach (XEngine xe in XEngine.ScriptEngines)
|
foreach (XEngine xe in XEngine.ScriptEngines)
|
||||||
{
|
{
|
||||||
if(xe.PostScriptEvent(
|
if (xe.PostScriptEvent(
|
||||||
rInfo.GetItemID(), new XEventParams(
|
rInfo.GetItemID(), new XEventParams(
|
||||||
"remote_data", resobj,
|
"remote_data", resobj,
|
||||||
new XDetectParams[0])))
|
new XDetectParams[0])))
|
||||||
|
@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
|
||||||
|
|
||||||
foreach (XEngine xe in XEngine.ScriptEngines)
|
foreach (XEngine xe in XEngine.ScriptEngines)
|
||||||
{
|
{
|
||||||
if(xe.PostScriptEvent(
|
if (xe.PostScriptEvent(
|
||||||
srdInfo.m_itemID, new XEventParams(
|
srdInfo.m_itemID, new XEventParams(
|
||||||
"remote_data", resobj,
|
"remote_data", resobj,
|
||||||
new XDetectParams[0])))
|
new XDetectParams[0])))
|
||||||
|
|
|
@ -256,7 +256,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
// string OutFile = Path.Combine(ScriptEnginesPath,
|
// string OutFile = Path.Combine(ScriptEnginesPath,
|
||||||
// FilePrefix + "_compiled_" + asset + ".dll");
|
// FilePrefix + "_compiled_" + asset + ".dll");
|
||||||
|
|
||||||
if(File.Exists(OutFile))
|
if (File.Exists(OutFile))
|
||||||
return OutFile;
|
return OutFile;
|
||||||
|
|
||||||
if (!Directory.Exists(ScriptEnginesPath))
|
if (!Directory.Exists(ScriptEnginesPath))
|
||||||
|
@ -284,7 +284,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
enumCompileType l = DefaultCompileLanguage;
|
enumCompileType l = DefaultCompileLanguage;
|
||||||
|
|
||||||
|
|
||||||
if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture))
|
if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture))
|
||||||
l = enumCompileType.cs;
|
l = enumCompileType.cs;
|
||||||
if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture))
|
if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture))
|
||||||
|
@ -334,7 +333,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
// End of insert
|
// End of insert
|
||||||
|
|
||||||
|
|
||||||
switch (l)
|
switch (l)
|
||||||
{
|
{
|
||||||
case enumCompileType.cs:
|
case enumCompileType.cs:
|
||||||
|
@ -368,8 +366,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
private static string CreateCSCompilerScript(string compileScript)
|
private static string CreateCSCompilerScript(string compileScript)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
compileScript = String.Empty +
|
compileScript = String.Empty +
|
||||||
"using OpenSim.Region.ScriptEngine.XEngine.Script; using System.Collections.Generic;\r\n" +
|
"using OpenSim.Region.ScriptEngine.XEngine.Script; using System.Collections.Generic;\r\n" +
|
||||||
String.Empty + "namespace SecondLife { " +
|
String.Empty + "namespace SecondLife { " +
|
||||||
|
@ -499,7 +495,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// NO ERRORS, BUT NO COMPILED FILE
|
// NO ERRORS, BUT NO COMPILED FILE
|
||||||
//
|
//
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the flags we just computed and return the result
|
// Save the flags we just computed and return the result
|
||||||
if(eventFlags != 0)
|
if (eventFlags != 0)
|
||||||
m_stateEvents.Add(m_Script.State, eventFlags);
|
m_stateEvents.Add(m_Script.State, eventFlags);
|
||||||
|
|
||||||
//Console.WriteLine("Returning {0:x}", eventFlags);
|
//Console.WriteLine("Returning {0:x}", eventFlags);
|
||||||
|
@ -130,7 +130,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
#endif
|
#endif
|
||||||
// Found
|
// Found
|
||||||
ev.Invoke(m_Script, args);
|
ev.Invoke(m_Script, args);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,8 +111,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if(text.Length > 1023)
|
if (text.Length > 1023)
|
||||||
text=text.Substring(0, 1023);
|
text = text.Substring(0, 1023);
|
||||||
|
|
||||||
World.SimChat(Helpers.StringToField(text),
|
World.SimChat(Helpers.StringToField(text),
|
||||||
ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
|
ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
|
||||||
|
@ -129,13 +129,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
private LLUUID InventorySelf()
|
private LLUUID InventorySelf()
|
||||||
{
|
{
|
||||||
LLUUID invItemID=new LLUUID();
|
LLUUID invItemID = new LLUUID();
|
||||||
|
|
||||||
foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
|
if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
|
||||||
{
|
{
|
||||||
invItemID=inv.Key;
|
invItemID = inv.Key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Old implementation of llRot2Euler, now normalized
|
// Old implementation of llRot2Euler, now normalized
|
||||||
|
|
||||||
public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r)
|
public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r)
|
||||||
|
@ -322,7 +321,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
return new LSL_Types.Vector3(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
|
return new LSL_Types.Vector3(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Xantor's newer llEuler2Rot() *try the second* inverted quaternions (-x,-y,-z,w) as LL seems to like
|
// Xantor's newer llEuler2Rot() *try the second* inverted quaternions (-x,-y,-z,w) as LL seems to like
|
||||||
// New and improved, now actually works as described. Prim rotates as expected as does llRot2Euler.
|
// New and improved, now actually works as described. Prim rotates as expected as does llRot2Euler.
|
||||||
|
|
||||||
|
@ -363,7 +361,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
return new LSL_Types.Quaternion(x, y, z, s);
|
return new LSL_Types.Quaternion(x, y, z, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up)
|
public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -388,6 +385,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
return (new LSL_Types.Vector3(0, 0, 1) * r);
|
return (new LSL_Types.Vector3(0, 0, 1) * r);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 a, LSL_Types.Vector3 b)
|
public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 a, LSL_Types.Vector3 b)
|
||||||
{
|
{
|
||||||
//A and B should both be normalized
|
//A and B should both be normalized
|
||||||
|
@ -401,12 +399,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
return new LSL_Types.Quaternion(axis.x * s, axis.y * s, axis.z * s, (float)Math.Cos(angle / 2));
|
return new LSL_Types.Quaternion(axis.x * s, axis.y * s, axis.z * s, (float)Math.Cos(angle / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llWhisper(int channelID, string text)
|
public void llWhisper(int channelID, string text)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if(text.Length > 1023)
|
if (text.Length > 1023)
|
||||||
text=text.Substring(0, 1023);
|
text = text.Substring(0, 1023);
|
||||||
|
|
||||||
World.SimChat(Helpers.StringToField(text),
|
World.SimChat(Helpers.StringToField(text),
|
||||||
ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
|
ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
|
||||||
|
@ -419,8 +418,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if(text.Length > 1023)
|
if (text.Length > 1023)
|
||||||
text=text.Substring(0, 1023);
|
text = text.Substring(0, 1023);
|
||||||
|
|
||||||
World.SimChat(Helpers.StringToField(text),
|
World.SimChat(Helpers.StringToField(text),
|
||||||
ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, true);
|
ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, true);
|
||||||
|
@ -437,9 +436,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (text.Length > 1023)
|
||||||
if(text.Length > 1023)
|
text = text.Substring(0, 1023);
|
||||||
text=text.Substring(0, 1023);
|
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
@ -520,14 +518,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
if (SensedObject == null)
|
if (SensedObject == null)
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
return SensedObject.Name;
|
return SensedObject.Name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string llDetectedName(int number)
|
public string llDetectedName(int number)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number);
|
LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number);
|
||||||
if(sensedUUID != null)
|
if (sensedUUID != null)
|
||||||
return resolveName(sensedUUID);
|
return resolveName(sensedUUID);
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
}
|
||||||
|
@ -540,7 +537,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
public EntityBase entityDetectedKey(int number)
|
public EntityBase entityDetectedKey(int number)
|
||||||
{
|
{
|
||||||
LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number);
|
LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number);
|
||||||
if(sensedUUID != null)
|
if (sensedUUID != null)
|
||||||
{
|
{
|
||||||
EntityBase SensedObject = null;
|
EntityBase SensedObject = null;
|
||||||
lock (World.Entities)
|
lock (World.Entities)
|
||||||
|
@ -567,7 +564,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
// returns UUID of owner of object detected
|
// returns UUID of owner of object detected
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
EntityBase SensedObject = entityDetectedKey(number);
|
EntityBase SensedObject = entityDetectedKey(number);
|
||||||
if (SensedObject ==null)
|
if (SensedObject == null)
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
LLUUID SensedUUID = uuidDetectedKey(number);
|
LLUUID SensedUUID = uuidDetectedKey(number);
|
||||||
if (World.GetScenePresence(SensedUUID) == null)
|
if (World.GetScenePresence(SensedUUID) == null)
|
||||||
|
@ -575,7 +572,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
// sensed object is not an avatar
|
// sensed object is not an avatar
|
||||||
// so get the owner of the sensed object
|
// so get the owner of the sensed object
|
||||||
SceneObjectPart SOP = World.GetSceneObjectPart(SensedUUID);
|
SceneObjectPart SOP = World.GetSceneObjectPart(SensedUUID);
|
||||||
if (SOP != null) { return SOP.ObjectOwner.ToString(); }
|
if (SOP != null)
|
||||||
|
{
|
||||||
|
return SOP.ObjectOwner.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -583,9 +583,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
return SensedUUID.ToString();
|
return SensedUUID.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Types.LSLInteger llDetectedType(int number)
|
public LSL_Types.LSLInteger llDetectedType(int number)
|
||||||
|
@ -599,14 +597,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
LLUUID SensedUUID = uuidDetectedKey(number);
|
LLUUID SensedUUID = uuidDetectedKey(number);
|
||||||
LSL_Types.Vector3 ZeroVector = new LSL_Types.Vector3(0, 0, 0);
|
LSL_Types.Vector3 ZeroVector = new LSL_Types.Vector3(0, 0, 0);
|
||||||
|
|
||||||
if (World.GetScenePresence(SensedUUID) != null) mask |= 0x01; // actor
|
if (World.GetScenePresence(SensedUUID) != null)
|
||||||
|
mask |= 0x01; // actor
|
||||||
|
|
||||||
if (SensedObject.Velocity.Equals(ZeroVector))
|
if (SensedObject.Velocity.Equals(ZeroVector))
|
||||||
mask |= 0x04; // passive non-moving
|
mask |= 0x04; // passive non-moving
|
||||||
else
|
else
|
||||||
mask |= 0x02; // active moving
|
mask |= 0x02; // active moving
|
||||||
if (SensedObject is IScript) mask |= 0x08; // Scripted. It COULD have one hidden ...
|
|
||||||
return mask;
|
|
||||||
|
|
||||||
|
if (SensedObject is IScript)
|
||||||
|
mask |= 0x08; // Scripted. It COULD have one hidden ...
|
||||||
|
|
||||||
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Types.Vector3 llDetectedPos(int number)
|
public LSL_Types.Vector3 llDetectedPos(int number)
|
||||||
|
@ -702,8 +704,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_host.ScriptSetPhysicsStatus(true);
|
m_host.ScriptSetPhysicsStatus(true);
|
||||||
else
|
else
|
||||||
m_host.ScriptSetPhysicsStatus(false);
|
m_host.ScriptSetPhysicsStatus(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM)
|
if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM)
|
||||||
{
|
{
|
||||||
if (value == 1)
|
if (value == 1)
|
||||||
|
@ -711,27 +713,32 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
else
|
else
|
||||||
m_host.ScriptSetPhantomStatus(false);
|
m_host.ScriptSetPhantomStatus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS)
|
if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS)
|
||||||
{
|
{
|
||||||
m_host.AddFlag(LLObject.ObjectFlags.CastShadows);
|
m_host.AddFlag(LLObject.ObjectFlags.CastShadows);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X)
|
if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X)
|
||||||
{
|
{
|
||||||
statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X;
|
statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y)
|
if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y)
|
||||||
{
|
{
|
||||||
statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y;
|
statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z)
|
if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z)
|
||||||
{
|
{
|
||||||
statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z;
|
statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status & BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) == BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB)
|
if ((status & BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) == BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB)
|
||||||
{
|
{
|
||||||
NotImplemented("llSetStatus - STATUS_BLOCK_GRAB");
|
NotImplemented("llSetStatus - STATUS_BLOCK_GRAB");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status & BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE)
|
if ((status & BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE)
|
||||||
{
|
{
|
||||||
if (value == 1)
|
if (value == 1)
|
||||||
|
@ -739,18 +746,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
else
|
else
|
||||||
m_host.SetDieAtEdge(false);
|
m_host.SetDieAtEdge(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status & BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE)
|
if ((status & BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE)
|
||||||
{
|
{
|
||||||
NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE");
|
NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status & BuiltIn_Commands_BaseClass.STATUS_SANDBOX) == BuiltIn_Commands_BaseClass.STATUS_SANDBOX)
|
if ((status & BuiltIn_Commands_BaseClass.STATUS_SANDBOX) == BuiltIn_Commands_BaseClass.STATUS_SANDBOX)
|
||||||
{
|
{
|
||||||
NotImplemented("llSetStatus - STATUS_SANDBOX");
|
NotImplemented("llSetStatus - STATUS_SANDBOX");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statusrotationaxis != 0)
|
if (statusrotationaxis != 0)
|
||||||
{
|
{
|
||||||
m_host.SetAxisRotation(statusrotationaxis, value);
|
m_host.SetAxisRotation(statusrotationaxis, value);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -766,23 +775,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case BuiltIn_Commands_BaseClass.STATUS_PHANTOM:
|
case BuiltIn_Commands_BaseClass.STATUS_PHANTOM:
|
||||||
if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom)
|
if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS:
|
case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS:
|
||||||
if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows)
|
if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB:
|
case BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB:
|
||||||
NotImplemented("llGetStatus - STATUS_BLOCK_GRAB");
|
NotImplemented("llGetStatus - STATUS_BLOCK_GRAB");
|
||||||
return 0;
|
return 0;
|
||||||
case BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE:
|
|
||||||
|
|
||||||
|
case BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE:
|
||||||
if (m_host.GetDieAtEdge())
|
if (m_host.GetDieAtEdge())
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
|
@ -791,15 +803,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE:
|
case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE:
|
||||||
NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE");
|
NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case BuiltIn_Commands_BaseClass.STATUS_ROTATE_X:
|
case BuiltIn_Commands_BaseClass.STATUS_ROTATE_X:
|
||||||
NotImplemented("llGetStatus - STATUS_ROTATE_X");
|
NotImplemented("llGetStatus - STATUS_ROTATE_X");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y:
|
case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y:
|
||||||
NotImplemented("llGetStatus - STATUS_ROTATE_Y");
|
NotImplemented("llGetStatus - STATUS_ROTATE_Y");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z:
|
case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z:
|
||||||
NotImplemented("llGetStatus - STATUS_ROTATE_Z");
|
NotImplemented("llGetStatus - STATUS_ROTATE_Z");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case BuiltIn_Commands_BaseClass.STATUS_SANDBOX:
|
case BuiltIn_Commands_BaseClass.STATUS_SANDBOX:
|
||||||
NotImplemented("llGetStatus - STATUS_SANDBOX");
|
NotImplemented("llGetStatus - STATUS_SANDBOX");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2499,17 +2515,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
string reply = String.Empty;
|
string reply = String.Empty;
|
||||||
|
|
||||||
switch(data)
|
switch (data)
|
||||||
{
|
{
|
||||||
case 1: // DATA_ONLINE (0|1)
|
case 1: // DATA_ONLINE (0|1)
|
||||||
// TODO: implement fetching of this information
|
// TODO: implement fetching of this information
|
||||||
// if(userProfile.CurrentAgent.AgentOnline)
|
// if (userProfile.CurrentAgent.AgentOnline)
|
||||||
// reply = "1";
|
// reply = "1";
|
||||||
// else
|
// else
|
||||||
reply = "0";
|
reply = "0";
|
||||||
break;
|
break;
|
||||||
case 2: // DATA_NAME (First Last)
|
case 2: // DATA_NAME (First Last)
|
||||||
reply = userProfile.FirstName+" "+userProfile.SurName;
|
reply = userProfile.FirstName + " " + userProfile.SurName;
|
||||||
break;
|
break;
|
||||||
case 3: // DATA_BORN (YYYY-MM-DD)
|
case 3: // DATA_BORN (YYYY-MM-DD)
|
||||||
DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||||
|
@ -3314,25 +3330,28 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
switch (src[i])
|
switch (src[i])
|
||||||
{
|
{
|
||||||
case '<' :
|
case '<':
|
||||||
parens++;
|
parens++;
|
||||||
length++;
|
length++;
|
||||||
break;
|
break;
|
||||||
case '>' :
|
case '>':
|
||||||
if (parens > 0)
|
if (parens > 0)
|
||||||
parens--;
|
parens--;
|
||||||
length++;
|
length++;
|
||||||
break;
|
break;
|
||||||
case ',' :
|
case ',':
|
||||||
if (parens == 0)
|
if (parens == 0)
|
||||||
{
|
{
|
||||||
result.Add(src.Substring(start,length).Trim());
|
result.Add(src.Substring(start,length).Trim());
|
||||||
start += length+1;
|
start += length+1;
|
||||||
length = 0;
|
length = 0;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
length++;
|
length++;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
length++;
|
length++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3341,7 +3360,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
result.Add(src.Substring(start,length).Trim());
|
result.Add(src.Substring(start,length).Trim());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -5290,11 +5308,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
if (active[j])
|
if (active[j])
|
||||||
{
|
{
|
||||||
// scan all of the markers
|
// scan all of the markers
|
||||||
if ((offset[j] = src.IndexOf((string)spcarray[j-seplen],beginning)) == -1)
|
if ((offset[j] = src.IndexOf((string)spcarray[j-seplen], beginning)) == -1)
|
||||||
{
|
{
|
||||||
// not present at all
|
// not present at all
|
||||||
active[j] = false;
|
active[j] = false;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// present and correct
|
// present and correct
|
||||||
if (offset[j] < offset[best])
|
if (offset[j] < offset[best])
|
||||||
|
@ -5313,7 +5332,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
// no markers were found on this pass
|
// no markers were found on this pass
|
||||||
// so we're pretty much done
|
// so we're pretty much done
|
||||||
tokens.Add(src.Substring(beginning, srclen-beginning));
|
tokens.Add(src.Substring(beginning, srclen - beginning));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5322,15 +5341,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
tokens.Add(src.Substring(beginning,offset[best]-beginning));
|
tokens.Add(src.Substring(beginning,offset[best]-beginning));
|
||||||
|
|
||||||
if (best<seplen)
|
if (best < seplen)
|
||||||
{
|
{
|
||||||
beginning = offset[best]+((string)separray[best]).Length;
|
beginning = offset[best] + ((string)separray[best]).Length;
|
||||||
} else
|
}
|
||||||
{
|
else
|
||||||
beginning = offset[best]+((string)spcarray[best-seplen]).Length;
|
{
|
||||||
tokens.Add(spcarray[best-seplen]);
|
beginning = offset[best] + ((string)spcarray[best - seplen]).Length;
|
||||||
|
tokens.Add(spcarray[best - seplen]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This an awkward an not very intuitive boundary case. If the
|
// This an awkward an not very intuitive boundary case. If the
|
||||||
|
@ -5475,18 +5494,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
public string llRequestSimulatorData(string simulator, int data)
|
public string llRequestSimulatorData(string simulator, int data)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
string reply = String.Empty;
|
string reply = String.Empty;
|
||||||
|
|
||||||
RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator);
|
RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator);
|
||||||
|
|
||||||
switch(data)
|
switch (data)
|
||||||
{
|
{
|
||||||
case 5: // DATA_SIM_POS
|
case 5: // DATA_SIM_POS
|
||||||
if(info == null)
|
if (info == null)
|
||||||
return LLUUID.Zero.ToString();
|
return LLUUID.Zero.ToString();
|
||||||
reply = new LSL_Types.Vector3(
|
reply = new LSL_Types.Vector3(
|
||||||
info.RegionLocX * Constants.RegionSize,
|
info.RegionLocX * Constants.RegionSize,
|
||||||
|
@ -5494,18 +5513,18 @@ try
|
||||||
0).ToString();
|
0).ToString();
|
||||||
break;
|
break;
|
||||||
case 6: // DATA_SIM_STATUS
|
case 6: // DATA_SIM_STATUS
|
||||||
if(info != null)
|
if (info != null)
|
||||||
reply = "up"; // Duh!
|
reply = "up"; // Duh!
|
||||||
else
|
else
|
||||||
reply = "unknown";
|
reply = "unknown";
|
||||||
break;
|
break;
|
||||||
case 7: // DATA_SIM_RATING
|
case 7: // DATA_SIM_RATING
|
||||||
if(info == null)
|
if (info == null)
|
||||||
return LLUUID.Zero.ToString();
|
return LLUUID.Zero.ToString();
|
||||||
int access = (int)info.EstateSettings.simAccess;
|
int access = (int)info.EstateSettings.simAccess;
|
||||||
if(access == 21)
|
if (access == 21)
|
||||||
reply = "MATURE";
|
reply = "MATURE";
|
||||||
else if(access == 13)
|
else if (access == 13)
|
||||||
reply = "MATURE";
|
reply = "MATURE";
|
||||||
else
|
else
|
||||||
reply = "UNKNOWN";
|
reply = "UNKNOWN";
|
||||||
|
@ -5523,12 +5542,12 @@ try
|
||||||
m_Dataserver.DataserverReply(rq.ToString(), reply);
|
m_Dataserver.DataserverReply(rq.ToString(), reply);
|
||||||
|
|
||||||
return tid.ToString();
|
return tid.ToString();
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.ToString());
|
Console.WriteLine(e.ToString());
|
||||||
return LLUUID.Zero.ToString();
|
return LLUUID.Zero.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llForceMouselook(int mouselook)
|
public void llForceMouselook(int mouselook)
|
||||||
|
@ -5543,7 +5562,7 @@ return LLUUID.Zero.ToString();
|
||||||
LLUUID key = new LLUUID();
|
LLUUID key = new LLUUID();
|
||||||
if (LLUUID.TryParse(id,out key))
|
if (LLUUID.TryParse(id,out key))
|
||||||
{
|
{
|
||||||
return (double)World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass();
|
return (double) World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5562,7 +5581,6 @@ return LLUUID.Zero.ToString();
|
||||||
|
|
||||||
public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end)
|
public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end)
|
||||||
{
|
{
|
||||||
|
|
||||||
LSL_Types.list pref = null;
|
LSL_Types.list pref = null;
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -5592,9 +5610,9 @@ return LLUUID.Zero.ToString();
|
||||||
pref = dest.GetSublist(0,start-1);
|
pref = dest.GetSublist(0,start-1);
|
||||||
// Only add a suffix if there is something
|
// Only add a suffix if there is something
|
||||||
// beyond the end index (it's inclusive too).
|
// beyond the end index (it's inclusive too).
|
||||||
if (end+1 < dest.Length)
|
if (end + 1 < dest.Length)
|
||||||
{
|
{
|
||||||
return pref + src + dest.GetSublist(end+1,-1);
|
return pref + src + dest.GetSublist(end + 1, -1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5609,9 +5627,9 @@ return LLUUID.Zero.ToString();
|
||||||
// is removed.
|
// is removed.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (end+1 < dest.Length)
|
if (end + 1 < dest.Length)
|
||||||
{
|
{
|
||||||
return src + dest.GetSublist(end+1,-1);
|
return src + dest.GetSublist(end + 1, -1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5627,7 +5645,7 @@ return LLUUID.Zero.ToString();
|
||||||
// might have been negative.
|
// might have been negative.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return dest.GetSublist(end+1,start-1)+src;
|
return dest.GetSublist(end + 1, start - 1) + src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6250,7 +6268,7 @@ return LLUUID.Zero.ToString();
|
||||||
LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.
|
LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.
|
||||||
m_Dataserver.RegisterRequest(m_localID,
|
m_Dataserver.RegisterRequest(m_localID,
|
||||||
m_itemID, item.AssetID.ToString());
|
m_itemID, item.AssetID.ToString());
|
||||||
if(NotecardCache.IsCached(item.AssetID))
|
if (NotecardCache.IsCached(item.AssetID))
|
||||||
{
|
{
|
||||||
m_ScriptEngine.m_ASYNCLSLCommandManager.
|
m_ScriptEngine.m_ASYNCLSLCommandManager.
|
||||||
m_Dataserver.DataserverReply(item.AssetID.ToString(),
|
m_Dataserver.DataserverReply(item.AssetID.ToString(),
|
||||||
|
@ -6286,7 +6304,7 @@ return LLUUID.Zero.ToString();
|
||||||
LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.
|
LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.
|
||||||
m_Dataserver.RegisterRequest(m_localID,
|
m_Dataserver.RegisterRequest(m_localID,
|
||||||
m_itemID, item.AssetID.ToString());
|
m_itemID, item.AssetID.ToString());
|
||||||
if(NotecardCache.IsCached(item.AssetID))
|
if (NotecardCache.IsCached(item.AssetID))
|
||||||
{
|
{
|
||||||
m_ScriptEngine.m_ASYNCLSLCommandManager.
|
m_ScriptEngine.m_ASYNCLSLCommandManager.
|
||||||
m_Dataserver.DataserverReply(item.AssetID.ToString(),
|
m_Dataserver.DataserverReply(item.AssetID.ToString(),
|
||||||
|
@ -6329,13 +6347,13 @@ return LLUUID.Zero.ToString();
|
||||||
{
|
{
|
||||||
CacheCheck();
|
CacheCheck();
|
||||||
|
|
||||||
lock(m_Notecards)
|
lock (m_Notecards)
|
||||||
{
|
{
|
||||||
if(m_Notecards.ContainsKey(assetID))
|
if (m_Notecards.ContainsKey(assetID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Notecard nc = new Notecard();
|
Notecard nc = new Notecard();
|
||||||
nc.lastRef=DateTime.Now;
|
nc.lastRef = DateTime.Now;
|
||||||
nc.text = ParseText(text.Replace("\r", "").Split('\n'));
|
nc.text = ParseText(text.Replace("\r", "").Split('\n'));
|
||||||
m_Notecards[assetID] = nc;
|
m_Notecards[assetID] = nc;
|
||||||
}
|
}
|
||||||
|
@ -6343,56 +6361,57 @@ return LLUUID.Zero.ToString();
|
||||||
|
|
||||||
private static string[] ParseText(string[] input)
|
private static string[] ParseText(string[] input)
|
||||||
{
|
{
|
||||||
int idx=0;
|
int idx = 0;
|
||||||
int level=0;
|
int level = 0;
|
||||||
List<string> output = new List<string>();
|
List<string> output = new List<string>();
|
||||||
string[] words;
|
string[] words;
|
||||||
|
|
||||||
while(idx < input.Length)
|
while (idx < input.Length)
|
||||||
{
|
{
|
||||||
if(input[idx] == "{")
|
if (input[idx] == "{")
|
||||||
{
|
{
|
||||||
level++;
|
level++;
|
||||||
idx++;
|
idx++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(input[idx]== "}")
|
|
||||||
|
if (input[idx]== "}")
|
||||||
{
|
{
|
||||||
level--;
|
level--;
|
||||||
idx++;
|
idx++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
words = input[idx].Split(' '); // Linden text ver
|
words = input[idx].Split(' '); // Linden text ver
|
||||||
int version = int.Parse(words[3]);
|
int version = int.Parse(words[3]);
|
||||||
if(version != 2)
|
if (version != 2)
|
||||||
return new String[0];
|
return new String[0];
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
words = input[idx].Split(' ');
|
words = input[idx].Split(' ');
|
||||||
if(words[0] == "LLEmbeddedItems")
|
if (words[0] == "LLEmbeddedItems")
|
||||||
break;
|
break;
|
||||||
if(words[0] == "Text")
|
if (words[0] == "Text")
|
||||||
{
|
{
|
||||||
int len = int.Parse(words[2]);
|
int len = int.Parse(words[2]);
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
int count=-1;
|
int count = -1;
|
||||||
|
|
||||||
while(count < len)
|
while (count < len)
|
||||||
{
|
{
|
||||||
int l = input[idx].Length;
|
int l = input[idx].Length;
|
||||||
string ln = input[idx];
|
string ln = input[idx];
|
||||||
|
|
||||||
int need = len-count-1;
|
int need = len-count-1;
|
||||||
if(ln.Length > need)
|
if (ln.Length > need)
|
||||||
ln=ln.Substring(0, need);
|
ln = ln.Substring(0, need);
|
||||||
|
|
||||||
output.Add(ln);
|
output.Add(ln);
|
||||||
count+=ln.Length+1;
|
count += ln.Length + 1;
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6401,10 +6420,10 @@ return LLUUID.Zero.ToString();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
words = input[idx].Split(' '); // count
|
words = input[idx].Split(' '); // count
|
||||||
if(words[0] == "count")
|
if (words[0] == "count")
|
||||||
{
|
{
|
||||||
int c = int.Parse(words[1]);
|
int c = int.Parse(words[1]);
|
||||||
if(c > 0)
|
if (c > 0)
|
||||||
return new String[0];
|
return new String[0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6417,7 +6436,7 @@ return LLUUID.Zero.ToString();
|
||||||
|
|
||||||
public static bool IsCached(LLUUID assetID)
|
public static bool IsCached(LLUUID assetID)
|
||||||
{
|
{
|
||||||
lock(m_Notecards)
|
lock (m_Notecards)
|
||||||
{
|
{
|
||||||
return m_Notecards.ContainsKey(assetID);
|
return m_Notecards.ContainsKey(assetID);
|
||||||
}
|
}
|
||||||
|
@ -6425,10 +6444,10 @@ return LLUUID.Zero.ToString();
|
||||||
|
|
||||||
public static int GetLines(LLUUID assetID)
|
public static int GetLines(LLUUID assetID)
|
||||||
{
|
{
|
||||||
if(!IsCached(assetID))
|
if (!IsCached(assetID))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
lock(m_Notecards)
|
lock (m_Notecards)
|
||||||
{
|
{
|
||||||
m_Notecards[assetID].lastRef = DateTime.Now;
|
m_Notecards[assetID].lastRef = DateTime.Now;
|
||||||
return m_Notecards[assetID].text.Length;
|
return m_Notecards[assetID].text.Length;
|
||||||
|
@ -6437,23 +6456,23 @@ return LLUUID.Zero.ToString();
|
||||||
|
|
||||||
public static string GetLine(LLUUID assetID, int line)
|
public static string GetLine(LLUUID assetID, int line)
|
||||||
{
|
{
|
||||||
if(line < 0)
|
if (line < 0)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
string data;
|
string data;
|
||||||
|
|
||||||
if(!IsCached(assetID))
|
if (!IsCached(assetID))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
lock(m_Notecards)
|
lock (m_Notecards)
|
||||||
{
|
{
|
||||||
m_Notecards[assetID].lastRef = DateTime.Now;
|
m_Notecards[assetID].lastRef = DateTime.Now;
|
||||||
|
|
||||||
if(line >= m_Notecards[assetID].text.Length)
|
if (line >= m_Notecards[assetID].text.Length)
|
||||||
return "\n\n\n";
|
return "\n\n\n";
|
||||||
|
|
||||||
data=m_Notecards[assetID].text[line];
|
data = m_Notecards[assetID].text[line];
|
||||||
if(data.Length > 255)
|
if (data.Length > 255)
|
||||||
data = data.Substring(0, 255);
|
data = data.Substring(0, 255);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -6465,10 +6484,9 @@ return LLUUID.Zero.ToString();
|
||||||
foreach (LLUUID key in new List<LLUUID>(m_Notecards.Keys))
|
foreach (LLUUID key in new List<LLUUID>(m_Notecards.Keys))
|
||||||
{
|
{
|
||||||
Notecard nc = m_Notecards[key];
|
Notecard nc = m_Notecards[key];
|
||||||
if(nc.lastRef.AddSeconds(30) < DateTime.Now)
|
if (nc.lastRef.AddSeconds(30) < DateTime.Now)
|
||||||
m_Notecards.Remove(key);
|
m_Notecards.Remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,25 +37,25 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
|
||||||
public static Assembly OnAssemblyResolve(object sender,
|
public static Assembly OnAssemblyResolve(object sender,
|
||||||
ResolveEventArgs args)
|
ResolveEventArgs args)
|
||||||
{
|
{
|
||||||
if(!(sender is System.AppDomain))
|
if (!(sender is System.AppDomain))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
AppDomain myDomain = (AppDomain)sender;
|
AppDomain myDomain = (AppDomain)sender;
|
||||||
string dirName = myDomain.FriendlyName;
|
string dirName = myDomain.FriendlyName;
|
||||||
|
|
||||||
string[] pathList=new string[] {"bin", "ScriptEngines",
|
string[] pathList = new string[] {"bin", "ScriptEngines",
|
||||||
Path.Combine("ScriptEngines", dirName)};
|
Path.Combine("ScriptEngines", dirName)};
|
||||||
|
|
||||||
string assemblyName = args.Name;
|
string assemblyName = args.Name;
|
||||||
if(assemblyName.IndexOf(",") != -1)
|
if (assemblyName.IndexOf(",") != -1)
|
||||||
assemblyName=args.Name.Substring(0, args.Name.IndexOf(","));
|
assemblyName = args.Name.Substring(0, args.Name.IndexOf(","));
|
||||||
|
|
||||||
foreach (string s in pathList)
|
foreach (string s in pathList)
|
||||||
{
|
{
|
||||||
string path=Path.Combine(Directory.GetCurrentDirectory(),
|
string path = Path.Combine(Directory.GetCurrentDirectory(),
|
||||||
Path.Combine(s, assemblyName))+".dll";
|
Path.Combine(s, assemblyName))+".dll";
|
||||||
|
|
||||||
if(File.Exists(path))
|
if (File.Exists(path))
|
||||||
return Assembly.LoadFrom(path);
|
return Assembly.LoadFrom(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, object> var in vars)
|
foreach (KeyValuePair<string, object> var in vars)
|
||||||
{
|
{
|
||||||
if(m_Fields.ContainsKey(var.Key))
|
if (m_Fields.ContainsKey(var.Key))
|
||||||
{
|
{
|
||||||
m_Fields[var.Key].SetValue(this, var.Value);
|
m_Fields[var.Key].SetValue(this, var.Value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1212,8 +1212,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
|
||||||
|
|
||||||
public LSLInteger(Object o)
|
public LSLInteger(Object o)
|
||||||
{
|
{
|
||||||
if(!(o is Int32))
|
if (!(o is Int32))
|
||||||
value=0;
|
value = 0;
|
||||||
else
|
else
|
||||||
value = (int)o;
|
value = (int)o;
|
||||||
}
|
}
|
||||||
|
@ -1327,11 +1327,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
|
||||||
|
|
||||||
public override bool Equals(object o)
|
public override bool Equals(object o)
|
||||||
{
|
{
|
||||||
if(o is Int32)
|
if (o is Int32)
|
||||||
{
|
{
|
||||||
return value == (Int32)o;
|
return value == (Int32)o;
|
||||||
}
|
}
|
||||||
if(o is LSLInteger)
|
if (o is LSLInteger)
|
||||||
{
|
{
|
||||||
return value == ((LSLInteger)o).value;
|
return value == ((LSLInteger)o).value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
m_ScriptConfig = configSource.Configs["XEngine"];
|
m_ScriptConfig = configSource.Configs["XEngine"];
|
||||||
|
|
||||||
if(m_ScriptConfig == null)
|
if (m_ScriptConfig == null)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[XEngine] No script configuration found. Scripts disabled");
|
m_log.ErrorFormat("[XEngine] No script configuration found. Scripts disabled");
|
||||||
return;
|
return;
|
||||||
|
@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
int saveTime = m_ScriptConfig.GetInt("SaveInterval", 300)*1000;
|
int saveTime = m_ScriptConfig.GetInt("SaveInterval", 300)*1000;
|
||||||
|
|
||||||
ThreadPriority prio = ThreadPriority.BelowNormal;
|
ThreadPriority prio = ThreadPriority.BelowNormal;
|
||||||
switch(priority)
|
switch (priority)
|
||||||
{
|
{
|
||||||
case "Lowest":
|
case "Lowest":
|
||||||
prio=ThreadPriority.Lowest;
|
prio=ThreadPriority.Lowest;
|
||||||
|
@ -149,7 +149,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock(m_ScriptEngines)
|
lock (m_ScriptEngines)
|
||||||
{
|
{
|
||||||
m_ScriptEngines.Add(this);
|
m_ScriptEngines.Add(this);
|
||||||
}
|
}
|
||||||
|
@ -166,14 +166,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_Scene.EventManager.OnRemoveScript += OnRemoveScript;
|
m_Scene.EventManager.OnRemoveScript += OnRemoveScript;
|
||||||
m_Scene.EventManager.OnScriptReset += OnScriptReset;
|
m_Scene.EventManager.OnScriptReset += OnScriptReset;
|
||||||
|
|
||||||
if(sleepTime > 0)
|
if (sleepTime > 0)
|
||||||
{
|
{
|
||||||
m_ThreadPool.QueueWorkItem(new WorkItemCallback(
|
m_ThreadPool.QueueWorkItem(new WorkItemCallback(
|
||||||
this.DoMaintenance), new Object[]
|
this.DoMaintenance), new Object[]
|
||||||
{ sleepTime });
|
{ sleepTime });
|
||||||
}
|
}
|
||||||
|
|
||||||
if(saveTime > 0)
|
if (saveTime > 0)
|
||||||
{
|
{
|
||||||
m_ThreadPool.QueueWorkItem(new WorkItemCallback(
|
m_ThreadPool.QueueWorkItem(new WorkItemCallback(
|
||||||
this.DoBackup), new Object[] { saveTime });
|
this.DoBackup), new Object[] { saveTime });
|
||||||
|
@ -187,9 +187,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
lock(m_ScriptEngines)
|
lock (m_ScriptEngines)
|
||||||
{
|
{
|
||||||
if(m_ScriptEngines.Contains(this))
|
if (m_ScriptEngines.Contains(this))
|
||||||
m_ScriptEngines.Remove(this);
|
m_ScriptEngines.Remove(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
List<XScriptInstance> instances = new List<XScriptInstance>();
|
List<XScriptInstance> instances = new List<XScriptInstance>();
|
||||||
|
|
||||||
lock(m_Scripts)
|
lock (m_Scripts)
|
||||||
{
|
{
|
||||||
foreach (XScriptInstance instance in m_Scripts.Values)
|
foreach (XScriptInstance instance in m_Scripts.Values)
|
||||||
instances.Add(instance);
|
instances.Add(instance);
|
||||||
|
@ -215,9 +215,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
string assembly = String.Empty;
|
string assembly = String.Empty;
|
||||||
|
|
||||||
lock(m_Scripts)
|
lock (m_Scripts)
|
||||||
{
|
{
|
||||||
if(!m_Assemblies.ContainsKey(i.AssetID))
|
if (!m_Assemblies.ContainsKey(i.AssetID))
|
||||||
continue;
|
continue;
|
||||||
assembly = m_Assemblies[i.AssetID];
|
assembly = m_Assemblies[i.AssetID];
|
||||||
}
|
}
|
||||||
|
@ -240,10 +240,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
foreach (XScriptInstance inst in m_Scripts.Values)
|
foreach (XScriptInstance inst in m_Scripts.Values)
|
||||||
{
|
{
|
||||||
if(inst.EventTime() > m_EventLimit)
|
if (inst.EventTime() > m_EventLimit)
|
||||||
{
|
{
|
||||||
inst.Stop(100);
|
inst.Stop(100);
|
||||||
if(!m_KillTimedOutScripts)
|
if (!m_KillTimedOutScripts)
|
||||||
inst.Start();
|
inst.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,22 +296,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
// already have it.
|
// already have it.
|
||||||
|
|
||||||
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
|
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
|
||||||
if(part == null)
|
if (part == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TaskInventoryItem item = part.GetInventoryItem(itemID);
|
TaskInventoryItem item = part.GetInventoryItem(itemID);
|
||||||
if(item == null)
|
if (item == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
LLUUID assetID=item.AssetID;
|
LLUUID assetID = item.AssetID;
|
||||||
|
|
||||||
// m_log.DebugFormat("[XEngine] Compiling script {0} ({1})",
|
// m_log.DebugFormat("[XEngine] Compiling script {0} ({1})",
|
||||||
// item.Name, itemID.ToString());
|
// item.Name, itemID.ToString());
|
||||||
|
|
||||||
string assembly="";
|
string assembly = "";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
assembly=m_Compiler.PerformScriptCompile(script,
|
assembly = m_Compiler.PerformScriptCompile(script,
|
||||||
assetID.ToString());
|
assetID.ToString());
|
||||||
m_log.DebugFormat("[XEngine] Loaded script {0}.{1}",
|
m_log.DebugFormat("[XEngine] Loaded script {0}.{1}",
|
||||||
part.ParentGroup.RootPart.Name, item.Name);
|
part.ParentGroup.RootPart.Name, item.Name);
|
||||||
|
@ -342,28 +342,28 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock(m_Scripts)
|
lock (m_Scripts)
|
||||||
{
|
{
|
||||||
// Create the object record
|
// Create the object record
|
||||||
|
|
||||||
if(!m_PrimObjects.ContainsKey(localID))
|
if (!m_PrimObjects.ContainsKey(localID))
|
||||||
m_PrimObjects[localID] = new List<LLUUID>();
|
m_PrimObjects[localID] = new List<LLUUID>();
|
||||||
|
|
||||||
if(!m_PrimObjects[localID].Contains(itemID))
|
if (!m_PrimObjects[localID].Contains(itemID))
|
||||||
m_PrimObjects[localID].Add(itemID);
|
m_PrimObjects[localID].Add(itemID);
|
||||||
|
|
||||||
if(!m_Assemblies.ContainsKey(assetID))
|
if (!m_Assemblies.ContainsKey(assetID))
|
||||||
m_Assemblies[assetID] = assembly;
|
m_Assemblies[assetID] = assembly;
|
||||||
|
|
||||||
if((!m_Scripts.ContainsKey(itemID)) ||
|
if ((!m_Scripts.ContainsKey(itemID)) ||
|
||||||
(m_Scripts[itemID].AssetID != assetID))
|
(m_Scripts[itemID].AssetID != assetID))
|
||||||
{
|
{
|
||||||
LLUUID appDomain=assetID;
|
LLUUID appDomain=assetID;
|
||||||
|
|
||||||
if(part.ParentGroup.RootPart.m_IsAttachment)
|
if (part.ParentGroup.RootPart.m_IsAttachment)
|
||||||
appDomain=part.ParentGroup.RootPart.UUID;
|
appDomain = part.ParentGroup.RootPart.UUID;
|
||||||
|
|
||||||
if(!m_AppDomains.ContainsKey(appDomain))
|
if (!m_AppDomains.ContainsKey(appDomain))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -394,7 +394,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
m_DomainScripts[appDomain].Add(itemID);
|
m_DomainScripts[appDomain].Add(itemID);
|
||||||
|
|
||||||
|
|
||||||
XScriptInstance instance = new XScriptInstance(this,localID,
|
XScriptInstance instance = new XScriptInstance(this,localID,
|
||||||
part.UUID, itemID, assetID, assembly,
|
part.UUID, itemID, assetID, assembly,
|
||||||
m_AppDomains[appDomain]);
|
m_AppDomains[appDomain]);
|
||||||
|
@ -409,10 +408,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
public void OnRemoveScript(uint localID, LLUUID itemID)
|
public void OnRemoveScript(uint localID, LLUUID itemID)
|
||||||
{
|
{
|
||||||
lock(m_Scripts)
|
lock (m_Scripts)
|
||||||
{
|
{
|
||||||
// Do we even have it?
|
// Do we even have it?
|
||||||
if(!m_Scripts.ContainsKey(itemID))
|
if (!m_Scripts.ContainsKey(itemID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_ASYNCLSLCommandManager.RemoveScript(localID, itemID);
|
m_ASYNCLSLCommandManager.RemoveScript(localID, itemID);
|
||||||
|
@ -426,25 +425,25 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
SceneObjectPart part =
|
SceneObjectPart part =
|
||||||
m_Scene.GetSceneObjectPart(localID);
|
m_Scene.GetSceneObjectPart(localID);
|
||||||
|
|
||||||
if(part != null)
|
if (part != null)
|
||||||
part.RemoveScriptEvents(itemID);
|
part.RemoveScriptEvents(itemID);
|
||||||
|
|
||||||
// Remove the script from it's prim
|
// Remove the script from it's prim
|
||||||
if(m_PrimObjects.ContainsKey(localID))
|
if (m_PrimObjects.ContainsKey(localID))
|
||||||
{
|
{
|
||||||
// Remove inventory item record
|
// Remove inventory item record
|
||||||
if(m_PrimObjects[localID].Contains(itemID))
|
if (m_PrimObjects[localID].Contains(itemID))
|
||||||
m_PrimObjects[localID].Remove(itemID);
|
m_PrimObjects[localID].Remove(itemID);
|
||||||
|
|
||||||
// If there are no more scripts, remove prim
|
// If there are no more scripts, remove prim
|
||||||
if(m_PrimObjects[localID].Count == 0)
|
if (m_PrimObjects[localID].Count == 0)
|
||||||
{
|
{
|
||||||
m_PrimObjects.Remove(localID);
|
m_PrimObjects.Remove(localID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
|
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
|
||||||
if(m_DomainScripts[instance.AppDomain].Count == 0)
|
if (m_DomainScripts[instance.AppDomain].Count == 0)
|
||||||
{
|
{
|
||||||
m_DomainScripts.Remove(instance.AppDomain);
|
m_DomainScripts.Remove(instance.AppDomain);
|
||||||
UnloadAppDomain(instance.AppDomain);
|
UnloadAppDomain(instance.AppDomain);
|
||||||
|
@ -467,7 +466,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
foreach (XScriptInstance i in m_Scripts.Values)
|
foreach (XScriptInstance i in m_Scripts.Values)
|
||||||
{
|
{
|
||||||
if(assetIDList.Contains(i.AssetID))
|
if (assetIDList.Contains(i.AssetID))
|
||||||
assetIDList.Remove(i.AssetID);
|
assetIDList.Remove(i.AssetID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,11 +475,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
// m_log.DebugFormat("[XEngine] Removing unreferenced assembly {0}", m_Assemblies[assetID]);
|
// m_log.DebugFormat("[XEngine] Removing unreferenced assembly {0}", m_Assemblies[assetID]);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(File.Exists(m_Assemblies[assetID]))
|
if (File.Exists(m_Assemblies[assetID]))
|
||||||
File.Delete(m_Assemblies[assetID]);
|
File.Delete(m_Assemblies[assetID]);
|
||||||
if(File.Exists(m_Assemblies[assetID]+".state"))
|
|
||||||
|
if (File.Exists(m_Assemblies[assetID]+".state"))
|
||||||
File.Delete(m_Assemblies[assetID]+".state");
|
File.Delete(m_Assemblies[assetID]+".state");
|
||||||
if(File.Exists(m_Assemblies[assetID]+".mdb"))
|
|
||||||
|
if (File.Exists(m_Assemblies[assetID]+".mdb"))
|
||||||
File.Delete(m_Assemblies[assetID]+".mdb");
|
File.Delete(m_Assemblies[assetID]+".mdb");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -492,9 +493,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
private void UnloadAppDomain(LLUUID id)
|
private void UnloadAppDomain(LLUUID id)
|
||||||
{
|
{
|
||||||
if(m_AppDomains.ContainsKey(id))
|
if (m_AppDomains.ContainsKey(id))
|
||||||
{
|
{
|
||||||
AppDomain domain=m_AppDomains[id];
|
AppDomain domain = m_AppDomains[id];
|
||||||
m_AppDomains.Remove(id);
|
m_AppDomains.Remove(id);
|
||||||
|
|
||||||
AppDomain.Unload(domain);
|
AppDomain.Unload(domain);
|
||||||
|
@ -510,7 +511,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
int idleTimeout, ThreadPriority threadPriority,
|
int idleTimeout, ThreadPriority threadPriority,
|
||||||
int maxScriptQueue, int stackSize)
|
int maxScriptQueue, int stackSize)
|
||||||
{
|
{
|
||||||
m_MaxScriptQueue=maxScriptQueue;
|
m_MaxScriptQueue = maxScriptQueue;
|
||||||
|
|
||||||
STPStartInfo startInfo = new STPStartInfo();
|
STPStartInfo startInfo = new STPStartInfo();
|
||||||
startInfo.IdleTimeout = idleTimeout;
|
startInfo.IdleTimeout = idleTimeout;
|
||||||
|
@ -537,7 +538,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
//
|
//
|
||||||
private object ProcessEventHandler(object parms)
|
private object ProcessEventHandler(object parms)
|
||||||
{
|
{
|
||||||
XScriptInstance instance=(XScriptInstance)parms;
|
XScriptInstance instance = (XScriptInstance) parms;
|
||||||
|
|
||||||
return instance.EventProcessor();
|
return instance.EventProcessor();
|
||||||
}
|
}
|
||||||
|
@ -549,15 +550,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if(!m_PrimObjects.ContainsKey(localID))
|
if (!m_PrimObjects.ContainsKey(localID))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (LLUUID itemID in m_PrimObjects[localID])
|
foreach (LLUUID itemID in m_PrimObjects[localID])
|
||||||
{
|
{
|
||||||
if(m_Scripts.ContainsKey(itemID))
|
if (m_Scripts.ContainsKey(itemID))
|
||||||
{
|
{
|
||||||
XScriptInstance instance = m_Scripts[itemID];
|
XScriptInstance instance = m_Scripts[itemID];
|
||||||
if(instance != null)
|
if (instance != null)
|
||||||
{
|
{
|
||||||
instance.PostEvent(p);
|
instance.PostEvent(p);
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -572,10 +573,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
//
|
//
|
||||||
public bool PostScriptEvent(LLUUID itemID, XEventParams p)
|
public bool PostScriptEvent(LLUUID itemID, XEventParams p)
|
||||||
{
|
{
|
||||||
if(m_Scripts.ContainsKey(itemID))
|
if (m_Scripts.ContainsKey(itemID))
|
||||||
{
|
{
|
||||||
XScriptInstance instance = m_Scripts[itemID];
|
XScriptInstance instance = m_Scripts[itemID];
|
||||||
if(instance != null)
|
if (instance != null)
|
||||||
instance.PostEvent(p);
|
instance.PostEvent(p);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -585,23 +586,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
public Assembly OnAssemblyResolve(object sender,
|
public Assembly OnAssemblyResolve(object sender,
|
||||||
ResolveEventArgs args)
|
ResolveEventArgs args)
|
||||||
{
|
{
|
||||||
if(!(sender is System.AppDomain))
|
if (!(sender is System.AppDomain))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
string[] pathList=new string[] {"bin", "ScriptEngines",
|
string[] pathList = new string[] {"bin", "ScriptEngines",
|
||||||
Path.Combine("ScriptEngines",
|
Path.Combine("ScriptEngines",
|
||||||
m_Scene.RegionInfo.RegionID.ToString())};
|
m_Scene.RegionInfo.RegionID.ToString())};
|
||||||
|
|
||||||
string assemblyName = args.Name;
|
string assemblyName = args.Name;
|
||||||
if(assemblyName.IndexOf(",") != -1)
|
if (assemblyName.IndexOf(",") != -1)
|
||||||
assemblyName=args.Name.Substring(0, args.Name.IndexOf(","));
|
assemblyName = args.Name.Substring(0, args.Name.IndexOf(","));
|
||||||
|
|
||||||
foreach (string s in pathList)
|
foreach (string s in pathList)
|
||||||
{
|
{
|
||||||
string path=Path.Combine(Directory.GetCurrentDirectory(),
|
string path = Path.Combine(Directory.GetCurrentDirectory(),
|
||||||
Path.Combine(s, assemblyName))+".dll";
|
Path.Combine(s, assemblyName))+".dll";
|
||||||
|
|
||||||
if(File.Exists(path))
|
if (File.Exists(path))
|
||||||
return Assembly.LoadFrom(path);
|
return Assembly.LoadFrom(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,9 +612,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
private XScriptInstance GetInstance(LLUUID itemID)
|
private XScriptInstance GetInstance(LLUUID itemID)
|
||||||
{
|
{
|
||||||
XScriptInstance instance;
|
XScriptInstance instance;
|
||||||
lock(m_Scripts)
|
lock (m_Scripts)
|
||||||
{
|
{
|
||||||
if(!m_Scripts.ContainsKey(itemID))
|
if (!m_Scripts.ContainsKey(itemID))
|
||||||
return null;
|
return null;
|
||||||
instance = m_Scripts[itemID];
|
instance = m_Scripts[itemID];
|
||||||
}
|
}
|
||||||
|
@ -623,9 +624,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
public void SetScriptState(LLUUID itemID, bool running)
|
public void SetScriptState(LLUUID itemID, bool running)
|
||||||
{
|
{
|
||||||
XScriptInstance instance = GetInstance(itemID);
|
XScriptInstance instance = GetInstance(itemID);
|
||||||
if(instance != null)
|
if (instance != null)
|
||||||
{
|
{
|
||||||
if(running)
|
if (running)
|
||||||
instance.Start();
|
instance.Start();
|
||||||
else
|
else
|
||||||
instance.Stop(500);
|
instance.Stop(500);
|
||||||
|
@ -635,7 +636,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
public bool GetScriptState(LLUUID itemID)
|
public bool GetScriptState(LLUUID itemID)
|
||||||
{
|
{
|
||||||
XScriptInstance instance = GetInstance(itemID);
|
XScriptInstance instance = GetInstance(itemID);
|
||||||
if(instance != null)
|
if (instance != null)
|
||||||
return instance.Running;
|
return instance.Running;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -643,14 +644,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
public void ResetScript(LLUUID itemID)
|
public void ResetScript(LLUUID itemID)
|
||||||
{
|
{
|
||||||
XScriptInstance instance = GetInstance(itemID);
|
XScriptInstance instance = GetInstance(itemID);
|
||||||
if(instance != null)
|
if (instance != null)
|
||||||
instance.ResetScript();
|
instance.ResetScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
public XDetectParams GetDetectParams(LLUUID itemID, int idx)
|
public XDetectParams GetDetectParams(LLUUID itemID, int idx)
|
||||||
{
|
{
|
||||||
XScriptInstance instance = GetInstance(itemID);
|
XScriptInstance instance = GetInstance(itemID);
|
||||||
if(instance != null)
|
if (instance != null)
|
||||||
return instance.GetDetectParams(idx);
|
return instance.GetDetectParams(idx);
|
||||||
return new XDetectParams();
|
return new XDetectParams();
|
||||||
}
|
}
|
||||||
|
@ -658,7 +659,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
public LLUUID GetDetectID(LLUUID itemID, int idx)
|
public LLUUID GetDetectID(LLUUID itemID, int idx)
|
||||||
{
|
{
|
||||||
XScriptInstance instance = GetInstance(itemID);
|
XScriptInstance instance = GetInstance(itemID);
|
||||||
if(instance != null)
|
if (instance != null)
|
||||||
return instance.GetDetectID(idx);
|
return instance.GetDetectID(idx);
|
||||||
return LLUUID.Zero;
|
return LLUUID.Zero;
|
||||||
}
|
}
|
||||||
|
@ -688,8 +689,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
private XEngine m_Engine;
|
private XEngine m_Engine;
|
||||||
private IWorkItemResult m_CurrentResult=null;
|
private IWorkItemResult m_CurrentResult=null;
|
||||||
private Queue m_EventQueue=new Queue(32);
|
private Queue m_EventQueue = new Queue(32);
|
||||||
private bool m_RunEvents=false;
|
private bool m_RunEvents = false;
|
||||||
private LLUUID m_ItemID;
|
private LLUUID m_ItemID;
|
||||||
private uint m_LocalID;
|
private uint m_LocalID;
|
||||||
private LLUUID m_ObjectID;
|
private LLUUID m_ObjectID;
|
||||||
|
@ -765,7 +766,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
public XScriptInstance(XEngine engine, uint localID, LLUUID objectID,
|
public XScriptInstance(XEngine engine, uint localID, LLUUID objectID,
|
||||||
LLUUID itemID, LLUUID assetID, string assembly, AppDomain dom)
|
LLUUID itemID, LLUUID assetID, string assembly, AppDomain dom)
|
||||||
{
|
{
|
||||||
m_Engine=engine;
|
m_Engine = engine;
|
||||||
|
|
||||||
m_LocalID = localID;
|
m_LocalID = localID;
|
||||||
m_ObjectID = objectID;
|
m_ObjectID = objectID;
|
||||||
|
@ -773,7 +774,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_AssetID = assetID;
|
m_AssetID = assetID;
|
||||||
|
|
||||||
SceneObjectPart part=engine.World.GetSceneObjectPart(localID);
|
SceneObjectPart part=engine.World.GetSceneObjectPart(localID);
|
||||||
if(part == null)
|
if (part == null)
|
||||||
{
|
{
|
||||||
engine.Log.Error("[XEngine] SceneObjectPart unavailable. Script NOT started.");
|
engine.Log.Error("[XEngine] SceneObjectPart unavailable. Script NOT started.");
|
||||||
return;
|
return;
|
||||||
|
@ -811,8 +812,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_Engine.Log.Error("Error loading script instance\n"+e.ToString());
|
m_Engine.Log.Error("Error loading script instance\n"+e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
string savedState = assembly+".state";
|
string savedState = assembly + ".state";
|
||||||
if(File.Exists(savedState))
|
if (File.Exists(savedState))
|
||||||
{
|
{
|
||||||
string xml = String.Empty;
|
string xml = String.Empty;
|
||||||
|
|
||||||
|
@ -820,7 +821,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
FileInfo fi = new FileInfo(savedState);
|
FileInfo fi = new FileInfo(savedState);
|
||||||
int size=(int)fi.Length;
|
int size=(int)fi.Length;
|
||||||
if(size < 130000)
|
if (size < 130000)
|
||||||
{
|
{
|
||||||
using (FileStream fs = File.Open(savedState,
|
using (FileStream fs = File.Open(savedState,
|
||||||
FileMode.Open, FileAccess.Read, FileShare.None))
|
FileMode.Open, FileAccess.Read, FileShare.None))
|
||||||
|
@ -828,10 +829,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
System.Text.ASCIIEncoding enc =
|
System.Text.ASCIIEncoding enc =
|
||||||
new System.Text.ASCIIEncoding();
|
new System.Text.ASCIIEncoding();
|
||||||
|
|
||||||
Byte[] data=new Byte[size];
|
Byte[] data = new Byte[size];
|
||||||
fs.Read(data, 0, size);
|
fs.Read(data, 0, size);
|
||||||
|
|
||||||
xml=enc.GetString(data);
|
xml = enc.GetString(data);
|
||||||
|
|
||||||
ScriptSerializer.Deserialize(xml, this);
|
ScriptSerializer.Deserialize(xml, this);
|
||||||
|
|
||||||
|
@ -874,17 +875,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
lock(m_EventQueue)
|
lock (m_EventQueue)
|
||||||
{
|
{
|
||||||
if(Running)
|
if (Running)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_RunEvents=true;
|
m_RunEvents = true;
|
||||||
|
|
||||||
if(m_EventQueue.Count > 0)
|
if (m_EventQueue.Count > 0)
|
||||||
{
|
{
|
||||||
if(m_CurrentResult == null)
|
if (m_CurrentResult == null)
|
||||||
m_CurrentResult=m_Engine.QueueEventHandler(this);
|
m_CurrentResult = m_Engine.QueueEventHandler(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -893,36 +894,36 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
IWorkItemResult result;
|
IWorkItemResult result;
|
||||||
|
|
||||||
lock(m_EventQueue)
|
lock (m_EventQueue)
|
||||||
{
|
{
|
||||||
if(!Running)
|
if (!Running)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(m_CurrentResult == null)
|
if (m_CurrentResult == null)
|
||||||
{
|
{
|
||||||
m_RunEvents=false;
|
m_RunEvents = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_CurrentResult.Cancel())
|
if (m_CurrentResult.Cancel())
|
||||||
{
|
{
|
||||||
m_CurrentResult=null;
|
m_CurrentResult = null;
|
||||||
m_RunEvents=false;
|
m_RunEvents = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
result=m_CurrentResult;
|
result = m_CurrentResult;
|
||||||
m_RunEvents=false;
|
m_RunEvents = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SmartThreadPool.WaitAll(new IWorkItemResult[] {result}, new TimeSpan((long)timeout*100000), false))
|
if (SmartThreadPool.WaitAll(new IWorkItemResult[] {result}, new TimeSpan((long)timeout * 100000), false))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock(m_EventQueue)
|
lock (m_EventQueue)
|
||||||
{
|
{
|
||||||
if(m_CurrentResult != null)
|
if (m_CurrentResult != null)
|
||||||
m_CurrentResult.Abort();
|
m_CurrentResult.Abort();
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
@ -943,56 +944,56 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
public void PostEvent(XEventParams data)
|
public void PostEvent(XEventParams data)
|
||||||
{
|
{
|
||||||
lock(m_EventQueue)
|
lock (m_EventQueue)
|
||||||
{
|
{
|
||||||
if(m_EventQueue.Count >= m_Engine.MaxScriptQueue)
|
if (m_EventQueue.Count >= m_Engine.MaxScriptQueue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_EventQueue.Enqueue(data);
|
m_EventQueue.Enqueue(data);
|
||||||
if(data.EventName == "timer")
|
if (data.EventName == "timer")
|
||||||
{
|
{
|
||||||
if(m_TimerQueued)
|
if (m_TimerQueued)
|
||||||
return;
|
return;
|
||||||
m_TimerQueued = true;
|
m_TimerQueued = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!m_RunEvents)
|
if (!m_RunEvents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(m_CurrentResult == null)
|
if (m_CurrentResult == null)
|
||||||
{
|
{
|
||||||
m_CurrentResult=m_Engine.QueueEventHandler(this);
|
m_CurrentResult = m_Engine.QueueEventHandler(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public object EventProcessor()
|
public object EventProcessor()
|
||||||
{
|
{
|
||||||
XEventParams data=null;
|
XEventParams data = null;
|
||||||
|
|
||||||
lock(m_EventQueue)
|
lock (m_EventQueue)
|
||||||
{
|
{
|
||||||
data=(XEventParams)m_EventQueue.Dequeue();
|
data = (XEventParams) m_EventQueue.Dequeue();
|
||||||
if(data == null) // Shouldn't happen
|
if (data == null) // Shouldn't happen
|
||||||
{
|
{
|
||||||
m_CurrentResult=null;
|
m_CurrentResult = null;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(data.EventName == "timer")
|
if (data.EventName == "timer")
|
||||||
m_TimerQueued = false;
|
m_TimerQueued = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DetectParams=data.DetectParams;
|
m_DetectParams = data.DetectParams;
|
||||||
|
|
||||||
if(data.EventName == "state") // Hardcoded state change
|
if (data.EventName == "state") // Hardcoded state change
|
||||||
{
|
{
|
||||||
m_State=data.Params[0].ToString();
|
m_State=data.Params[0].ToString();
|
||||||
m_Engine.m_ASYNCLSLCommandManager.RemoveScript(
|
m_Engine.m_ASYNCLSLCommandManager.RemoveScript(
|
||||||
m_LocalID, m_ItemID);
|
m_LocalID, m_ItemID);
|
||||||
|
|
||||||
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(
|
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
|
||||||
m_LocalID);
|
m_LocalID);
|
||||||
if(part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
part.SetScriptEvents(m_ItemID,
|
part.SetScriptEvents(m_ItemID,
|
||||||
(int)m_Executor.GetStateEventFlags());
|
(int)m_Executor.GetStateEventFlags());
|
||||||
|
@ -1001,7 +1002,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// m_Engine.Log.DebugFormat("[XEngine] Processed event {0}", data.EventName);
|
// m_Engine.Log.DebugFormat("[XEngine] Processed event {0}", data.EventName);
|
||||||
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(
|
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
|
||||||
m_LocalID);
|
m_LocalID);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1013,21 +1014,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_InEvent = false;
|
m_InEvent = false;
|
||||||
if(e is System.Threading.ThreadAbortException)
|
if (e is System.Threading.ThreadAbortException)
|
||||||
{
|
{
|
||||||
lock(m_EventQueue)
|
lock (m_EventQueue)
|
||||||
{
|
{
|
||||||
if((m_EventQueue.Count > 0) && m_RunEvents)
|
if ((m_EventQueue.Count > 0) && m_RunEvents)
|
||||||
{
|
{
|
||||||
m_CurrentResult=m_Engine.QueueEventHandler(this);
|
m_CurrentResult=m_Engine.QueueEventHandler(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_CurrentResult=null;
|
m_CurrentResult = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DetectParams=null;
|
m_DetectParams = null;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1055,26 +1056,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock(m_EventQueue)
|
lock (m_EventQueue)
|
||||||
{
|
{
|
||||||
if((m_EventQueue.Count > 0) && m_RunEvents)
|
if ((m_EventQueue.Count > 0) && m_RunEvents)
|
||||||
{
|
{
|
||||||
m_CurrentResult=m_Engine.QueueEventHandler(this);
|
m_CurrentResult = m_Engine.QueueEventHandler(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_CurrentResult=null;
|
m_CurrentResult = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DetectParams=null;
|
m_DetectParams = null;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int EventTime()
|
public int EventTime()
|
||||||
{
|
{
|
||||||
if(!m_InEvent)
|
if (!m_InEvent)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (DateTime.Now - m_EventStart).Seconds;
|
return (DateTime.Now - m_EventStart).Seconds;
|
||||||
|
@ -1082,14 +1083,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
public void ResetScript()
|
public void ResetScript()
|
||||||
{
|
{
|
||||||
bool running=Running;
|
bool running = Running;
|
||||||
|
|
||||||
Stop(0);
|
Stop(0);
|
||||||
m_Engine.m_ASYNCLSLCommandManager.RemoveScript(m_LocalID, m_ItemID);
|
m_Engine.m_ASYNCLSLCommandManager.RemoveScript(m_LocalID, m_ItemID);
|
||||||
m_EventQueue.Clear();
|
m_EventQueue.Clear();
|
||||||
m_Script.ResetVars();
|
m_Script.ResetVars();
|
||||||
m_State = "default";
|
m_State = "default";
|
||||||
if(running)
|
if (running)
|
||||||
Start();
|
Start();
|
||||||
PostEvent(new XEventParams("state_entry",
|
PostEvent(new XEventParams("state_entry",
|
||||||
new Object[0], new XDetectParams[0]));
|
new Object[0], new XDetectParams[0]));
|
||||||
|
@ -1107,7 +1108,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
public XDetectParams GetDetectParams(int idx)
|
public XDetectParams GetDetectParams(int idx)
|
||||||
{
|
{
|
||||||
if(idx < 0 || idx >= m_DetectParams.Length)
|
if (idx < 0 || idx >= m_DetectParams.Length)
|
||||||
return new XDetectParams();
|
return new XDetectParams();
|
||||||
|
|
||||||
return m_DetectParams[idx];
|
return m_DetectParams[idx];
|
||||||
|
@ -1115,7 +1116,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
public LLUUID GetDetectID(int idx)
|
public LLUUID GetDetectID(int idx)
|
||||||
{
|
{
|
||||||
if(idx < 0 || idx >= m_DetectParams.Length)
|
if (idx < 0 || idx >= m_DetectParams.Length)
|
||||||
return LLUUID.Zero;
|
return LLUUID.Zero;
|
||||||
|
|
||||||
return m_DetectParams[idx].Key;
|
return m_DetectParams[idx].Key;
|
||||||
|
@ -1127,19 +1128,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_Engine.m_ASYNCLSLCommandManager.GetSerializationData(
|
m_Engine.m_ASYNCLSLCommandManager.GetSerializationData(
|
||||||
m_ItemID);
|
m_ItemID);
|
||||||
|
|
||||||
string xml=ScriptSerializer.Serialize(this);
|
string xml = ScriptSerializer.Serialize(this);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileStream fs = File.Create(assembly+".state");
|
FileStream fs = File.Create(assembly + ".state");
|
||||||
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
||||||
Byte[] buf=enc.GetBytes(xml);
|
Byte[] buf = enc.GetBytes(xml);
|
||||||
fs.Write(buf, 0, buf.Length);
|
fs.Write(buf, 0, buf.Length);
|
||||||
fs.Close();
|
fs.Close();
|
||||||
}
|
}
|
||||||
catch(Exception)
|
catch(Exception)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1179,7 +1179,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
int count = instance.EventQueue.Count;
|
int count = instance.EventQueue.Count;
|
||||||
|
|
||||||
while(count > 0)
|
while (count > 0)
|
||||||
{
|
{
|
||||||
XEventParams ep = (XEventParams)instance.EventQueue.Dequeue();
|
XEventParams ep = (XEventParams)instance.EventQueue.Dequeue();
|
||||||
instance.EventQueue.Enqueue(ep);
|
instance.EventQueue.Enqueue(ep);
|
||||||
|
@ -1188,7 +1188,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
XmlElement item = xmldoc.CreateElement("", "Item", "");
|
XmlElement item = xmldoc.CreateElement("", "Item", "");
|
||||||
XmlAttribute itemEvent = xmldoc.CreateAttribute("", "event",
|
XmlAttribute itemEvent = xmldoc.CreateAttribute("", "event",
|
||||||
"");
|
"");
|
||||||
itemEvent.Value=ep.EventName;
|
itemEvent.Value = ep.EventName;
|
||||||
item.Attributes.Append(itemEvent);
|
item.Attributes.Append(itemEvent);
|
||||||
|
|
||||||
XmlElement parms = xmldoc.CreateElement("", "Params", "");
|
XmlElement parms = xmldoc.CreateElement("", "Params", "");
|
||||||
|
@ -1205,7 +1205,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
XmlElement objectElem = xmldoc.CreateElement("", "Object",
|
XmlElement objectElem = xmldoc.CreateElement("", "Object",
|
||||||
"");
|
"");
|
||||||
XmlAttribute pos = xmldoc.CreateAttribute("", "pos", "");
|
XmlAttribute pos = xmldoc.CreateAttribute("", "pos", "");
|
||||||
pos.Value=det.OffsetPos.ToString();
|
pos.Value = det.OffsetPos.ToString();
|
||||||
objectElem.Attributes.Append(pos);
|
objectElem.Attributes.Append(pos);
|
||||||
objectElem.AppendChild(
|
objectElem.AppendChild(
|
||||||
xmldoc.CreateTextNode(det.Key.ToString()));
|
xmldoc.CreateTextNode(det.Key.ToString()));
|
||||||
|
@ -1221,7 +1221,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
rootElement.AppendChild(queue);
|
rootElement.AppendChild(queue);
|
||||||
|
|
||||||
XmlNode plugins = xmldoc.CreateElement("", "Plugins", "");
|
XmlNode plugins = xmldoc.CreateElement("", "Plugins", "");
|
||||||
if(instance.PluginData.Length > 0)
|
if (instance.PluginData.Length > 0)
|
||||||
DumpList(xmldoc, plugins,
|
DumpList(xmldoc, plugins,
|
||||||
new LSL_Types.list(instance.PluginData));
|
new LSL_Types.list(instance.PluginData));
|
||||||
|
|
||||||
|
@ -1243,20 +1243,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
doc.LoadXml(xml);
|
doc.LoadXml(xml);
|
||||||
|
|
||||||
XmlNodeList rootL = doc.GetElementsByTagName("ScriptState");
|
XmlNodeList rootL = doc.GetElementsByTagName("ScriptState");
|
||||||
if(rootL.Count != 1)
|
if (rootL.Count != 1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
XmlNode rootNode = rootL[0];
|
XmlNode rootNode = rootL[0];
|
||||||
|
|
||||||
if(rootNode != null)
|
if (rootNode != null)
|
||||||
{
|
{
|
||||||
object varValue;
|
object varValue;
|
||||||
XmlNodeList partL = rootNode.ChildNodes;
|
XmlNodeList partL = rootNode.ChildNodes;
|
||||||
|
|
||||||
foreach (XmlNode part in partL)
|
foreach (XmlNode part in partL)
|
||||||
{
|
{
|
||||||
switch(part.Name)
|
switch (part.Name)
|
||||||
{
|
{
|
||||||
case "State":
|
case "State":
|
||||||
instance.State=part.InnerText;
|
instance.State=part.InnerText;
|
||||||
|
@ -1268,7 +1268,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
string varName;
|
string varName;
|
||||||
varValue=ReadTypedValue(var, out varName);
|
varValue=ReadTypedValue(var, out varName);
|
||||||
|
|
||||||
if(vars.ContainsKey(varName))
|
if (vars.ContainsKey(varName))
|
||||||
vars[varName] = varValue;
|
vars[varName] = varValue;
|
||||||
}
|
}
|
||||||
instance.SetVars(vars);
|
instance.SetVars(vars);
|
||||||
|
@ -1286,7 +1286,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
XmlNodeList eventL = item.ChildNodes;
|
XmlNodeList eventL = item.ChildNodes;
|
||||||
foreach (XmlNode evt in eventL)
|
foreach (XmlNode evt in eventL)
|
||||||
{
|
{
|
||||||
switch(evt.Name)
|
switch (evt.Name)
|
||||||
{
|
{
|
||||||
case "Params":
|
case "Params":
|
||||||
XmlNodeList prms = evt.ChildNodes;
|
XmlNodeList prms = evt.ChildNodes;
|
||||||
|
@ -1342,7 +1342,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
List<Object> olist = new List<Object>();
|
List<Object> olist = new List<Object>();
|
||||||
|
|
||||||
XmlNodeList itemL = parent.ChildNodes;
|
XmlNodeList itemL = parent.ChildNodes;
|
||||||
foreach(XmlNode item in itemL)
|
foreach (XmlNode item in itemL)
|
||||||
olist.Add(ReadTypedValue(item));
|
olist.Add(ReadTypedValue(item));
|
||||||
|
|
||||||
return new LSL_Types.list(olist.ToArray());
|
return new LSL_Types.list(olist.ToArray());
|
||||||
|
@ -1355,14 +1355,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
XmlAttribute typ = doc.CreateAttribute("", "type", "");
|
XmlAttribute typ = doc.CreateAttribute("", "type", "");
|
||||||
XmlNode n = doc.CreateElement("", tag, "");
|
XmlNode n = doc.CreateElement("", tag, "");
|
||||||
|
|
||||||
if(value is LSL_Types.list)
|
if (value is LSL_Types.list)
|
||||||
{
|
{
|
||||||
typ.Value = "list";
|
typ.Value = "list";
|
||||||
n.Attributes.Append(typ);
|
n.Attributes.Append(typ);
|
||||||
|
|
||||||
DumpList(doc, n, (LSL_Types.list) value);
|
DumpList(doc, n, (LSL_Types.list) value);
|
||||||
|
|
||||||
if(name != String.Empty)
|
if (name != String.Empty)
|
||||||
{
|
{
|
||||||
XmlAttribute nam = doc.CreateAttribute("", "name", "");
|
XmlAttribute nam = doc.CreateAttribute("", "name", "");
|
||||||
nam.Value = name;
|
nam.Value = name;
|
||||||
|
@ -1377,7 +1377,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
typ.Value = t.ToString();
|
typ.Value = t.ToString();
|
||||||
n.Attributes.Append(typ);
|
n.Attributes.Append(typ);
|
||||||
if(name != String.Empty)
|
if (name != String.Empty)
|
||||||
{
|
{
|
||||||
XmlAttribute nam = doc.CreateAttribute("", "name", "");
|
XmlAttribute nam = doc.CreateAttribute("", "name", "");
|
||||||
nam.Value = name;
|
nam.Value = name;
|
||||||
|
@ -1401,10 +1401,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
string itemType = tag.Attributes.GetNamedItem("type").Value;
|
string itemType = tag.Attributes.GetNamedItem("type").Value;
|
||||||
|
|
||||||
if(itemType == "list")
|
if (itemType == "list")
|
||||||
return ReadList(tag);
|
return ReadList(tag);
|
||||||
|
|
||||||
if(itemType == "libsecondlife.LLUUID")
|
if (itemType == "libsecondlife.LLUUID")
|
||||||
{
|
{
|
||||||
LLUUID val = new LLUUID();
|
LLUUID val = new LLUUID();
|
||||||
LLUUID.TryParse(tag.InnerText, out val);
|
LLUUID.TryParse(tag.InnerText, out val);
|
||||||
|
@ -1413,19 +1413,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
Type itemT = Type.GetType(itemType);
|
Type itemT = Type.GetType(itemType);
|
||||||
if(itemT == null)
|
if (itemT == null)
|
||||||
{
|
{
|
||||||
Object[] args =
|
Object[] args =
|
||||||
new Object[] { tag.InnerText };
|
new Object[] { tag.InnerText };
|
||||||
|
|
||||||
assembly = itemType+", OpenSim.Region.ScriptEngine.XEngine.Script";
|
assembly = itemType+", OpenSim.Region.ScriptEngine.XEngine.Script";
|
||||||
itemT = Type.GetType(assembly);
|
itemT = Type.GetType(assembly);
|
||||||
if(itemT == null)
|
if (itemT == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
varValue = Activator.CreateInstance(itemT, args);
|
varValue = Activator.CreateInstance(itemT, args);
|
||||||
|
|
||||||
if(varValue == null)
|
if (varValue == null)
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue