添加载具射击偏移量

This commit is contained in:
aozhiwei 2021-05-06 13:38:26 +08:00
parent 39afdbe2c7
commit 4702500423
5 changed files with 21 additions and 0 deletions

View File

@ -221,6 +221,9 @@ void Buff::ProcDriver(Creature* caster)
if (hum->GetCar() && hum->GetCar()->GetCurrWeapon()) {
hold_weapons_.push_back(hum->weapons[hum->GetCar()->GetCurrWeapon()->weapon_idx]);
hum->weapons[hum->GetCar()->GetCurrWeapon()->weapon_idx] = *hum->GetCar()->GetCurrWeapon();
if (hum->GetCar()->meta && !hum->GetCar()->meta->shoot_offsets.empty()) {
hum->shoot_offset = hum->GetCar()->meta->shoot_offsets[0];
}
}
}
caster->need_sync_active_player = true;
@ -230,6 +233,7 @@ void Buff::ProcDriver(Creature* caster)
void Buff::ProcRemoveDriver(Creature* caster)
{
RecoverHoldWeapons(caster);
caster->shoot_offset = a8::Vec2();
}
void Buff::RecoverHoldWeapons(Creature* caster)

View File

@ -1330,6 +1330,8 @@ void Human::FillMFActivePlayerData(cs::MFActivePlayerData* player_data)
FillBodyState(player_data->mutable_states());
FillItemList(player_data->mutable_items());
FillSkillList(player_data->mutable_skill_list());
player_data->set_shoot_offset_x(shoot_offset.x);
player_data->set_shoot_offset_y(shoot_offset.y);
}
void Human::FillMFGasData(cs::MFGasData* gas_data)

View File

@ -160,6 +160,19 @@ namespace MetaData
int_param2 = a8::XValue(i->param2());
float_param2 = a8::XValue(i->param2()).GetDouble();
}
{
std::vector<std::string> strings;
a8::Split(i->volume(), strings, '|');
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
assert(strings2.size() == 2);
if (strings2.size() >= 2) {
shoot_offsets.push_back(a8::Vec2((float)a8::XValue(strings2[0]).GetDouble(),
(float)a8::XValue(strings2[1]).GetDouble()));
}
}
}
}
int Equip::GetWeaponIdx()

View File

@ -62,6 +62,7 @@ namespace MetaData
const metatable::Equip* i = nullptr;
std::vector<std::tuple<float, float, float>> bullet_born_offset;
std::vector<a8::Vec2> shoot_offsets;
std::array<int, IS_END> volume = {};
int int_param1 = 0;
float float_param1 = 0;

View File

@ -115,6 +115,7 @@ message Equip
optional float recoil_force = 47;
optional int32 missiles_time = 48;
optional int32 heroid = 49;
optional string launch_dev = 50;
optional string inventory_slot = 31; //
optional int32 _inventory_slot = 32; //