Consistently give responsibility for thread sleeping to behaviours rather than controlling from the main action loop

This is to avoid excessive and inconsistent delays between behaviours that currently need to embed sleeps in other actions (e.g. physics) and other behaviours.
Might need a more sophisticated approach in the long term.
0.7.6-extended
Justin Clark-Casey (justincc) 2013-09-03 19:41:12 +01:00
parent cfef2b19bb
commit cfdb2700bc
3 changed files with 7 additions and 1 deletions

View File

@ -29,6 +29,7 @@ using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using pCampBot.Interfaces;
namespace pCampBot
@ -60,6 +61,8 @@ namespace pCampBot
Bot.Client.Self.Grab(prim.LocalID);
Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero);
Bot.Client.Self.DeGrab(prim.LocalID);
Thread.Sleep(1000);
}
}
}

View File

@ -29,6 +29,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading;
using log4net;
using OpenMetaverse;
using pCampBot.Interfaces;
@ -74,6 +75,8 @@ namespace pCampBot
Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition);
Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition);
Thread.Sleep(Bot.Random.Next(3000, 10000));
}
}
}

View File

@ -282,7 +282,7 @@ namespace pCampBot
{
foreach (IBehaviour behaviour in Behaviours.Values)
{
Thread.Sleep(Random.Next(3000, 10000));
// Thread.Sleep(Random.Next(3000, 10000));
// m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType());
behaviour.Action();