This commit is contained in:
aozhiwei 2019-04-22 13:45:48 +08:00
parent 4e3f00bc68
commit bdf403485b
2 changed files with 48 additions and 40 deletions

View File

@ -404,25 +404,27 @@ void Player::UpdateJump()
{
if (a8::HasBitFlag(status, HS_Fly)) {
DoJump();
room->xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 3,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
Human* hum = (Human*)param.sender.GetUserData();
hum->room->TouchHumanList(
a8::XParams()
.SetSender(hum),
[] (Human* hum, a8::XParams& param) -> bool
{
if (a8::HasBitFlag(hum->status, HS_Fly)) {
hum->DoJump();
return false;
}
return true;
});
},
&xtimer_attacher.timer_list_);
for (size_t i = 0; i < 4; ++i){
room->xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE / 10,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
Human* hum = (Human*)param.sender.GetUserData();
hum->room->TouchHumanList(
a8::XParams()
.SetSender(hum),
[] (Human* hum, a8::XParams& param) -> bool
{
if (a8::HasBitFlag(hum->status, HS_Fly) && hum->entity_subtype != EST_Player) {
hum->DoJump();
return false;
}
return true;
});
},
&xtimer_attacher.timer_list_);
}
}
jump = false;
}

View File

@ -368,6 +368,12 @@ void Room::CollisionDetection(Entity* sender, int detection_flags, std::vector<E
if (sender == pair.second) {
continue;
}
#if 1
if (std::abs(sender->pos.x - pair.second->pos.x) > 1000 ||
std::abs(sender->pos.y - pair.second->pos.y) > 1000){
continue;
}
#endif
if (a8::HasBitFlag(detection_flags, ET_Player) && pair.second->entity_type == ET_Player) {
if (sender->entity_type == ET_Bullet) {
Bullet* bullet = (Bullet*)sender;
@ -814,27 +820,27 @@ void Room::UpdateGas()
gas_data.gas_start_frameno = frame_no;
ShuaPlane();
RoomMgr::Instance()->RemoveFromInactiveRoomHash(room_uuid);
#if 1
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 3,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
Room* room = (Room*)param.sender.GetUserData();
room->TouchHumanList(
a8::XParams()
.SetSender(room),
[] (Human* hum, a8::XParams& param) -> bool
{
if (a8::HasBitFlag(hum->status, HS_Fly)) {
hum->DoJump();
return false;
}
return true;
});
},
&xtimer_attacher.timer_list_);
#endif
for (size_t i = 1; i < 7; ++i) {
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 3 * i,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
Room* room = (Room*)param.sender.GetUserData();
room->TouchHumanList(
a8::XParams()
.SetSender(room),
[] (Human* hum, a8::XParams& param) -> bool
{
if (a8::HasBitFlag(hum->status, HS_Fly) && hum->entity_subtype != EST_Player) {
hum->DoJump();
return false;
}
return true;
});
},
&xtimer_attacher.timer_list_);
}
}
}
break;