This commit is contained in:
aozhiwei 2023-06-21 19:44:00 +08:00
parent 6efcec599a
commit 36cc1e758d

View File

@ -315,8 +315,6 @@ behaviac::EBTStatus BaseAgent::DoIdle(int min_time, int max_time)
auto context = MAKE_BTCONTEXT auto context = MAKE_BTCONTEXT
( (
a8::XTimerWp timer_ptr; a8::XTimerWp timer_ptr;
CreatureWeakPtr last_attacker;
long long last_attacked_frameno = 0;
); );
context->timer_ptr = GetOwner()->room->xtimer.SetTimeoutWpEx context->timer_ptr = GetOwner()->room->xtimer.SetTimeoutWpEx
( (
@ -333,8 +331,20 @@ behaviac::EBTStatus BaseAgent::DoIdle(int min_time, int max_time)
if (!context_wp.expired()) { if (!context_wp.expired()) {
auto context = context_wp.lock(); auto context = context_wp.lock();
Creature* c = args.Get<Creature*>(0); Creature* c = args.Get<Creature*>(0);
context->last_attacker = c->GetWeakPtrRef(); context->events.push_back
context->last_attacked_frameno = c->room->GetFrameNo(); (
BtEvent::Create
(
kBetOnAttack,
a8::Args({
c->GetUniId(),
kBetOnAttack
}),
[c_wp = c->GetWeakPtrRef(), frameno = c->room->GetFrameNo()] () mutable
{
return c_wp.Get() && !c_wp.Get()->dead;
})
);
} }
})); }));