public void LockTarget()
{
// If the bad idea is attacking, attack back
if (IsBadIdea && !IsAttacking)
{
Logging.Log("EntityCache: Attempting to target a player or concord entity! [" + Name + "]");
return;
}
if (Cache.Instance.TargetingIDs.ContainsKey(Id))
{
var lastTargeted = Cache.Instance.TargetingIDs[Id];
// Ignore targeting request
var seconds = DateTime.Now.Subtract(lastTargeted).TotalSeconds;
if (seconds < 45)
{
Logging.Log("EntityCache: LockTarget is ignored for [" + Name + "][" + Id + "], can retarget in [" + (45 - seconds) + "]");
return;
}
}
// Only add targeting id's when its actually being targeted
if (_directEntity != null && _directEntity.LockTarget())
Cache.Instance.TargetingIDs[Id] = DateTime.Now;
}