public void OnHeartbeat()
{
if (HasCombatRoundProcess == true &&
UsingEndCombatRound == true)
{
// We're in a fight, but End Combat Round is firing, so we don't want to do anything here. Overloading
// with commands is what causes the stutter walk.
return;
}
if (HasCombatRoundProcess == true &&
UsingEndCombatRound == false)
{
// In this state, we've decided that the creature would like to start a fight, but combat rounds
// haven't started yet. We'll start the fight, and update once the creature gets there.
SelectCombatRoundAction(false);
return;
}
if (HasCombatRoundProcess == false &&
UsingEndCombatRound == false)
{
// We're not in a fight, but maybe our pals need healing.
if (CleanUpNeeded)
{
if (!TryToHealAll())
CleanUpNeeded = false;
}
// We're not in a fight, but maybe our leader is.
if (this.Party.PartyLeader != null)
{
if (this.Party.PartyLeader.HasCombatRoundProcess)
{
// And nearby-- we should go find him.
if (this.Area == Party.PartyLeader.Area)
Script.ActionMoveToObject(Party.PartyLeader.ObjectId, CLRScriptBase.TRUE, 1.0f);
// Seems Glorious Leader isn't nearby. Bordering area, maybe?
else
{
if (Area.AreaTransitions.Count > 0)
{
foreach (AreaObject.AreaTransition Transition in Area.AreaTransitions)
{
if (Transition.TargetArea == PartyLeader.Area)
{
Script.ActionInteractObject(Transition.ObjectId);
}
}
}
}
}
}
// Guess no one we know is in trouble. Carry on.
else _AmbientBehavior();
}
}