Mantis#1623. Thank you, Melanie for a patch that:
Fully defines the equality operators on the lsl types and plubs in the script engine side of the work begun in 0001616 (aly, this one's for you)0.6.0-stable
parent
c06dbf4fe5
commit
2f70baee52
|
@ -95,6 +95,12 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
set { _Source = value; }
|
||||
}
|
||||
|
||||
private int m_StartParam = 0;
|
||||
public int StartParam
|
||||
{
|
||||
get { return m_StartParam; }
|
||||
set { m_StartParam = value; }
|
||||
}
|
||||
|
||||
public BuiltIn_Commands_BaseClass()
|
||||
{
|
||||
|
@ -860,7 +866,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
|
||||
public LSL_Types.LSLInteger llGetStartParameter()
|
||||
{
|
||||
return m_LSL_Functions.llGetStartParameter();
|
||||
return m_StartParam;
|
||||
}
|
||||
|
||||
public void llGodLikeRezObject(string inventory, vector pos)
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
public interface IScript
|
||||
{
|
||||
string State { get; set; }
|
||||
int StartParam { get; set; }
|
||||
ExecutorBase Exec { get; }
|
||||
string Source { get; set; }
|
||||
void Start(BuilIn_Commands BuiltIn_Commands);
|
||||
|
|
|
@ -2343,8 +2343,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
|
||||
public LSL_Types.LSLInteger llGetStartParameter()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llGetStartParameter");
|
||||
// This is not handled here
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1293,6 +1293,18 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
return ret;
|
||||
}
|
||||
|
||||
public override bool Equals(Object o)
|
||||
{
|
||||
if(!(o is LSLInteger))
|
||||
return false;
|
||||
return value == ((LSLInteger)o).value;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
static public LSLInteger operator &(LSLInteger i1, LSLInteger i2)
|
||||
{
|
||||
int ret = i1.value & i2.value;
|
||||
|
@ -1438,6 +1450,19 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
return String.Format("{0:0.000000}", this.value);
|
||||
}
|
||||
|
||||
public override bool Equals(Object o)
|
||||
{
|
||||
if(!(o is LSLFloat))
|
||||
return false;
|
||||
return value == ((LSLFloat)o).value;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Convert.ToInt32(value);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
|||
{
|
||||
Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " +
|
||||
script.Length);
|
||||
myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script);
|
||||
myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script, startParam, postOnRez);
|
||||
}
|
||||
|
||||
public void OnRemoveScript(uint localID, LLUUID itemID)
|
||||
|
|
|
@ -72,6 +72,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
|||
public LLUUID itemID;
|
||||
public string script;
|
||||
public LUType Action;
|
||||
public int startParam;
|
||||
public bool postOnRez;
|
||||
}
|
||||
|
||||
private enum LUType
|
||||
|
@ -223,7 +225,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
|||
}
|
||||
else if (item.Action == LUType.Load)
|
||||
{
|
||||
_StartScript(item.localID, item.itemID, item.script);
|
||||
_StartScript(item.localID, item.itemID, item.script, item.startParam, item.postOnRez);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -252,7 +254,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
|||
/// </summary>
|
||||
/// <param name="itemID"></param>
|
||||
/// <param name="localID"></param>
|
||||
public void StartScript(uint localID, LLUUID itemID, string Script)
|
||||
public void StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez)
|
||||
{
|
||||
lock (LUQueue)
|
||||
{
|
||||
|
@ -267,6 +269,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
|||
ls.itemID = itemID;
|
||||
ls.script = Script;
|
||||
ls.Action = LUType.Load;
|
||||
ls.startParam = startParam;
|
||||
ls.postOnRez = postOnRez;
|
||||
LUQueue.Enqueue(ls);
|
||||
}
|
||||
}
|
||||
|
@ -282,6 +286,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
|||
ls.localID = localID;
|
||||
ls.itemID = itemID;
|
||||
ls.Action = LUType.Unload;
|
||||
ls.startParam = 0;
|
||||
ls.postOnRez = false;
|
||||
lock (LUQueue)
|
||||
{
|
||||
LUQueue.Enqueue(ls);
|
||||
|
@ -291,7 +297,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
|||
// Create a new instance of the compiler (reuse)
|
||||
//private Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler();
|
||||
|
||||
public abstract void _StartScript(uint localID, LLUUID itemID, string Script);
|
||||
public abstract void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez);
|
||||
public abstract void _StopScript(uint localID, LLUUID itemID);
|
||||
|
||||
|
||||
|
@ -423,9 +429,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
|||
|
||||
public void ResetScript(uint localID, LLUUID itemID)
|
||||
{
|
||||
string script = GetScript(localID, itemID).Source;
|
||||
IScript s = GetScript(localID, itemID);
|
||||
string script = s.Source;
|
||||
StopScript(localID, itemID);
|
||||
StartScript(localID, itemID, script);
|
||||
StartScript(localID, itemID, script, s.StartParam, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
// PROVIDE SCRIPT WITH ITS INTERFACE TO OpenSim
|
||||
|
||||
|
||||
public override void _StartScript(uint localID, LLUUID itemID, string Script)
|
||||
public override void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez)
|
||||
{
|
||||
m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID);
|
||||
|
||||
|
@ -114,6 +114,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
//#endif
|
||||
|
||||
CompiledScript.Source = Script;
|
||||
CompiledScript.StartParam = startParam;
|
||||
|
||||
// Add it to our script memstruct
|
||||
m_scriptEngine.m_ScriptManager.SetScript(localID, itemID, CompiledScript);
|
||||
|
||||
|
@ -130,6 +132,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
int eventFlags = m_scriptEngine.m_ScriptManager.GetStateEventFlags(localID, itemID);
|
||||
m_host.SetScriptEvents(itemID, eventFlags);
|
||||
m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", EventQueueManager.llDetectNull, new object[] { });
|
||||
if(postOnRez)
|
||||
{
|
||||
m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "on_rez", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(startParam) });
|
||||
}
|
||||
}
|
||||
catch (Exception e) // LEGIT: User Scripting
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue