1
This commit is contained in:
parent
81b1bdaa33
commit
fef73d93f8
@ -25,6 +25,16 @@ void Car::Initialize()
|
||||
if (!hero_meta_) {
|
||||
abort();
|
||||
}
|
||||
MetaData::Equip* weapon_meta = MetaMgr::Instance()->GetEquip(hero_meta_->i->default_weapon());
|
||||
if (weapon_meta) {
|
||||
weapons[GUN_SLOT1].weapon_idx = GUN_SLOT1;
|
||||
weapons[GUN_SLOT1].weapon_id = weapon_meta->i->id();
|
||||
weapons[GUN_SLOT1].weapon_lv = 1;
|
||||
weapons[GUN_SLOT1].ammo = 10000;
|
||||
weapons[GUN_SLOT1].meta = weapon_meta;
|
||||
weapons[GUN_SLOT1].Recalc();
|
||||
SetCurrWeapon(&weapons[GUN_SLOT1]);
|
||||
}
|
||||
}
|
||||
|
||||
void Car::FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data)
|
||||
@ -44,6 +54,7 @@ void Car::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data)
|
||||
TypeConvert::ToPb(GetPos(), p->mutable_pos());
|
||||
TypeConvert::ToPb(GetMoveDir(), p->mutable_dir());
|
||||
p->set_car_id(meta->i->id());
|
||||
p->set_heroid(meta->i->heroid());
|
||||
p->set_driver(driver_ ? driver_->GetEntityUniId() : 0);
|
||||
for (auto hum : passengers_) {
|
||||
auto less_data = p->add_passengers();
|
||||
|
@ -192,22 +192,29 @@ void Player::UpdateShot()
|
||||
Shot();
|
||||
return;
|
||||
}
|
||||
Weapon* p_weapon = GetCurrWeapon();
|
||||
if (second_weapon.meta) {
|
||||
p_weapon = &second_weapon;
|
||||
}
|
||||
if (shot_hold) {
|
||||
++series_shot_frames;
|
||||
if (last_shot_frameno_ == 0 ||
|
||||
(
|
||||
(room->GetFrameNo() - last_shot_frameno_) * (1000 / SERVER_FRAME_RATE)) >=
|
||||
p_weapon->GetAttrValue(kHAT_FireRate)
|
||||
) {
|
||||
Shot();
|
||||
if (GetCar() && GetCar()->IsDriver(this)) {
|
||||
bool shot_ok = false;
|
||||
a8::Vec2 target_dir = attack_dir;
|
||||
GetCar()->Shot(target_dir, shot_ok, fly_distance);
|
||||
return;
|
||||
} else {
|
||||
Weapon* p_weapon = GetCurrWeapon();
|
||||
if (second_weapon.meta) {
|
||||
p_weapon = &second_weapon;
|
||||
}
|
||||
if (series_shot_frames > 8) {
|
||||
shot_hold = false;
|
||||
series_shot_frames = 0;
|
||||
if (shot_hold) {
|
||||
++series_shot_frames;
|
||||
if (last_shot_frameno_ == 0 ||
|
||||
(
|
||||
(room->GetFrameNo() - last_shot_frameno_) * (1000 / SERVER_FRAME_RATE)) >=
|
||||
p_weapon->GetAttrValue(kHAT_FireRate)
|
||||
) {
|
||||
Shot();
|
||||
}
|
||||
if (series_shot_frames > 8) {
|
||||
shot_hold = false;
|
||||
series_shot_frames = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (HasBuffEffect(kBET_Camouflage)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user