This commit is contained in:
aozhiwei 2023-12-15 11:16:32 +08:00
parent 255b12e18d
commit 72af10dc5f
3 changed files with 21 additions and 1 deletions

View File

@ -47,6 +47,11 @@ Bullet::Bullet():MoveableEntity()
Bullet::~Bullet() Bullet::~Bullet()
{ {
--PerfMonitor::Instance()->entity_num[ET_Bullet]; --PerfMonitor::Instance()->entity_num[ET_Bullet];
if (IsFlyHook()) {
if (sender.Get()) {
sender.Get()->hook_hash.erase(GetUniId());
}
}
} }
void Bullet::Initialize() void Bullet::Initialize()
@ -69,6 +74,7 @@ void Bullet::Initialize()
} }
if (sender.Get()) { if (sender.Get()) {
sender.Get()->GetTrigger()->FlyHookCreate(this); sender.Get()->GetTrigger()->FlyHookCreate(this);
sender.Get()->hook_hash[GetUniId()] = GetUniId();
} }
Raycast(); Raycast();
} }
@ -1138,3 +1144,9 @@ bool Bullet::NoAdjustPos()
} }
return false; return false;
} }
void Bullet::ReportHookHitPos(const glm::vec3& hit_pos)
{
}

View File

@ -62,6 +62,8 @@ class Bullet : public MoveableEntity, public IBullet
virtual const Position& GetPos() override; virtual const Position& GetPos() override;
virtual void ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int target_uniid, const glm::vec3& pos) override; virtual void ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int target_uniid, const glm::vec3& pos) override;
void ReportHookHitPos(const glm::vec3& hit_pos);
protected: protected:
Bullet(); Bullet();

View File

@ -1808,7 +1808,13 @@ void Player::_CMGetSettlementTeamList(f8::MsgHdr* hdr, const cs::CMGetSettlement
void Player::_CMReportHookHitPos(f8::MsgHdr* hdr, const cs::CMReportHookHitPos& msg) void Player::_CMReportHookHitPos(f8::MsgHdr* hdr, const cs::CMReportHookHitPos& msg)
{ {
Entity* e = room->GetEntityByUniId(msg.bullet_uniid());
if (e && e->GetEntityType() == ET_Bullet) {
Bullet* b = (Bullet*)e;
glm::vec3 hit_pos;
TypeConvert::FromPb(hit_pos, &msg.pos());
b->ReportHookHitPos(hit_pos);
}
} }
void Player::SetShotHold(bool hold) void Player::SetShotHold(bool hold)