Patch for mantis#1493: Several patches to xengine. Thanks Melanie!
parent
2b83aa931c
commit
990225a4ba
|
@ -257,7 +257,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
// FilePrefix + "_compiled_" + asset + ".dll");
|
// FilePrefix + "_compiled_" + asset + ".dll");
|
||||||
|
|
||||||
if (File.Exists(OutFile))
|
if (File.Exists(OutFile))
|
||||||
|
{
|
||||||
|
m_scriptEngine.Log.DebugFormat("[XEngine] Returning existing assembly for {0}", asset);
|
||||||
return OutFile;
|
return OutFile;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Directory.Exists(ScriptEnginesPath))
|
if (!Directory.Exists(ScriptEnginesPath))
|
||||||
{
|
{
|
||||||
|
@ -422,9 +425,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
string srcFileName = FilePrefix + "_source_" + Path.GetFileNameWithoutExtension(OutFile) + ext;
|
string srcFileName = FilePrefix + "_source_" + Path.GetFileNameWithoutExtension(OutFile) + ext;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.WriteAllText(
|
File.WriteAllText(Path.Combine(Path.Combine(
|
||||||
Path.Combine("ScriptEngines", srcFileName),
|
ScriptEnginesPath,
|
||||||
Script);
|
m_scriptEngine.World.RegionInfo.RegionID.ToString()),
|
||||||
|
srcFileName), Script);
|
||||||
}
|
}
|
||||||
catch (Exception ex) // NOTLEGIT - Should be just catching FileIOException
|
catch (Exception ex) // NOTLEGIT - Should be just catching FileIOException
|
||||||
{
|
{
|
||||||
|
@ -504,6 +508,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
errtext += "No compile error. But not able to locate compiled file.";
|
errtext += "No compile error. But not able to locate compiled file.";
|
||||||
throw new Exception(errtext);
|
throw new Exception(errtext);
|
||||||
}
|
}
|
||||||
|
m_scriptEngine.Log.DebugFormat("[XEngine] Compiled new assembly for {0}", asset);
|
||||||
return OutFile;
|
return OutFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,10 @@ using System.Collections.Generic;
|
||||||
using System.Runtime.Remoting.Lifetime;
|
using System.Runtime.Remoting.Lifetime;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Nini.Config;
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using OpenSim;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment;
|
using OpenSim.Region.Environment;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
|
@ -973,6 +975,78 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction,
|
||||||
|
float wind, float tension, LSL_Types.Vector3 Force)
|
||||||
|
{
|
||||||
|
if (part == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool needs_fakedelete = false;
|
||||||
|
if (flexi)
|
||||||
|
{
|
||||||
|
if (!part.Shape.FlexiEntry)
|
||||||
|
{
|
||||||
|
needs_fakedelete = true;
|
||||||
|
}
|
||||||
|
part.Shape.FlexiEntry = true; // this setting flexi true isn't working, but the below parameters do
|
||||||
|
// work once the prim is already flexi
|
||||||
|
part.Shape.FlexiSoftness = softness;
|
||||||
|
part.Shape.FlexiGravity = gravity;
|
||||||
|
part.Shape.FlexiDrag = friction;
|
||||||
|
part.Shape.FlexiWind = wind;
|
||||||
|
part.Shape.FlexiTension = tension;
|
||||||
|
part.Shape.FlexiForceX = (float)Force.x;
|
||||||
|
part.Shape.FlexiForceY = (float)Force.y;
|
||||||
|
part.Shape.FlexiForceZ = (float)Force.z;
|
||||||
|
part.Shape.PathCurve = 0x80;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (part.Shape.FlexiEntry)
|
||||||
|
{
|
||||||
|
needs_fakedelete = true;
|
||||||
|
}
|
||||||
|
part.Shape.FlexiEntry = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
needs_fakedelete = false;
|
||||||
|
if (needs_fakedelete)
|
||||||
|
{
|
||||||
|
if (part.ParentGroup != null)
|
||||||
|
{
|
||||||
|
part.ParentGroup.FakeDeleteGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
part.ScheduleFullUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetPointLight(SceneObjectPart part, bool light, LSL_Types.Vector3 color, float intensity, float radius, float falloff)
|
||||||
|
{
|
||||||
|
if (part == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (light)
|
||||||
|
{
|
||||||
|
part.Shape.LightEntry = true;
|
||||||
|
part.Shape.LightColorR = (float)color.x;
|
||||||
|
part.Shape.LightColorG = (float)color.y;
|
||||||
|
part.Shape.LightColorB = (float)color.z;
|
||||||
|
part.Shape.LightIntensity = intensity;
|
||||||
|
part.Shape.LightRadius = radius;
|
||||||
|
part.Shape.LightFalloff = falloff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
part.Shape.LightEntry = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
part.ScheduleFullUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public LSL_Types.Vector3 llGetColor(int face)
|
public LSL_Types.Vector3 llGetColor(int face)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -4516,7 +4590,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
SetPos(part, v);
|
SetPos(part, v);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case 7: // PRIM_SIZE
|
||||||
|
if (remain < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
v=new LSL_Types.Vector3(rules.Data[idx++].ToString());
|
||||||
|
SetScale(part, v);
|
||||||
|
|
||||||
|
break;
|
||||||
case 8: // PRIM_ROTATION
|
case 8: // PRIM_ROTATION
|
||||||
if (remain < 1)
|
if (remain < 1)
|
||||||
return;
|
return;
|
||||||
|
@ -4555,13 +4636,31 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
SetAlpha(part, alpha, face);
|
SetAlpha(part, alpha, face);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case 21: // PRIM_FLEXI
|
||||||
case 7: // PRIM_SIZE
|
if (remain < 7)
|
||||||
if (remain < 1)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
v=new LSL_Types.Vector3(rules.Data[idx++].ToString());
|
int flexi = Convert.ToInt32(rules.Data[idx++]);
|
||||||
SetScale(part, v);
|
int softness = Convert.ToInt32(rules.Data[idx++]);
|
||||||
|
float gravity = (float)Convert.ToDouble(rules.Data[idx++]);
|
||||||
|
float friction = (float)Convert.ToDouble(rules.Data[idx++]);
|
||||||
|
float wind = (float)Convert.ToDouble(rules.Data[idx++]);
|
||||||
|
float tension = (float)Convert.ToDouble(rules.Data[idx++]);
|
||||||
|
LSL_Types.Vector3 force =new LSL_Types.Vector3(rules.Data[idx++].ToString());
|
||||||
|
|
||||||
|
SetFlexi(part, (flexi == 1), softness, gravity, friction, wind, tension, force);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 23: // PRIM_POINT_LIGHT
|
||||||
|
if (remain < 5)
|
||||||
|
return;
|
||||||
|
int light = Convert.ToInt32(rules.Data[idx++]);
|
||||||
|
LSL_Types.Vector3 lightcolor =new LSL_Types.Vector3(rules.Data[idx++].ToString());
|
||||||
|
float intensity = (float)Convert.ToDouble(rules.Data[idx++]);
|
||||||
|
float radius = (float)Convert.ToDouble(rules.Data[idx++]);
|
||||||
|
float falloff = (float)Convert.ToDouble(rules.Data[idx++]);
|
||||||
|
|
||||||
|
SetPointLight(part, (light == 1), lightcolor, intensity, radius, falloff);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -5466,30 +5565,39 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
public void llSetObjectPermMask(int mask, int value)
|
public void llSetObjectPermMask(int mask, int value)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
IConfigSource config = new IniConfigSource(Application.iniFilePath);
|
||||||
|
if (config.Configs["XEngine"] == null)
|
||||||
|
config.AddConfig("XEngine");
|
||||||
|
|
||||||
if (mask == BuiltIn_Commands_BaseClass.MASK_BASE)//0
|
if (config.Configs["XEngine"].GetBoolean("AllowGodFunctions", false))
|
||||||
{
|
{
|
||||||
m_host.BaseMask = (uint)value;
|
if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID))
|
||||||
}
|
{
|
||||||
|
if (mask == BuiltIn_Commands_BaseClass.MASK_BASE)//0
|
||||||
|
{
|
||||||
|
m_host.BaseMask = (uint)value;
|
||||||
|
}
|
||||||
|
|
||||||
else if (mask == BuiltIn_Commands_BaseClass.MASK_OWNER)//1
|
else if (mask == BuiltIn_Commands_BaseClass.MASK_OWNER)//1
|
||||||
{
|
{
|
||||||
m_host.OwnerMask = (uint)value;
|
m_host.OwnerMask = (uint)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (mask == BuiltIn_Commands_BaseClass.MASK_GROUP)//2
|
else if (mask == BuiltIn_Commands_BaseClass.MASK_GROUP)//2
|
||||||
{
|
{
|
||||||
m_host.GroupMask = (uint)value;
|
m_host.GroupMask = (uint)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (mask == BuiltIn_Commands_BaseClass.MASK_EVERYONE)//3
|
else if (mask == BuiltIn_Commands_BaseClass.MASK_EVERYONE)//3
|
||||||
{
|
{
|
||||||
m_host.EveryoneMask = (uint)value;
|
m_host.EveryoneMask = (uint)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (mask == BuiltIn_Commands_BaseClass.MASK_NEXT)//4
|
else if (mask == BuiltIn_Commands_BaseClass.MASK_NEXT)//4
|
||||||
{
|
{
|
||||||
m_host.NextOwnerMask = (uint)value;
|
m_host.NextOwnerMask = (uint)value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -425,6 +425,30 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
|
||||||
return new list(tmp);
|
return new list(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ExtendAndAdd(object o)
|
||||||
|
{
|
||||||
|
Array.Resize(ref m_data, Length + 1);
|
||||||
|
m_data.SetValue(o, Length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static list operator +(list a, string s)
|
||||||
|
{
|
||||||
|
a.ExtendAndAdd(s);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static list operator +(list a, int i)
|
||||||
|
{
|
||||||
|
a.ExtendAndAdd(i);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static list operator +(list a, double d)
|
||||||
|
{
|
||||||
|
a.ExtendAndAdd(d);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
public void Add(object o)
|
public void Add(object o)
|
||||||
{
|
{
|
||||||
object[] tmp;
|
object[] tmp;
|
||||||
|
@ -1321,6 +1345,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
|
||||||
return (double)i.value;
|
return (double)i.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public implicit operator LSLFloat(LSLInteger i)
|
||||||
|
{
|
||||||
|
return new LSLFloat((double)i.value);
|
||||||
|
}
|
||||||
|
|
||||||
public static bool operator true(LSLInteger i)
|
public static bool operator true(LSLInteger i)
|
||||||
{
|
{
|
||||||
return i.value != 0;
|
return i.value != 0;
|
||||||
|
@ -1370,12 +1399,28 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
|
||||||
|
|
||||||
public LSLFloat(int i)
|
public LSLFloat(int i)
|
||||||
{
|
{
|
||||||
this.value = (double)i;
|
value = (double)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSLFloat(double d)
|
public LSLFloat(double d)
|
||||||
{
|
{
|
||||||
this.value = d;
|
value = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LSLFloat(string s)
|
||||||
|
{
|
||||||
|
value = double.Parse(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LSLFloat(Object o)
|
||||||
|
{
|
||||||
|
if(!((o is double) || (o is float)))
|
||||||
|
{
|
||||||
|
value = 0.0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = (double)o;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1446,10 +1491,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
|
||||||
return f.value;
|
return f.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
//static public implicit operator System.Int32(LSLFloat f)
|
static public explicit operator LSLString(LSLFloat f)
|
||||||
//{
|
{
|
||||||
// return (int)f.value;
|
string v = String.Format("{0:0.000000}", f.value);
|
||||||
//}
|
return new LSLString(v);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -314,8 +314,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
{
|
{
|
||||||
assembly = m_Compiler.PerformScriptCompile(script,
|
assembly = m_Compiler.PerformScriptCompile(script,
|
||||||
assetID.ToString());
|
assetID.ToString());
|
||||||
m_log.DebugFormat("[XEngine] Loaded script {0}.{1}",
|
|
||||||
part.ParentGroup.RootPart.Name, item.Name);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -387,8 +385,13 @@ 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],
|
||||||
|
part.ParentGroup.RootPart.Name,
|
||||||
|
item.Name);
|
||||||
|
|
||||||
|
m_log.DebugFormat("[XEngine] Loaded script {0}.{1}",
|
||||||
|
part.ParentGroup.RootPart.Name, item.Name);
|
||||||
|
|
||||||
instance.AppDomain = appDomain;
|
instance.AppDomain = appDomain;
|
||||||
|
|
||||||
|
@ -450,6 +453,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
UnloadAppDomain(instance.AppDomain);
|
UnloadAppDomain(instance.AppDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance.RemoveState();
|
||||||
|
|
||||||
instance = null;
|
instance = null;
|
||||||
|
|
||||||
CleanAssemblies();
|
CleanAssemblies();
|
||||||
|
@ -706,6 +711,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
private bool m_TimerQueued;
|
private bool m_TimerQueued;
|
||||||
private DateTime m_EventStart;
|
private DateTime m_EventStart;
|
||||||
private bool m_InEvent;
|
private bool m_InEvent;
|
||||||
|
private string m_PrimName;
|
||||||
|
private string m_ScriptName;
|
||||||
|
private string m_Assembly;
|
||||||
|
|
||||||
// Script state
|
// Script state
|
||||||
private string m_State="default";
|
private string m_State="default";
|
||||||
|
@ -715,6 +723,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
public bool Running
|
public bool Running
|
||||||
{
|
{
|
||||||
get { return m_RunEvents; }
|
get { return m_RunEvents; }
|
||||||
|
set { m_RunEvents = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string State
|
public string State
|
||||||
|
@ -734,6 +743,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
set { m_AppDomain = value; }
|
set { m_AppDomain = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string PrimName
|
||||||
|
{
|
||||||
|
get { return m_PrimName; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ScriptName
|
||||||
|
{
|
||||||
|
get { return m_ScriptName; }
|
||||||
|
}
|
||||||
|
|
||||||
public LLUUID ItemID
|
public LLUUID ItemID
|
||||||
{
|
{
|
||||||
get { return m_ItemID; }
|
get { return m_ItemID; }
|
||||||
|
@ -766,7 +785,8 @@ 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,
|
||||||
|
string primName, string scriptName)
|
||||||
{
|
{
|
||||||
m_Engine = engine;
|
m_Engine = engine;
|
||||||
|
|
||||||
|
@ -774,6 +794,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_ObjectID = objectID;
|
m_ObjectID = objectID;
|
||||||
m_ItemID = itemID;
|
m_ItemID = itemID;
|
||||||
m_AssetID = assetID;
|
m_AssetID = assetID;
|
||||||
|
m_PrimName = primName;
|
||||||
|
m_ScriptName = scriptName;
|
||||||
|
m_Assembly = assembly;
|
||||||
|
|
||||||
SceneObjectPart part=engine.World.GetSceneObjectPart(localID);
|
SceneObjectPart part=engine.World.GetSceneObjectPart(localID);
|
||||||
if (part == null)
|
if (part == null)
|
||||||
|
@ -811,10 +834,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_Engine.Log.Error("Error loading script instance\n"+e.ToString());
|
m_Engine.Log.Error("[XEngine] Error loading script instance\n"+e.ToString());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string savedState = assembly + ".state";
|
string savedState = Path.Combine(Path.GetDirectoryName(assembly),
|
||||||
|
m_ItemID.ToString() + ".state");
|
||||||
if (File.Exists(savedState))
|
if (File.Exists(savedState))
|
||||||
{
|
{
|
||||||
string xml = String.Empty;
|
string xml = String.Empty;
|
||||||
|
@ -841,28 +866,53 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_Engine.m_ASYNCLSLCommandManager.CreateFromData(
|
m_Engine.m_ASYNCLSLCommandManager.CreateFromData(
|
||||||
m_LocalID, m_ItemID, m_ObjectID,
|
m_LocalID, m_ItemID, m_ObjectID,
|
||||||
PluginData);
|
PluginData);
|
||||||
|
|
||||||
|
m_Engine.Log.DebugFormat("[XEngine] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName);
|
||||||
|
|
||||||
|
if(m_RunEvents)
|
||||||
|
{
|
||||||
|
m_RunEvents = false;
|
||||||
|
Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Engine.Log.Error("Unable to load script state: Memory limit exceeded");
|
m_Engine.Log.Error("[XEngine] Unable to load script state: Memory limit exceeded");
|
||||||
PostEvent(new XEventParams("state_entry",
|
PostEvent(new XEventParams("state_entry",
|
||||||
new Object[0], new XDetectParams[0]));
|
new Object[0], new XDetectParams[0]));
|
||||||
|
Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_Engine.Log.ErrorFormat("Unable to load script state from xml: {0}\n"+e.ToString(), xml);
|
m_Engine.Log.ErrorFormat("[XEngine] Unable to load script state from xml: {0}\n"+e.ToString(), xml);
|
||||||
PostEvent(new XEventParams("state_entry",
|
PostEvent(new XEventParams("state_entry",
|
||||||
new Object[0], new XDetectParams[0]));
|
new Object[0], new XDetectParams[0]));
|
||||||
|
Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_Engine.Log.ErrorFormat("[XEngine] Unable to load script state, file not found");
|
||||||
PostEvent(new XEventParams("state_entry",
|
PostEvent(new XEventParams("state_entry",
|
||||||
new Object[0], new XDetectParams[0]));
|
new Object[0], new XDetectParams[0]));
|
||||||
|
Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveState()
|
||||||
|
{
|
||||||
|
string savedState = Path.Combine(Path.GetDirectoryName(m_Assembly),
|
||||||
|
m_ItemID.ToString() + ".state");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Delete(savedState);
|
||||||
|
}
|
||||||
|
catch(Exception)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void VarDump(Dictionary<string, object> vars)
|
public void VarDump(Dictionary<string, object> vars)
|
||||||
|
@ -935,16 +985,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
result.Abort();
|
result.Abort();
|
||||||
|
|
||||||
if (SmartThreadPool.WaitAll(new IWorkItemResult[] {result}, new TimeSpan((long)10000000), false))
|
lock (m_EventQueue)
|
||||||
{
|
{
|
||||||
lock (m_EventQueue)
|
m_CurrentResult = null;
|
||||||
{
|
|
||||||
m_CurrentResult = null;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Engine.Log.Error("[XEngine] Failed to reliably stop script");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -960,6 +1005,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
public void PostEvent(XEventParams data)
|
public void PostEvent(XEventParams data)
|
||||||
{
|
{
|
||||||
|
// m_Engine.Log.DebugFormat("[XEngine] Posted event {2} in state {3} to {0}.{1}",
|
||||||
|
// m_PrimName, m_ScriptName, data.EventName, m_State);
|
||||||
lock (m_EventQueue)
|
lock (m_EventQueue)
|
||||||
{
|
{
|
||||||
if (m_EventQueue.Count >= m_Engine.MaxScriptQueue)
|
if (m_EventQueue.Count >= m_Engine.MaxScriptQueue)
|
||||||
|
@ -1003,6 +1050,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
if (data.EventName == "state") // Hardcoded state change
|
if (data.EventName == "state") // Hardcoded state change
|
||||||
{
|
{
|
||||||
|
// m_Engine.Log.DebugFormat("[XEngine] Script {0}.{1} state set to {2}",
|
||||||
|
// m_PrimName, m_ScriptName, data.Params[0].ToString());
|
||||||
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);
|
||||||
|
@ -1020,6 +1069,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
// 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);
|
||||||
|
// m_Engine.Log.DebugFormat("[XEngine] Delivered event {2} in state {3} to {0}.{1}",
|
||||||
|
// m_PrimName, m_ScriptName, data.EventName, m_State);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_EventStart = DateTime.Now;
|
m_EventStart = DateTime.Now;
|
||||||
|
@ -1148,14 +1200,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileStream fs = File.Create(assembly + ".state");
|
FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".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 e)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Unable to save xml\n"+e.ToString());
|
||||||
|
}
|
||||||
|
if(!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state")))
|
||||||
|
{
|
||||||
|
throw new Exception("Completed persistence save, but no file was created");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1181,6 +1238,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
rootElement.AppendChild(state);
|
rootElement.AppendChild(state);
|
||||||
|
|
||||||
|
XmlElement running = xmldoc.CreateElement("", "Running", "");
|
||||||
|
running.AppendChild(xmldoc.CreateTextNode(
|
||||||
|
instance.Running.ToString()));
|
||||||
|
|
||||||
|
rootElement.AppendChild(running);
|
||||||
|
|
||||||
Dictionary<string, Object> vars = instance.GetVars();
|
Dictionary<string, Object> vars = instance.GetVars();
|
||||||
|
|
||||||
XmlElement variables = xmldoc.CreateElement("", "Variables", "");
|
XmlElement variables = xmldoc.CreateElement("", "Variables", "");
|
||||||
|
@ -1277,6 +1340,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
case "State":
|
case "State":
|
||||||
instance.State=part.InnerText;
|
instance.State=part.InnerText;
|
||||||
break;
|
break;
|
||||||
|
case "Running":
|
||||||
|
instance.Running=bool.Parse(part.InnerText);
|
||||||
|
break;
|
||||||
case "Variables":
|
case "Variables":
|
||||||
XmlNodeList varL = part.ChildNodes;
|
XmlNodeList varL = part.ChildNodes;
|
||||||
foreach (XmlNode var in varL)
|
foreach (XmlNode var in varL)
|
||||||
|
|
|
@ -1668,6 +1668,7 @@
|
||||||
<Reference name="System.Runtime.Remoting" localCopy="false"/>
|
<Reference name="System.Runtime.Remoting" localCopy="false"/>
|
||||||
<Reference name="libsecondlife.dll"/>
|
<Reference name="libsecondlife.dll"/>
|
||||||
<Reference name="RAIL.dll"/>
|
<Reference name="RAIL.dll"/>
|
||||||
|
<Reference name="OpenSim"/>
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="OpenSim.Framework.Communications"/>
|
<Reference name="OpenSim.Framework.Communications"/>
|
||||||
|
|
Loading…
Reference in New Issue