1
This commit is contained in:
parent
a91ac7cca8
commit
a2e93d8e93
@ -2478,26 +2478,6 @@ void Creature::AutoNavigation(const glm::vec3& target_pos, float speed,
|
|||||||
&xtimer_attacher);
|
&xtimer_attacher);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::AddTraceBullet(int bullet_uniid, int target_uniid, int gun_id)
|
|
||||||
{
|
|
||||||
trace_bullet_hash_[bullet_uniid] = std::make_tuple(target_uniid, gun_id);
|
|
||||||
room->xtimer.SetTimeoutEx
|
|
||||||
(
|
|
||||||
SERVER_FRAME_RATE * 10,
|
|
||||||
[this, bullet_uniid] (int event, const a8::Args* args)
|
|
||||||
{
|
|
||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
|
||||||
trace_bullet_hash_.erase(bullet_uniid);
|
|
||||||
Entity* entity = room->GetEntityByUniId(bullet_uniid);
|
|
||||||
if (entity && entity->GetEntityType() == ET_Bullet) {
|
|
||||||
Bullet* bullet = (Bullet*)entity;
|
|
||||||
bullet->ForceRemove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
&xtimer_attacher);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Creature::LockAttackDir(int time)
|
void Creature::LockAttackDir(int time)
|
||||||
{
|
{
|
||||||
IncDisableAttackDirTimes();
|
IncDisableAttackDirTimes();
|
||||||
|
@ -329,7 +329,6 @@ class Creature : public MoveableEntity
|
|||||||
void RecalcDtoAttr();
|
void RecalcDtoAttr();
|
||||||
void AutoNavigation(const glm::vec3& target_pos, float speed,
|
void AutoNavigation(const glm::vec3& target_pos, float speed,
|
||||||
std::function<void (Creature*)> cb);
|
std::function<void (Creature*)> cb);
|
||||||
void AddTraceBullet(int bullet_uniid, int target_uniid, int gun_id);
|
|
||||||
void LockAttackDir(int time);
|
void LockAttackDir(int time);
|
||||||
void PullTarget(const glm::vec3& target_pos);
|
void PullTarget(const glm::vec3& target_pos);
|
||||||
void MarkSyncActivePlayer(const char* file, int line, const char* func);
|
void MarkSyncActivePlayer(const char* file, int line, const char* func);
|
||||||
@ -383,8 +382,6 @@ protected:
|
|||||||
long long last_follow_move_frameno_ = 0;
|
long long last_follow_move_frameno_ = 0;
|
||||||
int follow_target_last_chg_move_dir_times_ = -1;
|
int follow_target_last_chg_move_dir_times_ = -1;
|
||||||
a8::XTimerWp follow_target_timer_;
|
a8::XTimerWp follow_target_timer_;
|
||||||
//target_uniid, gun_id
|
|
||||||
std::map<int, std::tuple<int, int>> trace_bullet_hash_;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CreatureWeakPtr weak_ptr_;
|
CreatureWeakPtr weak_ptr_;
|
||||||
|
@ -1196,6 +1196,7 @@ void Player::_CMCancelRevive(f8::MsgHdr& hdr, const cs::CMCancelRevive& msg)
|
|||||||
|
|
||||||
void Player::_CMRequestBulletDmg(f8::MsgHdr& hdr, const cs::CMRequestBulletDmg& msg)
|
void Player::_CMRequestBulletDmg(f8::MsgHdr& hdr, const cs::CMRequestBulletDmg& msg)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
auto itr = trace_bullet_hash_.find(msg.bullet_uniid());
|
auto itr = trace_bullet_hash_.find(msg.bullet_uniid());
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
a8::XPrintf("CMRequestBulletDmg bullet_uniid:%d shield_hit:%d strengthen_wall_uniid:%d target_uniid:%d found:%d\n",
|
a8::XPrintf("CMRequestBulletDmg bullet_uniid:%d shield_hit:%d strengthen_wall_uniid:%d target_uniid:%d found:%d\n",
|
||||||
@ -1262,6 +1263,7 @@ void Player::_CMRequestBulletDmg(f8::MsgHdr& hdr, const cs::CMRequestBulletDmg&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
trace_bullet_hash_.erase(itr);
|
trace_bullet_hash_.erase(itr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMRequestThrowDmg(f8::MsgHdr& hdr, const cs::CMRequestThrowDmg& msg)
|
void Player::_CMRequestThrowDmg(f8::MsgHdr& hdr, const cs::CMRequestThrowDmg& msg)
|
||||||
|
@ -3571,3 +3571,8 @@ bool Room::FindWalkablePointWithOutHouse(const glm::vec3& center, int try_count,
|
|||||||
out_point = point;
|
out_point = point;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Room::AddReportBullet(int bullet_uniid)
|
||||||
|
{
|
||||||
|
report_bullet_hash[bullet_uniid] = GetFrameNo();
|
||||||
|
}
|
||||||
|
@ -73,6 +73,8 @@ public:
|
|||||||
int pve_human_num = 0;
|
int pve_human_num = 0;
|
||||||
PveData pve_data;
|
PveData pve_data;
|
||||||
bool stop_world = false;
|
bool stop_world = false;
|
||||||
|
//target_uniid, frameno
|
||||||
|
std::map<int, long long> report_bullet_hash;
|
||||||
|
|
||||||
~Room();
|
~Room();
|
||||||
void InitData(RoomInitInfo& init_info);
|
void InitData(RoomInitInfo& init_info);
|
||||||
@ -219,6 +221,7 @@ public:
|
|||||||
size_t GetRoomMaxPlayerNum();
|
size_t GetRoomMaxPlayerNum();
|
||||||
bool RandomSafeAreaPoint(glm::vec3& point);
|
bool RandomSafeAreaPoint(glm::vec3& point);
|
||||||
bool FindWalkablePointWithOutHouse(const glm::vec3& center, int try_count, int step, glm::vec3& out_point);
|
bool FindWalkablePointWithOutHouse(const glm::vec3& center, int try_count, int step, glm::vec3& out_point);
|
||||||
|
void AddReportBullet(int bullet_uniid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ShuaAndroid();
|
void ShuaAndroid();
|
||||||
|
@ -266,11 +266,9 @@ static void InternalCreateBullet(BulletInfo& bullet_info)
|
|||||||
bullet_info.trace_target_uniid,
|
bullet_info.trace_target_uniid,
|
||||||
bullet_info.hand);
|
bullet_info.hand);
|
||||||
if (bullet_uniid && bullet_info.trace_target_uniid) {
|
if (bullet_uniid && bullet_info.trace_target_uniid) {
|
||||||
c->AddTraceBullet(
|
c->room->AddReportBullet(
|
||||||
bullet_uniid,
|
bullet_uniid
|
||||||
bullet_info.trace_target_uniid,
|
);
|
||||||
bullet_info.weapon_meta->id()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::shared_ptr<BulletInfo> info_copy = std::make_shared<BulletInfo>();
|
std::shared_ptr<BulletInfo> info_copy = std::make_shared<BulletInfo>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user