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,
// XMRE specific
region_cross = 63,
// marks highest numbered event, ie, number of columns in seht.
Size = 64
Size = 41
}
}

View File

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

View File

@ -422,9 +422,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
object[] saveEHArgs = this.ehArgs;
ScriptEventCode saveEventCode = this.eventCode;
this.m_DetectParams = evt.DetectParams;
this.ehArgs = evt.Params;
this.eventCode = evc;
m_DetectParams = evt.DetectParams;
ehArgs = evt.Params;
eventCode = evc;
try
{
@ -432,9 +432,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
}
finally
{
this.m_DetectParams = saveDetParams;
this.ehArgs = saveEHArgs;
this.eventCode = saveEventCode;
m_DetectParams = saveDetParams;
ehArgs = saveEHArgs;
eventCode = saveEventCode;
}
// 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 will then be set again on suspend/completion
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
{
get

View File

@ -63,8 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
*/
public void PostEvent(EventParams evt)
{
ScriptEventCode evc = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode),
evt.EventName);
ScriptEventCode evc = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode), evt.EventName);
// Put event on end of event queue.
bool startIt = false;
@ -86,6 +85,32 @@ namespace OpenSim.Region.ScriptEngine.Yengine
if(!m_Running && !construct)
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.
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)
{
EventParams evt2 = lln2.Value;
ScriptEventCode evc2 = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode),
evt2.EventName);
if((evc2 != ScriptEventCode.state_entry) &&
(evc2 != ScriptEventCode.attach))
ScriptEventCode evc2 = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode), evt2.EventName);
if((evc2 != ScriptEventCode.state_entry) && (evc2 != ScriptEventCode.attach))
break;
}
if(lln2 == null)