This commit is contained in:
aozhiwei 2021-06-03 19:38:57 +08:00
parent d36c300161
commit a089b5e6c7
3 changed files with 20 additions and 12 deletions

View File

@ -147,7 +147,7 @@ void Car::GetOn(Human* passenger)
passengers_.insert(passenger);
if (!driver_) {
driver_ = passenger;
driver_->SetAttackDir(a8::Vec2::UP);
driver_->SetAttackDir(a8::Vec2::RIGHT);
SetAttackDir(driver_->GetAttackDir());
}
passenger->SetCar(this);
@ -393,3 +393,8 @@ bool Car::IsPassenger(Human* hum)
{
return passengers_.find(hum) != passengers_.end();
}
void Car::SetAttackDir(const a8::Vec2& attack_dir)
{
Creature::SetAttackDir(attack_dir);
}

View File

@ -38,13 +38,13 @@ class Car : public Creature
virtual float GetSpeed() override;
virtual void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) override;
virtual void SendDebugMsg(const std::string& debug_msg) override;
virtual void SetAttackDir(const a8::Vec2& attack_dir) override;
private:
int AllocSeat();
void BeKill(int killer_id, const std::string& killer_name, int weapon_id);
void Explosion(int team_id);
bool IsPassenger(Human* hum);
private:
long long born_frameno_ = 0;
bool later_removed_ = false;

View File

@ -108,15 +108,6 @@ void Player::InternalUpdate(int delta_time)
if (jump) {
UpdateJump();
}
if (get_down) {
UpdateGetDown();
}
if (get_on) {
UpdateGetOn();
}
if (switch_seat) {
UpdateSwitchSeat();
}
if (shot_start || shot_hold) {
UpdateShot();
}
@ -130,6 +121,15 @@ void Player::InternalUpdate(int delta_time)
if (playing_skill) {
UpdateSkill();
}
if (get_down) {
UpdateGetDown();
}
if (get_on) {
UpdateGetOn();
}
if (switch_seat) {
UpdateSwitchSeat();
}
}
}
@ -1049,7 +1049,8 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
std::abs(msg.attack_dir().y()) > 0.00001f
)
){
if (!HasBuffEffect(kBET_Vertigo)) {
if (!HasBuffEffect(kBET_Vertigo) &&
!(GetCar() && GetCar()->HasBuffEffect(kBET_Vertigo))) {
a8::Vec2 attack_dir;
TypeConvert::FromPb(attack_dir, &msg.attack_dir());
attack_dir.Normalize();
@ -1057,6 +1058,8 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
if (GetCar() && GetCar()->IsDriver(this)) {
GetCar()->SetAttackDir(GetAttackDir());
}
} else {
int i = 0;
}
}
} else {