This commit is contained in:
aozhiwei 2023-12-11 13:16:19 +08:00
parent 454aab53e8
commit babea4e97d
10 changed files with 27 additions and 8 deletions

View File

@ -326,7 +326,8 @@ void Buff::ProcSputteringFunc(Bullet* bullet)
0,
0,
0,
nullptr);
nullptr,
bullet->shot_uniid);
auto p = std::make_shared<VirtualBullet>();
p->bullet_uniid = bullet_uniid;
p->weapon_uniid = bullet->weapon_uniid;
@ -340,6 +341,7 @@ void Buff::ProcSputteringFunc(Bullet* bullet)
p->dir = bullet_dir;
p->born_pos = bullet_born_pos;
p->born_dir = bullet_dir;
p->shot_uniid = bullet->shot_uniid;
p->Init();
owner->room->AddTask(bullet_uniid, std::make_shared<a8::CommonCbProcEx>
(

View File

@ -13,6 +13,7 @@ class Ability;
class Bullet : public MoveableEntity, public IBullet
{
public:
int shot_uniid = 0;
long long weapon_uniid = 0;
int gun_lv = 0;
int spec_gun_buff_id = 0;

View File

@ -91,7 +91,8 @@ void FrameEvent::AddBullet(int bullet_uniid,
float fly_distance,
int trace_target_id,
int hand,
std::shared_ptr<std::set<int>> reporter_list)
std::shared_ptr<std::set<int>> reporter_list,
int shot_uniid)
{
{
auto& tuple = a8::FastAppend(room->frame_event_data->bullets_);
@ -115,6 +116,7 @@ void FrameEvent::AddBullet(int bullet_uniid,
p.add_reporter_list(reporter);
}
}
p.set_shot_uniid(shot_uniid);
}
{
int bullet_idx = room->frame_event_data->bullets_.size() - 1;

View File

@ -26,7 +26,8 @@ public:
float fly_distance,
int trace_target_id,
int hand,
std::shared_ptr<std::set<int>> reporter_list);
std::shared_ptr<std::set<int>> reporter_list,
int shot_uniid);
void RemoveBullet(glm::vec3 pos, int bullet_uniid);
void AddExplosion(Bullet* bullet, int item_id, Position bomb_pos);
void AddPlaySkill(CreatureWeakPtr& sender, int skill_id);

View File

@ -2278,7 +2278,8 @@ int Creature::Throw(int slot, const glm::vec3& bomb_pos, const glm::vec3& bomb_d
fly_distance,
0,
1,
nullptr);
nullptr,
0);
if (IsAndroid()) {
AsHuman()->throw_bomb = std::make_shared<cs::MFThrow>();
AsHuman()->throw_bomb->set_weapon_id(weapon.weapon_id);

View File

@ -703,7 +703,8 @@ int Room::CreateBullet(Creature* sender,
a8::XTimerWp keep_shot_animi_timer_ptr,
float shot_animi_time,
int weapon_buff_id,
std::shared_ptr<std::set<int>> reporter_list)
std::shared_ptr<std::set<int>> reporter_list,
int shot_uniid)
{
int bullet_uniid = 0;
if (grid_service->CanAdd(pos.x, pos.z)) {
@ -728,6 +729,7 @@ int Room::CreateBullet(Creature* sender,
bullet->shot_animi_time = shot_animi_time;
bullet->spec_gun_buff_id = weapon_buff_id;
bullet->reporter_list = reporter_list;
bullet->shot_uniid = shot_uniid;
bullet->Initialize();
#ifdef MYDEBUG1
a8::XPrintf("xxxxxxx born_pos:%f,%f,%f curr_pos:%f,%f,%f\n",

View File

@ -177,7 +177,8 @@ public:
a8::XTimerWp keep_shot_animi_timer_ptr,
float shot_animi_time,
int weapon_buff_id,
std::shared_ptr<std::set<int>> reporter_list);
std::shared_ptr<std::set<int>> reporter_list,
int shot_uniid);
Car* CreateCar(Human* driver,
int car_uniid,
const mt::Equip* meta,
@ -278,6 +279,7 @@ public:
Team* GetMobaTeamA() { return moba_team_a_; }
Team* GetMobaTeamB() { return moba_team_b_; }
RoomAgent* GetRoomAgent() { return room_agent_; }
int GenShotUniid() { return ++current_shot_uniid_; }
private:
void ShuaAndroid();
@ -384,6 +386,7 @@ private:
int current_teamid_ = 0;
int current_uniid_ = FIXED_OBJECT_MAXID;
int current_shot_uniid_ = 0;
std::set<int> refreshed_robot_set_;
std::map<int, std::shared_ptr<Team>> team_hash_;

View File

@ -53,6 +53,7 @@ struct BulletInfo
int bullet_idx = 0;
int bullet_num = 0;
std::shared_ptr<std::set<int>> reporter_list;
int shot_uniid = 0;
a8::XTimerWp keep_shot_animi_timer_ptr;
};
@ -247,7 +248,8 @@ static void InternalCreateBullet(BulletInfo& bullet_info)
bullet_info.keep_shot_animi_timer_ptr,
bullet_info.shot_animi_time,
bullet_info.weapon_buff_id,
bullet_info.reporter_list);
bullet_info.reporter_list,
bullet_info.shot_uniid);
#ifdef MYDEBUG1
if (bullet_info.c.Get()->IsPlayer()) {
bullet_info.c.Get()->SendDebugMsg(a8::Format("CreateBullet id:%d",
@ -288,7 +290,8 @@ static void InternalCreateBullet(BulletInfo& bullet_info)
bullet_info.fly_distance,
bullet_info.trace_target_uniid,
bullet_info.hand,
bullet_info.reporter_list);
bullet_info.reporter_list,
bullet_info.shot_uniid);
if (bullet_uniid && (bullet_info.trace_target_uniid || bullet_info.reporter_list)) {
c->room->AddReportBullet(
bullet_uniid
@ -586,6 +589,7 @@ void InternalShot(Creature* c,
if (bullet_info.skill_meta && bullet_info.skill_meta->_number_meta) {
c->GetTrigger()->SkillBulletPreCreate(bullet_info.delay_time, bullet_info.skill_meta);
}
bullet_info.shot_uniid = c->room->GenShotUniid();
InternalCreateBullet(bullet_info);
}
}

View File

@ -7,6 +7,7 @@ class Obstacle;
class VirtualBullet : public IBullet
{
public:
int shot_uniid = 0;
int bullet_uniid = 0;
long long weapon_uniid = 0;
const mt::Skill* skill_meta = nullptr;

View File

@ -769,6 +769,7 @@ message MFBullet
optional int32 trace_target_uniid = 13 [default = 0]; //0uniid
optional float track_change_time = 14 [default = 0]; //
optional int32 is_through = 15 [default = 0]; //穿
optional int32 shot_uniid = 17; //id()
//(reporter_list.size() > 0)
repeated int32 reporter_list = 20; //
@ -779,6 +780,7 @@ message MFShot
{
optional int32 player_id = 1; //id
optional MFWeapon weapon = 2; //id
optional int32 shot_uniid = 3; //id()
optional int32 hole = 5 [default = 0]; //(0)
optional int32 aiming = 6 [default = 0]; //
}