This commit is contained in:
aozhiwei 2021-06-18 19:33:52 +08:00
parent 12bf6bffaa
commit b17c584736

View File

@ -1384,6 +1384,34 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance)
SyncAroundPlayers(__FILE__, __LINE__, __func__);
}
break;
case IS_C4:
case IS_SHIELD_WALL:
case IS_SINGAL_GUN:
case IS_OIL_BUCKET:
{
if (GetCurrWeapon()->ammo <= 0) {
if (GetInventory(slot_id) > 0) {
DecInventory(slot_id, 1);
++GetCurrWeapon()->ammo;
} else {
int weapon_idx = GetCurrWeapon()->weapon_idx;
*GetCurrWeapon() = Weapon();
GetCurrWeapon()->weapon_idx = weapon_idx;
Weapon* next_weapon = ChooseNextWeapon(slot_id, SPEC3_IS_BEGIN, SPEC3_IS_END);
if (!next_weapon) {
next_weapon = ChooseNextWeapon(SPEC1_IS_BEGIN, SPEC1_IS_BEGIN, SPEC1_IS_END);
}
if (!next_weapon) {
next_weapon = AutoChgWeapon();
}
SetCurrWeapon(next_weapon);
AutoLoadingBullet();
}
}
need_sync_active_player = true;
SyncAroundPlayers(__FILE__, __LINE__, __func__);
}
break;
default:
{
}