1
This commit is contained in:
parent
b3ef379109
commit
9732a54a97
@ -106,6 +106,9 @@ behaviac::EBTStatus AndroidAgent::DoRandomShot()
|
|||||||
if (status_ == behaviac::BT_RUNNING) {
|
if (status_ == behaviac::BT_RUNNING) {
|
||||||
return DoRunningCb();
|
return DoRunningCb();
|
||||||
}
|
}
|
||||||
|
if (a8::HasBitFlag(GetOwner()->status, CS_DisableAttackAndroid)) {
|
||||||
|
return behaviac::BT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 dir = GetOwner()->GetMoveDir();
|
glm::vec3 dir = GetOwner()->GetMoveDir();
|
||||||
GlmHelper::RotateY(dir, (10 + rand() % 360)/ 180.0f);
|
GlmHelper::RotateY(dir, (10 + rand() % 360)/ 180.0f);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "android.h"
|
#include "android.h"
|
||||||
#include "airraid.h"
|
#include "airraid.h"
|
||||||
#include "car.h"
|
#include "car.h"
|
||||||
|
#include "incubator.h"
|
||||||
|
|
||||||
#include "cs_proto.pb.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
|
#ifdef DEBUG
|
||||||
a8::XPrintf("exec_cmd:%s\n", {cmd});
|
a8::XPrintf("exec_cmd:%s\n", {cmd});
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "glmhelper.h"
|
#include "glmhelper.h"
|
||||||
#include "mapinstance.h"
|
#include "mapinstance.h"
|
||||||
#include "bornpoint.h"
|
#include "bornpoint.h"
|
||||||
|
#include "movement.h"
|
||||||
|
|
||||||
#include "mt/Param.h"
|
#include "mt/Param.h"
|
||||||
#include "mt/Map.h"
|
#include "mt/Map.h"
|
||||||
@ -493,6 +494,9 @@ void Incubator::ShowHand()
|
|||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
glm::vec3 center;
|
glm::vec3 center;
|
||||||
|
if (hold_humans_.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
a8::XPrintf("ShowHand hold_humans_.size:%d\n", {hold_humans_.size()});
|
a8::XPrintf("ShowHand hold_humans_.size:%d\n", {hold_humans_.size()});
|
||||||
#endif
|
#endif
|
||||||
for (auto& hum : hold_humans_) {
|
for (auto& hum : hold_humans_) {
|
||||||
@ -506,30 +510,34 @@ void Incubator::ShowHand()
|
|||||||
hum->GetMutablePos().FromGlmVec3(point);
|
hum->GetMutablePos().FromGlmVec3(point);
|
||||||
Global::Instance()->verify_set_pos = 0;
|
Global::Instance()->verify_set_pos = 0;
|
||||||
|
|
||||||
a8::SetBitFlag(hum->status, CS_CrazeMode);
|
|
||||||
a8::SetBitFlag(hum->status, CS_DisableAttackAndroid);
|
|
||||||
room->xtimer.SetTimeoutEx
|
room->xtimer.SetTimeoutEx
|
||||||
(
|
(
|
||||||
SERVER_FRAME_RATE * 20,
|
SERVER_FRAME_RATE * 20,
|
||||||
[hum] (int event, const a8::Args* args)
|
[hum] (int event, const a8::Args* args)
|
||||||
{
|
{
|
||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
if (a8::TIMER_EXEC_EVENT == event) {
|
||||||
|
#if 0
|
||||||
a8::UnSetBitFlag(hum->status, CS_DisableAttackAndroid);
|
a8::UnSetBitFlag(hum->status, CS_DisableAttackAndroid);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
&hum->xtimer_attacher);
|
&hum->xtimer_attacher);
|
||||||
|
|
||||||
room->EnableHuman(hum);
|
room->EnableHuman(hum);
|
||||||
hum->MustBeAddBuff(hum, kTraceBuffId);
|
hum->MustBeAddBuff(hum, kTraceBuffId);
|
||||||
|
a8::SetBitFlag(hum->status, CS_CrazeMode);
|
||||||
|
a8::SetBitFlag(hum->status, CS_DisableAttackAndroid);
|
||||||
}
|
}
|
||||||
hold_humans_.clear();
|
hold_humans_.clear();
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG1
|
||||||
room->TraversePlayerList
|
room->TraversePlayerList
|
||||||
(
|
(
|
||||||
[this, center] (Player* hum)
|
[this, center] (Player* hum)
|
||||||
{
|
{
|
||||||
hum->GetMutablePos().FromGlmVec3(center);
|
hum->GetMutablePos().FromGlmVec3(center);
|
||||||
|
a8::XPrintf("showhand %f %f %f\n", {center.x, center.y, center.z});
|
||||||
room->grid_service->MoveCreature(hum);
|
room->grid_service->MoveCreature(hum);
|
||||||
|
hum->GetMovement()->ClearPath();
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,13 @@ class Incubator
|
|||||||
bool IsTimeOut() { return timeout_; };
|
bool IsTimeOut() { return timeout_; };
|
||||||
int GetPveLeftTime();
|
int GetPveLeftTime();
|
||||||
void NextWave();
|
void NextWave();
|
||||||
|
void ShowHand();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool CanSee(Human* hum, Human* exclude_hum);
|
bool CanSee(Human* hum, Human* exclude_hum);
|
||||||
void AutoAllocAndroid();
|
void AutoAllocAndroid();
|
||||||
void OnEnterNewWave(int wave);
|
void OnEnterNewWave(int wave);
|
||||||
void SpawnWaveMon(int wave);
|
void SpawnWaveMon(int wave);
|
||||||
void ShowHand();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int wait_alloc_time_ = 0;
|
int wait_alloc_time_ = 0;
|
||||||
|
@ -11,6 +11,9 @@ namespace mt
|
|||||||
|
|
||||||
void SafeArea::Init1()
|
void SafeArea::Init1()
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG1
|
||||||
|
wait_time_ = 30;
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
auto itr = type_hash_.find(type());
|
auto itr = type_hash_.find(type());
|
||||||
if (itr == type_hash_.end()) {
|
if (itr == type_hash_.end()) {
|
||||||
|
@ -484,6 +484,9 @@ Creature* Room::FindEnemy(Creature* c, float range)
|
|||||||
if (!hum->dead &&
|
if (!hum->dead &&
|
||||||
!a8::HasBitFlag(hum->status, CS_Disable) &&
|
!a8::HasBitFlag(hum->status, CS_Disable) &&
|
||||||
hum->team_id != myself->team_id) {
|
hum->team_id != myself->team_id) {
|
||||||
|
if (a8::HasBitFlag(myself->status, CS_DisableAttackAndroid) &&
|
||||||
|
hum->IsAndroid()) {
|
||||||
|
} else {
|
||||||
float distance = hum->GetPos().Distance2D2(myself->GetPos());
|
float distance = hum->GetPos().Distance2D2(myself->GetPos());
|
||||||
if (distance <= range) {
|
if (distance <= range) {
|
||||||
if (distance < last_distance) {
|
if (distance < last_distance) {
|
||||||
@ -492,6 +495,7 @@ Creature* Room::FindEnemy(Creature* c, float range)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
return target;
|
return target;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user