This commit is contained in:
aozhiwei 2023-11-15 14:25:40 +08:00
parent 9476ed0d60
commit 958b62c93c
2 changed files with 13 additions and 18 deletions

View File

@ -11,13 +11,6 @@
<property Prototype="Self.HeroAgent::ChaseToKill(0,0,0)" />
<property IsHTN="false" />
<node class="Sequence" id="1">
<node class="Selector" id="108">
<node class="ReferencedBehavior" id="106">
<property ReferenceBehavior="const string &quot;task/Pickup&quot;" />
<property Task="Self.HeroAgent::PickupItem(0,0,{x=0;y=0;z=0;})" />
</node>
<node class="True" id="107" />
</node>
<node class="Assignment" id="2">
<property CastRight="false" />
<property Opl="int Self.HeroAgent::_$local_task_param_$_0" />
@ -50,6 +43,13 @@
<property Phase="Both" />
</attachment>
<node class="Sequence" id="6">
<node class="Selector" id="108">
<node class="ReferencedBehavior" id="106">
<property ReferenceBehavior="const string &quot;task/Pickup&quot;" />
<property Task="Self.HeroAgent::PickupItem(0,0,{x=0;y=0;z=0;})" />
</node>
<node class="True" id="107" />
</node>
<node class="Selector" id="100">
<node class="IfElse" id="9">
<node class="Condition" id="10">

View File

@ -140,6 +140,10 @@ bool HeroAgent::CanShot()
if (owner_->GetActionType() == AT_Reload) {
return false;
}
if (owner_->GetCar() && owner_->IsHuman() &&
!owner_->GetCar()->CanShot(owner_->AsHuman())) {
return false;
}
return owner_->CanShot(true);
}
@ -1266,9 +1270,6 @@ behaviac::EBTStatus HeroAgent::CoGetNextMobaModeRoadPoint()
int HeroAgent::SearchPickupObj()
{
#ifdef DEBUG
a8::XPrintf("SearchPickupObj\n", {});
#endif
if (!owner_->IsHuman()) {
return 0;
}
@ -1315,14 +1316,8 @@ int HeroAgent::SearchPickupObj()
} else if (e->IsLoot()) {
}
});
#ifdef DEBUG
a8::XPrintf("SearchPickupObj 11111 %d\n", {nearest_obj ? 1 : 0});
#endif
if (nearest_obj &&
nearest_obj->GetPos().ManhattanDistance2D(owner_->GetPos()) < 600) {
#ifdef DEBUG
a8::XPrintf("SearchPickupObj 22222\n", {});
#endif
int obj_type = 0;
if (nearest_obj->IsCar()) {
obj_type = 1;
@ -1373,7 +1368,7 @@ behaviac::EBTStatus HeroAgent::Pickup()
auto context = MAKE_BTCONTEXT
(
);
int pickup_time = a8::RandEx(500, 1000 * 3);
int pickup_time = a8::RandEx(200, 800);
auto co = std::make_shared<BtCoroutine>(context, co_id, "Pickup");
co->runing_cb =
[this, context, pickup_time] (BtCoroutine* co)
@ -1391,7 +1386,7 @@ behaviac::EBTStatus HeroAgent::Pickup()
return behaviac::BT_FAILURE;
}
if (!owner_->IsHuman()) {
return behaviac::BT_RUNNING;
return behaviac::BT_FAILURE;
}
if ((GetRoom()->GetFrameNo() - context->frameno) * FRAME_RATE_MS < pickup_time) {
return behaviac::BT_RUNNING;