This commit is contained in:
aozhiwei 2023-04-02 11:24:10 +08:00
parent 393d63f293
commit f2ff2b65af
3 changed files with 22 additions and 3 deletions

View File

@ -608,7 +608,8 @@ int Room::CreateBullet(Creature* sender,
int hand,
a8::XTimerWp keep_shot_animi_timer_ptr,
float shot_animi_time,
int weapon_buff_id)
int weapon_buff_id,
std::shared_ptr<std::set<int>> reporter_list)
{
int bullet_uniid = 0;
if (grid_service->CanAdd(pos.x, pos.z)) {
@ -632,6 +633,7 @@ int Room::CreateBullet(Creature* sender,
bullet->keep_shot_animi_timer_ptr = keep_shot_animi_timer_ptr;
bullet->shot_animi_time = shot_animi_time;
bullet->spec_gun_buff_id = weapon_buff_id;
bullet->reporter_list = reporter_list;
bullet->Initialize();
#ifdef DEBUG1
a8::XPrintf("xxxxxxx born_pos:%f,%f,%f curr_pos:%f,%f,%f\n",
@ -3575,4 +3577,19 @@ bool Room::FindWalkablePointWithOutHouse(const glm::vec3& center, int try_count,
void Room::AddReportBullet(int bullet_uniid)
{
report_bullet_hash[bullet_uniid] = GetFrameNo();
xtimer.SetTimeoutEx
(
SERVER_FRAME_RATE * 10,
[this, bullet_uniid] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
report_bullet_hash.erase(bullet_uniid);
Entity* entity = GetEntityByUniId(bullet_uniid);
if (entity && entity->GetEntityType() == ET_Bullet) {
Bullet* bullet = (Bullet*)entity;
bullet->ForceRemove();
}
}
},
&xtimer_attacher_);
}

View File

@ -153,7 +153,8 @@ public:
int hand,
a8::XTimerWp keep_shot_animi_timer_ptr,
float shot_animi_time,
int weapon_buff_id);
int weapon_buff_id,
std::shared_ptr<std::set<int>> reporter_list);
Car* CreateCar(Human* driver,
int car_uniid,
const mt::Equip* meta,

View File

@ -215,7 +215,8 @@ static void InternalCreateBullet(BulletInfo& bullet_info)
bullet_info.hand,
bullet_info.keep_shot_animi_timer_ptr,
bullet_info.shot_animi_time,
bullet_info.weapon_buff_id);
bullet_info.weapon_buff_id,
nullptr);
#ifdef DEBUG1
if (bullet_info.c.Get()->IsPlayer()) {
bullet_info.c.Get()->SendDebugMsg(a8::Format("CreateBullet id:%d",