This commit is contained in:
aozhiwei 2024-03-28 15:35:57 +08:00
parent 8776b6f008
commit a529321b18

View File

@ -159,7 +159,7 @@ void Room::Init()
}, },
&xtimer_attacher_); &xtimer_attacher_);
xtimer.SetIntervalWpEx xtimer.SetIntervalWpEx
(SERVER_FRAME_RATE * 3, (SERVER_FRAME_RATE * 1,
[this] (int event, const a8::Args* args) [this] (int event, const a8::Args* args)
{ {
if (a8::TIMER_EXEC_EVENT == event) { if (a8::TIMER_EXEC_EVENT == event) {
@ -3739,12 +3739,12 @@ void Room::MobaBatterysUpdate()
} }
return true; return true;
}); });
if (!target.Get()) { if (!target.Get() || last_distance <= 0.000001f) {
break; break;
} }
glm::vec3 bullet_dir = GlmHelper::UP; glm::vec3 bullet_dir = target.Get()->GetPos().ToGlmVec3() - center;
GlmHelper::RotateY(bullet_dir, glm::radians(1.0f + (float)(rand() % 360))); GlmHelper::Normalize(bullet_dir);
const mt::Equip* weapon_meta = mt::Equip::GetById(std::get<2>(tuple)); const mt::Equip* weapon_meta = mt::Equip::GetById(std::get<2>(tuple));
if (!weapon_meta) { if (!weapon_meta) {
@ -3761,7 +3761,7 @@ void Room::MobaBatterysUpdate()
1, 1,
bullet_born_pos, bullet_born_pos,
bullet_dir, bullet_dir,
0, 0, //last_distance,
0, 0,
0, 0,
nullptr, nullptr,