This commit is contained in:
aozhiwei 2023-06-15 18:11:19 +08:00
parent b3ef379109
commit 9732a54a97
6 changed files with 39 additions and 9 deletions

View File

@ -106,6 +106,9 @@ behaviac::EBTStatus AndroidAgent::DoRandomShot()
if (status_ == behaviac::BT_RUNNING) {
return DoRunningCb();
}
if (a8::HasBitFlag(GetOwner()->status, CS_DisableAttackAndroid)) {
return behaviac::BT_FAILURE;
}
glm::vec3 dir = GetOwner()->GetMoveDir();
GlmHelper::RotateY(dir, (10 + rand() % 360)/ 180.0f);

View File

@ -10,6 +10,7 @@
#include "android.h"
#include "airraid.h"
#include "car.h"
#include "incubator.h"
#include "cs_proto.pb.h"
@ -342,6 +343,17 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
}
}
}
} else if (cmd == "show_hand") {
room->xtimer.SetTimeoutEx
(
1,
[this] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
room->GetIncubator()->ShowHand();
}
},
&xtimer_attacher);
}
#ifdef DEBUG
a8::XPrintf("exec_cmd:%s\n", {cmd});

View File

@ -9,6 +9,7 @@
#include "glmhelper.h"
#include "mapinstance.h"
#include "bornpoint.h"
#include "movement.h"
#include "mt/Param.h"
#include "mt/Map.h"
@ -493,6 +494,9 @@ void Incubator::ShowHand()
{
#ifdef DEBUG
glm::vec3 center;
if (hold_humans_.empty()) {
return;
}
a8::XPrintf("ShowHand hold_humans_.size:%d\n", {hold_humans_.size()});
#endif
for (auto& hum : hold_humans_) {
@ -506,30 +510,34 @@ void Incubator::ShowHand()
hum->GetMutablePos().FromGlmVec3(point);
Global::Instance()->verify_set_pos = 0;
a8::SetBitFlag(hum->status, CS_CrazeMode);
a8::SetBitFlag(hum->status, CS_DisableAttackAndroid);
room->xtimer.SetTimeoutEx
(
SERVER_FRAME_RATE * 20,
[hum] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
#if 0
a8::UnSetBitFlag(hum->status, CS_DisableAttackAndroid);
#endif
}
},
&hum->xtimer_attacher);
room->EnableHuman(hum);
hum->MustBeAddBuff(hum, kTraceBuffId);
a8::SetBitFlag(hum->status, CS_CrazeMode);
a8::SetBitFlag(hum->status, CS_DisableAttackAndroid);
}
hold_humans_.clear();
#ifdef DEBUG
#ifdef DEBUG1
room->TraversePlayerList
(
[this, center] (Player* hum)
{
hum->GetMutablePos().FromGlmVec3(center);
a8::XPrintf("showhand %f %f %f\n", {center.x, center.y, center.z});
room->grid_service->MoveCreature(hum);
hum->GetMovement()->ClearPath();
});
#endif
}

View File

@ -18,13 +18,13 @@ class Incubator
bool IsTimeOut() { return timeout_; };
int GetPveLeftTime();
void NextWave();
void ShowHand();
private:
bool CanSee(Human* hum, Human* exclude_hum);
void AutoAllocAndroid();
void OnEnterNewWave(int wave);
void SpawnWaveMon(int wave);
void ShowHand();
private:
int wait_alloc_time_ = 0;

View File

@ -11,6 +11,9 @@ namespace mt
void SafeArea::Init1()
{
#ifdef DEBUG1
wait_time_ = 30;
#endif
{
auto itr = type_hash_.find(type());
if (itr == type_hash_.end()) {

View File

@ -484,6 +484,9 @@ Creature* Room::FindEnemy(Creature* c, float range)
if (!hum->dead &&
!a8::HasBitFlag(hum->status, CS_Disable) &&
hum->team_id != myself->team_id) {
if (a8::HasBitFlag(myself->status, CS_DisableAttackAndroid) &&
hum->IsAndroid()) {
} else {
float distance = hum->GetPos().Distance2D2(myself->GetPos());
if (distance <= range) {
if (distance < last_distance) {
@ -492,6 +495,7 @@ Creature* Room::FindEnemy(Creature* c, float range)
}
}
}
}
return true;
});
return target;