Yengine: let llminEventDelay do something: it just ignores a more limited set of events than Xengine (neither do as SL)

0.9.1.0-post-fixes
UbitUmarov 2019-02-20 20:12:13 +00:00
parent ac651a168a
commit 72c472f988
6 changed files with 62 additions and 17 deletions

View File

@ -88,10 +88,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
path_update = 40, path_update = 40,
// XMRE specific
region_cross = 63,
// marks highest numbered event, ie, number of columns in seht. // marks highest numbered event, ie, number of columns in seht.
Size = 64 Size = 41
} }
} }

View File

@ -930,6 +930,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
public void SetMinEventDelay(UUID itemID, double delay) public void SetMinEventDelay(UUID itemID, double delay)
{ {
XMRInstance instance = GetInstance(itemID);
if (instance != null)
instance.MinEventDelay = delay;
} }
public int GetStartParameter(UUID itemID) public int GetStartParameter(UUID itemID)

View File

@ -422,9 +422,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
object[] saveEHArgs = this.ehArgs; object[] saveEHArgs = this.ehArgs;
ScriptEventCode saveEventCode = this.eventCode; ScriptEventCode saveEventCode = this.eventCode;
this.m_DetectParams = evt.DetectParams; m_DetectParams = evt.DetectParams;
this.ehArgs = evt.Params; ehArgs = evt.Params;
this.eventCode = evc; eventCode = evc;
try try
{ {
@ -432,9 +432,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
} }
finally finally
{ {
this.m_DetectParams = saveDetParams; m_DetectParams = saveDetParams;
this.ehArgs = saveEHArgs; ehArgs = saveEHArgs;
this.eventCode = saveEventCode; eventCode = saveEventCode;
} }
// Keep waiting until we find a returnable event or timeout. // Keep waiting until we find a returnable event or timeout.

View File

@ -215,5 +215,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
// It's born ready, but will be reset when the detach is posted. // It's born ready, but will be reset when the detach is posted.
// It will then be set again on suspend/completion // It will then be set again on suspend/completion
private ManualResetEvent m_DetachReady = new ManualResetEvent(true); private ManualResetEvent m_DetachReady = new ManualResetEvent(true);
// llmineventdelay support
double m_minEventDelay = 0.0;
double m_nextEventTime = 0.0;
} }
} }

View File

@ -298,6 +298,24 @@ namespace OpenSim.Region.ScriptEngine.Yengine
} }
} }
public double MinEventDelay
{
get
{
return m_minEventDelay;
}
set
{
if (value > 0.001)
m_minEventDelay = value;
else
m_minEventDelay = 0.0;
m_nextEventTime = 0.0; // reset it
}
}
public SceneObjectPart SceneObject public SceneObjectPart SceneObject
{ {
get get

View File

@ -63,8 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
*/ */
public void PostEvent(EventParams evt) public void PostEvent(EventParams evt)
{ {
ScriptEventCode evc = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode), ScriptEventCode evc = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode), evt.EventName);
evt.EventName);
// Put event on end of event queue. // Put event on end of event queue.
bool startIt = false; bool startIt = false;
@ -86,6 +85,32 @@ namespace OpenSim.Region.ScriptEngine.Yengine
if(!m_Running && !construct) if(!m_Running && !construct)
return; return;
if(m_minEventDelay != 0)
{
switch (evc)
{
// ignore some events by time set by llMinEventDelay
case ScriptEventCode.collision:
case ScriptEventCode.land_collision:
case ScriptEventCode.listen:
case ScriptEventCode.not_at_target:
case ScriptEventCode.not_at_rot_target:
case ScriptEventCode.no_sensor:
case ScriptEventCode.sensor:
case ScriptEventCode.timer:
case ScriptEventCode.touch:
{
double now = Util.GetTimeStamp();
if (now < m_nextEventTime)
return;
m_nextEventTime = now + m_minEventDelay;
break;
}
default:
break;
}
}
// Only so many of each event type allowed to queue. // Only so many of each event type allowed to queue.
if((uint)evc < (uint)m_EventCounts.Length) if((uint)evc < (uint)m_EventCounts.Length)
{ {
@ -124,10 +149,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine
for(lln2 = m_EventQueue.First; lln2 != null; lln2 = lln2.Next) for(lln2 = m_EventQueue.First; lln2 != null; lln2 = lln2.Next)
{ {
EventParams evt2 = lln2.Value; EventParams evt2 = lln2.Value;
ScriptEventCode evc2 = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode), ScriptEventCode evc2 = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode), evt2.EventName);
evt2.EventName); if((evc2 != ScriptEventCode.state_entry) && (evc2 != ScriptEventCode.attach))
if((evc2 != ScriptEventCode.state_entry) &&
(evc2 != ScriptEventCode.attach))
break; break;
} }
if(lln2 == null) if(lln2 == null)