cosmetics

This commit is contained in:
UbitUmarov
2021-11-20 02:46:07 +00:00
parent ca7b6e7deb
commit 1692254e3f
6 changed files with 113 additions and 127 deletions

View File

@@ -264,9 +264,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
ExecutionTime = new MetricsCollectorTime(MeasurementWindow, 10);
// m_log.DebugFormat(
// "[SCRIPT INSTANCE]: Instantiated script instance {0} (id {1}) in part {2} (id {3}) in object {4} attached avatar {5} in {6}",
// ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, m_AttachedAvatar, Engine.World.Name);
//m_log.DebugFormat(
// "[SCRIPT INSTANCE]: Instantiated script instance {0} (id {1}) in part {2} (id {3}) in object {4} attached avatar {5} in {6}",
// ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, m_AttachedAvatar, Engine.World.Name);
}
/// <summary>
@@ -351,8 +351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
LocalID, ItemID, ObjectID,
PluginData);
// m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName);
//m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName);
if (!Running)
m_startOnInit = false;
@@ -372,12 +371,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (!StatePersistedHere)
RemoveState();
}
// else
// {
// m_log.WarnFormat(
// "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. Unable to load script state file {6}. Memory limit exceeded.",
// ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState);
// }
//else
//{
// m_log.WarnFormat(
// "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. Unable to load script state file {6}. Memory limit exceeded.",
// ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState);
//}
}
catch (Exception e)
{
@@ -386,12 +385,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState, xml, e.Message, e.StackTrace);
}
}
// else
// {
// m_log.DebugFormat(
// "[SCRIPT INSTANCE]: Did not find state for script {0} for {1} ({2}) at {3} in {4}",
// ItemID, savedState, Part.Name, Part.ParentGroup.Name, Part.ParentGroup.Scene.Name);
// }
//else
//{
// m_log.DebugFormat(
// "[SCRIPT INSTANCE]: Did not find state for script {0} for {1} ({2}) at {3} in {4}",
// ItemID, savedState, Part.Name, Part.ParentGroup.Name, Part.ParentGroup.Scene.Name);
//}
try
{
Part.SetScriptEvents(ItemID, m_Script.GetStateEventFlags(State));
@@ -1126,8 +1125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (m_CurrentEvent != "state_entry" || oldState != "default")
{
m_SaveState = StatePersistedHere;
PostEvent(new EventParams("state_entry",
new Object[0], new DetectParams[0]));
PostEvent(EventParams.StateEntryParams);
throw new EventAbortException();
}
}

View File

@@ -225,7 +225,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
instance.State=part.InnerText;
break;
case "Running":
instance.Running=bool.Parse(part.InnerText);
instance.Running = bool.Parse(part.InnerText);
break;
case "Variables":
XmlNodeList varL = part.ChildNodes;

View File

@@ -1136,7 +1136,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
bool postOnRez = (bool)p[4];
StateSource stateSource = (StateSource)p[5];
// m_log.DebugFormat("[XEngine]: DoOnRezScript called for script {0}", itemID);
//m_log.DebugFormat("[XEngine]: DoOnRezScript called for script {0}", itemID);
lock (m_CompileDict)
{
@@ -1216,74 +1216,64 @@ namespace OpenSim.Region.ScriptEngine.XEngine
m_ScriptErrors[itemID] = new ArrayList();
m_ScriptErrors[itemID].Add(warning);
// try
// {
// // DISPLAY WARNING INWORLD
// string text = "Warning:\n" + warning;
// if (text.Length > 1000)
// text = text.Substring(0, 1000);
// if (!ShowScriptSaveResponse(item.OwnerID,
// assetID, text, true))
// {
// if (presence != null && (!postOnRez))
// presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false);
//
// World.SimChat(Utils.StringToBytes(text),
// ChatTypeEnum.DebugChannel, 2147483647,
// part.AbsolutePosition,
// part.Name, part.UUID, false);
// }
// }
// catch (Exception e2) // LEGIT: User Scripting
// {
// m_log.Error("[XEngine]: " +
// "Error displaying warning in-world: " +
// e2.ToString());
// m_log.Error("[XEngine]: " +
// "Warning:\r\n" +
// warning);
// }
//try
//{
// DISPLAY WARNING INWORLD
// string text = "Warning:\n" + warning;
// if (text.Length > 1000)
// text = text.Substring(0, 1000);
// if (!ShowScriptSaveResponse(item.OwnerID,assetID, text, true))
// {
// if (presence != null && (!postOnRez))
// presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false);
//
// World.SimChat(Utils.StringToBytes(text),
// ChatTypeEnum.DebugChannel, 2147483647,
// part.AbsolutePosition,
// part.Name, part.UUID, false);
// }
//}
//catch (Exception e2) // LEGIT: User Scripting
//{
// m_log.Error("[XEngine]: " + "Error displaying warning in-world: " + e2.ToString());
// m_log.Error("[XEngine]: " + "Warning:\r\n" + warning);
//}
}
}
}
catch (Exception e)
{
// m_log.ErrorFormat(
// "[XEngine]: Exception when rezzing script with item ID {0}, {1}{2}",
// itemID, e.Message, e.StackTrace);
//m_log.ErrorFormat(
// "[XEngine]: Exception when rezzing script with item ID {0}, {1}{2}",
// itemID, e.Message, e.StackTrace);
// try
// {
//try
//{
if (!m_ScriptErrors.ContainsKey(itemID))
m_ScriptErrors[itemID] = new ArrayList();
// DISPLAY ERROR INWORLD
// m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
//
//m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
m_ScriptFailCount++;
m_ScriptErrors[itemID].Add(e.Message.ToString());
// string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
// if (text.Length > 1000)
// text = text.Substring(0, 1000);
// if (!ShowScriptSaveResponse(item.OwnerID,
// assetID, text, false))
// {
// if (presence != null && (!postOnRez))
// presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
// World.SimChat(Utils.StringToBytes(text),
// ChatTypeEnum.DebugChannel, 2147483647,
// part.AbsolutePosition,
// part.Name, part.UUID, false);
// }
// }
// catch (Exception e2) // LEGIT: User Scripting
// {
// m_log.Error("[XEngine]: "+
// "Error displaying error in-world: " +
// e2.ToString());
// m_log.Error("[XEngine]: " +
// "Errormessage: Error compiling script:\r\n" +
// e.Message.ToString());
// }
//string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
//if (text.Length > 1000)
// text = text.Substring(0, 1000);
//if (!ShowScriptSaveResponse(item.OwnerID,assetID, text, false))
//{
// if (presence != null && (!postOnRez))
// presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
// World.SimChat(Utils.StringToBytes(text),
// ChatTypeEnum.DebugChannel, 2147483647,
// part.AbsolutePosition,
// part.Name, part.UUID, false);
// }
//}
//catch (Exception e2) // LEGIT: User Scripting
//{
// m_log.Error("[XEngine]: "+ "Error displaying error in-world: " + e2.ToString());
// m_log.Error("[XEngine]: " + "Errormessage: Error compiling script:\r\n" + e.Message.ToString());
//}
lock (m_CompileDict)
m_CompileDict.Remove(itemID);
@@ -1866,7 +1856,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
string path = Path.Combine(Directory.GetCurrentDirectory(),
Path.Combine(s, assemblyName))+".dll";
// Console.WriteLine("[XEngine]: Trying to resolve {0}", path);
//Console.WriteLine("[XEngine]: Trying to resolve {0}", path);
if (File.Exists(path))
return Assembly.LoadFrom(path);

View File

@@ -993,10 +993,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine
{
XMRInstance instance = GetInstance(itemID);
if(instance != null)
{
instance.Running = state;
if(instance.m_Item != null)
instance.m_Item.ScriptRunning = instance.Running;
}
}
// Control display of the "running" checkbox
//
public bool GetScriptState(UUID itemID)
{
@@ -1145,8 +1148,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
return false;
isX = true;
}
// <ScriptState>...</ScriptState> contains contents of .state file.
XmlElement scriptStateN = (XmlElement)stateN.SelectSingleNode("ScriptState");
// <ScriptState>...</ScriptState> contains contents of .state file.
XmlElement scriptStateN = (XmlElement)stateN.SelectSingleNode("ScriptState");
if(scriptStateN == null)
return false;

View File

@@ -370,9 +370,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
doGblInit = true;
stateCode = 0;
PostEvent(new EventParams("state_entry",
zeroObjectArray,
zeroDetectParams));
PostEvent(EventParams.StateEntryParams);
}
else
{
@@ -403,52 +401,47 @@ namespace OpenSim.Region.ScriptEngine.Yengine
doGblInit = true;
stateCode = 0;
PostEvent(new EventParams("state_entry",
zeroObjectArray,
zeroDetectParams));
PostEvent(EventParams.StateEntryParams);
}
}
// Post event(s) saying what caused the script to start.
if(m_PostOnRez)
//if(m_Running)
{
PostEvent(new EventParams("on_rez",
new Object[] { m_StartParam },
zeroDetectParams));
}
switch(m_StateSource)
{
case StateSource.AttachedRez:
PostEvent(new EventParams("attach",
new object[] { m_Part.ParentGroup.AttachedAvatar.ToString() },
if(m_PostOnRez)
{
PostEvent(new EventParams("on_rez",
new object[] { m_StartParam },
zeroDetectParams));
break;
}
case StateSource.PrimCrossing:
PostEvent(new EventParams("changed",
sbcCR,
zeroDetectParams));
break;
switch(m_StateSource)
{
case StateSource.AttachedRez:
PostEvent(new EventParams("attach",
new object[] { m_Part.ParentGroup.AttachedAvatar.ToString() },
zeroDetectParams));
break;
case StateSource.Teleporting:
PostEvent(new EventParams("changed",
sbcCRT,
zeroDetectParams));
break;
case StateSource.PrimCrossing:
PostEvent(changedEvent_CR);
break;
case StateSource.RegionStart:
PostEvent(new EventParams("changed",
sbcCRS,
zeroDetectParams));
break;
case StateSource.Teleporting:
PostEvent(changedEvent_CRT);
break;
case StateSource.RegionStart:
PostEvent(changedEvent_CRS);
break;
}
}
}
private static Object[] sbcCRS = new Object[] { ScriptBaseClass.CHANGED_REGION_START };
private static Object[] sbcCR = new Object[] { ScriptBaseClass.CHANGED_REGION };
private static Object[] sbcCT = new Object[] { ScriptBaseClass.CHANGED_TELEPORT };
private static Object[] sbcCRT = new Object[] { ScriptBaseClass.CHANGED_REGION | ScriptBaseClass.CHANGED_TELEPORT };
private static EventParams changedEvent_CR = new EventParams("changed", new object[] { CHANGED_REGION }, zeroDetectParams);
private static EventParams changedEvent_CT = new EventParams("changed", new object[] { CHANGED_TELEPORT }, zeroDetectParams);
private static EventParams changedEvent_CRT = new EventParams("changed", new object[] { CHANGED_REGION | CHANGED_TELEPORT }, zeroDetectParams);
private static EventParams changedEvent_CRS = new EventParams("changed", new object[] { CHANGED_REGION_START }, zeroDetectParams);
/**
* @brief Save compilation error messages for later retrieval

View File

@@ -426,14 +426,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine
CheckRunLockInvariants(true);
return XMRInstState.FINISHED;
}
// If event handler completed, get rid of detect params.
if(this.eventCode == ScriptEventCode.None)
m_DetectParams = null;
}
finally
{
// If event handler completed, get rid of detect params.
if (eventCode == ScriptEventCode.None)
m_DetectParams = null;
//m_RunOnePhase += "; checking exit invariants and unlocking";
CheckRunLockInvariants(false);
Monitor.Exit(m_RunLock);
@@ -910,9 +909,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
stateCode = 0;
m_Part.RemoveScriptTargets(m_ItemID);
m_Part.SetScriptEvents(m_ItemID, GetStateEventFlags(0));
PostEvent(new EventParams("state_entry",
zeroObjectArray,
zeroDetectParams));
PostEvent(EventParams.StateEntryParams);
// Tell CheckRun() to let script run.
suspendOnCheckRunHold = false;
@@ -993,7 +990,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
break;
default:
{
throw new Exception("callMode=" + callMode);
}
}
//m_CheckRunPhase = "resumed";
@@ -1004,7 +1003,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
// Upon return from CheckRun() it should always be the case that the script is
// going to process calls normally, neither saving nor restoring stack frame state.
if(callMode != CallMode_NORMAL)
{
throw new Exception("bad callMode " + callMode);
}
}
/**