This commit is contained in:
aozhiwei 2024-05-06 17:05:20 +08:00
parent ec25b5a13a
commit 8bf2110e74
9 changed files with 22 additions and 7 deletions

View File

@ -1493,6 +1493,7 @@ void CallFuncBuff::Shot()
float x = meta->GetBuffParam3(this); float x = meta->GetBuffParam3(this);
float y = meta->GetBuffParam4(this); float y = meta->GetBuffParam4(this);
float z = meta->GetBuffParam5(this); float z = meta->GetBuffParam5(this);
int duration = meta->GetBuffParam8(this);
const mt::Equip* gun_meta = mt::Equip::GetById(id); const mt::Equip* gun_meta = mt::Equip::GetById(id);
if (gun_meta) { if (gun_meta) {
const mt::Equip* bullet_meta = mt::Equip::GetById(gun_meta->use_bullet()); const mt::Equip* bullet_meta = mt::Equip::GetById(gun_meta->use_bullet());

View File

@ -35,6 +35,7 @@ class Bullet : public MoveableEntity, public IBullet
std::shared_ptr<std::set<int>> reporter_list; std::shared_ptr<std::set<int>> reporter_list;
bool ignore_original_dmg = false; bool ignore_original_dmg = false;
std::function<void(Bullet*)> on_bullet_exit = nullptr; std::function<void(Bullet*)> on_bullet_exit = nullptr;
int duration = 0;
virtual ~Bullet() override; virtual ~Bullet() override;
virtual void Initialize() override; virtual void Initialize() override;

View File

@ -94,7 +94,8 @@ void FrameEvent::AddBullet(int bullet_uniid,
int hand, int hand,
std::shared_ptr<std::set<int>> reporter_list, std::shared_ptr<std::set<int>> reporter_list,
int shot_uniid, int shot_uniid,
int force_player_id) int force_player_id,
int duration)
{ {
{ {
auto& tuple = a8::FastAppend(room->frame_event_data->bullets_); auto& tuple = a8::FastAppend(room->frame_event_data->bullets_);
@ -122,6 +123,7 @@ void FrameEvent::AddBullet(int bullet_uniid,
} }
} }
p.set_shot_uniid(shot_uniid); p.set_shot_uniid(shot_uniid);
p.set_duration(duration);
} }
{ {
int bullet_idx = room->frame_event_data->bullets_.size() - 1; int bullet_idx = room->frame_event_data->bullets_.size() - 1;

View File

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

View File

@ -808,7 +808,8 @@ int Room::CreateBullet(Creature* sender,
int weapon_buff_id, int weapon_buff_id,
std::shared_ptr<std::set<int>> reporter_list, std::shared_ptr<std::set<int>> reporter_list,
int shot_uniid, int shot_uniid,
std::function<void(Bullet*)> on_bullet_exit) std::function<void(Bullet*)> on_bullet_exit,
int duration)
{ {
int bullet_uniid = 0; int bullet_uniid = 0;
if (grid_service->CanAdd(pos.x, pos.z)) { if (grid_service->CanAdd(pos.x, pos.z)) {
@ -835,6 +836,7 @@ int Room::CreateBullet(Creature* sender,
bullet->reporter_list = reporter_list; bullet->reporter_list = reporter_list;
bullet->shot_uniid = shot_uniid; bullet->shot_uniid = shot_uniid;
bullet->on_bullet_exit = on_bullet_exit; bullet->on_bullet_exit = on_bullet_exit;
bullet->duration = duration;
bullet->Initialize(); bullet->Initialize();
#ifdef MYDEBUG1 #ifdef MYDEBUG1
a8::XPrintf("xxxxxxx born_pos:%f,%f,%f curr_pos:%f,%f,%f\n", a8::XPrintf("xxxxxxx born_pos:%f,%f,%f curr_pos:%f,%f,%f\n",

View File

@ -190,7 +190,8 @@ public:
int weapon_buff_id, int weapon_buff_id,
std::shared_ptr<std::set<int>> reporter_list, std::shared_ptr<std::set<int>> reporter_list,
int shot_uniid, int shot_uniid,
std::function<void(Bullet*)> on_bullet_exit); std::function<void(Bullet*)> on_bullet_exit,
int duration);
Car* CreateCar(Human* driver, Car* CreateCar(Human* driver,
int car_uniid, int car_uniid,
const mt::Equip* meta, const mt::Equip* meta,

View File

@ -58,6 +58,7 @@ struct BulletInfo
a8::XTimerWp keep_shot_animi_timer_ptr; a8::XTimerWp keep_shot_animi_timer_ptr;
bool ignore_original_dmg = false; bool ignore_original_dmg = false;
std::function<void(Bullet*)> on_bullet_exit; std::function<void(Bullet*)> on_bullet_exit;
int duration = 0;
}; };
static void CalcGunMuzzlePosition(Creature* c, static void CalcGunMuzzlePosition(Creature* c,
@ -284,7 +285,8 @@ static void InternalCreateBullet(BulletInfo& bullet_info)
bullet_info.weapon_buff_id, bullet_info.weapon_buff_id,
bullet_info.reporter_list, bullet_info.reporter_list,
bullet_info.shot_uniid, bullet_info.shot_uniid,
bullet_info.on_bullet_exit); bullet_info.on_bullet_exit,
bullet_info.duration);
#ifdef MYDEBUG1 #ifdef MYDEBUG1
if (bullet_info.c.Get()->IsPlayer()) { if (bullet_info.c.Get()->IsPlayer()) {
bullet_info.c.Get()->SendDebugMsg(a8::Format("CreateBullet id:%d", bullet_info.c.Get()->SendDebugMsg(a8::Format("CreateBullet id:%d",
@ -359,7 +361,8 @@ void InternalShot(Creature* c,
float fly_distance, float fly_distance,
long long weapon_uniid, long long weapon_uniid,
int trace_target_uniid, int trace_target_uniid,
std::function<void(Bullet*)> on_bullet_exit) std::function<void(Bullet*)> on_bullet_exit,
int duration)
{ {
bool is_player = c->IsPlayer(); bool is_player = c->IsPlayer();
bool is_car = c->IsCar(); bool is_car = c->IsCar();
@ -543,6 +546,7 @@ void InternalShot(Creature* c,
bullet_info.reporter_list = c->CalcReporterList(trace_target_uniid, weapon_meta, bullet_meta); bullet_info.reporter_list = c->CalcReporterList(trace_target_uniid, weapon_meta, bullet_meta);
bullet_info.ignore_original_dmg = c->GetAbility()->GetSwitchTimes(kIgnoreOriginalDmg) > 0; bullet_info.ignore_original_dmg = c->GetAbility()->GetSwitchTimes(kIgnoreOriginalDmg) > 0;
bullet_info.on_bullet_exit = on_bullet_exit; bullet_info.on_bullet_exit = on_bullet_exit;
bullet_info.duration = duration;
if (shot_animi && shot_animi->is_other) { if (shot_animi && shot_animi->is_other) {
bullet_info.hand = shot_animi->GetShotHand(bulletIdx - 1); bullet_info.hand = shot_animi->GetShotHand(bulletIdx - 1);
} else { } else {

View File

@ -10,4 +10,5 @@ void InternalShot(Creature* sender,
float fly_distance, float fly_distance,
long long weapon_uniid, long long weapon_uniid,
int trace_target_uniid, int trace_target_uniid,
std::function<void(Bullet*)> on_bullet_exit = nullptr); std::function<void(Bullet*)> on_bullet_exit = nullptr,
int duration = 0);

View File

@ -828,6 +828,7 @@ message MFBullet
optional float fly_distance = 11; // optional float fly_distance = 11; //
optional int32 bullet_uniid = 12; //id optional int32 bullet_uniid = 12; //id
optional int32 hand = 16 [default = 0]; // 0: 1: optional int32 hand = 16 [default = 0]; // 0: 1:
optional int32 duration = 21; //(,>0)
//(trace_target_uniid != 0) //(trace_target_uniid != 0)
optional int32 trace_target_uniid = 13 [default = 0]; //0uniid optional int32 trace_target_uniid = 13 [default = 0]; //0uniid
@ -837,6 +838,7 @@ message MFBullet
//(reporter_list.size() > 0) //(reporter_list.size() > 0)
repeated int32 reporter_list = 20; // repeated int32 reporter_list = 20; //
} }
// //