Skip to content

Commit

Permalink
Some fixes for item usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikusch committed Feb 27, 2025
1 parent d365113 commit c91ef85
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ static int Update(CTFBotDeliverFlag action, int actor, float interval)
return action.Done("I'm no longer carrying the flag");
}

if (IsMannVsMachineMode())
{
// let the bomb carrier use it's buff banners/etc
NextBotAction result = CTFPlayer(actor).OpportunisticallyUseWeaponAbilities();
if (result)
{
return action.SuspendFor(result, "Opportunistically using buff item");
}
}

if (UpgradeOverTime(action, actor) && mitm_bot_taunt_on_upgrade.BoolValue)
{
return action.SuspendFor(CTFBotTaunt(), "Taunting for our new upgrade");
Expand Down
9 changes: 6 additions & 3 deletions addons/sourcemod/scripting/mitm/behavior/tf_bot_use_item.sp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,12 @@ static int Update(CTFBotUseItem action, CTFPlayer actor, float interval)
{
if (action.m_cooldownTimer.IsElapsed())
{
// use it
actor.PressFireButton();
action.m_cooldownTimer.Invalidate();
if (actor.GetPropFloat(Prop_Data, "m_flNextAttack") <= GetGameTime())
{
// use it
actor.PressFireButton();
action.m_cooldownTimer.Invalidate();
}
}
}
else // used
Expand Down

0 comments on commit c91ef85

Please sign in to comment.