修复1级僵尸问题

This commit is contained in:
aozhiwei 2020-07-31 13:02:29 +08:00
parent 93d0377c41
commit 896fa57144
3 changed files with 21 additions and 15 deletions

View File

@ -67,7 +67,12 @@ void FrameEvent::AddShot(Human* sender)
}
}
void FrameEvent::AddBullet(Human* sender, a8::Vec2 born_pos, a8::Vec2 dir, float fly_distance)
void FrameEvent::AddBullet(Human* sender,
MetaData::Equip* weapon_meta,
int weapon_lv,
a8::Vec2 born_pos,
a8::Vec2 dir,
float fly_distance)
{
{
auto& tuple = a8::FastAppend(bullets_);
@ -75,23 +80,14 @@ void FrameEvent::AddBullet(Human* sender, a8::Vec2 born_pos, a8::Vec2 dir, float
auto& p = std::get<1>(tuple);
p.set_player_id(sender->GetEntityUniId());
if (sender->car_weapon.meta) {
p.set_bullet_id(sender->car_weapon.meta->i->use_bullet());
} else {
p.set_bullet_id(sender->curr_weapon->meta->i->use_bullet());
}
p.set_bullet_id(weapon_meta->i->use_bullet());
TypeConvert::ToPb(born_pos, p.mutable_pos());
TypeConvert::ToPb(dir, p.mutable_dir());
#if 0
p.set_bulletskin(10001);
#endif
if (sender->car_weapon.meta) {
p.set_gun_id(sender->car_weapon.meta->i->id());
p.set_gun_lv(sender->car_weapon.weapon_lv);
} else {
p.set_gun_id(sender->curr_weapon->meta->i->id());
p.set_gun_lv(sender->curr_weapon->weapon_lv);
}
p.set_gun_id(weapon_meta->i->id());
p.set_gun_lv(weapon_lv);
p.set_fly_distance(fly_distance);
}
{

View File

@ -12,7 +12,12 @@ public:
void AddAirDrop(int appear_time, int box_id, a8::Vec2 box_pos);
void AddEmote(Human* hum, int emote_id);
void AddShot(Human* hum);
void AddBullet(Human* hum, a8::Vec2 born_pos, a8::Vec2 dir, float fly_distance);
void AddBullet(Human* hum,
MetaData::Equip* weapon_meta,
int weapon_lv,
a8::Vec2 born_pos,
a8::Vec2 dir,
float fly_distance);
void AddExplosion(Bullet* bullet, int item_id, a8::Vec2 bomb_pos);
void AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos);
void AddExplosionEx(Human* sender, int item_id, a8::Vec2 bomb_pos, int effect);

View File

@ -71,7 +71,12 @@ void InternalShot(Human* hum,
bullet_born_pos.x += MetaMgr::Instance()->horse_shoot_x;
bullet_born_pos.y += MetaMgr::Instance()->horse_shoot_y;
}
hum->room->frame_event.AddBullet(hum, bullet_born_pos, bullet_dir, fly_distance);
hum->room->frame_event.AddBullet(hum,
weapon_meta,
weapon_lv,
bullet_born_pos,
bullet_dir,
fly_distance);
if (hum->room->BattleStarted()) {
hum->room->CreateBullet(hum,
weapon_meta,