This commit is contained in:
aozhiwei 2023-04-03 19:39:35 +08:00
parent 7b80205461
commit 3a13c07d59
4 changed files with 58 additions and 51 deletions

View File

@ -3013,13 +3013,27 @@ void CreatuRemoveSurplusObstacle(int thing_id, int num)
} }
#endif #endif
std::shared_ptr<std::set<int>> Creature::CalcReporterList(const mt::Equip* weapon_meta, std::shared_ptr<std::set<int>> Creature::CalcReporterList(bool is_trace_bullet,
const mt::Equip* weapon_meta,
const mt::Equip* bullet_meta) const mt::Equip* bullet_meta)
{ {
std::shared_ptr<std::set<int>> p; std::shared_ptr<std::set<int>> p;
bool need_gen = false;
switch (bullet_meta->_inventory_slot()) { switch (bullet_meta->_inventory_slot()) {
case IS_RPG: case IS_RPG:
{ {
need_gen = true;
}
break;
default:
{
if (IsEntityType(ET_Hero) && is_trace_bullet) {
need_gen = true;
}
}
break;
}
if (need_gen) {
float nearest_distance = FLT_MAX; float nearest_distance = FLT_MAX;
Creature* nearest_hum = nullptr; Creature* nearest_hum = nullptr;
TraverseCreatures TraverseCreatures
@ -3066,12 +3080,6 @@ std::shared_ptr<std::set<int>> Creature::CalcReporterList(const mt::Equip* weapo
p->insert(nearest_hum->GetUniId()); p->insert(nearest_hum->GetUniId());
} }
} }
break;
default:
{
}
break;
}
return p; return p;
} }

View File

@ -342,7 +342,8 @@ class Creature : public MoveableEntity
float GetSkillRaycastDistance(); float GetSkillRaycastDistance();
virtual void NetInitOk(); virtual void NetInitOk();
bool IsNearGas(); bool IsNearGas();
std::shared_ptr<std::set<int>> CalcReporterList(const mt::Equip* weapon_meta, std::shared_ptr<std::set<int>> CalcReporterList(bool is_trace_bullet,
const mt::Equip* weapon_meta,
const mt::Equip* bullet_meta); const mt::Equip* bullet_meta);
protected: protected:

View File

@ -111,9 +111,7 @@ void Hero::Update(int delta_time)
} }
} }
#ifdef DEBUG #ifdef DEBUG
if (!room->stop_world) {
agent_->Exec(); agent_->Exec();
}
#else #else
agent_->Exec(); agent_->Exec();
#endif #endif

View File

@ -529,7 +529,6 @@ void InternalShot(Creature* c,
bullet_info.bullet_num = bulletNum; bullet_info.bullet_num = bulletNum;
bullet_info.weapon_lv = weapon_lv; bullet_info.weapon_lv = weapon_lv;
bullet_info.weapon_buff_id = weapon_buff_id; bullet_info.weapon_buff_id = weapon_buff_id;
bullet_info.reporter_list = c->CalcReporterList(weapon_meta, bullet_meta);
#if 0 #if 0
if (skill_meta && if (skill_meta &&
(skill_meta->GetMagicId() == MAGIC_20101_HL || (skill_meta->GetMagicId() == MAGIC_20101_HL ||
@ -538,6 +537,7 @@ void InternalShot(Creature* c,
bullet_info.trace_target_uniid = c->GetSkillTargetId(); bullet_info.trace_target_uniid = c->GetSkillTargetId();
} }
#endif #endif
bullet_info.reporter_list = c->CalcReporterList(trace_target_uniid, weapon_meta, bullet_meta);
if (weapon_meta->double_gun() && if (weapon_meta->double_gun() &&
bulletIdx > (int)(bulletNum / 2)) { bulletIdx > (int)(bulletNum / 2)) {
bullet_info.hand = 1; bullet_info.hand = 1;