This commit is contained in:
aozhiwei 2021-09-14 17:01:51 +08:00
parent 98db807a91
commit 54c2dbdae3
2 changed files with 37 additions and 6 deletions

View File

@ -347,6 +347,35 @@ void Buff::ProcSprint()
owner->SetMoveDir(owner->context_dir);
owner->SetAttackDir(owner->context_dir);
owner->SetDisableMoveDirTimes(old_times);
#ifdef DEBUG1
{
owner->SendDebugMsg(a8::Format("xxxxxxxx move_dir:%d,%d attack_dir:%d,%d",
{
owner->GetMoveDir().x,
owner->GetMoveDir().y,
owner->GetAttackDir().x,
owner->GetAttackDir().y,
}));
owner->room->xtimer.AddRepeatTimerAndAttach
(
2,
a8::XParams()
.SetSender(owner),
[] (const a8::XParams& param)
{
Human* hum = (Human*)param.sender.GetUserData();
hum->SendDebugMsg(a8::Format("xxxxxxxx move_dir:%d,%d attack_dir:%d,%d",
{
hum->GetMoveDir().x,
hum->GetMoveDir().y,
hum->GetAttackDir().x,
hum->GetAttackDir().y,
}));
},
&xtimer_attacher.timer_list_
);
}
#endif
}
Player* hum = (Player*)caster_.Get();
std::set<int>* hited_objects = new std::set<int>;

View File

@ -693,12 +693,14 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
}
}
if (can_set) {
a8::Vec2 attack_dir;
TypeConvert::FromPb(attack_dir, &msg.attack_dir());
attack_dir.Normalize();
SetAttackDir(attack_dir);
if (GetCar() && GetCar()->IsDriver(this)) {
GetCar()->SetAttackDir(GetAttackDir());
if (GetDisableMoveDirTimes() <= 0) {
a8::Vec2 attack_dir;
TypeConvert::FromPb(attack_dir, &msg.attack_dir());
attack_dir.Normalize();
SetAttackDir(attack_dir);
if (GetCar() && GetCar()->IsDriver(this)) {
GetCar()->SetAttackDir(GetAttackDir());
}
}
}
}