This commit is contained in:
aozhiwei 2023-01-05 13:41:24 +08:00
parent 409eaf6efe
commit 6a29a0f724
3 changed files with 22 additions and 10 deletions

View File

@ -50,11 +50,14 @@ void Bullet::Initialize()
int buff_uniid = sender.Get()->TryAddBuff(sender.Get(), kVertigoBuffId);
if (buff_uniid) {
Buff* buff = sender.Get()->GetBuffByUniId(buff_uniid);
if (buff && buff->remover_timer.expired()) {
if (buff && !buff->remover_timer.expired()) {
buff_list_.push_back(buff_uniid);
sender.Get()->room->xtimer.ModifyTime(buff->remover_timer, SERVER_FRAME_RATE * 10);
}
}
#ifdef DEBUG
a8::XPrintf("buff_uniid:%d\n", {buff_uniid});
#endif
if (sender.Get()) {
sender.Get()->GetTrigger()->FlyHookCreate(this);
}
@ -633,6 +636,7 @@ void Bullet::ClearBuffList()
void Bullet::ProcFlyHook(Entity* target)
{
return;
ClearBuffList();
float distance = born_pos.Distance2D2(GetPos());
if (distance < 0.001f) {
@ -885,13 +889,17 @@ void Bullet::ProcNormalBullet(BulletCheckResult& result)
if (!hited) {
if (raycast_hited) {
if (result.flyed_distance > 0.001f) {
sender.Get()->AutoNavigation(raycast_hit_point_, gun_meta->bullet_speed() * 2,
[] (Creature* c)
{
});
sender.Get()->IncDisableMoveTimes();
ClearBuffList();
a8::XPrintf("ClearBuffList\n", {});
auto sender_p = sender;
sender.Get()->AutoNavigation
(raycast_hit_point_, gun_meta->bullet_speed() * 2,
[sender_p] (Creature* c) mutable
{
sender_p.Get()->GetTrigger()->FlyHookDestory();
});
#if 0
sender.Get()->IncDisableMoveTimes();
sender.Get()->room->xtimer.SetTimeoutEx
(
(raycast_len_ / gun_meta->bullet_speed() / 2 + 0.75) * SERVER_FRAME_RATE,
@ -904,10 +912,12 @@ void Bullet::ProcNormalBullet(BulletCheckResult& result)
},
&sender.Get()->xtimer_attacher
);
#endif
sender.Get()->RemoveBuffById(kKeepShotAnimiBuffId);
sender.Get()->TryAddBuff(sender.Get(), gun_meta->_int_param2);
}
} else {
#if 0
sender.Get()->IncDisableMoveTimes();
sender.Get()->IncDisableAttackDirTimes();
auto sender_p = sender;
@ -936,6 +946,7 @@ void Bullet::ProcNormalBullet(BulletCheckResult& result)
&sender.Get()->xtimer_attacher
);
sender.Get()->TryAddBuff(sender.Get(), gun_meta->_int_param2);
#endif
}
}
}

View File

@ -2590,7 +2590,7 @@ void Creature::AutoNavigation(const glm::vec3& target_pos, float speed,
}
#ifdef DEBUG
a8::XPrintf("speed:%d src_pos:%f,%f,%f curr_pos:%f,%f,%f "
"target_pos:%f,%f,%f\n",
"target_pos:%f,%f,%f ok:%d\n",
{
context->speed,
context->src_pos.x,
@ -2601,7 +2601,8 @@ void Creature::AutoNavigation(const glm::vec3& target_pos, float speed,
curr_pos.z,
context->target_pos.x,
context->target_pos.y,
context->target_pos.z
context->target_pos.z,
ok
});
#endif

View File

@ -435,7 +435,7 @@ bool MapInstance::Raycast(int layer, const glm::vec3& start, const glm::vec3& en
memset(hit_normal_, 0, sizeof(hit_normal_));
navmesh_query_->raycast(startRef, spos, epos, &filter, &t, hit_normal_, polys_, &npolys, MAX_POLYS);
#ifdef DEBUG
#ifdef DEBUG1
{
std::string dbg_data = a8::Format("npolys:%d t:%f ", {npolys, t});
for (int i = 0; i < npolys; ++i) {