修复手雷烟雾弹丢弃问题
This commit is contained in:
parent
3a201c57d5
commit
3e86e734f5
@ -961,11 +961,13 @@ void Player::UpdateDropWeapon()
|
|||||||
if (drop_ok) {
|
if (drop_ok) {
|
||||||
if (drop_weapon_idx == 0 ||
|
if (drop_weapon_idx == 0 ||
|
||||||
drop_weapon_idx == GUN_SLOT1 ||
|
drop_weapon_idx == GUN_SLOT1 ||
|
||||||
drop_weapon_idx == GUN_SLOT2
|
drop_weapon_idx == GUN_SLOT2 ||
|
||||||
|
drop_weapon_idx == FRAG_SLOT ||
|
||||||
|
drop_weapon_idx == SMOKE_SLOT
|
||||||
) {
|
) {
|
||||||
a8::Vec2 dir = a8::Vec2::UP;
|
a8::Vec2 dir = a8::Vec2::UP;
|
||||||
dir.Rotate(a8::RandAngle());
|
dir.Rotate(a8::RandAngle());
|
||||||
room->CreateLoot(weapon_id, pos + dir * (25 + rand() % 50), 1, weapon_lv);
|
room->CreateLoot(weapon_id, pos + dir * (40 + rand() % 50), 1, weapon_lv);
|
||||||
}
|
}
|
||||||
if (weapon_ammo > 0) {
|
if (weapon_ammo > 0) {
|
||||||
MetaData::Equip* bullet_meta = MetaMgr::Instance()->GetEquip(weapon_meta->i->use_bullet());
|
MetaData::Equip* bullet_meta = MetaMgr::Instance()->GetEquip(weapon_meta->i->use_bullet());
|
||||||
@ -973,7 +975,8 @@ void Player::UpdateDropWeapon()
|
|||||||
int volume = GetVolume(bullet_meta->i->_inventory_slot());
|
int volume = GetVolume(bullet_meta->i->_inventory_slot());
|
||||||
int inventory = GetInventory(bullet_meta->i->_inventory_slot());
|
int inventory = GetInventory(bullet_meta->i->_inventory_slot());
|
||||||
int add_inventory = std::min(weapon_ammo, volume - std::min(volume, inventory));
|
int add_inventory = std::min(weapon_ammo, volume - std::min(volume, inventory));
|
||||||
if (add_inventory > 0) {
|
if (add_inventory > 0 &&
|
||||||
|
!(drop_weapon_idx == FRAG_SLOT || drop_weapon_idx == SMOKE_SLOT)) {
|
||||||
AddInventory(bullet_meta->i->_inventory_slot(), add_inventory);
|
AddInventory(bullet_meta->i->_inventory_slot(), add_inventory);
|
||||||
}
|
}
|
||||||
int drop_num = weapon_ammo - add_inventory;
|
int drop_num = weapon_ammo - add_inventory;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user